@mingfuyun/star-allinone 0.4.1 → 0.4.3
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 +1 -0
- package/dist/components/CustomDrawer/index.d.ts +1 -0
- package/dist/components/CustomDrawer/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/scripts/cli.js +4 -2
- package/scripts/gen/fixtures/run.js +13 -0
- package/scripts/gen/page.js +59 -13
- package/skills/README.md +4 -4
- package/skills/shared/design-to-page/SKILL.md +6 -0
- package/skills/shared/design-to-page/references/list-page-template.md +3 -0
- package/skills/shared/design-to-page/references/overlays.md +2 -0
- package/skills/shared/design-to-page/references/page-conventions.md +4 -0
- package/skills/shared/design-to-page/references/tracking.md +83 -0
- package/skills/shared/project-conventions/references/review-checklist.md +13 -0
- package/skills/shared/review-and-submit/SKILL.md +2 -1
- package/skills/shared/review-and-submit/references/ai-review.md +6 -4
- package/skills/shared/review-and-submit/references/verify.md +3 -1
- package/skills/shared/tracking/SKILL.md +109 -6
package/README.md
CHANGED
|
@@ -464,6 +464,7 @@ function DrawerExample() {
|
|
|
464
464
|
| onConfirm | 确定回调 | () => void | - |
|
|
465
465
|
| width | 宽度 | number \| string | - |
|
|
466
466
|
| closable | 是否显示关闭按钮 | boolean | true |
|
|
467
|
+
| maskClosable | 点击蒙层是否关闭 | boolean | true |
|
|
467
468
|
| cancelText | 取消按钮文字 | string | "取消" |
|
|
468
469
|
| okText | 确定按钮文字 | string | "确定" |
|
|
469
470
|
| children | 内容 | ReactNode | - |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/CustomDrawer/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,cAAc,CAAC;AAEtB,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/CustomDrawer/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,cAAc,CAAC;AAEtB,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAqDvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react/jsx-runtime";import*as n from"antd";import*as r from"react";var t=[,(e,n,r)=>{r.r(n),r.d(n,{default:()=>d});var t=r(2),a=r(3),o=r(4),i=r(5),l=r(6),u=function(){return u=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},u.apply(this,arguments)},s=["minute","hour","day","month","week"],c={display:"block",lineHeight:2};const d=(0,i.forwardRef)(function(e,n){var r=e.cronExpression,d=(0,i.useState)(""),m=d[0],h=d[1],f=(0,i.useState)({minute:1,hour:1,day:1,month:1,week:1}),p=f[0],v=f[1],x=(0,i.useState)({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),y=x[0],w=x[1],g=(0,i.useState)({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),j=g[0],k=g[1],C=(0,i.useState)({minute:[],hour:[],day:[],month:[],week:[]}),b=C[0],R=C[1],T=(0,i.useRef)(null),_=(0,i.useState)(void 0),O=_[0],N=_[1],S=function(e,n){switch(e){case"minute":return{minute:n};case"hour":return{hour:n};case"day":return{day:n};case"month":return{month:n};case"week":return{week:n};default:return{}}},I=function(){return m},z=function(){v({minute:1,hour:1,day:1,month:1,week:1}),w({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),k({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),R({minute:[],hour:[],day:[],month:[],week:[]}),h("")},E=function(e,n){for(var r=[],t=e;t<=n;t++)r.push({label:t,value:t});return r},P=function(e){for(var n=[],r=["","一","二","三","四","五","六","日"],t=1;t<=e;t++)n.push({label:"星期".concat(r[t]),value:t+1===8?7:t});return n},D=function(e,n){switch(n){case"week":v(u(u(u({},p),{day:2}),S(n,e.target.value)));break;case"day":v(u(u(u({},p),{week:2}),S(n,e.target.value)));break;default:v(u(u({},p),S(n,e.target.value)))}},B=function(e,n,r){var t,a;r(u(u({},b),((t={})[n]=e,t))),v(u(u({},p),((a={})[n]="point",a)))},A=function(e,n,r){var t=y;t[n]="max"===r?{max:e,min:t[n].min}:{max:t[n].max,min:e},w(u(u({},y),S(n,t[n])))},L=function(e,n,r){var t=j;t[n]="start"===r?{start:e,end:t[n].end}:{start:t[n].start,end:e},k(u(u({},j),S(n,t[n])))};return(0,i.useEffect)(function(){r?function(e){h(e);var n=e.split(" "),r={},t={},a={},o={};n.forEach(function(e,n){if(-1!==e.indexOf("/")&&-1!==e.indexOf("-")){r[s[n]]="loop";var i=e.split("/")[0],l=i.split("-")[0];a[s[n]]={start:"*"===i?0:Number(l),end:Number(e.split("/")[1])}}else-1!==e.indexOf("*")?r[s[n]]="*":-1!==e.indexOf("-")?(r[s[n]]="period",t[s[n]]={min:Number(e.split("-")[0]),max:Number(e.split("-")[1])}):(r[s[n]]="point",o[s[n]]=e.split(",").map(function(e){return Number(e)}))}),w(u(u({},y),t)),k(u(u({},j),a)),R(u(u({},b),o)),v(u(u({},p),r))}(r):z()},[r]),(0,i.useEffect)(function(){!function(){var e={};s.forEach(function(n){return e=u(u({},e),function(e){var n=p[e],r=y[e],t=j[e],a=b[e],o="";switch(n){case"*":default:o="*";break;case"point":for(var i=0,l=a;i<l.length;i++)o=o+l[i]+",";o=o.substring(0,o.length-1);break;case"period":o=r.min+"-"+r.max;break;case"loop":o=t.start+"-"+{minute:59,hour:23,day:31,month:12,week:7}[e]+"/"+t.end}return S(e,o)}(n))});var n=e.minute,r=e.hour,t=e.day,a=e.month,o=e.week;h(n+" "+r+" "+t+" "+a+" "+o)}()},[p,y,j]),(0,i.useImperativeHandle)(n,function(){return{refGetCron:I,resetCronState:z,getValidateStatus:function(){return O}}}),(0,i.useEffect)(function(){var e;!function(e){(0,o.isValidCron)(e)?null==N||N("success"):null==N||N("error")}(m),null===(e=T.current)||void 0===e||e.setFieldsValue({cronText:m})},[m]),(0,t.jsxs)("div",{className:l.default.Cron,children:[(0,t.jsx)(a.Tabs,{type:"card",items:[{label:"分",key:"minute",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{value:p.minute,onChange:function(e){return D(e,"minute")},children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每分执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:y.minute.min,onChange:function(e){return A(e,"minute","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:59,value:y.minute.max,onChange:function(e){return A(e,"minute","max")}}),"分"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:j.minute.start,onChange:function(e){return L(e,"minute","start")}}),"分开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:58,value:j.minute.end,onChange:function(e){return L(e,"minute","end")}}),"分执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.minute,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择分钟",onChange:function(e){return B(e,"minute",R)},options:E(0,59)})})]})]})})},{label:"时",key:"hour",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"hour")},value:p.hour,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每小时执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:y.hour.min,onChange:function(e){return A(e,"hour","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:23,value:y.hour.max,onChange:function(e){return A(e,"hour","max")}}),"时"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:j.hour.start,onChange:function(e){return L(e,"hour","start")}}),"时开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:22,value:j.hour.end,onChange:function(e){return L(e,"hour","end")}}),"时执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.hour,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择小时",onChange:function(e){return B(e,"hour",R)},options:E(0,23)})})]})]})})},{label:"日",key:"day",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"day")},value:p.day,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每日执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:30,value:y.day.min,onChange:function(e){return A(e,"day","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:31,value:y.day.max,onChange:function(e){return A(e,"day","max")}}),"日"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:j.day.start,onChange:function(e){return L(e,"day","start")}}),"日开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:j.day.end,onChange:function(e){return L(e,"day","end")}}),"日执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.day,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择日期",onChange:function(e){return B(e,"day",R)},options:E(1,31)})})]})]})})},{label:"月",key:"month",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"month")},value:p.month,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每月执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:11,value:y.month.min,onChange:function(e){return A(e,"month","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:12,value:y.month.max,onChange:function(e){return A(e,"month","max")}}),"月"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:j.month.start,onChange:function(e){return L(e,"month","start")}}),"月开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:j.month.end,onChange:function(e){return L(e,"month","end")}}),"月执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.month,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择月份",onChange:function(e){return B(e,"month",R)},options:E(1,12)})})]})]})})},{label:"周",key:"week",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"week")},value:p.week,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每周执行"}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Radio,{style:c,value:"period",children:"周期从 周"})}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.min,placeholder:"请选择周",onChange:function(e){return A(e,"week","min")},options:P(7)})}),(0,t.jsx)(a.Col,{className:l.default.CronWeekFont,children:"- 周"}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.max,placeholder:"请选择周",onChange:function(e){return A(e,"week","max")},options:P(7)})})]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.week,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择周",onChange:function(e){return B(e,"week",R)},options:P(7)})})]})]})})}]}),(0,t.jsx)(a.Form,{className:l.default.CronPreview,ref:T,children:(0,t.jsx)(a.Form.Item,{label:"预览",name:"cronText",className:l.default.CronPreviewItem,hasFeedback:!0,validateStatus:O,children:(0,t.jsx)(a.Input,{readOnly:!0,style:{width:150}})})})]})})},n=>{n.exports=e},e=>{e.exports=n},function(e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},r.apply(this,arguments)};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidCron=void 0;var t=function(e){return/^\d+$/.test(e)?Number(e):NaN},a=function(e){return"?"===e},o=function(e,n,r){return e>=n&&e<=r},i=function(e,n,r){return-1===e.search(/[^\d-,\/*]/)&&e.split(",").every(function(e){var a=e.split("/");if(e.trim().endsWith("/"))return!1;if(a.length>2)return!1;var i=a[0],l=a[1];return function(e,n,r){var a=e.split("-");switch(a.length){case 1:return function(e){return"*"===e}(e)||o(t(e),n,r);case 2:var i=a.map(function(e){return t(e)}),l=i[0],u=i[1];return l<=u&&o(l,n,r)&&o(u,n,r);default:return!1}}(i,n,r)&&function(e){return void 0===e||-1===e.search(/[^\d]/)&&t(e)>0}(l)})},l={jan:"1",feb:"2",mar:"3",apr:"4",may:"5",jun:"6",jul:"7",aug:"8",sep:"9",oct:"10",nov:"11",dec:"12"},u={sun:"0",mon:"1",tue:"2",wed:"3",thu:"4",fri:"5",sat:"6"},s={alias:!1,seconds:!1,allowBlankDay:!1,allowSevenAsSunday:!1,allowNthWeekdayOfMonth:!1};n.isValidCron=function(e,n){var c=r(r({},s),n),d=function(e){return e.trim().split(/\s+/)}(e);if(d.length>(c.seconds?6:5)||d.length<5)return!1;var m=[];if(6===d.length){var h=d.shift();h&&m.push(function(e){return i(e,0,59)}(h))}var f=d[0],p=d[1],v=d[2],x=d[3],y=d[4];return m.push(function(e){return i(e,0,59)}(f)),m.push(function(e){return i(e,0,23)}(p)),m.push(function(e,n){return n&&a(e)||i(e,1,31)}(v,c.allowBlankDay)),m.push(function(e,n){if(-1!==e.search(/\/[a-zA-Z]/))return!1;if(n){var r=e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===l[e]?e:l[e]});return i(r,1,12)}return i(e,1,12)}(x,c.alias)),m.push(function(e,n){var r=n.allowBlankDay,l=n.alias,s=n.allowSevenAsSunday,c=n.allowNthWeekdayOfMonth;if(r&&a(e))return!0;if(!r&&a(e))return!1;if(-1!==e.search(/\/[a-zA-Z]/))return!1;var d=l?e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===u[e]?e:u[e]}):e,m=s?7:6,h=d.split("#");if(c&&h.length>=2){var f=h[0],p=h[1];return 0===h.slice(2).length&&o(t(p),1,5)&&o(t(f),0,m)}return i(d,0,m)}(y,c)),m.push(function(e,n,r){return!(r&&a(e)&&a(n))}(v,y,c.allowBlankDay)),m.every(Boolean)}},e=>{e.exports=r},(e,n,r)=>{r.r(n),r.d(n,{default:()=>t});const t={Cron:"vBb5040F",CronWeekFont:"O5XKllcf",CronPreview:"Ci4nV30W",CronPreviewItem:"y5qUyBlE"}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(5),o=function(){return o=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},o.apply(this,arguments)};function i(e){return(0,a.forwardRef)(function(n,r){var i=(0,a.useState)(!1),l=i[0],u=i[1],s=(0,a.useRef)(null);(0,a.useImperativeHandle)(r,function(){return{show:function(e){s.current=e,u(!0)},hide:function(){u(!1)}}});var c=function(){u(!1)},d=(0,a.useMemo)(function(){return(0,t.jsx)(e,o({},n,{visible:l,handleCancel:c},s.current))},[l]);return(0,t.jsx)(t.Fragment,{children:l?d:null})})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>o});var t=r(2),a=r(3);r(9);const o=function(e){var n=e.title,r=e.open,o=e.onClose,i=e.onConfirm,l=e.children,u=e.width,s=e.closable,c=e.cancelText,d=e.okText,m=e.footer,h=e.className,f=e.extra,p=void 0===f?null:f,v=e.loading,x=void 0!==v&&v,y=e.cancelTrack,w=e.okTrack;return(0,t.jsx)(a.Drawer,{title:(0,t.jsx)("div",{style:{float:"left"},children:n}),placement:"right",className:h,closable:s,onClose:o,width:u,open:r,footer:m||(0,t.jsx)("div",{className:"custom-footer",children:(0,t.jsxs)(a.Space,{children:[(0,t.jsx)(a.Button,{"data-track":y,onClick:o,children:c||"取消"}),(0,t.jsx)(a.Button,{"data-track":w,loading:x,type:"primary",onClick:i,children:d||"确定"})]})}),extra:p,loading:x,children:l})}},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(3),o=r(5);function i(e){var n=e.children,r=e.onError,i=(0,o.useState)({hasError:!1}),l=i[0],u=i[1],s=(0,o.useCallback)(function(e,n){u({hasError:!0,error:e,errorInfo:n}),r&&r(e,n),console.error("Error caught by boundary:",e,n)},[r]);return(0,o.useEffect)(function(){var e=function(e){s(e,{isAsync:!0,timestamp:(new Date).toISOString()})},n=function(n){n.preventDefault(),e(n.reason)},r=function(n){n.preventDefault(),e(n.error)};return window.addEventListener("unhandledrejection",n),window.addEventListener("error",r),function(){window.removeEventListener("unhandledrejection",n),window.removeEventListener("error",r)}},[s]),l.hasError&&l.error?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a.Result,{status:"error",title:"System Failed",subTitle:"Please check and modify the following information before resubmitting.",extra:[(0,t.jsx)(a.Button,{type:"primary",onClick:function(){return window.location.reload()},children:"刷新页面"},"console")]})}):(0,t.jsx)(t.Fragment,{children:n})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>l});var t=r(2),a=r(3),o=r(5),i=(r(12),function(){return i=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},i.apply(this,arguments)});const l=(0,o.memo)(function(e){var n=e.title,r=e.visible,o=e.onOk,l=e.onCancel,u=e.children,s=e.width,c=e.afterClose,d=e.okText,m=e.confirmLoading,h=void 0!==m&&m,f=e.footer,p=void 0===f?void 0:f,v=e.wrapClassName,x=void 0===v?"":v,y=e.cancelText,w=e.className,g=void 0===w?"":w,j=e.keyboard,k=void 0===j||j,C=e.maskClosable,b=void 0===C||C,R=e.mask,T=void 0===R||R,_=e.getContainer,O=e.closable,N=void 0===O||O,S=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(t=Object.getOwnPropertySymbols(e);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(r[t[a]]=e[t[a]])}return r}(e,["title","visible","onOk","onCancel","children","width","afterClose","okText","confirmLoading","footer","wrapClassName","cancelText","className","keyboard","maskClosable","mask","getContainer","closable"]);return(0,t.jsx)(a.Modal,i({mask:T,width:s||320,title:n,open:r,onOk:o,onCancel:l,wrapClassName:"".concat(x," base-modal"),centered:!0,afterClose:c,okText:d||"确定",cancelText:y||"取消",confirmLoading:h,footer:p,destroyOnClose:!0,className:g,keyboard:k,maskClosable:b,getContainer:_,closable:N},S,{children:u}))})},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{TRACKING_REPORT_URLS:()=>a,createTracking:()=>l,getTrackData:()=>i,normalizeTrackKey:()=>o});var t=function(){return t=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},t.apply(this,arguments)},a={test:"https://track-test.cjjd10.com:31029/api/v1/events/collect",prod:"https://track.cjjd10.com:31029/api/v1/events/collect"},o=function(e){return String(e||"").replace(/([a-z\d])([A-Z])/g,"$1_$2").split("").map(function(e){return/[a-z\d]/i.test(e)||e.charCodeAt(0)>127?e:"_"}).join("").replace(/_+/g,"_").replace(/^_+|_+$/g,"").toLowerCase()},i=function(e,n,r,t,a,i){void 0===t&&(t="undefined"==typeof window?"/":window.location.pathname),void 0===i&&(i=function(e){return e});var l=i(t),u=[o(l),o(null==r?void 0:r.key),o(e)].filter(Boolean).join("_"),s=[null==a?void 0:a(l),null==r?void 0:r.name,n].filter(Boolean).join("-");return JSON.stringify({id:u,name:s||n||u})},l=function(e){var n,r,a="",o="/",l=!1,u=[],s=!1,c=function(){return{ready:l,pathname:o}},d=function(){var e;try{null===(e=window.__tracker)||void 0===e||e.destroy()}catch(e){}window.__tracker=void 0,a="",n=void 0},m=function(){var n,r=!!e.getConfig(),t=c();s=r&&e.shouldQueue(t),r&&!(null===(n=e.shouldClearQueue)||void 0===n?void 0:n.call(e,t))||u.splice(0)},h=function(i){o=i||"/",m(),e.getConfig()?l&&!e.shouldQueue(c())&&function(r){var o=e.getConfig();if(o&&window.TrackingSDK){var i=e.getUserId(r);if(!window.__tracker||a!==o.appId||n!==i)try{window.__tracker&&a!==o.appId&&(window.__tracker.destroy(),window.__tracker=void 0),window.__tracker=window.TrackingSDK.createTracker(t(t({},o),{userId:i,debug:!1})),a=o.appId,n=i,function(){if(window.__tracker)for(var e=0,n=u.splice(0);e<n.length;e++){var r=n[e];try{window.__tracker.trackApi("api_request",r)}catch(e){}}}()}catch(e){window.__tracker=void 0,a="",n=void 0}}else d()}(r):d()};return m(),{markReady:function(e){l=!0,r=e,h(o)},syncRoute:h,reportApi:function(e){if(e.url)if(window.__tracker)try{window.__tracker.trackApi("api_request",e)}catch(e){}else s&&(u.length>=50&&u.shift(),u.push(e))},getTrackData:function(n,r,t,a){return i(n,r,t,a,e.getRouteName,e.normalizePathname)},destroy:d}}}],a={};function o(e){var n=a[e];if(void 0!==n)return n.exports;var r=a[e]={exports:{}};return t[e].call(r.exports,r,r.exports,o),r.exports}o.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return o.d(n,{a:n}),n},o.d=(e,n)=>{for(var r in n)o.o(n,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{o.r(i),o.d(i,{BaseModal:()=>a.default,Cron:()=>e.default,CustomDrawer:()=>r.default,ErrorBoundary:()=>t.default,HocModal:()=>n.default,TRACKING_REPORT_URLS:()=>l.TRACKING_REPORT_URLS,createTracking:()=>l.createTracking,getTrackData:()=>l.getTrackData,normalizeTrackKey:()=>l.normalizeTrackKey});var e=o(1),n=o(7),r=o(8),t=o(10),a=o(11),l=o(13)})();const l=i.BaseModal,u=i.Cron,s=i.CustomDrawer,c=i.ErrorBoundary,d=i.HocModal,m=i.TRACKING_REPORT_URLS,h=i.createTracking,f=i.getTrackData,p=i.normalizeTrackKey;export{l as BaseModal,u as Cron,s as CustomDrawer,c as ErrorBoundary,d as HocModal,m as TRACKING_REPORT_URLS,h as createTracking,f as getTrackData,p as normalizeTrackKey};
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as n from"antd";import*as r from"react";var t=[,(e,n,r)=>{r.r(n),r.d(n,{default:()=>d});var t=r(2),a=r(3),o=r(4),i=r(5),l=r(6),u=function(){return u=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},u.apply(this,arguments)},s=["minute","hour","day","month","week"],c={display:"block",lineHeight:2};const d=(0,i.forwardRef)(function(e,n){var r=e.cronExpression,d=(0,i.useState)(""),m=d[0],h=d[1],f=(0,i.useState)({minute:1,hour:1,day:1,month:1,week:1}),p=f[0],v=f[1],x=(0,i.useState)({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),y=x[0],w=x[1],g=(0,i.useState)({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),j=g[0],k=g[1],C=(0,i.useState)({minute:[],hour:[],day:[],month:[],week:[]}),b=C[0],R=C[1],T=(0,i.useRef)(null),_=(0,i.useState)(void 0),O=_[0],N=_[1],S=function(e,n){switch(e){case"minute":return{minute:n};case"hour":return{hour:n};case"day":return{day:n};case"month":return{month:n};case"week":return{week:n};default:return{}}},I=function(){return m},z=function(){v({minute:1,hour:1,day:1,month:1,week:1}),w({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),k({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),R({minute:[],hour:[],day:[],month:[],week:[]}),h("")},E=function(e,n){for(var r=[],t=e;t<=n;t++)r.push({label:t,value:t});return r},P=function(e){for(var n=[],r=["","一","二","三","四","五","六","日"],t=1;t<=e;t++)n.push({label:"星期".concat(r[t]),value:t+1===8?7:t});return n},D=function(e,n){switch(n){case"week":v(u(u(u({},p),{day:2}),S(n,e.target.value)));break;case"day":v(u(u(u({},p),{week:2}),S(n,e.target.value)));break;default:v(u(u({},p),S(n,e.target.value)))}},B=function(e,n,r){var t,a;r(u(u({},b),((t={})[n]=e,t))),v(u(u({},p),((a={})[n]="point",a)))},A=function(e,n,r){var t=y;t[n]="max"===r?{max:e,min:t[n].min}:{max:t[n].max,min:e},w(u(u({},y),S(n,t[n])))},L=function(e,n,r){var t=j;t[n]="start"===r?{start:e,end:t[n].end}:{start:t[n].start,end:e},k(u(u({},j),S(n,t[n])))};return(0,i.useEffect)(function(){r?function(e){h(e);var n=e.split(" "),r={},t={},a={},o={};n.forEach(function(e,n){if(-1!==e.indexOf("/")&&-1!==e.indexOf("-")){r[s[n]]="loop";var i=e.split("/")[0],l=i.split("-")[0];a[s[n]]={start:"*"===i?0:Number(l),end:Number(e.split("/")[1])}}else-1!==e.indexOf("*")?r[s[n]]="*":-1!==e.indexOf("-")?(r[s[n]]="period",t[s[n]]={min:Number(e.split("-")[0]),max:Number(e.split("-")[1])}):(r[s[n]]="point",o[s[n]]=e.split(",").map(function(e){return Number(e)}))}),w(u(u({},y),t)),k(u(u({},j),a)),R(u(u({},b),o)),v(u(u({},p),r))}(r):z()},[r]),(0,i.useEffect)(function(){!function(){var e={};s.forEach(function(n){return e=u(u({},e),function(e){var n=p[e],r=y[e],t=j[e],a=b[e],o="";switch(n){case"*":default:o="*";break;case"point":for(var i=0,l=a;i<l.length;i++)o=o+l[i]+",";o=o.substring(0,o.length-1);break;case"period":o=r.min+"-"+r.max;break;case"loop":o=t.start+"-"+{minute:59,hour:23,day:31,month:12,week:7}[e]+"/"+t.end}return S(e,o)}(n))});var n=e.minute,r=e.hour,t=e.day,a=e.month,o=e.week;h(n+" "+r+" "+t+" "+a+" "+o)}()},[p,y,j]),(0,i.useImperativeHandle)(n,function(){return{refGetCron:I,resetCronState:z,getValidateStatus:function(){return O}}}),(0,i.useEffect)(function(){var e;!function(e){(0,o.isValidCron)(e)?null==N||N("success"):null==N||N("error")}(m),null===(e=T.current)||void 0===e||e.setFieldsValue({cronText:m})},[m]),(0,t.jsxs)("div",{className:l.default.Cron,children:[(0,t.jsx)(a.Tabs,{type:"card",items:[{label:"分",key:"minute",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{value:p.minute,onChange:function(e){return D(e,"minute")},children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每分执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:y.minute.min,onChange:function(e){return A(e,"minute","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:59,value:y.minute.max,onChange:function(e){return A(e,"minute","max")}}),"分"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:j.minute.start,onChange:function(e){return L(e,"minute","start")}}),"分开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:58,value:j.minute.end,onChange:function(e){return L(e,"minute","end")}}),"分执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.minute,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择分钟",onChange:function(e){return B(e,"minute",R)},options:E(0,59)})})]})]})})},{label:"时",key:"hour",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"hour")},value:p.hour,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每小时执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:y.hour.min,onChange:function(e){return A(e,"hour","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:23,value:y.hour.max,onChange:function(e){return A(e,"hour","max")}}),"时"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:j.hour.start,onChange:function(e){return L(e,"hour","start")}}),"时开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:22,value:j.hour.end,onChange:function(e){return L(e,"hour","end")}}),"时执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.hour,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择小时",onChange:function(e){return B(e,"hour",R)},options:E(0,23)})})]})]})})},{label:"日",key:"day",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"day")},value:p.day,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每日执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:30,value:y.day.min,onChange:function(e){return A(e,"day","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:31,value:y.day.max,onChange:function(e){return A(e,"day","max")}}),"日"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:j.day.start,onChange:function(e){return L(e,"day","start")}}),"日开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:j.day.end,onChange:function(e){return L(e,"day","end")}}),"日执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.day,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择日期",onChange:function(e){return B(e,"day",R)},options:E(1,31)})})]})]})})},{label:"月",key:"month",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"month")},value:p.month,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每月执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:11,value:y.month.min,onChange:function(e){return A(e,"month","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:12,value:y.month.max,onChange:function(e){return A(e,"month","max")}}),"月"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:j.month.start,onChange:function(e){return L(e,"month","start")}}),"月开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:j.month.end,onChange:function(e){return L(e,"month","end")}}),"月执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.month,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择月份",onChange:function(e){return B(e,"month",R)},options:E(1,12)})})]})]})})},{label:"周",key:"week",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return D(e,"week")},value:p.week,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每周执行"}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Radio,{style:c,value:"period",children:"周期从 周"})}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.min,placeholder:"请选择周",onChange:function(e){return A(e,"week","min")},options:P(7)})}),(0,t.jsx)(a.Col,{className:l.default.CronWeekFont,children:"- 周"}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.max,placeholder:"请选择周",onChange:function(e){return A(e,"week","max")},options:P(7)})})]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.week,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择周",onChange:function(e){return B(e,"week",R)},options:P(7)})})]})]})})}]}),(0,t.jsx)(a.Form,{className:l.default.CronPreview,ref:T,children:(0,t.jsx)(a.Form.Item,{label:"预览",name:"cronText",className:l.default.CronPreviewItem,hasFeedback:!0,validateStatus:O,children:(0,t.jsx)(a.Input,{readOnly:!0,style:{width:150}})})})]})})},n=>{n.exports=e},e=>{e.exports=n},function(e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},r.apply(this,arguments)};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidCron=void 0;var t=function(e){return/^\d+$/.test(e)?Number(e):NaN},a=function(e){return"?"===e},o=function(e,n,r){return e>=n&&e<=r},i=function(e,n,r){return-1===e.search(/[^\d-,\/*]/)&&e.split(",").every(function(e){var a=e.split("/");if(e.trim().endsWith("/"))return!1;if(a.length>2)return!1;var i=a[0],l=a[1];return function(e,n,r){var a=e.split("-");switch(a.length){case 1:return function(e){return"*"===e}(e)||o(t(e),n,r);case 2:var i=a.map(function(e){return t(e)}),l=i[0],u=i[1];return l<=u&&o(l,n,r)&&o(u,n,r);default:return!1}}(i,n,r)&&function(e){return void 0===e||-1===e.search(/[^\d]/)&&t(e)>0}(l)})},l={jan:"1",feb:"2",mar:"3",apr:"4",may:"5",jun:"6",jul:"7",aug:"8",sep:"9",oct:"10",nov:"11",dec:"12"},u={sun:"0",mon:"1",tue:"2",wed:"3",thu:"4",fri:"5",sat:"6"},s={alias:!1,seconds:!1,allowBlankDay:!1,allowSevenAsSunday:!1,allowNthWeekdayOfMonth:!1};n.isValidCron=function(e,n){var c=r(r({},s),n),d=function(e){return e.trim().split(/\s+/)}(e);if(d.length>(c.seconds?6:5)||d.length<5)return!1;var m=[];if(6===d.length){var h=d.shift();h&&m.push(function(e){return i(e,0,59)}(h))}var f=d[0],p=d[1],v=d[2],x=d[3],y=d[4];return m.push(function(e){return i(e,0,59)}(f)),m.push(function(e){return i(e,0,23)}(p)),m.push(function(e,n){return n&&a(e)||i(e,1,31)}(v,c.allowBlankDay)),m.push(function(e,n){if(-1!==e.search(/\/[a-zA-Z]/))return!1;if(n){var r=e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===l[e]?e:l[e]});return i(r,1,12)}return i(e,1,12)}(x,c.alias)),m.push(function(e,n){var r=n.allowBlankDay,l=n.alias,s=n.allowSevenAsSunday,c=n.allowNthWeekdayOfMonth;if(r&&a(e))return!0;if(!r&&a(e))return!1;if(-1!==e.search(/\/[a-zA-Z]/))return!1;var d=l?e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===u[e]?e:u[e]}):e,m=s?7:6,h=d.split("#");if(c&&h.length>=2){var f=h[0],p=h[1];return 0===h.slice(2).length&&o(t(p),1,5)&&o(t(f),0,m)}return i(d,0,m)}(y,c)),m.push(function(e,n,r){return!(r&&a(e)&&a(n))}(v,y,c.allowBlankDay)),m.every(Boolean)}},e=>{e.exports=r},(e,n,r)=>{r.r(n),r.d(n,{default:()=>t});const t={Cron:"vBb5040F",CronWeekFont:"O5XKllcf",CronPreview:"Ci4nV30W",CronPreviewItem:"y5qUyBlE"}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(5),o=function(){return o=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},o.apply(this,arguments)};function i(e){return(0,a.forwardRef)(function(n,r){var i=(0,a.useState)(!1),l=i[0],u=i[1],s=(0,a.useRef)(null);(0,a.useImperativeHandle)(r,function(){return{show:function(e){s.current=e,u(!0)},hide:function(){u(!1)}}});var c=function(){u(!1)},d=(0,a.useMemo)(function(){return(0,t.jsx)(e,o({},n,{visible:l,handleCancel:c},s.current))},[l]);return(0,t.jsx)(t.Fragment,{children:l?d:null})})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>o});var t=r(2),a=r(3);r(9);const o=function(e){var n=e.title,r=e.open,o=e.onClose,i=e.onConfirm,l=e.children,u=e.width,s=e.closable,c=e.cancelText,d=e.okText,m=e.footer,h=e.className,f=e.extra,p=void 0===f?null:f,v=e.loading,x=void 0!==v&&v,y=e.maskClosable,w=void 0===y||y,g=e.cancelTrack,j=e.okTrack;return(0,t.jsx)(a.Drawer,{title:(0,t.jsx)("div",{style:{float:"left"},children:n}),placement:"right",className:h,closable:s,maskClosable:w,onClose:o,width:u,open:r,footer:m||(0,t.jsx)("div",{className:"custom-footer",children:(0,t.jsxs)(a.Space,{children:[(0,t.jsx)(a.Button,{"data-track":g,onClick:o,children:c||"取消"}),(0,t.jsx)(a.Button,{"data-track":j,loading:x,type:"primary",onClick:i,children:d||"确定"})]})}),extra:p,loading:x,children:l})}},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(3),o=r(5);function i(e){var n=e.children,r=e.onError,i=(0,o.useState)({hasError:!1}),l=i[0],u=i[1],s=(0,o.useCallback)(function(e,n){u({hasError:!0,error:e,errorInfo:n}),r&&r(e,n),console.error("Error caught by boundary:",e,n)},[r]);return(0,o.useEffect)(function(){var e=function(e){s(e,{isAsync:!0,timestamp:(new Date).toISOString()})},n=function(n){n.preventDefault(),e(n.reason)},r=function(n){n.preventDefault(),e(n.error)};return window.addEventListener("unhandledrejection",n),window.addEventListener("error",r),function(){window.removeEventListener("unhandledrejection",n),window.removeEventListener("error",r)}},[s]),l.hasError&&l.error?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a.Result,{status:"error",title:"System Failed",subTitle:"Please check and modify the following information before resubmitting.",extra:[(0,t.jsx)(a.Button,{type:"primary",onClick:function(){return window.location.reload()},children:"刷新页面"},"console")]})}):(0,t.jsx)(t.Fragment,{children:n})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>l});var t=r(2),a=r(3),o=r(5),i=(r(12),function(){return i=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},i.apply(this,arguments)});const l=(0,o.memo)(function(e){var n=e.title,r=e.visible,o=e.onOk,l=e.onCancel,u=e.children,s=e.width,c=e.afterClose,d=e.okText,m=e.confirmLoading,h=void 0!==m&&m,f=e.footer,p=void 0===f?void 0:f,v=e.wrapClassName,x=void 0===v?"":v,y=e.cancelText,w=e.className,g=void 0===w?"":w,j=e.keyboard,k=void 0===j||j,C=e.maskClosable,b=void 0===C||C,R=e.mask,T=void 0===R||R,_=e.getContainer,O=e.closable,N=void 0===O||O,S=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(t=Object.getOwnPropertySymbols(e);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(r[t[a]]=e[t[a]])}return r}(e,["title","visible","onOk","onCancel","children","width","afterClose","okText","confirmLoading","footer","wrapClassName","cancelText","className","keyboard","maskClosable","mask","getContainer","closable"]);return(0,t.jsx)(a.Modal,i({mask:T,width:s||320,title:n,open:r,onOk:o,onCancel:l,wrapClassName:"".concat(x," base-modal"),centered:!0,afterClose:c,okText:d||"确定",cancelText:y||"取消",confirmLoading:h,footer:p,destroyOnClose:!0,className:g,keyboard:k,maskClosable:b,getContainer:_,closable:N},S,{children:u}))})},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{TRACKING_REPORT_URLS:()=>a,createTracking:()=>l,getTrackData:()=>i,normalizeTrackKey:()=>o});var t=function(){return t=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},t.apply(this,arguments)},a={test:"https://track-test.cjjd10.com:31029/api/v1/events/collect",prod:"https://track.cjjd10.com:31029/api/v1/events/collect"},o=function(e){return String(e||"").replace(/([a-z\d])([A-Z])/g,"$1_$2").split("").map(function(e){return/[a-z\d]/i.test(e)||e.charCodeAt(0)>127?e:"_"}).join("").replace(/_+/g,"_").replace(/^_+|_+$/g,"").toLowerCase()},i=function(e,n,r,t,a,i){void 0===t&&(t="undefined"==typeof window?"/":window.location.pathname),void 0===i&&(i=function(e){return e});var l=i(t),u=[o(l),o(null==r?void 0:r.key),o(e)].filter(Boolean).join("_"),s=[null==a?void 0:a(l),null==r?void 0:r.name,n].filter(Boolean).join("-");return JSON.stringify({id:u,name:s||n||u})},l=function(e){var n,r,a="",o="/",l=!1,u=[],s=!1,c=function(){return{ready:l,pathname:o}},d=function(){var e;try{null===(e=window.__tracker)||void 0===e||e.destroy()}catch(e){}window.__tracker=void 0,a="",n=void 0},m=function(){var n,r=!!e.getConfig(),t=c();s=r&&e.shouldQueue(t),r&&!(null===(n=e.shouldClearQueue)||void 0===n?void 0:n.call(e,t))||u.splice(0)},h=function(i){o=i||"/",m(),e.getConfig()?l&&!e.shouldQueue(c())&&function(r){var o=e.getConfig();if(o&&window.TrackingSDK){var i=e.getUserId(r);if(!window.__tracker||a!==o.appId||n!==i)try{window.__tracker&&a!==o.appId&&(window.__tracker.destroy(),window.__tracker=void 0),window.__tracker=window.TrackingSDK.createTracker(t(t({},o),{userId:i,debug:!1})),a=o.appId,n=i,function(){if(window.__tracker)for(var e=0,n=u.splice(0);e<n.length;e++){var r=n[e];try{window.__tracker.trackApi("api_request",r)}catch(e){}}}()}catch(e){window.__tracker=void 0,a="",n=void 0}}else d()}(r):d()};return m(),{markReady:function(e){l=!0,r=e,h(o)},syncRoute:h,reportApi:function(e){if(e.url)if(window.__tracker)try{window.__tracker.trackApi("api_request",e)}catch(e){}else s&&(u.length>=50&&u.shift(),u.push(e))},getTrackData:function(n,r,t,a){return i(n,r,t,a,e.getRouteName,e.normalizePathname)},destroy:d}}}],a={};function o(e){var n=a[e];if(void 0!==n)return n.exports;var r=a[e]={exports:{}};return t[e].call(r.exports,r,r.exports,o),r.exports}o.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return o.d(n,{a:n}),n},o.d=(e,n)=>{for(var r in n)o.o(n,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{o.r(i),o.d(i,{BaseModal:()=>a.default,Cron:()=>e.default,CustomDrawer:()=>r.default,ErrorBoundary:()=>t.default,HocModal:()=>n.default,TRACKING_REPORT_URLS:()=>l.TRACKING_REPORT_URLS,createTracking:()=>l.createTracking,getTrackData:()=>l.getTrackData,normalizeTrackKey:()=>l.normalizeTrackKey});var e=o(1),n=o(7),r=o(8),t=o(10),a=o(11),l=o(13)})();const l=i.BaseModal,u=i.Cron,s=i.CustomDrawer,c=i.ErrorBoundary,d=i.HocModal,m=i.TRACKING_REPORT_URLS,h=i.createTracking,f=i.getTrackData,p=i.normalizeTrackKey;export{l as BaseModal,u as Cron,s as CustomDrawer,c as ErrorBoundary,d as HocModal,m as TRACKING_REPORT_URLS,h as createTracking,f as getTrackData,p as normalizeTrackKey};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("antd"),require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["antd","react","react/jsx-runtime"],n):"object"==typeof exports?exports.MFYAllInOne=n(require("antd"),require("react"),require("react/jsx-runtime")):e.MFYAllInOne=n(e.antd,e.React,e["react/jsx-runtime"])}(this,(e,n,r)=>(()=>{"use strict";var t=[,(e,n,r)=>{r.r(n),r.d(n,{default:()=>d});var t=r(2),a=r(3),o=r(4),i=r(5),l=r(6),u=function(){return u=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},u.apply(this,arguments)},s=["minute","hour","day","month","week"],c={display:"block",lineHeight:2};const d=(0,i.forwardRef)(function(e,n){var r=e.cronExpression,d=(0,i.useState)(""),m=d[0],h=d[1],f=(0,i.useState)({minute:1,hour:1,day:1,month:1,week:1}),p=f[0],v=f[1],x=(0,i.useState)({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),y=x[0],w=x[1],j=(0,i.useState)({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),g=j[0],k=j[1],C=(0,i.useState)({minute:[],hour:[],day:[],month:[],week:[]}),b=C[0],R=C[1],O=(0,i.useRef)(null),_=(0,i.useState)(void 0),N=_[0],T=_[1],S=function(e,n){switch(e){case"minute":return{minute:n};case"hour":return{hour:n};case"day":return{day:n};case"month":return{month:n};case"week":return{week:n};default:return{}}},I=function(){return m},z=function(){v({minute:1,hour:1,day:1,month:1,week:1}),w({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),k({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),R({minute:[],hour:[],day:[],month:[],week:[]}),h("")},E=function(e,n){for(var r=[],t=e;t<=n;t++)r.push({label:t,value:t});return r},P=function(e){for(var n=[],r=["","一","二","三","四","五","六","日"],t=1;t<=e;t++)n.push({label:"星期".concat(r[t]),value:t+1===8?7:t});return n},A=function(e,n){switch(n){case"week":v(u(u(u({},p),{day:2}),S(n,e.target.value)));break;case"day":v(u(u(u({},p),{week:2}),S(n,e.target.value)));break;default:v(u(u({},p),S(n,e.target.value)))}},D=function(e,n,r){var t,a;r(u(u({},b),((t={})[n]=e,t))),v(u(u({},p),((a={})[n]="point",a)))},B=function(e,n,r){var t=y;t[n]="max"===r?{max:e,min:t[n].min}:{max:t[n].max,min:e},w(u(u({},y),S(n,t[n])))},F=function(e,n,r){var t=g;t[n]="start"===r?{start:e,end:t[n].end}:{start:t[n].start,end:e},k(u(u({},g),S(n,t[n])))};return(0,i.useEffect)(function(){r?function(e){h(e);var n=e.split(" "),r={},t={},a={},o={};n.forEach(function(e,n){if(-1!==e.indexOf("/")&&-1!==e.indexOf("-")){r[s[n]]="loop";var i=e.split("/")[0],l=i.split("-")[0];a[s[n]]={start:"*"===i?0:Number(l),end:Number(e.split("/")[1])}}else-1!==e.indexOf("*")?r[s[n]]="*":-1!==e.indexOf("-")?(r[s[n]]="period",t[s[n]]={min:Number(e.split("-")[0]),max:Number(e.split("-")[1])}):(r[s[n]]="point",o[s[n]]=e.split(",").map(function(e){return Number(e)}))}),w(u(u({},y),t)),k(u(u({},g),a)),R(u(u({},b),o)),v(u(u({},p),r))}(r):z()},[r]),(0,i.useEffect)(function(){!function(){var e={};s.forEach(function(n){return e=u(u({},e),function(e){var n=p[e],r=y[e],t=g[e],a=b[e],o="";switch(n){case"*":default:o="*";break;case"point":for(var i=0,l=a;i<l.length;i++)o=o+l[i]+",";o=o.substring(0,o.length-1);break;case"period":o=r.min+"-"+r.max;break;case"loop":o=t.start+"-"+{minute:59,hour:23,day:31,month:12,week:7}[e]+"/"+t.end}return S(e,o)}(n))});var n=e.minute,r=e.hour,t=e.day,a=e.month,o=e.week;h(n+" "+r+" "+t+" "+a+" "+o)}()},[p,y,g]),(0,i.useImperativeHandle)(n,function(){return{refGetCron:I,resetCronState:z,getValidateStatus:function(){return N}}}),(0,i.useEffect)(function(){var e;!function(e){(0,o.isValidCron)(e)?null==T||T("success"):null==T||T("error")}(m),null===(e=O.current)||void 0===e||e.setFieldsValue({cronText:m})},[m]),(0,t.jsxs)("div",{className:l.default.Cron,children:[(0,t.jsx)(a.Tabs,{type:"card",items:[{label:"分",key:"minute",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{value:p.minute,onChange:function(e){return A(e,"minute")},children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每分执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:y.minute.min,onChange:function(e){return B(e,"minute","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:59,value:y.minute.max,onChange:function(e){return B(e,"minute","max")}}),"分"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:g.minute.start,onChange:function(e){return F(e,"minute","start")}}),"分开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:58,value:g.minute.end,onChange:function(e){return F(e,"minute","end")}}),"分执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.minute,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择分钟",onChange:function(e){return D(e,"minute",R)},options:E(0,59)})})]})]})})},{label:"时",key:"hour",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"hour")},value:p.hour,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每小时执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:y.hour.min,onChange:function(e){return B(e,"hour","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:23,value:y.hour.max,onChange:function(e){return B(e,"hour","max")}}),"时"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:g.hour.start,onChange:function(e){return F(e,"hour","start")}}),"时开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:22,value:g.hour.end,onChange:function(e){return F(e,"hour","end")}}),"时执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.hour,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择小时",onChange:function(e){return D(e,"hour",R)},options:E(0,23)})})]})]})})},{label:"日",key:"day",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"day")},value:p.day,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每日执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:30,value:y.day.min,onChange:function(e){return B(e,"day","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:31,value:y.day.max,onChange:function(e){return B(e,"day","max")}}),"日"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:g.day.start,onChange:function(e){return F(e,"day","start")}}),"日开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:g.day.end,onChange:function(e){return F(e,"day","end")}}),"日执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.day,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择日期",onChange:function(e){return D(e,"day",R)},options:E(1,31)})})]})]})})},{label:"月",key:"month",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"month")},value:p.month,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每月执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:11,value:y.month.min,onChange:function(e){return B(e,"month","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:12,value:y.month.max,onChange:function(e){return B(e,"month","max")}}),"月"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:g.month.start,onChange:function(e){return F(e,"month","start")}}),"月开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:g.month.end,onChange:function(e){return F(e,"month","end")}}),"月执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.month,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择月份",onChange:function(e){return D(e,"month",R)},options:E(1,12)})})]})]})})},{label:"周",key:"week",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"week")},value:p.week,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每周执行"}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Radio,{style:c,value:"period",children:"周期从 周"})}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.min,placeholder:"请选择周",onChange:function(e){return B(e,"week","min")},options:P(7)})}),(0,t.jsx)(a.Col,{className:l.default.CronWeekFont,children:"- 周"}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.max,placeholder:"请选择周",onChange:function(e){return B(e,"week","max")},options:P(7)})})]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.week,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择周",onChange:function(e){return D(e,"week",R)},options:P(7)})})]})]})})}]}),(0,t.jsx)(a.Form,{className:l.default.CronPreview,ref:O,children:(0,t.jsx)(a.Form.Item,{label:"预览",name:"cronText",className:l.default.CronPreviewItem,hasFeedback:!0,validateStatus:N,children:(0,t.jsx)(a.Input,{readOnly:!0,style:{width:150}})})})]})})},e=>{e.exports=r},n=>{n.exports=e},function(e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},r.apply(this,arguments)};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidCron=void 0;var t=function(e){return/^\d+$/.test(e)?Number(e):NaN},a=function(e){return"?"===e},o=function(e,n,r){return e>=n&&e<=r},i=function(e,n,r){return-1===e.search(/[^\d-,\/*]/)&&e.split(",").every(function(e){var a=e.split("/");if(e.trim().endsWith("/"))return!1;if(a.length>2)return!1;var i=a[0],l=a[1];return function(e,n,r){var a=e.split("-");switch(a.length){case 1:return function(e){return"*"===e}(e)||o(t(e),n,r);case 2:var i=a.map(function(e){return t(e)}),l=i[0],u=i[1];return l<=u&&o(l,n,r)&&o(u,n,r);default:return!1}}(i,n,r)&&function(e){return void 0===e||-1===e.search(/[^\d]/)&&t(e)>0}(l)})},l={jan:"1",feb:"2",mar:"3",apr:"4",may:"5",jun:"6",jul:"7",aug:"8",sep:"9",oct:"10",nov:"11",dec:"12"},u={sun:"0",mon:"1",tue:"2",wed:"3",thu:"4",fri:"5",sat:"6"},s={alias:!1,seconds:!1,allowBlankDay:!1,allowSevenAsSunday:!1,allowNthWeekdayOfMonth:!1};n.isValidCron=function(e,n){var c=r(r({},s),n),d=function(e){return e.trim().split(/\s+/)}(e);if(d.length>(c.seconds?6:5)||d.length<5)return!1;var m=[];if(6===d.length){var h=d.shift();h&&m.push(function(e){return i(e,0,59)}(h))}var f=d[0],p=d[1],v=d[2],x=d[3],y=d[4];return m.push(function(e){return i(e,0,59)}(f)),m.push(function(e){return i(e,0,23)}(p)),m.push(function(e,n){return n&&a(e)||i(e,1,31)}(v,c.allowBlankDay)),m.push(function(e,n){if(-1!==e.search(/\/[a-zA-Z]/))return!1;if(n){var r=e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===l[e]?e:l[e]});return i(r,1,12)}return i(e,1,12)}(x,c.alias)),m.push(function(e,n){var r=n.allowBlankDay,l=n.alias,s=n.allowSevenAsSunday,c=n.allowNthWeekdayOfMonth;if(r&&a(e))return!0;if(!r&&a(e))return!1;if(-1!==e.search(/\/[a-zA-Z]/))return!1;var d=l?e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===u[e]?e:u[e]}):e,m=s?7:6,h=d.split("#");if(c&&h.length>=2){var f=h[0],p=h[1];return 0===h.slice(2).length&&o(t(p),1,5)&&o(t(f),0,m)}return i(d,0,m)}(y,c)),m.push(function(e,n,r){return!(r&&a(e)&&a(n))}(v,y,c.allowBlankDay)),m.every(Boolean)}},e=>{e.exports=n},(e,n,r)=>{r.r(n),r.d(n,{default:()=>t});const t={Cron:"vBb5040F",CronWeekFont:"O5XKllcf",CronPreview:"Ci4nV30W",CronPreviewItem:"y5qUyBlE"}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(5),o=function(){return o=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},o.apply(this,arguments)};function i(e){return(0,a.forwardRef)(function(n,r){var i=(0,a.useState)(!1),l=i[0],u=i[1],s=(0,a.useRef)(null);(0,a.useImperativeHandle)(r,function(){return{show:function(e){s.current=e,u(!0)},hide:function(){u(!1)}}});var c=function(){u(!1)},d=(0,a.useMemo)(function(){return(0,t.jsx)(e,o({},n,{visible:l,handleCancel:c},s.current))},[l]);return(0,t.jsx)(t.Fragment,{children:l?d:null})})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>o});var t=r(2),a=r(3);r(9);const o=function(e){var n=e.title,r=e.open,o=e.onClose,i=e.onConfirm,l=e.children,u=e.width,s=e.closable,c=e.cancelText,d=e.okText,m=e.footer,h=e.className,f=e.extra,p=void 0===f?null:f,v=e.loading,x=void 0!==v&&v,y=e.cancelTrack,w=e.okTrack;return(0,t.jsx)(a.Drawer,{title:(0,t.jsx)("div",{style:{float:"left"},children:n}),placement:"right",className:h,closable:s,onClose:o,width:u,open:r,footer:m||(0,t.jsx)("div",{className:"custom-footer",children:(0,t.jsxs)(a.Space,{children:[(0,t.jsx)(a.Button,{"data-track":y,onClick:o,children:c||"取消"}),(0,t.jsx)(a.Button,{"data-track":w,loading:x,type:"primary",onClick:i,children:d||"确定"})]})}),extra:p,loading:x,children:l})}},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(3),o=r(5);function i(e){var n=e.children,r=e.onError,i=(0,o.useState)({hasError:!1}),l=i[0],u=i[1],s=(0,o.useCallback)(function(e,n){u({hasError:!0,error:e,errorInfo:n}),r&&r(e,n),console.error("Error caught by boundary:",e,n)},[r]);return(0,o.useEffect)(function(){var e=function(e){s(e,{isAsync:!0,timestamp:(new Date).toISOString()})},n=function(n){n.preventDefault(),e(n.reason)},r=function(n){n.preventDefault(),e(n.error)};return window.addEventListener("unhandledrejection",n),window.addEventListener("error",r),function(){window.removeEventListener("unhandledrejection",n),window.removeEventListener("error",r)}},[s]),l.hasError&&l.error?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a.Result,{status:"error",title:"System Failed",subTitle:"Please check and modify the following information before resubmitting.",extra:[(0,t.jsx)(a.Button,{type:"primary",onClick:function(){return window.location.reload()},children:"刷新页面"},"console")]})}):(0,t.jsx)(t.Fragment,{children:n})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>l});var t=r(2),a=r(3),o=r(5),i=(r(12),function(){return i=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},i.apply(this,arguments)});const l=(0,o.memo)(function(e){var n=e.title,r=e.visible,o=e.onOk,l=e.onCancel,u=e.children,s=e.width,c=e.afterClose,d=e.okText,m=e.confirmLoading,h=void 0!==m&&m,f=e.footer,p=void 0===f?void 0:f,v=e.wrapClassName,x=void 0===v?"":v,y=e.cancelText,w=e.className,j=void 0===w?"":w,g=e.keyboard,k=void 0===g||g,C=e.maskClosable,b=void 0===C||C,R=e.mask,O=void 0===R||R,_=e.getContainer,N=e.closable,T=void 0===N||N,S=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(t=Object.getOwnPropertySymbols(e);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(r[t[a]]=e[t[a]])}return r}(e,["title","visible","onOk","onCancel","children","width","afterClose","okText","confirmLoading","footer","wrapClassName","cancelText","className","keyboard","maskClosable","mask","getContainer","closable"]);return(0,t.jsx)(a.Modal,i({mask:O,width:s||320,title:n,open:r,onOk:o,onCancel:l,wrapClassName:"".concat(x," base-modal"),centered:!0,afterClose:c,okText:d||"确定",cancelText:y||"取消",confirmLoading:h,footer:p,destroyOnClose:!0,className:j,keyboard:k,maskClosable:b,getContainer:_,closable:T},S,{children:u}))})},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{TRACKING_REPORT_URLS:()=>a,createTracking:()=>l,getTrackData:()=>i,normalizeTrackKey:()=>o});var t=function(){return t=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},t.apply(this,arguments)},a={test:"https://track-test.cjjd10.com:31029/api/v1/events/collect",prod:"https://track.cjjd10.com:31029/api/v1/events/collect"},o=function(e){return String(e||"").replace(/([a-z\d])([A-Z])/g,"$1_$2").split("").map(function(e){return/[a-z\d]/i.test(e)||e.charCodeAt(0)>127?e:"_"}).join("").replace(/_+/g,"_").replace(/^_+|_+$/g,"").toLowerCase()},i=function(e,n,r,t,a,i){void 0===t&&(t="undefined"==typeof window?"/":window.location.pathname),void 0===i&&(i=function(e){return e});var l=i(t),u=[o(l),o(null==r?void 0:r.key),o(e)].filter(Boolean).join("_"),s=[null==a?void 0:a(l),null==r?void 0:r.name,n].filter(Boolean).join("-");return JSON.stringify({id:u,name:s||n||u})},l=function(e){var n,r,a="",o="/",l=!1,u=[],s=!1,c=function(){return{ready:l,pathname:o}},d=function(){var e;try{null===(e=window.__tracker)||void 0===e||e.destroy()}catch(e){}window.__tracker=void 0,a="",n=void 0},m=function(){var n,r=!!e.getConfig(),t=c();s=r&&e.shouldQueue(t),r&&!(null===(n=e.shouldClearQueue)||void 0===n?void 0:n.call(e,t))||u.splice(0)},h=function(i){o=i||"/",m(),e.getConfig()?l&&!e.shouldQueue(c())&&function(r){var o=e.getConfig();if(o&&window.TrackingSDK){var i=e.getUserId(r);if(!window.__tracker||a!==o.appId||n!==i)try{window.__tracker&&a!==o.appId&&(window.__tracker.destroy(),window.__tracker=void 0),window.__tracker=window.TrackingSDK.createTracker(t(t({},o),{userId:i,debug:!1})),a=o.appId,n=i,function(){if(window.__tracker)for(var e=0,n=u.splice(0);e<n.length;e++){var r=n[e];try{window.__tracker.trackApi("api_request",r)}catch(e){}}}()}catch(e){window.__tracker=void 0,a="",n=void 0}}else d()}(r):d()};return m(),{markReady:function(e){l=!0,r=e,h(o)},syncRoute:h,reportApi:function(e){if(e.url)if(window.__tracker)try{window.__tracker.trackApi("api_request",e)}catch(e){}else s&&(u.length>=50&&u.shift(),u.push(e))},getTrackData:function(n,r,t,a){return i(n,r,t,a,e.getRouteName,e.normalizePathname)},destroy:d}}}],a={};function o(e){var n=a[e];if(void 0!==n)return n.exports;var r=a[e]={exports:{}};return t[e].call(r.exports,r,r.exports,o),r.exports}o.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return o.d(n,{a:n}),n},o.d=(e,n)=>{for(var r in n)o.o(n,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{BaseModal:()=>a.default,Cron:()=>e.default,CustomDrawer:()=>r.default,ErrorBoundary:()=>t.default,HocModal:()=>n.default,TRACKING_REPORT_URLS:()=>l.TRACKING_REPORT_URLS,createTracking:()=>l.createTracking,getTrackData:()=>l.getTrackData,normalizeTrackKey:()=>l.normalizeTrackKey});var e=o(1),n=o(7),r=o(8),t=o(10),a=o(11),l=o(13)})(),i})());
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("antd"),require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["antd","react","react/jsx-runtime"],n):"object"==typeof exports?exports.MFYAllInOne=n(require("antd"),require("react"),require("react/jsx-runtime")):e.MFYAllInOne=n(e.antd,e.React,e["react/jsx-runtime"])}(this,(e,n,r)=>(()=>{"use strict";var t=[,(e,n,r)=>{r.r(n),r.d(n,{default:()=>d});var t=r(2),a=r(3),o=r(4),i=r(5),l=r(6),u=function(){return u=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},u.apply(this,arguments)},s=["minute","hour","day","month","week"],c={display:"block",lineHeight:2};const d=(0,i.forwardRef)(function(e,n){var r=e.cronExpression,d=(0,i.useState)(""),m=d[0],h=d[1],f=(0,i.useState)({minute:1,hour:1,day:1,month:1,week:1}),p=f[0],v=f[1],x=(0,i.useState)({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),y=x[0],w=x[1],j=(0,i.useState)({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),g=j[0],k=j[1],C=(0,i.useState)({minute:[],hour:[],day:[],month:[],week:[]}),b=C[0],R=C[1],O=(0,i.useRef)(null),_=(0,i.useState)(void 0),N=_[0],T=_[1],S=function(e,n){switch(e){case"minute":return{minute:n};case"hour":return{hour:n};case"day":return{day:n};case"month":return{month:n};case"week":return{week:n};default:return{}}},I=function(){return m},z=function(){v({minute:1,hour:1,day:1,month:1,week:1}),w({minute:{min:1,max:2},hour:{min:0,max:1},day:{min:1,max:2},month:{min:1,max:2},week:{min:2,max:3}}),k({minute:{start:0,end:1},hour:{start:0,end:1},day:{start:1,end:1},month:{start:1,end:1},week:{start:1,end:1}}),R({minute:[],hour:[],day:[],month:[],week:[]}),h("")},E=function(e,n){for(var r=[],t=e;t<=n;t++)r.push({label:t,value:t});return r},P=function(e){for(var n=[],r=["","一","二","三","四","五","六","日"],t=1;t<=e;t++)n.push({label:"星期".concat(r[t]),value:t+1===8?7:t});return n},A=function(e,n){switch(n){case"week":v(u(u(u({},p),{day:2}),S(n,e.target.value)));break;case"day":v(u(u(u({},p),{week:2}),S(n,e.target.value)));break;default:v(u(u({},p),S(n,e.target.value)))}},D=function(e,n,r){var t,a;r(u(u({},b),((t={})[n]=e,t))),v(u(u({},p),((a={})[n]="point",a)))},B=function(e,n,r){var t=y;t[n]="max"===r?{max:e,min:t[n].min}:{max:t[n].max,min:e},w(u(u({},y),S(n,t[n])))},F=function(e,n,r){var t=g;t[n]="start"===r?{start:e,end:t[n].end}:{start:t[n].start,end:e},k(u(u({},g),S(n,t[n])))};return(0,i.useEffect)(function(){r?function(e){h(e);var n=e.split(" "),r={},t={},a={},o={};n.forEach(function(e,n){if(-1!==e.indexOf("/")&&-1!==e.indexOf("-")){r[s[n]]="loop";var i=e.split("/")[0],l=i.split("-")[0];a[s[n]]={start:"*"===i?0:Number(l),end:Number(e.split("/")[1])}}else-1!==e.indexOf("*")?r[s[n]]="*":-1!==e.indexOf("-")?(r[s[n]]="period",t[s[n]]={min:Number(e.split("-")[0]),max:Number(e.split("-")[1])}):(r[s[n]]="point",o[s[n]]=e.split(",").map(function(e){return Number(e)}))}),w(u(u({},y),t)),k(u(u({},g),a)),R(u(u({},b),o)),v(u(u({},p),r))}(r):z()},[r]),(0,i.useEffect)(function(){!function(){var e={};s.forEach(function(n){return e=u(u({},e),function(e){var n=p[e],r=y[e],t=g[e],a=b[e],o="";switch(n){case"*":default:o="*";break;case"point":for(var i=0,l=a;i<l.length;i++)o=o+l[i]+",";o=o.substring(0,o.length-1);break;case"period":o=r.min+"-"+r.max;break;case"loop":o=t.start+"-"+{minute:59,hour:23,day:31,month:12,week:7}[e]+"/"+t.end}return S(e,o)}(n))});var n=e.minute,r=e.hour,t=e.day,a=e.month,o=e.week;h(n+" "+r+" "+t+" "+a+" "+o)}()},[p,y,g]),(0,i.useImperativeHandle)(n,function(){return{refGetCron:I,resetCronState:z,getValidateStatus:function(){return N}}}),(0,i.useEffect)(function(){var e;!function(e){(0,o.isValidCron)(e)?null==T||T("success"):null==T||T("error")}(m),null===(e=O.current)||void 0===e||e.setFieldsValue({cronText:m})},[m]),(0,t.jsxs)("div",{className:l.default.Cron,children:[(0,t.jsx)(a.Tabs,{type:"card",items:[{label:"分",key:"minute",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{value:p.minute,onChange:function(e){return A(e,"minute")},children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每分执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:y.minute.min,onChange:function(e){return B(e,"minute","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:59,value:y.minute.max,onChange:function(e){return B(e,"minute","max")}}),"分"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:58,value:g.minute.start,onChange:function(e){return F(e,"minute","start")}}),"分开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:58,value:g.minute.end,onChange:function(e){return F(e,"minute","end")}}),"分执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.minute,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择分钟",onChange:function(e){return D(e,"minute",R)},options:E(0,59)})})]})]})})},{label:"时",key:"hour",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"hour")},value:p.hour,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每小时执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:y.hour.min,onChange:function(e){return B(e,"hour","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:23,value:y.hour.max,onChange:function(e){return B(e,"hour","max")}}),"时"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:0,max:22,value:g.hour.start,onChange:function(e){return F(e,"hour","start")}}),"时开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:22,value:g.hour.end,onChange:function(e){return F(e,"hour","end")}}),"时执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.hour,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择小时",onChange:function(e){return D(e,"hour",R)},options:E(0,23)})})]})]})})},{label:"日",key:"day",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"day")},value:p.day,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每日执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:30,value:y.day.min,onChange:function(e){return B(e,"day","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:31,value:y.day.max,onChange:function(e){return B(e,"day","max")}}),"日"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:g.day.start,onChange:function(e){return F(e,"day","start")}}),"日开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:31,value:g.day.end,onChange:function(e){return F(e,"day","end")}}),"日执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.day,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择日期",onChange:function(e){return D(e,"day",R)},options:E(1,31)})})]})]})})},{label:"月",key:"month",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"month")},value:p.month,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每月执行"}),(0,t.jsxs)(a.Radio,{style:c,value:"period",children:["周期从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:11,value:y.month.min,onChange:function(e){return B(e,"month","min")}}),"-",(0,t.jsx)(a.InputNumber,{size:"small",min:2,max:12,value:y.month.max,onChange:function(e){return B(e,"month","max")}}),"月"]}),(0,t.jsxs)(a.Radio,{style:c,value:"loop",children:["从",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:g.month.start,onChange:function(e){return F(e,"month","start")}}),"月开始,每",(0,t.jsx)(a.InputNumber,{size:"small",min:1,max:12,value:g.month.end,onChange:function(e){return F(e,"month","end")}}),"月执行一次"]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.month,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择月份",onChange:function(e){return D(e,"month",R)},options:E(1,12)})})]})]})})},{label:"周",key:"week",children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(a.Radio.Group,{onChange:function(e){return A(e,"week")},value:p.week,children:[(0,t.jsx)(a.Radio,{style:c,value:"*",children:"每周执行"}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Radio,{style:c,value:"period",children:"周期从 周"})}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.min,placeholder:"请选择周",onChange:function(e){return B(e,"week","min")},options:P(7)})}),(0,t.jsx)(a.Col,{className:l.default.CronWeekFont,children:"- 周"}),(0,t.jsx)(a.Col,{children:(0,t.jsx)(a.Select,{style:{marginTop:7},allowClear:!0,value:y.week.max,placeholder:"请选择周",onChange:function(e){return B(e,"week","max")},options:P(7)})})]}),(0,t.jsxs)(a.Row,{children:[(0,t.jsx)(a.Radio,{style:c,value:"point",children:"指定"}),(0,t.jsx)(a.Col,{span:18,children:(0,t.jsx)(a.Select,{value:b.week,style:{width:"80%",marginTop:7},mode:"multiple",allowClear:!0,placeholder:"请选择周",onChange:function(e){return D(e,"week",R)},options:P(7)})})]})]})})}]}),(0,t.jsx)(a.Form,{className:l.default.CronPreview,ref:O,children:(0,t.jsx)(a.Form.Item,{label:"预览",name:"cronText",className:l.default.CronPreviewItem,hasFeedback:!0,validateStatus:N,children:(0,t.jsx)(a.Input,{readOnly:!0,style:{width:150}})})})]})})},e=>{e.exports=r},n=>{n.exports=e},function(e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},r.apply(this,arguments)};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidCron=void 0;var t=function(e){return/^\d+$/.test(e)?Number(e):NaN},a=function(e){return"?"===e},o=function(e,n,r){return e>=n&&e<=r},i=function(e,n,r){return-1===e.search(/[^\d-,\/*]/)&&e.split(",").every(function(e){var a=e.split("/");if(e.trim().endsWith("/"))return!1;if(a.length>2)return!1;var i=a[0],l=a[1];return function(e,n,r){var a=e.split("-");switch(a.length){case 1:return function(e){return"*"===e}(e)||o(t(e),n,r);case 2:var i=a.map(function(e){return t(e)}),l=i[0],u=i[1];return l<=u&&o(l,n,r)&&o(u,n,r);default:return!1}}(i,n,r)&&function(e){return void 0===e||-1===e.search(/[^\d]/)&&t(e)>0}(l)})},l={jan:"1",feb:"2",mar:"3",apr:"4",may:"5",jun:"6",jul:"7",aug:"8",sep:"9",oct:"10",nov:"11",dec:"12"},u={sun:"0",mon:"1",tue:"2",wed:"3",thu:"4",fri:"5",sat:"6"},s={alias:!1,seconds:!1,allowBlankDay:!1,allowSevenAsSunday:!1,allowNthWeekdayOfMonth:!1};n.isValidCron=function(e,n){var c=r(r({},s),n),d=function(e){return e.trim().split(/\s+/)}(e);if(d.length>(c.seconds?6:5)||d.length<5)return!1;var m=[];if(6===d.length){var h=d.shift();h&&m.push(function(e){return i(e,0,59)}(h))}var f=d[0],p=d[1],v=d[2],x=d[3],y=d[4];return m.push(function(e){return i(e,0,59)}(f)),m.push(function(e){return i(e,0,23)}(p)),m.push(function(e,n){return n&&a(e)||i(e,1,31)}(v,c.allowBlankDay)),m.push(function(e,n){if(-1!==e.search(/\/[a-zA-Z]/))return!1;if(n){var r=e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===l[e]?e:l[e]});return i(r,1,12)}return i(e,1,12)}(x,c.alias)),m.push(function(e,n){var r=n.allowBlankDay,l=n.alias,s=n.allowSevenAsSunday,c=n.allowNthWeekdayOfMonth;if(r&&a(e))return!0;if(!r&&a(e))return!1;if(-1!==e.search(/\/[a-zA-Z]/))return!1;var d=l?e.toLowerCase().replace(/[a-z]{3}/g,function(e){return void 0===u[e]?e:u[e]}):e,m=s?7:6,h=d.split("#");if(c&&h.length>=2){var f=h[0],p=h[1];return 0===h.slice(2).length&&o(t(p),1,5)&&o(t(f),0,m)}return i(d,0,m)}(y,c)),m.push(function(e,n,r){return!(r&&a(e)&&a(n))}(v,y,c.allowBlankDay)),m.every(Boolean)}},e=>{e.exports=n},(e,n,r)=>{r.r(n),r.d(n,{default:()=>t});const t={Cron:"vBb5040F",CronWeekFont:"O5XKllcf",CronPreview:"Ci4nV30W",CronPreviewItem:"y5qUyBlE"}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(5),o=function(){return o=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},o.apply(this,arguments)};function i(e){return(0,a.forwardRef)(function(n,r){var i=(0,a.useState)(!1),l=i[0],u=i[1],s=(0,a.useRef)(null);(0,a.useImperativeHandle)(r,function(){return{show:function(e){s.current=e,u(!0)},hide:function(){u(!1)}}});var c=function(){u(!1)},d=(0,a.useMemo)(function(){return(0,t.jsx)(e,o({},n,{visible:l,handleCancel:c},s.current))},[l]);return(0,t.jsx)(t.Fragment,{children:l?d:null})})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>o});var t=r(2),a=r(3);r(9);const o=function(e){var n=e.title,r=e.open,o=e.onClose,i=e.onConfirm,l=e.children,u=e.width,s=e.closable,c=e.cancelText,d=e.okText,m=e.footer,h=e.className,f=e.extra,p=void 0===f?null:f,v=e.loading,x=void 0!==v&&v,y=e.maskClosable,w=void 0===y||y,j=e.cancelTrack,g=e.okTrack;return(0,t.jsx)(a.Drawer,{title:(0,t.jsx)("div",{style:{float:"left"},children:n}),placement:"right",className:h,closable:s,maskClosable:w,onClose:o,width:u,open:r,footer:m||(0,t.jsx)("div",{className:"custom-footer",children:(0,t.jsxs)(a.Space,{children:[(0,t.jsx)(a.Button,{"data-track":j,onClick:o,children:c||"取消"}),(0,t.jsx)(a.Button,{"data-track":g,loading:x,type:"primary",onClick:i,children:d||"确定"})]})}),extra:p,loading:x,children:l})}},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{default:()=>i});var t=r(2),a=r(3),o=r(5);function i(e){var n=e.children,r=e.onError,i=(0,o.useState)({hasError:!1}),l=i[0],u=i[1],s=(0,o.useCallback)(function(e,n){u({hasError:!0,error:e,errorInfo:n}),r&&r(e,n),console.error("Error caught by boundary:",e,n)},[r]);return(0,o.useEffect)(function(){var e=function(e){s(e,{isAsync:!0,timestamp:(new Date).toISOString()})},n=function(n){n.preventDefault(),e(n.reason)},r=function(n){n.preventDefault(),e(n.error)};return window.addEventListener("unhandledrejection",n),window.addEventListener("error",r),function(){window.removeEventListener("unhandledrejection",n),window.removeEventListener("error",r)}},[s]),l.hasError&&l.error?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a.Result,{status:"error",title:"System Failed",subTitle:"Please check and modify the following information before resubmitting.",extra:[(0,t.jsx)(a.Button,{type:"primary",onClick:function(){return window.location.reload()},children:"刷新页面"},"console")]})}):(0,t.jsx)(t.Fragment,{children:n})}},(e,n,r)=>{r.r(n),r.d(n,{default:()=>l});var t=r(2),a=r(3),o=r(5),i=(r(12),function(){return i=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},i.apply(this,arguments)});const l=(0,o.memo)(function(e){var n=e.title,r=e.visible,o=e.onOk,l=e.onCancel,u=e.children,s=e.width,c=e.afterClose,d=e.okText,m=e.confirmLoading,h=void 0!==m&&m,f=e.footer,p=void 0===f?void 0:f,v=e.wrapClassName,x=void 0===v?"":v,y=e.cancelText,w=e.className,j=void 0===w?"":w,g=e.keyboard,k=void 0===g||g,C=e.maskClosable,b=void 0===C||C,R=e.mask,O=void 0===R||R,_=e.getContainer,N=e.closable,T=void 0===N||N,S=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(t=Object.getOwnPropertySymbols(e);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(r[t[a]]=e[t[a]])}return r}(e,["title","visible","onOk","onCancel","children","width","afterClose","okText","confirmLoading","footer","wrapClassName","cancelText","className","keyboard","maskClosable","mask","getContainer","closable"]);return(0,t.jsx)(a.Modal,i({mask:O,width:s||320,title:n,open:r,onOk:o,onCancel:l,wrapClassName:"".concat(x," base-modal"),centered:!0,afterClose:c,okText:d||"确定",cancelText:y||"取消",confirmLoading:h,footer:p,destroyOnClose:!0,className:j,keyboard:k,maskClosable:b,getContainer:_,closable:T},S,{children:u}))})},(e,n,r)=>{r.r(n)},(e,n,r)=>{r.r(n),r.d(n,{TRACKING_REPORT_URLS:()=>a,createTracking:()=>l,getTrackData:()=>i,normalizeTrackKey:()=>o});var t=function(){return t=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},t.apply(this,arguments)},a={test:"https://track-test.cjjd10.com:31029/api/v1/events/collect",prod:"https://track.cjjd10.com:31029/api/v1/events/collect"},o=function(e){return String(e||"").replace(/([a-z\d])([A-Z])/g,"$1_$2").split("").map(function(e){return/[a-z\d]/i.test(e)||e.charCodeAt(0)>127?e:"_"}).join("").replace(/_+/g,"_").replace(/^_+|_+$/g,"").toLowerCase()},i=function(e,n,r,t,a,i){void 0===t&&(t="undefined"==typeof window?"/":window.location.pathname),void 0===i&&(i=function(e){return e});var l=i(t),u=[o(l),o(null==r?void 0:r.key),o(e)].filter(Boolean).join("_"),s=[null==a?void 0:a(l),null==r?void 0:r.name,n].filter(Boolean).join("-");return JSON.stringify({id:u,name:s||n||u})},l=function(e){var n,r,a="",o="/",l=!1,u=[],s=!1,c=function(){return{ready:l,pathname:o}},d=function(){var e;try{null===(e=window.__tracker)||void 0===e||e.destroy()}catch(e){}window.__tracker=void 0,a="",n=void 0},m=function(){var n,r=!!e.getConfig(),t=c();s=r&&e.shouldQueue(t),r&&!(null===(n=e.shouldClearQueue)||void 0===n?void 0:n.call(e,t))||u.splice(0)},h=function(i){o=i||"/",m(),e.getConfig()?l&&!e.shouldQueue(c())&&function(r){var o=e.getConfig();if(o&&window.TrackingSDK){var i=e.getUserId(r);if(!window.__tracker||a!==o.appId||n!==i)try{window.__tracker&&a!==o.appId&&(window.__tracker.destroy(),window.__tracker=void 0),window.__tracker=window.TrackingSDK.createTracker(t(t({},o),{userId:i,debug:!1})),a=o.appId,n=i,function(){if(window.__tracker)for(var e=0,n=u.splice(0);e<n.length;e++){var r=n[e];try{window.__tracker.trackApi("api_request",r)}catch(e){}}}()}catch(e){window.__tracker=void 0,a="",n=void 0}}else d()}(r):d()};return m(),{markReady:function(e){l=!0,r=e,h(o)},syncRoute:h,reportApi:function(e){if(e.url)if(window.__tracker)try{window.__tracker.trackApi("api_request",e)}catch(e){}else s&&(u.length>=50&&u.shift(),u.push(e))},getTrackData:function(n,r,t,a){return i(n,r,t,a,e.getRouteName,e.normalizePathname)},destroy:d}}}],a={};function o(e){var n=a[e];if(void 0!==n)return n.exports;var r=a[e]={exports:{}};return t[e].call(r.exports,r,r.exports,o),r.exports}o.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return o.d(n,{a:n}),n},o.d=(e,n)=>{for(var r in n)o.o(n,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{BaseModal:()=>a.default,Cron:()=>e.default,CustomDrawer:()=>r.default,ErrorBoundary:()=>t.default,HocModal:()=>n.default,TRACKING_REPORT_URLS:()=>l.TRACKING_REPORT_URLS,createTracking:()=>l.createTracking,getTrackData:()=>l.getTrackData,normalizeTrackKey:()=>l.normalizeTrackKey});var e=o(1),n=o(7),r=o(8),t=o(10),a=o(11),l=o(13)})(),i})());
|
package/package.json
CHANGED
package/scripts/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ function usage() {
|
|
|
19
19
|
star-allinone skills sync [--target <dir>] [--dry-run]
|
|
20
20
|
star-allinone doctor [--target <dir>]
|
|
21
21
|
star-allinone gen service --operation "GET /api/v1/devices/" [--spec <file>] [--domain Devices] [--mock-file] [--dry-run]
|
|
22
|
-
star-allinone gen page --feature Widgets --route /widgets --title 组件管理 --list-operation "GET /api/v1/widgets/" [--create-operation ...] [--update-operation ...] [--delete-operation ...] [--dry-run]
|
|
22
|
+
star-allinone gen page --feature Widgets --route /widgets --title 组件管理 --list-operation "GET /api/v1/widgets/" [--create-operation ...] [--update-operation ...] [--delete-operation ...] [--no-tracking] [--dry-run]
|
|
23
23
|
|
|
24
24
|
Run from a business project containing .star-allinone.json.
|
|
25
25
|
|
|
@@ -30,7 +30,8 @@ If <project>/AGENTS.md is missing, it copies examples/AGENTS.md once.
|
|
|
30
30
|
doctor checks config, OpenAPI, MFRequest, MFProTable, skill sync, and bad imports.
|
|
31
31
|
|
|
32
32
|
gen service writes one MFRequest method and types from OpenAPI/Swagger.
|
|
33
|
-
gen page scaffolds a list + drawer + confirm page from OpenAPI schema and can generate services first
|
|
33
|
+
gen page scaffolds a list + drawer + confirm page from OpenAPI schema and can generate services first.
|
|
34
|
+
When src/utils/tracking/index.ts exists, generated pages include getTrackData wiring unless --no-tracking is passed.`);
|
|
34
35
|
process.exitCode = 1;
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -65,6 +66,7 @@ function parseArgs(args) {
|
|
|
65
66
|
if (arg === '--dry-run') options.dryRun = true;
|
|
66
67
|
else if (arg === '--mock-file') options.mockFile = true;
|
|
67
68
|
else if (arg === '--force') options.force = true;
|
|
69
|
+
else if (arg === '--no-tracking') options.noTracking = true;
|
|
68
70
|
else if (arg.startsWith('--')) {
|
|
69
71
|
const key = arg.slice(2).replace(/-([a-z])/g, (_, ch) => ch.toUpperCase());
|
|
70
72
|
options[key] = args[++index];
|
|
@@ -49,6 +49,11 @@ function makeProject() {
|
|
|
49
49
|
fs.mkdirSync(path.join(root, 'src/components/CommonTable'), { recursive: true });
|
|
50
50
|
fs.writeFileSync(path.join(root, 'src/components/CommonTable/MFProTable.tsx'), 'export default function MFProTable() { return null; }\n');
|
|
51
51
|
fs.mkdirSync(path.join(root, 'src/pages'), { recursive: true });
|
|
52
|
+
fs.mkdirSync(path.join(root, 'src/utils/tracking'), { recursive: true });
|
|
53
|
+
fs.writeFileSync(
|
|
54
|
+
path.join(root, 'src/utils/tracking/index.ts'),
|
|
55
|
+
"export const getTrackData = (...args: unknown[]) => JSON.stringify(args);\n",
|
|
56
|
+
);
|
|
52
57
|
fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({
|
|
53
58
|
dependencies: { '@mingfuyun/star-allinone': '^0.3.2' },
|
|
54
59
|
scripts: { typecheck: 'tsc --noEmit' },
|
|
@@ -120,11 +125,19 @@ function main() {
|
|
|
120
125
|
assert(columns.includes("dataIndex: 'kind'"), columns);
|
|
121
126
|
assert(columns.includes("valueType: 'select'"), columns);
|
|
122
127
|
assert(columns.includes("valueType: 'digit'"), columns);
|
|
128
|
+
assert(columns.includes("getTrackData('create', \"新增\""), columns);
|
|
129
|
+
assert(columns.includes("getTrackData('edit', \"编辑\""), columns);
|
|
130
|
+
assert(columns.includes("getTrackData('delete', \"删除\""), columns);
|
|
123
131
|
const drawer = fs.readFileSync(path.join(root, 'src/pages/Widgets/components/WidgetsDrawer.tsx'), 'utf8');
|
|
124
132
|
assert(drawer.includes('ProFormSelect'), drawer);
|
|
125
133
|
assert(drawer.includes("name=\"status\""), drawer);
|
|
126
134
|
assert(drawer.includes("name=\"name\""), drawer);
|
|
127
135
|
assert(drawer.includes('required: true'), drawer);
|
|
136
|
+
assert(drawer.includes('cancelTrack={getTrackData('), drawer);
|
|
137
|
+
assert(drawer.includes('okTrack={getTrackData('), drawer);
|
|
138
|
+
const confirm = fs.readFileSync(path.join(root, 'src/pages/Widgets/components/WidgetsConfirmModal.tsx'), 'utf8');
|
|
139
|
+
assert(confirm.includes("'data-track': getTrackData('cancel', \"取消\""), confirm);
|
|
140
|
+
assert(confirm.includes("'data-track': getTrackData('confirm', \"确定\""), confirm);
|
|
128
141
|
const route = fs.readFileSync(path.join(root, 'config/route.ts'), 'utf8');
|
|
129
142
|
assert(route.includes("path: '/widgets'"), route);
|
|
130
143
|
|
package/scripts/gen/page.js
CHANGED
|
@@ -19,6 +19,20 @@ function detectLayout(root) {
|
|
|
19
19
|
return { hasPageContainer, hasProTableLess, hasContainerConfig };
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
function hasTracking(root, config) {
|
|
23
|
+
const modulePath = (config.trackingModule || '@/utils/tracking').replace(/^@\//, 'src/');
|
|
24
|
+
return fs.existsSync(path.join(root, `${modulePath}.ts`))
|
|
25
|
+
|| fs.existsSync(path.join(root, `${modulePath}/index.ts`));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function trackingImport(config) {
|
|
29
|
+
return config.trackingModule || '@/utils/tracking';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function emitTrackData(action, label, context) {
|
|
33
|
+
return `getTrackData('${action}', ${JSON.stringify(label)}, ${JSON.stringify(context)})`;
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
function featureNames(options) {
|
|
23
37
|
const feature = options.feature.replace(/\\/g, '/').replace(/^\/+|\/+$/g, '');
|
|
24
38
|
if (!feature) throw new Error('Missing --feature. Example: --feature Widgets');
|
|
@@ -43,7 +57,7 @@ function searchFieldNames(fields) {
|
|
|
43
57
|
.map((field) => field.name);
|
|
44
58
|
}
|
|
45
59
|
|
|
46
|
-
function emitColumns(names, itemType, fields, permissions, queryNames) {
|
|
60
|
+
function emitColumns(names, itemType, fields, permissions, queryNames, tracking, trackingModule) {
|
|
47
61
|
const columnFields = fields.length ? fields : [{ name: 'id', title: 'ID', type: 'string' }];
|
|
48
62
|
const searchable = new Set(
|
|
49
63
|
queryNames?.length
|
|
@@ -74,7 +88,19 @@ function emitColumns(names, itemType, fields, permissions, queryNames) {
|
|
|
74
88
|
const permCreate = permissions.create ? ` permission: '${permissions.create}',\n` : '';
|
|
75
89
|
const permEdit = permissions.edit ? ` permission: '${permissions.edit}',\n` : '';
|
|
76
90
|
const permDelete = permissions.delete ? ` permission: '${permissions.delete}',\n` : '';
|
|
77
|
-
|
|
91
|
+
const trackImport = tracking
|
|
92
|
+
? `import { getTrackData } from '${trackingModule}';\n`
|
|
93
|
+
: '';
|
|
94
|
+
const trackEdit = tracking
|
|
95
|
+
? ` track: ${emitTrackData('edit', '编辑', { key: 'action', name: '操作' })},\n`
|
|
96
|
+
: '';
|
|
97
|
+
const trackDelete = tracking
|
|
98
|
+
? ` track: ${emitTrackData('delete', '删除', { key: 'action', name: '操作' })},\n`
|
|
99
|
+
: '';
|
|
100
|
+
const trackCreate = tracking
|
|
101
|
+
? ` track: ${emitTrackData('create', '新增', { key: 'toolbar', name: '工具栏' })},\n`
|
|
102
|
+
: '';
|
|
103
|
+
return `${trackImport}import type {
|
|
78
104
|
ITableProps,
|
|
79
105
|
TableSearchType,
|
|
80
106
|
} from '@/components/CommonTable/type';
|
|
@@ -99,12 +125,12 @@ export const getActionColumn = ({
|
|
|
99
125
|
>['actions'] => [
|
|
100
126
|
{
|
|
101
127
|
key: 'edit',
|
|
102
|
-
${permEdit} getText: () => '编辑',
|
|
128
|
+
${permEdit}${trackEdit} getText: () => '编辑',
|
|
103
129
|
onClick: handleEdit,
|
|
104
130
|
},
|
|
105
131
|
{
|
|
106
132
|
key: 'delete',
|
|
107
|
-
${permDelete} getText: () => '删除',
|
|
133
|
+
${permDelete}${trackDelete} getText: () => '删除',
|
|
108
134
|
onClick: handleDelete,
|
|
109
135
|
},
|
|
110
136
|
];
|
|
@@ -116,7 +142,7 @@ export const getToolBarRender = ({
|
|
|
116
142
|
key: 'create',
|
|
117
143
|
text: '新增',
|
|
118
144
|
type: 'primary',
|
|
119
|
-
${permCreate} onClick: handleCreate,
|
|
145
|
+
${permCreate}${trackCreate} onClick: handleCreate,
|
|
120
146
|
},
|
|
121
147
|
];
|
|
122
148
|
`;
|
|
@@ -324,7 +350,7 @@ function emitFormItem(field) {
|
|
|
324
350
|
/>`;
|
|
325
351
|
}
|
|
326
352
|
|
|
327
|
-
function emitDrawer(names, types, fns, formFields) {
|
|
353
|
+
function emitDrawer(names, types, fns, formFields, tracking, trackingModule) {
|
|
328
354
|
const itemType = types.itemType || 'Record<string, unknown>';
|
|
329
355
|
const fields = formFields.length
|
|
330
356
|
? formFields
|
|
@@ -336,11 +362,18 @@ function emitDrawer(names, types, fns, formFields) {
|
|
|
336
362
|
const updateCall = fns.update
|
|
337
363
|
? ` await Service.${fns.update}(record.id, values);`
|
|
338
364
|
: ' // TODO: call update service';
|
|
365
|
+
const trackImport = tracking
|
|
366
|
+
? `import { getTrackData } from '${trackingModule}';\n`
|
|
367
|
+
: '';
|
|
368
|
+
const drawerTracks = tracking
|
|
369
|
+
? `\n cancelTrack={${emitTrackData('cancel', '取消', { key: 'editor', name: names.title })}}\n okTrack={${emitTrackData('confirm', '确定', { key: 'editor', name: names.title })}}`
|
|
370
|
+
: '';
|
|
339
371
|
return `import Service from '@/services';
|
|
340
372
|
import { ${components.join(', ')} } from '@ant-design/pro-components';
|
|
341
373
|
import { CustomDrawer, HocModal } from '@mingfuyun/star-allinone';
|
|
342
374
|
import { Form, message } from 'antd';
|
|
343
375
|
import { useEffect, useState } from 'react';
|
|
376
|
+
${trackImport}
|
|
344
377
|
|
|
345
378
|
type ${names.drawer}Args = {
|
|
346
379
|
record?: ${itemType};
|
|
@@ -397,7 +430,7 @@ ${createCall}
|
|
|
397
430
|
loading={loading}
|
|
398
431
|
open={visible}
|
|
399
432
|
title={editing ? '编辑${names.title}' : '新增${names.title}'}
|
|
400
|
-
width={480}
|
|
433
|
+
width={480}${drawerTracks}
|
|
401
434
|
onClose={handleCancel}
|
|
402
435
|
onConfirm={handleConfirm}
|
|
403
436
|
>
|
|
@@ -417,10 +450,17 @@ export default HocModal(${names.drawer});
|
|
|
417
450
|
`;
|
|
418
451
|
}
|
|
419
452
|
|
|
420
|
-
function emitConfirm(names) {
|
|
453
|
+
function emitConfirm(names, tracking, trackingModule) {
|
|
454
|
+
const trackImport = tracking
|
|
455
|
+
? `import { getTrackData } from '${trackingModule}';\n`
|
|
456
|
+
: '';
|
|
457
|
+
const modalTracks = tracking
|
|
458
|
+
? `\n cancelButtonProps={{\n 'data-track': ${emitTrackData('cancel', '取消', { key: 'confirm', name: '确认' })},\n }}\n okButtonProps={{\n 'data-track': ${emitTrackData('confirm', '确定', { key: 'confirm', name: '确认' })},\n }}`
|
|
459
|
+
: '';
|
|
421
460
|
return `import { BaseModal, HocModal } from '@mingfuyun/star-allinone';
|
|
422
461
|
import { Typography } from 'antd';
|
|
423
462
|
import { useState } from 'react';
|
|
463
|
+
${trackImport}
|
|
424
464
|
|
|
425
465
|
export type ${names.confirm}Args = {
|
|
426
466
|
title: string;
|
|
@@ -466,7 +506,7 @@ const ${names.confirm}: React.FC<Props> = ({
|
|
|
466
506
|
maskClosable={false}
|
|
467
507
|
title={title}
|
|
468
508
|
visible={visible}
|
|
469
|
-
width={480}
|
|
509
|
+
width={480}${modalTracks}
|
|
470
510
|
onCancel={handleCancel}
|
|
471
511
|
onOk={handleOk}
|
|
472
512
|
>
|
|
@@ -613,10 +653,16 @@ function generatePage(cwd, options) {
|
|
|
613
653
|
};
|
|
614
654
|
|
|
615
655
|
const queryNames = querySearchNames(operationByKey.list?.queryParams);
|
|
656
|
+
const tracking = !options.noTracking && hasTracking(project.root, project.config);
|
|
657
|
+
const trackingModule = trackingImport(project.config);
|
|
616
658
|
writeFile(files[1], emitLess(layout), project.dryRun);
|
|
617
|
-
writeFile(
|
|
618
|
-
|
|
619
|
-
|
|
659
|
+
writeFile(
|
|
660
|
+
files[2],
|
|
661
|
+
emitColumns(names, types.itemType, fields, permissions, queryNames, tracking, trackingModule),
|
|
662
|
+
project.dryRun,
|
|
663
|
+
);
|
|
664
|
+
writeFile(files[3], emitDrawer(names, types, fns, formFields, tracking, trackingModule), project.dryRun);
|
|
665
|
+
writeFile(files[4], emitConfirm(names, tracking, trackingModule), project.dryRun);
|
|
620
666
|
if (layout.hasContainerConfig) {
|
|
621
667
|
writeFile(files[0], emitContainerIndex(), project.dryRun);
|
|
622
668
|
writeFile(files[5], emitIndex(names, layout, types, fns, pagination, 'list'), project.dryRun);
|
|
@@ -631,4 +677,4 @@ function generatePage(cwd, options) {
|
|
|
631
677
|
return names;
|
|
632
678
|
}
|
|
633
679
|
|
|
634
|
-
module.exports = { generatePage, featureNames, patchContainerConfig };
|
|
680
|
+
module.exports = { generatePage, featureNames, patchContainerConfig, hasTracking };
|
package/skills/README.md
CHANGED
|
@@ -134,11 +134,11 @@ git commit -m "chore(skill): 更新公共 skill"
|
|
|
134
134
|
| 入口 | 规则位置 | 覆盖内容 |
|
|
135
135
|
| --- | --- | --- |
|
|
136
136
|
| `shared-api-to-service` | SKILL + `references/service-conventions.md`、`api-artifact-generation.md`、`mock.md` | 指定 operation、`MFRequest`、namespace 类型、snake_case、mock |
|
|
137
|
-
| `shared-design-to-page` | SKILL + `page-conventions.md`、`overlays.md`、`list-page-template.md` | 页面分层、标准列表 CLI
|
|
138
|
-
| `shared-review-and-submit` | SKILL + `impact-analysis.md`、`verify.md`、`ai-review.md`、`commit.md` | 影响分析 →
|
|
137
|
+
| `shared-design-to-page` | SKILL + `page-conventions.md`、`overlays.md`、`list-page-template.md`、`tracking.md` | 页面分层、标准列表 CLI、弹层合同、按钮埋点 |
|
|
138
|
+
| `shared-review-and-submit` | SKILL + `impact-analysis.md`、`verify.md`、`ai-review.md`、`commit.md` | 影响分析 → 验证(含埋点完整性)→ 确认后提交 |
|
|
139
139
|
| `shared-publish-test` | SKILL + `scripts/publish-current-branch.sh` | 云效测发;只读 `publishPipelineId` |
|
|
140
|
-
| `shared-tracking` | SKILL |
|
|
141
|
-
| (非入口)`shared-project-conventions` | `architecture.md`、`mfprotable.md`、`component-contract.md`、`review-checklist.md
|
|
140
|
+
| `shared-tracking` | SKILL | 埋点接入:能力包版本、配置文件、脚本、初始化、失败上报、权限按钮、操作列、抽屉弹层、表单按钮 |
|
|
141
|
+
| (非入口)`shared-project-conventions` | `architecture.md`、`mfprotable.md`、`component-contract.md`、`review-checklist.md`(含埋点审查)、`quality-checklist.md` | 架构、导入合同、质量清单 |
|
|
142
142
|
| (非入口)`shared-i-have-adhd` | `i-have-adhd.md` | 用户输出格式 |
|
|
143
143
|
|
|
144
144
|
以下内容**不**写进公共 skill 源码:
|
|
@@ -15,6 +15,7 @@ Before implementation, read:
|
|
|
15
15
|
2. [references/page-conventions.md](references/page-conventions.md)
|
|
16
16
|
3. [references/overlays.md](references/overlays.md) for any modal, drawer, or confirmation
|
|
17
17
|
4. `.agents/skills/shared-project-conventions/references/architecture.md`
|
|
18
|
+
5. [references/tracking.md](references/tracking.md) when `src/utils/tracking/index.ts` exists (or the project tracking path in conventions)
|
|
18
19
|
|
|
19
20
|
If `.agents/project/conventions.md` exists, use it only for extra paths.
|
|
20
21
|
|
|
@@ -51,6 +52,7 @@ Add `--permission-create`, `--permission-edit`, `--permission-delete` when codes
|
|
|
51
52
|
3. The CLI fills columns and drawer fields from the OpenAPI schema (required, enum → `ProFormSelect`, dates/numbers). Review labels and permission codes; do not recreate the file tree. See [references/list-page-template.md](references/list-page-template.md).
|
|
52
53
|
4. If `src/components/Page/Container/config.tsx` exists, `gen page` writes a Container `index.tsx`, puts the table in `components/List.tsx`, and registers a Tab with `loader: () => import(...)`. Do not invent a second page shell.
|
|
53
54
|
5. Do not overwrite existing page files. Tell the user the CLI refused, then edit in place.
|
|
55
|
+
6. **Tracking:** When the project has tracking configured, `gen page` auto-wires default button tracking. Review and extend per [references/tracking.md](references/tracking.md). Add tracking for any extra buttons the CLI did not generate. If tracking is not set up yet, tell the user to run `$shared-tracking` first; do not invent a second tracking helper.
|
|
54
56
|
|
|
55
57
|
## Design path
|
|
56
58
|
|
|
@@ -63,6 +65,7 @@ For non-standard layouts:
|
|
|
63
65
|
5. API-backed pages include types, `MFRequest` methods, aggregate exports, and page consumption in the same change. Use `.agents/skills/shared-api-to-service/SKILL.md` for missing services. Use `.agents/skills/shared-api-to-service/references/mock.md` for extra mock scenarios. Do not embed production fake data.
|
|
64
66
|
6. Compare desktop and narrow layouts against the design. Fix structure and spacing before decoration.
|
|
65
67
|
7. Run focused verification. Do not claim visual fidelity without inspecting the rendered page.
|
|
68
|
+
8. When tracking is enabled, apply [references/tracking.md](references/tracking.md) for every toolbar, action, drawer, confirm, and standalone permission button on the page.
|
|
66
69
|
|
|
67
70
|
## Hard rules
|
|
68
71
|
|
|
@@ -76,6 +79,7 @@ For non-standard layouts:
|
|
|
76
79
|
- Do not use `Modal.confirm` or feature-level Ant Design `Modal` / `Drawer` shells.
|
|
77
80
|
- Do not add a UI library, state library, or CSS-in-JS system without approval.
|
|
78
81
|
- Do not refactor unrelated code.
|
|
82
|
+
- When `src/utils/tracking/index.ts` exists, new or changed pages must wire `getTrackData` on every button covered by [references/tracking.md](references/tracking.md). Do not call `track()` in handlers.
|
|
79
83
|
|
|
80
84
|
## Verification
|
|
81
85
|
|
|
@@ -86,6 +90,8 @@ pnpm typecheck
|
|
|
86
90
|
|
|
87
91
|
Run `pnpm lint` for broad or shared changes. Run the project's documented build command when routes, entry, or multiple pages change.
|
|
88
92
|
|
|
93
|
+
When tracking is configured, scan changed page files: toolbar `track`, action `track`, drawer `cancelTrack` / `okTrack` or custom-footer `data-track`, confirm modal button props, and standalone permission buttons. Report any missing wiring before calling the page done.
|
|
94
|
+
|
|
89
95
|
## User-facing output
|
|
90
96
|
|
|
91
97
|
Read and apply `.agents/skills/shared-i-have-adhd/i-have-adhd.md` to every response this skill sends to the user.
|
|
@@ -27,6 +27,7 @@ When `src/components/Page/Container/config.tsx` exists, `index.tsx` is a Contain
|
|
|
27
27
|
- Export `columns`, `getActionColumn`, `getToolBarRender`.
|
|
28
28
|
- Columns come from the list item schema: types, enums, and the first string fields as search.
|
|
29
29
|
- Put permission strings on actions and toolbar items when the project uses them.
|
|
30
|
+
- When tracking is configured, add `track: getTrackData(...)` beside each toolbar and action item. See [tracking.md](tracking.md).
|
|
30
31
|
- Render empty cells as `'-'`.
|
|
31
32
|
|
|
32
33
|
## Drawer
|
|
@@ -36,12 +37,14 @@ When `src/components/Page/Container/config.tsx` exists, `index.tsx` is a Contain
|
|
|
36
37
|
- Fields come from the create/update body schema: required rules, `enum` → `ProFormSelect`, numbers → `ProFormDigit`, dates → date pickers.
|
|
37
38
|
- `validateFields()` in `try`. Create vs update from `record`.
|
|
38
39
|
- Reset fields when `visible` becomes true.
|
|
40
|
+
- When tracking is configured, set `cancelTrack` and `okTrack` on `CustomDrawer` (default footer). Do not add duplicate submit tracks on `ProForm`.
|
|
39
41
|
|
|
40
42
|
## Confirm modal
|
|
41
43
|
|
|
42
44
|
- `BaseModal` + `HocModal`.
|
|
43
45
|
- `confirmLoading` tied to the async `onConfirm`.
|
|
44
46
|
- Do not use `Modal.confirm`.
|
|
47
|
+
- When tracking is configured, set `cancelButtonProps` and `okButtonProps` with `'data-track'` from `getTrackData`. See [tracking.md](tracking.md).
|
|
45
48
|
|
|
46
49
|
## Container tabs
|
|
47
50
|
|
|
@@ -41,6 +41,8 @@ Do not duplicate open/visible, selected-record, and close state in the page when
|
|
|
41
41
|
|
|
42
42
|
Use `CustomDrawer` confirmation controls and disable the ProForm submitter. Reset or initialize fields whenever the overlay becomes visible.
|
|
43
43
|
|
|
44
|
+
When the project has tracking, wire `cancelTrack` / `okTrack` on the default drawer footer, or `data-track` on each button in a custom footer. For `BaseModal`, use `cancelButtonProps` / `okButtonProps`. Details: [tracking.md](tracking.md).
|
|
45
|
+
|
|
44
46
|
```tsx
|
|
45
47
|
const handleConfirm = async () => {
|
|
46
48
|
try {
|
|
@@ -62,6 +62,10 @@ Follow [overlays.md](overlays.md). Use `CustomDrawer`, `BaseModal`, and `HocModa
|
|
|
62
62
|
- Do not treat hidden buttons as authorization. Backend enforcement must remain.
|
|
63
63
|
- Add explicit routes in `config/route.ts` when the page needs navigation. Preserve `/403`, `/404`, and nested menu behavior.
|
|
64
64
|
|
|
65
|
+
## Tracking
|
|
66
|
+
|
|
67
|
+
When `src/utils/tracking/index.ts` exists, every new or changed page wires button tracking in the same PR. Follow [tracking.md](tracking.md) and `.agents/skills/shared-tracking/SKILL.md` for SDK setup. Use `getTrackData`; do not call `track()` in handlers.
|
|
68
|
+
|
|
65
69
|
## Async behavior
|
|
66
70
|
|
|
67
71
|
- Every `await` lives in `try-catch`, including handlers, loaders, and submissions.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Page tracking
|
|
2
|
+
|
|
3
|
+
Apply when the business project already has `src/utils/tracking/index.ts` (or the path documented in project conventions). Full SDK setup lives in `.agents/skills/shared-tracking/SKILL.md`. This file covers **page generation only**.
|
|
4
|
+
|
|
5
|
+
Import:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { getTrackData } from '@/utils/tracking';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Click reporting uses `data-track` JSON from `getTrackData`. Do not call `track()` in business handlers.
|
|
12
|
+
|
|
13
|
+
## Required on every new page
|
|
14
|
+
|
|
15
|
+
| Surface | Where | Pattern |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Toolbar create / batch actions | `const.tsx` → `getToolBarRender` | `track: getTrackData('<action>', '<文案>', { key: 'toolbar', name: '工具栏' })` |
|
|
18
|
+
| Row actions | `const.tsx` → `getActionColumn` | `track: getTrackData('<action>', '<文案>', { key: 'action', name: '操作' })` |
|
|
19
|
+
| Standalone permission buttons | page or `const.tsx` | `data-track={getTrackData(...)}` on the button |
|
|
20
|
+
| Drawer footer | `<Feature>Drawer.tsx` | `cancelTrack` / `okTrack` on `CustomDrawer` when using the default footer |
|
|
21
|
+
| Confirm dialog | `<Feature>ConfirmModal.tsx` | `cancelButtonProps` / `okButtonProps` with `'data-track'` on `BaseModal` |
|
|
22
|
+
| Inline form submit | `ProForm` with default submitter | `submitButtonProps` / `resetButtonProps` |
|
|
23
|
+
|
|
24
|
+
`MFProTable` query and reset are handled inside the table (`filter_query` / `查询`, `filter_reset` / `重置`). Do not duplicate them in page code unless the project documents otherwise.
|
|
25
|
+
|
|
26
|
+
## Drawer with `submitter={false}`
|
|
27
|
+
|
|
28
|
+
Submit lives on `CustomDrawer`. Do not add a second submit track on `ProForm`.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<CustomDrawer
|
|
32
|
+
cancelTrack={getTrackData('cancel', '取消', { key: 'editor', name: '<页面中文名>' })}
|
|
33
|
+
okTrack={getTrackData('confirm', '确定', { key: 'editor', name: '<页面中文名>' })}
|
|
34
|
+
onClose={handleCancel}
|
|
35
|
+
onConfirm={handleConfirm}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use the page menu title or feature name for `name`. Keep `key: 'editor'` for create/edit drawers.
|
|
40
|
+
|
|
41
|
+
## Confirm modal
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<BaseModal
|
|
45
|
+
cancelButtonProps={{
|
|
46
|
+
'data-track': getTrackData('cancel', '取消', { key: 'confirm', name: '确认' }),
|
|
47
|
+
}}
|
|
48
|
+
okButtonProps={{
|
|
49
|
+
'data-track': getTrackData('confirm', '确定', { key: 'confirm', name: '确认' }),
|
|
50
|
+
}}
|
|
51
|
+
onCancel={handleCancel}
|
|
52
|
+
onOk={handleOk}
|
|
53
|
+
/>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Custom footer
|
|
57
|
+
|
|
58
|
+
If `CustomDrawer` or `BaseModal` uses a custom `footer`, every business button in that footer needs its own `data-track`. Do not replace the default footer only to add tracking.
|
|
59
|
+
|
|
60
|
+
## Do not track
|
|
61
|
+
|
|
62
|
+
- Copy, column settings, table overflow 「更多」 ellipsis.
|
|
63
|
+
- Search-bar buttons other than query and reset, unless the user explicitly asked.
|
|
64
|
+
- Buttons hidden by permission (no render → no track).
|
|
65
|
+
|
|
66
|
+
## After `gen page`
|
|
67
|
+
|
|
68
|
+
When `src/utils/tracking/index.ts` exists, `gen page` already wires:
|
|
69
|
+
|
|
70
|
+
- `track` on toolbar create and action edit/delete in `const.tsx`
|
|
71
|
+
- `cancelTrack` / `okTrack` on `CustomDrawer`
|
|
72
|
+
- `cancelButtonProps` / `okButtonProps` on `BaseModal`
|
|
73
|
+
|
|
74
|
+
Review and adjust labels or module path (`trackingModule` in `.star-allinone.json` when non-default). Add tracking for any extra buttons the CLI did not generate. Pass `--no-tracking` to skip auto wiring.
|
|
75
|
+
|
|
76
|
+
For pages built without `gen page`, follow the table above manually.
|
|
77
|
+
|
|
78
|
+
## Verification
|
|
79
|
+
|
|
80
|
+
Static scan changed page files for:
|
|
81
|
+
|
|
82
|
+
- Every rendered toolbar / action / drawer / confirm button listed above has `track`, `cancelTrack`, `okTrack`, or `data-track`.
|
|
83
|
+
- No `data-track` on excluded controls.
|
|
@@ -26,6 +26,19 @@ This checklist is complete for shared review and commit. If `.agents/project/rev
|
|
|
26
26
|
- Check loading, empty, error, disabled, long content, and narrow-screen layout.
|
|
27
27
|
- Table empty values render `'-'` unless the design requires another value.
|
|
28
28
|
|
|
29
|
+
## Tracking
|
|
30
|
+
|
|
31
|
+
Apply when the project has `src/utils/tracking/index.ts` (or the path in project conventions). Read `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md`.
|
|
32
|
+
|
|
33
|
+
- Toolbar and batch actions in `getToolBarRender` need `track: getTrackData(...)`.
|
|
34
|
+
- Action column entries need `track` beside `permission` when present.
|
|
35
|
+
- Standalone permission buttons need `data-track={getTrackData(...)}`.
|
|
36
|
+
- `CustomDrawer` with the default footer needs `cancelTrack` and `okTrack`; custom footers need `data-track` on each business button.
|
|
37
|
+
- `BaseModal` confirm dialogs need `cancelButtonProps` / `okButtonProps` with `'data-track'`.
|
|
38
|
+
- `ProForm` with a visible default submitter needs submit/reset button props; when `submitter={false}`, tracking belongs on the overlay footer only.
|
|
39
|
+
- Do not require tracking on copy, column settings, table overflow ellipsis, or buttons hidden by permission.
|
|
40
|
+
- Missing in-scope button tracking on a changed page is **P1**.
|
|
41
|
+
|
|
29
42
|
## Shared components and regression
|
|
30
43
|
|
|
31
44
|
- Changes to `MFProTable`, permission components, the request wrapper, or shared hooks must list direct callers.
|
|
@@ -30,8 +30,9 @@ Follow [references/impact-analysis.md](references/impact-analysis.md). Output:
|
|
|
30
30
|
Follow [references/verify.md](references/verify.md). Output:
|
|
31
31
|
|
|
32
32
|
- P0/P1/P2 blockers
|
|
33
|
-
- Completeness of route, permission, API, types, mock, and
|
|
33
|
+
- Completeness of route, permission, API, types, mock, page states, and button tracking when the project has tracking configured
|
|
34
34
|
- Async, loading, overlay, and list-reload behavior
|
|
35
|
+
- Missing `track` / `data-track` / `cancelTrack` / `okTrack` on in-scope buttons per `shared-tracking` and `shared-design-to-page/references/tracking.md` (P1 when tracking is enabled)
|
|
35
36
|
- Prettier, TypeScript, lint, and build results
|
|
36
37
|
- Uncovered risks
|
|
37
38
|
|
|
@@ -6,6 +6,7 @@ Review the current diff plus relevant callers and types. Before reviewing, read:
|
|
|
6
6
|
|
|
7
7
|
1. `.agents/skills/shared-project-conventions/references/review-checklist.md`
|
|
8
8
|
2. `.agents/skills/shared-project-conventions/references/quality-checklist.md`
|
|
9
|
+
3. `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md` when the project has tracking configured
|
|
9
10
|
|
|
10
11
|
If `.agents/project/review-rules.md` exists, apply extra domain checks only; do not weaken shared hard rules.
|
|
11
12
|
|
|
@@ -14,14 +15,15 @@ If `.agents/project/review-rules.md` exists, apply extra domain checks only; do
|
|
|
14
15
|
1. React Hooks: stale closures, incomplete dependencies, request races, updates after unmount, unnecessary rerenders.
|
|
15
16
|
2. API contracts: method/path/params, response unwrapping, pagination, nullability, enum drift, error handling, DTO mismatch.
|
|
16
17
|
3. Permissions: route access, button visibility, mutation authorization, client-only enforcement.
|
|
17
|
-
4.
|
|
18
|
-
5.
|
|
18
|
+
4. **Tracking** (when `src/utils/tracking/index.ts` or project equivalent exists): scan changed pages for missing `track` / `cancelTrack` / `okTrack` / `data-track` on in-scope buttons—toolbar, action column, permission buttons, drawer and confirm footers, inline form submitters. Flag missing wiring as **P1**. Do not require tracking on copy, column settings, table overflow ellipsis, or permission-hidden buttons. Do not flag handlers that call `track()` when `data-track` is the project standard.
|
|
19
|
+
5. Forms/tables: validation, reset, duplicate submit, refresh after mutation, column-state, long text, empty/error.
|
|
20
|
+
6. Performance (hard checks):
|
|
19
21
|
- New or changed files must not statically `import 'xlsx'`, `@uiw/react-codemirror`, `@codemirror/*`, `echarts`, `@ant-design/charts`, or `react-json-view` at module top level. Those must be `import()`.
|
|
20
22
|
- Do not add heavy modules to `src/app.ts`, `src/global.tsx`, or layout bootstrap.
|
|
21
23
|
- Flag generated list pages that pull Excel/editor/chart code into the route entry instead of a feature-level dynamic import.
|
|
22
24
|
- Also check duplicate libraries, large lists without virtualization, unstable columns/handlers, and avoidable requests.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
7. Security/privacy: tokens, user data, URLs, unsafe HTML, sensitive logs, environment config.
|
|
26
|
+
8. Tests and accessibility: critical paths, failure states, keyboard labels, disabled/loading semantics.
|
|
25
27
|
|
|
26
28
|
## Output
|
|
27
29
|
|
|
@@ -6,6 +6,7 @@ Read the current diff, related callers, and:
|
|
|
6
6
|
|
|
7
7
|
1. `.agents/skills/shared-project-conventions/references/review-checklist.md`
|
|
8
8
|
2. `.agents/skills/shared-project-conventions/references/architecture.md`
|
|
9
|
+
3. `.agents/skills/shared-tracking/SKILL.md` when the project has `src/utils/tracking/index.ts` (or the tracking path in project conventions)
|
|
9
10
|
|
|
10
11
|
Do not auto-fix. If `.agents/project/review-rules.md` exists, apply extra domain checks only.
|
|
11
12
|
|
|
@@ -18,6 +19,7 @@ Do not auto-fix. If `.agents/project/review-rules.md` exists, apply extra domain
|
|
|
18
19
|
5. Empty table values, duplicate-submit guards, permission wrappers, and narrow-screen overflow.
|
|
19
20
|
6. Heavy deps (`xlsx`, editors, charts) are `import()`; nothing new lands in `src/app.ts`.
|
|
20
21
|
7. No `MFTablePro` / table-from-package imports; overlays come from `@mingfuyun/star-allinone`.
|
|
22
|
+
8. **Tracking** (when tracking is configured): every in-scope button has `track`, `cancelTrack`, `okTrack`, or `data-track` per `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md`. Check toolbar items, action column entries, standalone permission buttons, drawer default or custom footers, confirm modals, and inline `ProForm` submitters. Missing wiring is **P1** when the button is user-visible and in scope. Excluded controls (copy, column settings, table overflow ellipsis, non-default search buttons) must not be flagged. Permission-hidden buttons may omit tracking.
|
|
21
23
|
|
|
22
24
|
## Commands
|
|
23
25
|
|
|
@@ -36,7 +38,7 @@ Run the project's build script when routes, entry, or shared runtime change.
|
|
|
36
38
|
## Output
|
|
37
39
|
|
|
38
40
|
1. Blocking issues P0–P2, with file, line, impact, and fix direction.
|
|
39
|
-
2. Completeness: route, permission, API, types, mock, page states.
|
|
41
|
+
2. Completeness: route, permission, API, types, mock, page states, and tracking on in-scope buttons when tracking is configured.
|
|
40
42
|
3. Command results, distinguishing new, existing, and environment failures.
|
|
41
43
|
4. Regression list: affected pages, suggested manual paths, uncovered risks.
|
|
42
44
|
|
|
@@ -101,12 +101,115 @@ Umi:
|
|
|
101
101
|
|
|
102
102
|
### 按钮
|
|
103
103
|
|
|
104
|
-
`getTrackData(action, name, { key, name })` 生成 `data-track` JSON。`id` 用下划线,展示名用 `-`
|
|
104
|
+
`getTrackData(action, name, { key, name })` 生成 `data-track` JSON。`id` 用下划线,展示名用 `-` 连接。点击由 SDK 监听 `data-track`,业务代码不要再调 `track`。
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
权限按钮、操作列、抽屉/弹层底部、表单提交都要上报。复制、列设置、表格「更多」省略号不上报。搜索栏里除查询和重置以外的按钮,除非用户点名,否则不加。
|
|
107
|
+
|
|
108
|
+
#### 权限按钮
|
|
109
|
+
|
|
110
|
+
`withAuth` 会把除 `permission`、`fallback` 以外的 props 传给原按钮。无权限时组件不渲染,不会上报。
|
|
111
|
+
|
|
112
|
+
工具栏、批量底部、搜索附加按钮已经走 `TableSearchType.track`,`MFProTable` 把它写成 `data-track`。在 `const.tsx` 里和 `permission` 一起写:
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
{
|
|
116
|
+
key: 'create',
|
|
117
|
+
text: '新增',
|
|
118
|
+
type: 'primary',
|
|
119
|
+
permission: FULL_MENU.example.create,
|
|
120
|
+
track: getTrackData('create', '新增', { key: 'toolbar', name: '工具栏' }),
|
|
121
|
+
onClick: handleCreate,
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
页面上单独的 `withAuth(Button)` 直接写 `data-track`,不要为了埋点再包一层:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<AccessButton
|
|
129
|
+
permission={FULL_MENU.example.create}
|
|
130
|
+
type="primary"
|
|
131
|
+
data-track={getTrackData('create', '新增', { key: 'toolbar', name: '工具栏' })}
|
|
132
|
+
onClick={handleCreate}
|
|
133
|
+
>
|
|
134
|
+
新增
|
|
135
|
+
</AccessButton>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### CustomDrawer、HocModal
|
|
139
|
+
|
|
140
|
+
`HocModal` 只控制显隐,不渲染按钮。埋点写在它包住的 `CustomDrawer` 或 `BaseModal` 上。
|
|
141
|
+
|
|
142
|
+
`CustomDrawer` 默认底部用 `cancelTrack` 和 `okTrack`。不要为了埋点整段替换 `footer`。
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
<CustomDrawer
|
|
146
|
+
cancelTrack={getTrackData('cancel', '取消', { key: 'editor', name: '用户' })}
|
|
147
|
+
okTrack={getTrackData('confirm', '确定', { key: 'editor', name: '用户' })}
|
|
148
|
+
onClose={handleCancel}
|
|
149
|
+
onConfirm={handleConfirm}
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
自定义 `footer` 会换掉默认底部。每个业务按钮自己带 `data-track`,包括预览、上一步、取消、确定。
|
|
154
|
+
|
|
155
|
+
`BaseModal` 用 antd 的按钮 props。自定义 `footer` 时同样把 `data-track` 写在自己的按钮上。
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
<BaseModal
|
|
159
|
+
cancelButtonProps={{
|
|
160
|
+
'data-track': getTrackData('cancel', '取消', { key: 'confirm', name: '确认' }),
|
|
161
|
+
}}
|
|
162
|
+
okButtonProps={{
|
|
163
|
+
'data-track': getTrackData('confirm', '确定', { key: 'confirm', name: '确认' }),
|
|
164
|
+
}}
|
|
165
|
+
onCancel={handleCancel}
|
|
166
|
+
onOk={handleOk}
|
|
167
|
+
/>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### MFProTable 操作列
|
|
171
|
+
|
|
172
|
+
`actionColumn` 的配置在页面 `const.tsx`。给 `ActionItem` 增加 `track?: string`,和 `permission` 放在一起。模块固定 `{ key: 'action', name: '操作' }`,`action` 用该项的 `key`,`name` 用按钮文案。
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
{
|
|
176
|
+
key: 'allocate',
|
|
177
|
+
permission: FULL_MENU.example.allocate,
|
|
178
|
+
track: getTrackData('allocate', '分配', { key: 'action', name: '操作' }),
|
|
179
|
+
getText: () => '分配',
|
|
180
|
+
onClick: handleAllocate,
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
业务仓的 `TableActions` 要把 `track` 写到可点击节点上:
|
|
185
|
+
|
|
186
|
+
- 行内 `<a>` 加 `data-track={action.track}`。
|
|
187
|
+
- 超出 `maxCount` 收进下拉时,菜单项 `label` 用 `<span data-track={action.track}>`。不要给「更多」省略号按钮加埋点。
|
|
188
|
+
|
|
189
|
+
`MFProTable` 查询按钮用 `filter_query` / `查询`,重置按钮用 `filter_reset` / `重置`。ProTable 重置按钮的 key 是 `rest`。
|
|
190
|
+
|
|
191
|
+
#### ProForm、Form
|
|
192
|
+
|
|
193
|
+
抽屉里的 `ProForm` 若 `submitter={false}`,提交按钮在抽屉或弹层底部,按上一节上报,不要在表单里再加一套。
|
|
194
|
+
|
|
195
|
+
`ProForm` 使用默认提交栏时,写在 `submitter` 上:
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
<ProForm
|
|
199
|
+
submitter={{
|
|
200
|
+
submitButtonProps: {
|
|
201
|
+
'data-track': getTrackData('submit', '提交', { key: 'form', name: '表单' }),
|
|
202
|
+
},
|
|
203
|
+
resetButtonProps: {
|
|
204
|
+
'data-track': getTrackData('reset', '重置', { key: 'form', name: '表单' }),
|
|
205
|
+
},
|
|
206
|
+
}}
|
|
207
|
+
/>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
`submitter.render` 换掉默认按钮时,返回的每个提交、重置按钮自己带 `data-track`。
|
|
211
|
+
|
|
212
|
+
antd `Form` 的提交、重置按钮同样写 `data-track`。只上报会触发提交或清空表单的按钮,不上报字段里的辅助按钮。
|
|
110
213
|
|
|
111
214
|
## 不要做的事
|
|
112
215
|
|
|
@@ -123,6 +226,6 @@ Umi:
|
|
|
123
226
|
1. 页面请求了 OSS 上的脚本,并且出现 `window.TrackingSDK`。
|
|
124
227
|
2. 进入业务页、初始状态完成后存在 `window.__tracker`。`/` 上可以还没有。
|
|
125
228
|
3. 一次失败请求发出事件名 `api_request`。
|
|
126
|
-
4.
|
|
229
|
+
4. 查询、重置、权限按钮、操作列、抽屉或弹层底部、表单提交按钮带 `data-track`。无权限而不渲染的按钮可以没有。
|
|
127
230
|
|
|
128
231
|
`appId` 与平台不一致时,只改 `src/utils/tracking/index.ts`。
|