@brushes/component-core 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -0
- package/package.json +3 -2
- package/src/basic-component/container/index.tsx +0 -229
- package/src/basic-component/default/index.tsx +0 -55
- package/src/basic-component/empty/index.tsx +0 -24
- package/src/basic-component/index.tsx +0 -4
- package/src/basic-component/resizer/index.tsx +0 -270
- package/src/basic-component/resizer/numToMeasurement.ts +0 -26
- package/src/components/code.tsx +0 -60
- package/src/components/image.tsx +0 -78
- package/src/components/index.ts +0 -2
- package/src/context/index.tsx +0 -10
- package/src/index.ts +0 -7
- package/src/setting/basic.tsx +0 -91
- package/src/setting/index.ts +0 -1
- package/src/setting/title.tsx +0 -14
- package/src/store/commonModule.tsx +0 -37
- package/src/store/commonStore.tsx +0 -103
- package/src/store/index.tsx +0 -2
- package/src/store/rootModule.tsx +0 -24
- package/src/store/rootStore.tsx +0 -56
- package/src/store/storeDataConfig.tsx +0 -50
- package/src/tool/combine.ts +0 -11
- package/src/tool/fullpath.ts +0 -13
- package/src/tool/index.tsx +0 -2
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{useState as o,useMemo as n,useEffect as i,createContext as s,useRef as c,useContext as a}from"react";import{Form as d,Button as l,Spin as u,Watermark as h,Typography as g}from"antd";import{useMountedRef as p,dynamicFormFields as b}from"@brushes/form";import{get as m}from"@brushes/request";import{createStyles as f}from"antd-style";export*from"antd-style";import{QjIcon as y}from"@brushes/share-resource";import{useEditor as x,useNode as v}from"@craftjs/core";export*from"@craftjs/core";import{createStore as w,useStore as O}from"zustand";import{persist as j,createJSONStorage as C}from"zustand/middleware";import{useSearchParams as S}from"react-router-dom";import{get as _,isUndefined as P,isEmpty as $}from"lodash";function k(e){e.forEach(e=>{try{const{Component:t,setting:r}=e;t.craft=r,t.craft.displayName=e.name}catch(t){console.error(t,e)}})}const I=process.env.REACT_APP_BASE_URL,M=process.env.REACT_IMG_PATH||"",A=(e="")=>{let t=e;return e?e.startsWith("http")?e:(e.startsWith(M)||e.startsWith(M.slice(1))||(t=M+e),I+t):""};function T(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}"function"==typeof SuppressedError&&SuppressedError;const V=({api:t="/web/ml/muser/sendPhone.json",codeKey:r,height:s=36})=>{const c=d.useFormInstance(),a=c.getFieldValue("verCode"),[u,h]=o(0),[g,b]=o(!1),f=p(),y=n(()=>u>0||!a,[u,a]);i(()=>{const e=setTimeout(function(){0!==u?f.current&&h(e=>e-1):clearTimeout(e)},1e3);return()=>clearTimeout(e)},[u,f]);return e(l,{loading:g,size:"small",type:"link",disabled:y,style:{cursor:"pointer",height:s,width:90},onClick:()=>{b(!0);const{getFieldsValue:e}=c,o=e(),{loginName:n,userPhone:i,userinfoConPhone:s,verCode:a}=o,d=T(o,["loginName","userPhone","userinfoConPhone","verCode"]);let l={userPhone:n||i||s,code:a};r&&(l={userPhone:d[r],code:a}),m(t,l).then(()=>{h(60)}).catch(e=>{}).finally(()=>{b(!1)})},children:0===u?"获取验证码":`倒计时${u}秒`})},E=f(({token:e,css:t},{height:r})=>({wrap:t`
|
|
2
|
+
input[name='verCode'] {
|
|
3
|
+
height: ${r}px;
|
|
4
|
+
}
|
|
5
|
+
`})),N=({api:t="/web/ml/mlogin/getVerCode.img",codeKey:r,height:n=40})=>{const{styles:s}=E({height:n}),c=d.useFormInstance(),a=c.getFieldValue("isDisabled"),[l,h]=o(!1),[g,p]=o("");i(()=>{""===a&&m()},[a]);const m=()=>{h(!0);const{getFieldsValue:e}=c,o=e(),{loginName:n,userPhone:i,userinfoConPhone:s}=o,a=T(o,["loginName","userPhone","userinfoConPhone"]);let d=n||i||s;r&&(d=a[r]),fetch(`${t}?userPhone=${d}`).then(e=>e).then(e=>e.arrayBuffer()).then(e=>{const t="data:image/png;base64,"+window.btoa(String.fromCharCode(...new Uint8Array(e)));p(t)}).catch(e=>{}).finally(()=>{h(!1)})};return e("div",{className:s.wrap,children:b([{name:"verCode",type:"text",label:"",style:{width:"100%"},rules:[{required:!0,message:"请输入"}],extraProps:{autoComplete:"off",placeholder:"请输入",addonAfter:e(u,{spinning:l,children:g?e("img",{src:g,onClick:m,style:{width:90,height:n-2}}):e("div",{style:{width:90,height:n-2}})}),style:{height:n}}}],c)})},R=f(({token:e,css:t})=>({defaultWrap:t`
|
|
6
|
+
border: dashed 1px rgba(0, 0, 0, 0.15);
|
|
7
|
+
width: 100%;
|
|
8
|
+
text-align: center;
|
|
9
|
+
border-radius: ${e.borderRadius}px;
|
|
10
|
+
height: 100%;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
color: ${e.colorTextLabel};
|
|
16
|
+
p {
|
|
17
|
+
margin-top: 10px;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
}
|
|
20
|
+
}`})),z=({text:r="内容放置区域",root:o})=>{const{styles:n}=R();return t("div",{className:n.defaultWrap,style:{minHeight:o?"calc(100vh - 110px)":"auto"},children:[e(y,{style:{fontSize:50,fontWeight:500,display:"block",color:"#bbb"},name:"icon-computer"}),e("p",{children:r})]})},L=({content:t="/",color:r="blue"})=>e(h,{gap:[1,1],font:{color:r},rotate:0,height:10,width:10,content:t,children:e("div",{style:{height:10}})}),W={contractSettlOpno:0,upmMap:{},rebMoney:0,goodsCamount:0,shoppingCountPrice:0,totalDiscountPrice:0,accountsSumPrice:0,discount:0,freight:0,comDisMoney:0,copyComDisMoney:0,shoppingType:"",promotionCode:"",promotionCodes:""},D=s(null);function F(t){var{children:r}=t,o=T(t,["children"]);const n=c();return n.current||(n.current=(e=>{const t={moduleStore:{_ocDiscount:[],_ocPoints:[],_couponList:[],_selectCoupon:[],_shoppingList:[],_contractGoodsList:[],_orderDomainStr:[],_ocContractSettlList:[],_orderAddressInfo:{freight:0,goodsReceiptMem:"",goodsReceiptPhone:"",goodsReceiptArrdess:"",areaCode:""},defaultValue:void 0,_skuInfo:{},params:{},breadList:[],open:!1}};return w()(r=>Object.assign(Object.assign(Object.assign({},t),e),{setModuleStore:e=>r(t=>({moduleStore:Object.assign(t.moduleStore,e)}))}))})(o)),e(D.Provider,{value:n.current,children:r})}function B(e){const t=a(D);if(!t)throw new Error("Missing ModuleContext.Provider in the tree");return O(t,e)}const H=s(null);function K(t){var{children:r}=t,o=T(t,["children"]);const n=c();return n.current||(n.current=(e=>{const t={rootStore:{_userInfo:{},_historyList:[],_themeColor:{colorPrimary:"#1677ff",colorBgTextHover:"#e6r4ff"},_orderCount:{},_cart:0,_webStore:{},_menuChildren:[]}};return w()(j(r=>Object.assign(Object.assign(Object.assign({},t),e),{setModuleRootStore:e=>r(t=>({rootStore:Object.assign(t.rootStore,e)}))}),{name:"root-storage",storage:C(()=>localStorage)}))})(o)),e(H.Provider,{value:n.current,children:r})}function q(e){const t=a(H);if(!t)throw new Error("Missing ModuleContext.Provider in the tree");return O(t,e)}const G=f(({token:e,css:t})=>({category:t`
|
|
21
|
+
&:hover {
|
|
22
|
+
box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
|
|
23
|
+
}
|
|
24
|
+
`,width_100:t`
|
|
25
|
+
width: 100%;
|
|
26
|
+
`})),U=({children:t,enabled:o,root:n,text:i})=>e(r,{children:t||(o?e(z,{text:i,root:n}):"")}),J=({moduleShowValue:t,rootKey:r="",isRevert:o=!1,children:i,routerIsShowValue:s,routerIsShow:c,moduleIsShow:a="",padding:d,storeKey:l="",margin:u})=>{const h=B(e=>e.moduleStore[l]),g=q(e=>e.rootStore[r]),{enabled:p}=x(e=>({enabled:e.options.enabled})),{connectors:{connect:b,drag:m}}=v();let[f]=S();const y=n(()=>{if(l&&h)return"number"==typeof h[a]?_(h,a)+"":_(h,a)},[h,l,a]),w=n(()=>{if(r&&g)return"number"==typeof g[a]?_(g,a)+"":_(g,a)},[g,r,a]),O=n(()=>{const e=c&&f.has(c)&&!s||c&&f.has(c)&&s&&s.split(",").includes(f.get(c)||"")||l&&!t&&!a&&!P(h)&&!$(h)||a&&l&&!t&&!P(y)&&!$(y)||t&&l&&a&&t.split(",").includes(y+"")||r&&!t&&!a&&!P(g)&&!$(g)||a&&r&&!t&&!P(w)&&!$(w)||t&&r&&a&&t.split(",").includes(w+"");return o?!e:e},[c,s,o,h,l,t,a,y,r,g,w]);if(console.log("103===>",h,!$(h),l&&!t&&!a&&!P(h)&&!$(h)),O||p)return e("div",{style:Object.assign(Object.assign({},u),d),ref:e=>b(m(e)),children:e(U,{enabled:p,children:i})})},Q=t=>{var{width:r,text:o,children:i,background:s,margin:c={},positionValue:a={},padding:d={},backgroundImage:l,position:u,$$_actions:h,$_actions:g,borderColor:p}=t,b=T(t,["width","text","children","background","margin","positionValue","padding","backgroundImage","position","$$_actions","$_actions","borderColor"]);const{styles:m}=G(),{enabled:f}=x(e=>({enabled:e.options.enabled})),y=n(()=>"fixed"===u&&0===a.right&&f?Object.assign(Object.assign({},a),{right:412}):"fixed"===u&&0===a.left&&f?Object.assign(Object.assign({},a),{left:172}):a,[a,u]),{connectors:{connect:w,drag:O}}=v();return e("div",{className:f?m.category:"",ref:e=>w(O(e)),style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),{display:"flex",boxSizing:"border-box",position:u,border:`solid 1px ${p}`}),d),b),y),{background:l?`url(${A(l)}) repeat-x center 0`:s,width:(r+"").includes("%")?r:`${r}px`}),children:e(U,{text:o,enabled:f,children:i})})},X=t=>{var{width:r,api:o,params:n,children:i,background:s,padding:c={},backgroundImage:a}=t,d=T(t,["width","api","params","children","background","padding","backgroundImage"]);const{enabled:l}=x(e=>({enabled:e.options.enabled})),{connectors:{connect:u,drag:h}}=v(),{styles:g}=G();return e("div",{ref:e=>u(h(e)),className:l?g.category:"",style:Object.assign(Object.assign(Object.assign({margin:"0 auto",display:"flex",boxSizing:"border-box"},c),d),{background:a?`url(${A(a)}) repeat-x center 0`:s,width:(r+"").includes("%")?r:`${r}px`}),children:e(U,{enabled:l,children:i})})},Y=t=>e(F,{children:e(X,Object.assign({},t))}),Z=t=>{var{width:r,background:o,children:n,backgroundImage:i,height:s,$$_style:c="",$_style:a=""}=t,d=T(t,["width","background","children","backgroundImage","height","$$_style","$_style"]);const{connectors:{connect:l,drag:u}}=v(),{enabled:h}=x(e=>({enabled:e.options.enabled}));return e("div",Object.assign({},d,{ref:e=>l(u(e)),style:{width:r,paddingBottom:5,background:i?`url(${A(i)}) repeat-x center 0`:o,minHeight:`calc(${s}vh - 110px)`},children:e(U,{root:!0,enabled:h,children:n})}))},ee=({children:t="当前为插槽容器,可以自定义组件代码。",borderColor:r="rgba(0, 0, 0, 0.1)"})=>e("div",{style:{height:"100%",width:"100%",borderColor:r,borderWidth:1,borderStyle:"dashed",fontSize:12,textAlign:"center",fontWeight:"normal",background:"rgba(255,255,255, 0.2)"},children:e(g.Text,{type:"secondary",children:t})}),te=s({});function re({value:t,children:r}){return e(te.Provider,{value:Object.assign({},t),children:r})}function oe(){return a(te)}export{re as ApplicationContext,V as CodeComponent,Q as Container,Z as ContainerWrap,L as DefaultEditorBg,z as DefaultJsx,N as ImageCodeComponent,U as Inner,J as IsShowContainer,F as ModuleProvider,K as ModuleRootProvider,Y as OutContainer,X as OutContainerComponent,ee as SlotEmpty,k as combine,A as fullpath,W as initialValueOrder,oe as useApplicationContext,B as useModuleContext,q as useModuleRootContext};
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brushes/component-core",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"main": "
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
|
+
"build": "./scripts/build.sh"
|
|
7
8
|
},
|
|
8
9
|
"devDependencies": {
|
|
9
10
|
"@codemirror/lang-css": "^6.3.1",
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { ReactNode, useMemo } from 'react';
|
|
2
|
-
import { DefaultJsx } from '../default';
|
|
3
|
-
import { fullpath } from '../../tool';
|
|
4
|
-
import { createStyles } from 'antd-style';
|
|
5
|
-
import { useEditor, useNode } from '@craftjs/core';
|
|
6
|
-
import { ModuleProvider, useModuleContext, useModuleRootContext } from '../../store';
|
|
7
|
-
import { useSearchParams } from 'react-router-dom';
|
|
8
|
-
import { isEmpty, isUndefined, get } from 'lodash';
|
|
9
|
-
|
|
10
|
-
const useStyles = createStyles(({ token, css }) => {
|
|
11
|
-
return {
|
|
12
|
-
category: css`
|
|
13
|
-
&:hover {
|
|
14
|
-
box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
|
|
15
|
-
}
|
|
16
|
-
`,
|
|
17
|
-
width_100: css`
|
|
18
|
-
width: 100%;
|
|
19
|
-
`
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
export const Inner = ({ children, enabled, root, text }: { text?: string; root?: boolean; enabled: boolean; children: ReactNode }) => {
|
|
23
|
-
return <>{children ? children : enabled ? <DefaultJsx text={text} root={root} /> : ''}</>;
|
|
24
|
-
};
|
|
25
|
-
export const IsShowContainer = ({
|
|
26
|
-
moduleShowValue,
|
|
27
|
-
rootKey = '',
|
|
28
|
-
isRevert = false,
|
|
29
|
-
children,
|
|
30
|
-
routerIsShowValue,
|
|
31
|
-
routerIsShow,
|
|
32
|
-
moduleIsShow = '',
|
|
33
|
-
padding,
|
|
34
|
-
storeKey = '',
|
|
35
|
-
margin
|
|
36
|
-
}: {
|
|
37
|
-
isRevert?: boolean;
|
|
38
|
-
routerIsShowValue?: string;
|
|
39
|
-
rootKey?: string;
|
|
40
|
-
moduleShowValue?: string;
|
|
41
|
-
moduleIsShow?: string;
|
|
42
|
-
routerIsShow?: string;
|
|
43
|
-
storeKey: string;
|
|
44
|
-
padding: object;
|
|
45
|
-
margin: object;
|
|
46
|
-
children?: ReactNode;
|
|
47
|
-
}) => {
|
|
48
|
-
const store = useModuleContext((s) => s.moduleStore[storeKey]);
|
|
49
|
-
const rootStore = useModuleRootContext((s) => s.rootStore[rootKey]);
|
|
50
|
-
|
|
51
|
-
const { enabled } = useEditor((state) => ({
|
|
52
|
-
enabled: state.options.enabled
|
|
53
|
-
}));
|
|
54
|
-
|
|
55
|
-
const {
|
|
56
|
-
connectors: { connect, drag }
|
|
57
|
-
} = useNode();
|
|
58
|
-
|
|
59
|
-
let [searchParams] = useSearchParams();
|
|
60
|
-
|
|
61
|
-
const nValue = useMemo(() => {
|
|
62
|
-
if (storeKey && store) {
|
|
63
|
-
if (typeof store[moduleIsShow] === 'number') {
|
|
64
|
-
return get(store, moduleIsShow) + '';
|
|
65
|
-
}
|
|
66
|
-
return get(store, moduleIsShow);
|
|
67
|
-
}
|
|
68
|
-
}, [store, storeKey, moduleIsShow]);
|
|
69
|
-
|
|
70
|
-
const rnValue = useMemo(() => {
|
|
71
|
-
if (rootKey && rootStore) {
|
|
72
|
-
if (typeof rootStore[moduleIsShow] === 'number') {
|
|
73
|
-
return get(rootStore, moduleIsShow) + '';
|
|
74
|
-
}
|
|
75
|
-
return get(rootStore, moduleIsShow);
|
|
76
|
-
}
|
|
77
|
-
}, [rootStore, rootKey, moduleIsShow]);
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 1: 路由是否包含
|
|
81
|
-
* 2: 路由是否包含 值是否匹配
|
|
82
|
-
* 3: store显示条件Key和value都为空, store是否为空
|
|
83
|
-
* 4: store显示条件Key不为空 store显示条件value为空, store里面的key的值是否空
|
|
84
|
-
* 5: store显示条件Key和store显示条件value都不为空, store里面的key的值和 显示条件value是否匹配
|
|
85
|
-
* 6: 全局Store显示条件Key和value都为空, 全局Store是否为空
|
|
86
|
-
* 7: 全局Store显示条件Key和显示条件value都不为空, 全局Store里面的key的值和 显示条件value是否匹配
|
|
87
|
-
* 8: 全局store显示条件Key不为空 store显示条件value为空, 全局store里面的key的值是否空
|
|
88
|
-
*/
|
|
89
|
-
const conditionType = useMemo(() => {
|
|
90
|
-
const condition =
|
|
91
|
-
(routerIsShow && searchParams.has(routerIsShow) && !routerIsShowValue) || // 1
|
|
92
|
-
(routerIsShow && searchParams.has(routerIsShow) && routerIsShowValue && routerIsShowValue.split(',').includes(searchParams.get(routerIsShow) || '')) || // 2
|
|
93
|
-
(storeKey && !moduleShowValue && !moduleIsShow && !isUndefined(store) && !isEmpty(store)) || // 3
|
|
94
|
-
(moduleIsShow && storeKey && !moduleShowValue && !isUndefined(nValue) && !isEmpty(nValue)) || // 4
|
|
95
|
-
(moduleShowValue && storeKey && moduleIsShow && moduleShowValue.split(',').includes(nValue + '')) || // 5
|
|
96
|
-
(rootKey && !moduleShowValue && !moduleIsShow && !isUndefined(rootStore) && !isEmpty(rootStore)) || // 6
|
|
97
|
-
(moduleIsShow && rootKey && !moduleShowValue && !isUndefined(rnValue) && !isEmpty(rnValue)) || // 7
|
|
98
|
-
(moduleShowValue && rootKey && moduleIsShow && moduleShowValue.split(',').includes(rnValue + '')); // 8
|
|
99
|
-
|
|
100
|
-
return isRevert ? !condition : condition;
|
|
101
|
-
}, [routerIsShow, routerIsShowValue, isRevert, store, storeKey, moduleShowValue, moduleIsShow, nValue, rootKey, rootStore, rnValue]);
|
|
102
|
-
|
|
103
|
-
console.log('103===>', store, !isEmpty(store), (storeKey && !moduleShowValue && !moduleIsShow && !isUndefined(store) && !isEmpty(store)));
|
|
104
|
-
if (conditionType || enabled) {
|
|
105
|
-
return (
|
|
106
|
-
<div
|
|
107
|
-
style={{
|
|
108
|
-
...margin,
|
|
109
|
-
...padding
|
|
110
|
-
}}
|
|
111
|
-
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
112
|
-
>
|
|
113
|
-
<Inner enabled={enabled}>{children}</Inner>
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const Container = ({ width, text, children, background, margin = {}, positionValue = {}, padding = {}, backgroundImage, position, $$_actions, $_actions, borderColor, ...props }: any) => {
|
|
120
|
-
// @ts-ignore
|
|
121
|
-
const { styles } = useStyles();
|
|
122
|
-
const { enabled } = useEditor((state) => ({
|
|
123
|
-
enabled: state.options.enabled
|
|
124
|
-
}));
|
|
125
|
-
//为了右边贴边位置特殊处理
|
|
126
|
-
const positionNewValue = useMemo(() => {
|
|
127
|
-
if (position === 'fixed' && positionValue.right === 0 && enabled) {
|
|
128
|
-
return {
|
|
129
|
-
...positionValue,
|
|
130
|
-
right: 412
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
if (position === 'fixed' && positionValue.left === 0 && enabled) {
|
|
134
|
-
return {
|
|
135
|
-
...positionValue,
|
|
136
|
-
left: 172
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return positionValue;
|
|
140
|
-
}, [positionValue, position]);
|
|
141
|
-
const {
|
|
142
|
-
connectors: { connect, drag }
|
|
143
|
-
} = useNode();
|
|
144
|
-
|
|
145
|
-
return (
|
|
146
|
-
<div
|
|
147
|
-
className={enabled ? styles.category : ''}
|
|
148
|
-
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
149
|
-
style={{
|
|
150
|
-
...margin,
|
|
151
|
-
display: 'flex',
|
|
152
|
-
boxSizing: 'border-box',
|
|
153
|
-
position,
|
|
154
|
-
border: `solid 1px ${borderColor}`,
|
|
155
|
-
...padding,
|
|
156
|
-
...props,
|
|
157
|
-
...positionNewValue,
|
|
158
|
-
background: backgroundImage ? `url(${fullpath(backgroundImage)}) repeat-x center 0` : background,
|
|
159
|
-
width: (width + '').includes('%') ? width : `${width}px`
|
|
160
|
-
}}
|
|
161
|
-
>
|
|
162
|
-
<Inner text={text} enabled={enabled}>
|
|
163
|
-
{children}
|
|
164
|
-
</Inner>
|
|
165
|
-
</div>
|
|
166
|
-
);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
export const OutContainerComponent = ({ width, api, params, children, background, padding = {}, backgroundImage, ...props }: any) => {
|
|
170
|
-
const { enabled } = useEditor((state) => ({
|
|
171
|
-
enabled: state.options.enabled
|
|
172
|
-
}));
|
|
173
|
-
|
|
174
|
-
const {
|
|
175
|
-
connectors: { connect, drag }
|
|
176
|
-
} = useNode();
|
|
177
|
-
|
|
178
|
-
const { styles } = useStyles();
|
|
179
|
-
return (
|
|
180
|
-
<div
|
|
181
|
-
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
182
|
-
className={enabled ? styles.category : ''}
|
|
183
|
-
style={{
|
|
184
|
-
margin: '0 auto',
|
|
185
|
-
display: 'flex',
|
|
186
|
-
boxSizing: 'border-box',
|
|
187
|
-
...padding,
|
|
188
|
-
...props,
|
|
189
|
-
background: backgroundImage ? `url(${fullpath(backgroundImage)}) repeat-x center 0` : background,
|
|
190
|
-
width: (width + '').includes('%') ? width : `${width}px`
|
|
191
|
-
}}
|
|
192
|
-
>
|
|
193
|
-
<Inner enabled={enabled}>{children}</Inner>
|
|
194
|
-
</div>
|
|
195
|
-
);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export const OutContainer = (props: any) => {
|
|
199
|
-
return (
|
|
200
|
-
<ModuleProvider>
|
|
201
|
-
<OutContainerComponent {...props} />
|
|
202
|
-
</ModuleProvider>
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
export const ContainerWrap = ({ width, background, children, backgroundImage, height, $$_style = '', $_style = '', ...props }: any) => {
|
|
206
|
-
const {
|
|
207
|
-
connectors: { connect, drag }
|
|
208
|
-
} = useNode();
|
|
209
|
-
|
|
210
|
-
const { enabled } = useEditor((state) => ({
|
|
211
|
-
enabled: state.options.enabled
|
|
212
|
-
}));
|
|
213
|
-
return (
|
|
214
|
-
<div
|
|
215
|
-
{...props}
|
|
216
|
-
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
217
|
-
style={{
|
|
218
|
-
width,
|
|
219
|
-
paddingBottom: 5,
|
|
220
|
-
background: backgroundImage ? `url(${fullpath(backgroundImage)}) repeat-x center 0` : background,
|
|
221
|
-
minHeight: `calc(${height}vh - 110px)`
|
|
222
|
-
}}
|
|
223
|
-
>
|
|
224
|
-
<Inner root={true} enabled={enabled}>
|
|
225
|
-
{children}
|
|
226
|
-
</Inner>
|
|
227
|
-
</div>
|
|
228
|
-
);
|
|
229
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { QjIcon } from '@brushes/share-resource';
|
|
2
|
-
import { Watermark } from 'antd';
|
|
3
|
-
import { createStyles } from 'antd-style';
|
|
4
|
-
|
|
5
|
-
const useStyle = createStyles(({ token, css }) => {
|
|
6
|
-
return {
|
|
7
|
-
defaultWrap: css`
|
|
8
|
-
border: dashed 1px rgba(0, 0, 0, 0.15);
|
|
9
|
-
width: 100%;
|
|
10
|
-
text-align: center;
|
|
11
|
-
border-radius: ${token.borderRadius}px;
|
|
12
|
-
height: 100%;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
align-items: center;
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
color: ${token.colorTextLabel};
|
|
18
|
-
p {
|
|
19
|
-
margin-top: 10px;
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
}
|
|
22
|
-
}`
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const DefaultJsx = ({ text = '内容放置区域', root }: { text?: string; root?: boolean }) => {
|
|
27
|
-
const { styles } = useStyle();
|
|
28
|
-
return (
|
|
29
|
-
<div
|
|
30
|
-
className={styles.defaultWrap}
|
|
31
|
-
style={{
|
|
32
|
-
minHeight: root ? `calc(100vh - 110px)` : 'auto'
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
<QjIcon
|
|
36
|
-
style={{
|
|
37
|
-
fontSize: 50,
|
|
38
|
-
fontWeight: 500,
|
|
39
|
-
display: 'block',
|
|
40
|
-
color: '#bbb'
|
|
41
|
-
}}
|
|
42
|
-
name={'icon-computer'}
|
|
43
|
-
></QjIcon>
|
|
44
|
-
<p>{text}</p>
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const DefaultEditorBg = ({ content = '/', color = 'blue' }: { content?: string; color?: string }) => {
|
|
50
|
-
return (
|
|
51
|
-
<Watermark gap={[1, 1]} font={{ color }} rotate={0} height={10} width={10} content={content}>
|
|
52
|
-
<div style={{ height: 10 }} />
|
|
53
|
-
</Watermark>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Typography } from 'antd';
|
|
2
|
-
|
|
3
|
-
export const SlotEmpty: React.FC<{
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
borderColor?: string;
|
|
6
|
-
}> = ({ children = '当前为插槽容器,可以自定义组件代码。', borderColor = 'rgba(0, 0, 0, 0.1)' }) => {
|
|
7
|
-
return (
|
|
8
|
-
<div
|
|
9
|
-
style={{
|
|
10
|
-
height: '100%',
|
|
11
|
-
width: '100%',
|
|
12
|
-
borderColor,
|
|
13
|
-
borderWidth: 1,
|
|
14
|
-
borderStyle: 'dashed',
|
|
15
|
-
fontSize: 12,
|
|
16
|
-
textAlign: 'center',
|
|
17
|
-
fontWeight: 'normal',
|
|
18
|
-
background: 'rgba(255,255,255, 0.2)'
|
|
19
|
-
}}
|
|
20
|
-
>
|
|
21
|
-
<Typography.Text type="secondary">{children}</Typography.Text>
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
// import { useNode, useEditor } from '@craftjs/core';
|
|
2
|
-
// import cx from 'classnames';
|
|
3
|
-
// import { debounce } from 'debounce';
|
|
4
|
-
// import { Resizable } from 're-resizable';
|
|
5
|
-
// import { useRef, useEffect, useState, useCallback } from 'react';
|
|
6
|
-
// import { styled } from 'styled-components';
|
|
7
|
-
//
|
|
8
|
-
// import {
|
|
9
|
-
// isPercentage,
|
|
10
|
-
// pxToPercent,
|
|
11
|
-
// percentToPx,
|
|
12
|
-
// getElementDimensions,
|
|
13
|
-
// } from './numToMeasurement';
|
|
14
|
-
//
|
|
15
|
-
// const Indicators = styled.div<{ $bound?: 'row' | 'column' }>`
|
|
16
|
-
// position: absolute;
|
|
17
|
-
// top: 0;
|
|
18
|
-
// left: 0;
|
|
19
|
-
// width: 100%;
|
|
20
|
-
// height: 100%;
|
|
21
|
-
// pointer-events: none;
|
|
22
|
-
// span {
|
|
23
|
-
// position: absolute;
|
|
24
|
-
// width: 8px;
|
|
25
|
-
// height: 8px;
|
|
26
|
-
// background: #fff;
|
|
27
|
-
// border-radius: 100%;
|
|
28
|
-
// display: block;
|
|
29
|
-
// box-shadow: 0px 0px 12px -1px rgba(0, 0, 0, 0.25);
|
|
30
|
-
// z-index: 99999;
|
|
31
|
-
// pointer-events: none;
|
|
32
|
-
// border: 2px solid #36a9e0;
|
|
33
|
-
// &:nth-child(1) {
|
|
34
|
-
// ${(props) =>
|
|
35
|
-
// props.$bound
|
|
36
|
-
// ? props.$bound === 'row'
|
|
37
|
-
// ? `
|
|
38
|
-
// left: 50%;
|
|
39
|
-
// top: -5px;
|
|
40
|
-
// transform:translateX(-50%);
|
|
41
|
-
// `
|
|
42
|
-
// : `
|
|
43
|
-
// top: 50%;
|
|
44
|
-
// left: -5px;
|
|
45
|
-
// transform:translateY(-50%);
|
|
46
|
-
// `
|
|
47
|
-
// : `
|
|
48
|
-
// left: -5px;
|
|
49
|
-
// top:-5px;
|
|
50
|
-
// `}
|
|
51
|
-
// }
|
|
52
|
-
// &:nth-child(2) {
|
|
53
|
-
// right: -5px;
|
|
54
|
-
// top: -5px;
|
|
55
|
-
// display: ${(props) => (props.$bound ? 'none' : 'block')};
|
|
56
|
-
// }
|
|
57
|
-
// &:nth-child(3) {
|
|
58
|
-
// ${(props) =>
|
|
59
|
-
// props.$bound
|
|
60
|
-
// ? props.$bound === 'row'
|
|
61
|
-
// ? `
|
|
62
|
-
// left: 50%;
|
|
63
|
-
// bottom: -3px;
|
|
64
|
-
// transform:translateX(-50%);
|
|
65
|
-
// `
|
|
66
|
-
// : `
|
|
67
|
-
// bottom: 50%;
|
|
68
|
-
// left: -5px;
|
|
69
|
-
// transform:translateY(-50%);
|
|
70
|
-
// `
|
|
71
|
-
// : `
|
|
72
|
-
// left: -5px;
|
|
73
|
-
// bottom:-3px;
|
|
74
|
-
// `}
|
|
75
|
-
// }
|
|
76
|
-
// &:nth-child(4) {
|
|
77
|
-
// bottom: -3px;
|
|
78
|
-
// right: -5px;
|
|
79
|
-
// display: ${(props) => (props.$bound ? 'none' : 'block')};
|
|
80
|
-
// }
|
|
81
|
-
// }
|
|
82
|
-
// `;
|
|
83
|
-
//
|
|
84
|
-
// export const Resizer = ({ propKey = { width: 'width', height: 'height' }, children, ...props }: any) => {
|
|
85
|
-
// const {
|
|
86
|
-
// id,
|
|
87
|
-
// actions: { setProp },
|
|
88
|
-
// connectors: { connect },
|
|
89
|
-
// fillSpace,
|
|
90
|
-
// nodeWidth,
|
|
91
|
-
// nodeHeight,
|
|
92
|
-
// parent,
|
|
93
|
-
// active,
|
|
94
|
-
// inNodeContext,
|
|
95
|
-
// } = useNode((node) => {
|
|
96
|
-
// return {
|
|
97
|
-
// parent: node.data.parent,
|
|
98
|
-
// active: node.events.selected,
|
|
99
|
-
// nodeWidth: node.data.props[propKey.width],
|
|
100
|
-
// nodeHeight: node.data.props[propKey.height],
|
|
101
|
-
// fillSpace: node.data.props.fillSpace,
|
|
102
|
-
// }
|
|
103
|
-
// });
|
|
104
|
-
// const { isRootNode, parentDirection } = useEditor((state, query) => {
|
|
105
|
-
// return {
|
|
106
|
-
// parentDirection:
|
|
107
|
-
// parent &&
|
|
108
|
-
// state.nodes[parent] &&
|
|
109
|
-
// state.nodes[parent].data.props.flexDirection,
|
|
110
|
-
// isRootNode: query.node(id).isRoot(),
|
|
111
|
-
// };
|
|
112
|
-
// });
|
|
113
|
-
//
|
|
114
|
-
// const resizable = useRef<Resizable>(null);
|
|
115
|
-
// const isResizing = useRef<Boolean>(false);
|
|
116
|
-
// const editingDimensions = useRef<any>(null);
|
|
117
|
-
// const nodeDimensions = useRef(null);
|
|
118
|
-
// nodeDimensions.current = { width: nodeWidth, height: nodeHeight };
|
|
119
|
-
//
|
|
120
|
-
// /**
|
|
121
|
-
// * Using an internal value to ensure the width/height set in the node is converted to px
|
|
122
|
-
// * because for some reason the <re-resizable /> library does not work well with percentages.
|
|
123
|
-
// */
|
|
124
|
-
// const [internalDimensions, setInternalDimensions] = useState({
|
|
125
|
-
// width: nodeWidth,
|
|
126
|
-
// height: nodeHeight,
|
|
127
|
-
// });
|
|
128
|
-
//
|
|
129
|
-
// const updateInternalDimensionsInPx = useCallback(() => {
|
|
130
|
-
// const { width: nodeWidth, height: nodeHeight } = nodeDimensions.current;
|
|
131
|
-
// const width = percentToPx(
|
|
132
|
-
// nodeWidth,
|
|
133
|
-
// resizable.current &&
|
|
134
|
-
// getElementDimensions(resizable.current.resizable.parentElement).width
|
|
135
|
-
// );
|
|
136
|
-
// const height = percentToPx(
|
|
137
|
-
// nodeHeight,
|
|
138
|
-
// resizable.current &&
|
|
139
|
-
// getElementDimensions(resizable.current.resizable.parentElement).height
|
|
140
|
-
// );
|
|
141
|
-
//
|
|
142
|
-
// setInternalDimensions({
|
|
143
|
-
// width,
|
|
144
|
-
// height,
|
|
145
|
-
// });
|
|
146
|
-
// }, []);
|
|
147
|
-
//
|
|
148
|
-
// const updateInternalDimensionsWithOriginal = useCallback(() => {
|
|
149
|
-
// const { width: nodeWidth, height: nodeHeight } = nodeDimensions.current;
|
|
150
|
-
// setInternalDimensions({
|
|
151
|
-
// width: nodeWidth,
|
|
152
|
-
// height: nodeHeight,
|
|
153
|
-
// });
|
|
154
|
-
// }, []);
|
|
155
|
-
//
|
|
156
|
-
// const getUpdatedDimensions = (width, height) => {
|
|
157
|
-
// const dom = resizable.current.resizable;
|
|
158
|
-
// if (!dom) return;
|
|
159
|
-
//
|
|
160
|
-
// const currentWidth = parseInt(editingDimensions.current.width),
|
|
161
|
-
// currentHeight = parseInt(editingDimensions.current.height);
|
|
162
|
-
//
|
|
163
|
-
// return {
|
|
164
|
-
// width: currentWidth + parseInt(width),
|
|
165
|
-
// height: currentHeight + parseInt(height),
|
|
166
|
-
// };
|
|
167
|
-
// };
|
|
168
|
-
//
|
|
169
|
-
// useEffect(() => {
|
|
170
|
-
// if (!isResizing.current) updateInternalDimensionsWithOriginal();
|
|
171
|
-
// }, [nodeWidth, nodeHeight, updateInternalDimensionsWithOriginal]);
|
|
172
|
-
//
|
|
173
|
-
// useEffect(() => {
|
|
174
|
-
// const listener = debounce(updateInternalDimensionsWithOriginal, 1);
|
|
175
|
-
// window.addEventListener('resize', listener);
|
|
176
|
-
//
|
|
177
|
-
// return () => {
|
|
178
|
-
// window.removeEventListener('resize', listener);
|
|
179
|
-
// };
|
|
180
|
-
// }, [updateInternalDimensionsWithOriginal]);
|
|
181
|
-
//
|
|
182
|
-
// return (
|
|
183
|
-
// <Resizable
|
|
184
|
-
// enable={[
|
|
185
|
-
// 'top',
|
|
186
|
-
// 'left',
|
|
187
|
-
// 'bottom',
|
|
188
|
-
// 'right',
|
|
189
|
-
// 'topLeft',
|
|
190
|
-
// 'topRight',
|
|
191
|
-
// 'bottomLeft',
|
|
192
|
-
// 'bottomRight',
|
|
193
|
-
// ].reduce((acc: any, key) => {
|
|
194
|
-
// acc[key] = active && inNodeContext;
|
|
195
|
-
// return acc;
|
|
196
|
-
// }, {})}
|
|
197
|
-
// style={{margin: '0 auto'}}
|
|
198
|
-
// className={cx([
|
|
199
|
-
// {
|
|
200
|
-
// 'm-auto': isRootNode,
|
|
201
|
-
// flex: true,
|
|
202
|
-
// },
|
|
203
|
-
// ])}
|
|
204
|
-
// ref={(ref) => {
|
|
205
|
-
// if (ref) {
|
|
206
|
-
// resizable.current = ref;
|
|
207
|
-
// connect(resizable.current.resizable);
|
|
208
|
-
// }
|
|
209
|
-
// }}
|
|
210
|
-
// size={internalDimensions}
|
|
211
|
-
// onResizeStart={(e) => {
|
|
212
|
-
// updateInternalDimensionsInPx();
|
|
213
|
-
// e.preventDefault();
|
|
214
|
-
// e.stopPropagation();
|
|
215
|
-
// const dom = resizable.current.resizable;
|
|
216
|
-
// if (!dom) return;
|
|
217
|
-
// editingDimensions.current = {
|
|
218
|
-
// width: dom.getBoundingClientRect().width,
|
|
219
|
-
// height: dom.getBoundingClientRect().height,
|
|
220
|
-
// };
|
|
221
|
-
// isResizing.current = true;
|
|
222
|
-
// }}
|
|
223
|
-
// onResize={(_, __, ___, d) => {
|
|
224
|
-
// const dom = resizable.current.resizable;
|
|
225
|
-
// let { width, height }: any = getUpdatedDimensions(d.width, d.height);
|
|
226
|
-
// if (isPercentage(nodeWidth))
|
|
227
|
-
// width =
|
|
228
|
-
// pxToPercent(width, getElementDimensions(dom.parentElement).width) +
|
|
229
|
-
// '%';
|
|
230
|
-
// else width = `${width}px`;
|
|
231
|
-
//
|
|
232
|
-
// if (isPercentage(nodeHeight))
|
|
233
|
-
// height =
|
|
234
|
-
// pxToPercent(
|
|
235
|
-
// height,
|
|
236
|
-
// getElementDimensions(dom.parentElement).height
|
|
237
|
-
// ) + '%';
|
|
238
|
-
// else height = `${height}px`;
|
|
239
|
-
//
|
|
240
|
-
// if (isPercentage(width) && dom.parentElement.style.width === 'auto') {
|
|
241
|
-
// width = editingDimensions.current.width + d.width + 'px';
|
|
242
|
-
// }
|
|
243
|
-
//
|
|
244
|
-
// if (isPercentage(height) && dom.parentElement.style.height === 'auto') {
|
|
245
|
-
// height = editingDimensions.current.height + d.height + 'px';
|
|
246
|
-
// }
|
|
247
|
-
//
|
|
248
|
-
// setProp((prop: any) => {
|
|
249
|
-
// prop[propKey.width] = width;
|
|
250
|
-
// prop[propKey.height] = height;
|
|
251
|
-
// }, 500);
|
|
252
|
-
// }}
|
|
253
|
-
// onResizeStop={() => {
|
|
254
|
-
// isResizing.current = false;
|
|
255
|
-
// updateInternalDimensionsWithOriginal();
|
|
256
|
-
// }}
|
|
257
|
-
// {...props}
|
|
258
|
-
// >
|
|
259
|
-
// {children}
|
|
260
|
-
// {active && (
|
|
261
|
-
// <Indicators $bound={fillSpace === 'yes' ? parentDirection : false}>
|
|
262
|
-
// <span></span>
|
|
263
|
-
// <span></span>
|
|
264
|
-
// <span></span>
|
|
265
|
-
// <span></span>
|
|
266
|
-
// </Indicators>
|
|
267
|
-
// )}
|
|
268
|
-
// </Resizable>
|
|
269
|
-
// );
|
|
270
|
-
// };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const isPercentage = (val: string) => typeof val === 'string' && val.indexOf('%') > -1;
|
|
2
|
-
|
|
3
|
-
export const percentToPx = (value: any, comparativeValue: number) => {
|
|
4
|
-
if (value.indexOf('px') > -1 || value === 'auto' || !comparativeValue) return value;
|
|
5
|
-
const percent = parseInt(value);
|
|
6
|
-
return (percent / 100) * comparativeValue + 'px';
|
|
7
|
-
};
|
|
8
|
-
export const pxToPercent = (value: any, comparativeValue: number) => {
|
|
9
|
-
const val = (Math.abs(value) / comparativeValue) * 100;
|
|
10
|
-
if (value < 0) return -1 * val;
|
|
11
|
-
else return Math.round(val);
|
|
12
|
-
};
|
|
13
|
-
export const getElementDimensions = (element: HTMLElement) => {
|
|
14
|
-
const computedStyle = getComputedStyle(element);
|
|
15
|
-
|
|
16
|
-
let height = element.clientHeight,
|
|
17
|
-
width = element.clientWidth; // width with padding
|
|
18
|
-
|
|
19
|
-
height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
|
|
20
|
-
width -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
width,
|
|
24
|
-
height
|
|
25
|
-
};
|
|
26
|
-
};
|
package/src/components/code.tsx
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { Button, Form } from 'antd';
|
|
3
|
-
import { useMountedRef } from '@brushes/form';
|
|
4
|
-
import { get } from '@brushes/request';
|
|
5
|
-
|
|
6
|
-
export const CodeComponent = ({ api = '/web/ml/muser/sendPhone.json', codeKey, height = 36 }: { codeKey?: string; api?: string; height?: number }) => {
|
|
7
|
-
const form = Form.useFormInstance();
|
|
8
|
-
const verCode = form.getFieldValue('verCode');
|
|
9
|
-
const [dataTime, setDataTime] = useState(0);
|
|
10
|
-
const [loading, setLoading] = useState(false);
|
|
11
|
-
const isMounted = useMountedRef();
|
|
12
|
-
const isfetch = useMemo(() => {
|
|
13
|
-
return dataTime > 0 || !verCode;
|
|
14
|
-
}, [dataTime, verCode]);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const time = setTimeout(function next() {
|
|
18
|
-
if (dataTime === 0) {
|
|
19
|
-
clearTimeout(time);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (isMounted.current) {
|
|
23
|
-
setDataTime((dataTime) => dataTime - 1);
|
|
24
|
-
}
|
|
25
|
-
}, 1000);
|
|
26
|
-
|
|
27
|
-
return () => clearTimeout(time);
|
|
28
|
-
}, [dataTime, isMounted]);
|
|
29
|
-
|
|
30
|
-
const fetchCode = () => {
|
|
31
|
-
setLoading(true);
|
|
32
|
-
const { getFieldsValue } = form;
|
|
33
|
-
const { loginName, userPhone, userinfoConPhone, verCode, ...rest } = getFieldsValue();
|
|
34
|
-
let params = {
|
|
35
|
-
userPhone: loginName || userPhone || userinfoConPhone,
|
|
36
|
-
code: verCode
|
|
37
|
-
}
|
|
38
|
-
if(codeKey) {
|
|
39
|
-
params = {
|
|
40
|
-
userPhone: rest[codeKey],
|
|
41
|
-
code: verCode
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get(api, params)
|
|
46
|
-
.then(() => {
|
|
47
|
-
setDataTime(1 * 60);
|
|
48
|
-
})
|
|
49
|
-
.catch((error: any) => {})
|
|
50
|
-
.finally(() => {
|
|
51
|
-
setLoading(false);
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<Button loading={loading} size={'small'} type={'link'} disabled={isfetch} style={{ cursor: 'pointer', height, width: 90 }} onClick={fetchCode}>
|
|
57
|
-
{dataTime === 0 ? '获取验证码' : `倒计时${dataTime}秒`}
|
|
58
|
-
</Button>
|
|
59
|
-
);
|
|
60
|
-
};
|
package/src/components/image.tsx
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Form, Spin } from 'antd';
|
|
3
|
-
import { dynamicFormFields } from '@brushes/form';
|
|
4
|
-
import { createStyles } from 'antd-style';
|
|
5
|
-
|
|
6
|
-
const useStyle = createStyles(({ token, css }, { height }: { height: number }) => {
|
|
7
|
-
return {
|
|
8
|
-
wrap: css`
|
|
9
|
-
input[name='verCode'] {
|
|
10
|
-
height: ${height}px;
|
|
11
|
-
}
|
|
12
|
-
`
|
|
13
|
-
};
|
|
14
|
-
});
|
|
15
|
-
export const ImageCodeComponent = ({ api = '/web/ml/mlogin/getVerCode.img', codeKey, height = 40 }: { api?: string; codeKey?:string; height?: number }) => {
|
|
16
|
-
const { styles } = useStyle({ height });
|
|
17
|
-
const form = Form.useFormInstance();
|
|
18
|
-
const isDisabled = form.getFieldValue('isDisabled');
|
|
19
|
-
const [loading, setLoading] = useState(false);
|
|
20
|
-
const [verImg, setVerImg] = useState('');
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (isDisabled === '') {
|
|
24
|
-
fetchCode();
|
|
25
|
-
}
|
|
26
|
-
}, [isDisabled]);
|
|
27
|
-
|
|
28
|
-
const fetchCode = () => {
|
|
29
|
-
setLoading(true);
|
|
30
|
-
const { getFieldsValue } = form;
|
|
31
|
-
const { loginName, userPhone, userinfoConPhone, ...rest } = getFieldsValue();
|
|
32
|
-
|
|
33
|
-
let params = loginName || userPhone || userinfoConPhone;
|
|
34
|
-
if(codeKey) {
|
|
35
|
-
params = rest[codeKey]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
fetch(`${api}?userPhone=${params}`)
|
|
39
|
-
.then((code) => {
|
|
40
|
-
return code;
|
|
41
|
-
})
|
|
42
|
-
.then((res) => res.arrayBuffer())
|
|
43
|
-
.then((res) => {
|
|
44
|
-
const imgUrl = 'data:image/png;base64,' + window.btoa(String.fromCharCode(...new Uint8Array(res)));
|
|
45
|
-
setVerImg(imgUrl);
|
|
46
|
-
})
|
|
47
|
-
.catch((error: any) => {})
|
|
48
|
-
.finally(() => {
|
|
49
|
-
setLoading(false);
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
return (
|
|
53
|
-
<div className={styles.wrap}>
|
|
54
|
-
{dynamicFormFields(
|
|
55
|
-
[
|
|
56
|
-
{
|
|
57
|
-
name: 'verCode',
|
|
58
|
-
type: 'text',
|
|
59
|
-
label: '',
|
|
60
|
-
style: { width: '100%' },
|
|
61
|
-
rules: [{ required: true, message: '请输入' }],
|
|
62
|
-
extraProps: {
|
|
63
|
-
autoComplete: 'off',
|
|
64
|
-
placeholder: '请输入',
|
|
65
|
-
addonAfter: (
|
|
66
|
-
<Spin spinning={loading}>{verImg ? <img src={verImg} onClick={fetchCode} style={{ width: 90, height: height - 2 }} /> : <div style={{ width: 90, height: height - 2 }}></div>}</Spin>
|
|
67
|
-
),
|
|
68
|
-
style: {
|
|
69
|
-
height
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
form
|
|
75
|
-
)}
|
|
76
|
-
</div>
|
|
77
|
-
);
|
|
78
|
-
};
|
package/src/components/index.ts
DELETED
package/src/context/index.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext, ReactNode, useContext } from 'react';
|
|
2
|
-
const Context = createContext({});
|
|
3
|
-
|
|
4
|
-
export function ApplicationContext({ value, children }: { value?: Object; children: ReactNode }) {
|
|
5
|
-
return <Context.Provider value={{ ...value }}>{children}</Context.Provider>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function useApplicationContext() {
|
|
9
|
-
return useContext(Context);
|
|
10
|
-
}
|
package/src/index.ts
DELETED
package/src/setting/basic.tsx
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Collapse, Form } from 'antd';
|
|
2
|
-
import { Fragment } from 'react';
|
|
3
|
-
import { dynamicFormFields, useImmutableCallback } from '@brushes/form';
|
|
4
|
-
import { useNode } from '@craftjs/core';
|
|
5
|
-
import type { FieldType } from '@brushes/form';
|
|
6
|
-
import { isUndefined, debounce } from 'lodash';
|
|
7
|
-
import { defaultStyle } from '@brushes/core-transform';
|
|
8
|
-
import Title from './title';
|
|
9
|
-
|
|
10
|
-
export type formConfigType = {
|
|
11
|
-
title?: string;
|
|
12
|
-
formFields: FieldType[];
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type LayoutType = 'horizontal' | 'vertical' | 'inline';
|
|
16
|
-
|
|
17
|
-
export const basicSettings = (formFields: formConfigType[], layout?: LayoutType) => {
|
|
18
|
-
return () => {
|
|
19
|
-
const [form] = Form.useForm();
|
|
20
|
-
const {
|
|
21
|
-
configProps,
|
|
22
|
-
actions: { setProp }
|
|
23
|
-
} = useNode((node) => ({
|
|
24
|
-
configProps: node.data.props
|
|
25
|
-
}));
|
|
26
|
-
const isNeedOmit = (values: any) => {
|
|
27
|
-
if (Array.isArray(values)) {
|
|
28
|
-
return values.filter((v) => !isUndefined(v));
|
|
29
|
-
}
|
|
30
|
-
return values;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const isBreakChangeValue = (params: any) => {
|
|
34
|
-
let obj = {};
|
|
35
|
-
Reflect.ownKeys(params).forEach((key) => {
|
|
36
|
-
Reflect.set(obj, key, isNeedOmit(Reflect.get(params, key)));
|
|
37
|
-
});
|
|
38
|
-
return obj;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const callbackImpl = debounce(
|
|
42
|
-
useImmutableCallback((_: any, prevAllValues: any) => {
|
|
43
|
-
const allValues = isBreakChangeValue(prevAllValues);
|
|
44
|
-
|
|
45
|
-
setProp((props: object) => {
|
|
46
|
-
Object.entries(allValues).forEach(([key, value], index) => {
|
|
47
|
-
// if(key === '$_actions') {
|
|
48
|
-
// // const fun = new Function('', `return ${value}`);
|
|
49
|
-
// // @ts-ignore
|
|
50
|
-
// props['onClick'] = fun('daa')
|
|
51
|
-
// } else {
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
props[key] = value;
|
|
54
|
-
// }
|
|
55
|
-
});
|
|
56
|
-
}, 500);
|
|
57
|
-
|
|
58
|
-
// setProp((props: object) => {}, 500);
|
|
59
|
-
}),
|
|
60
|
-
500
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<Form layout={layout} form={form} onValuesChange={callbackImpl} initialValues={configProps}>
|
|
65
|
-
<Collapse
|
|
66
|
-
bordered
|
|
67
|
-
size={'small'}
|
|
68
|
-
ghost
|
|
69
|
-
expandIconPosition={'end'}
|
|
70
|
-
items={formFields
|
|
71
|
-
.concat(
|
|
72
|
-
{
|
|
73
|
-
title: '样式',
|
|
74
|
-
formFields: defaultStyle
|
|
75
|
-
}
|
|
76
|
-
// {
|
|
77
|
-
// title: 'store',
|
|
78
|
-
// formFields: storeConfig
|
|
79
|
-
// }
|
|
80
|
-
)
|
|
81
|
-
.map((item: any, indx: number) => ({
|
|
82
|
-
key: indx,
|
|
83
|
-
label: <Title title={item.title} />,
|
|
84
|
-
children: <Fragment key={indx}>{dynamicFormFields(item.formFields, form)}</Fragment>
|
|
85
|
-
}))}
|
|
86
|
-
defaultActiveKey={['0', '1', '2', '3']}
|
|
87
|
-
/>
|
|
88
|
-
</Form>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
};
|
package/src/setting/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './basic';
|
package/src/setting/title.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Divider } from 'antd';
|
|
2
|
-
|
|
3
|
-
const Title = ({ title }: { title: string }) => {
|
|
4
|
-
return (
|
|
5
|
-
<>
|
|
6
|
-
<Divider style={{ fontSize: 13, margin: '2px 0' }} orientation="left">
|
|
7
|
-
{title}
|
|
8
|
-
</Divider>
|
|
9
|
-
{/*<Divider style={{fontSize:14}} orientation="left">{title}</Divider>*/}
|
|
10
|
-
</>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default Title;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ModuleStore, createModuleStore, ModuleState, moduleStore } from './commonStore';
|
|
2
|
-
import { useRef, useContext, createContext } from 'react';
|
|
3
|
-
import { useStore } from 'zustand';
|
|
4
|
-
const ModuleContext = createContext<ModuleStore | null>(null);
|
|
5
|
-
|
|
6
|
-
type ModuleProviderProps = React.PropsWithChildren<Partial<moduleStore>>;
|
|
7
|
-
|
|
8
|
-
export { initialValueOrder } from './commonStore';
|
|
9
|
-
|
|
10
|
-
// Provider wrapper
|
|
11
|
-
export function ModuleProvider({ children, ...props }: ModuleProviderProps) {
|
|
12
|
-
const storeRef = useRef<ModuleStore>();
|
|
13
|
-
|
|
14
|
-
if (!storeRef.current) {
|
|
15
|
-
storeRef.current = createModuleStore(props);
|
|
16
|
-
}
|
|
17
|
-
return <ModuleContext.Provider value={storeRef.current}>{children}</ModuleContext.Provider>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function useModuleContext<T>(selector: (state: ModuleState) => T): T {
|
|
21
|
-
const store = useContext(ModuleContext);
|
|
22
|
-
if (!store) throw new Error('Missing ModuleContext.Provider in the tree');
|
|
23
|
-
return useStore(store, selector);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// example
|
|
27
|
-
// Consumer usage of the custom hook
|
|
28
|
-
// function CommonConsumer() {
|
|
29
|
-
// const module_id = useModuleContext((s) => s.module_id)
|
|
30
|
-
// const setModuleId = useModuleContext((s) => s.setModuleId)
|
|
31
|
-
// return (
|
|
32
|
-
// <>
|
|
33
|
-
// <div>{module_id} Bears.</div>
|
|
34
|
-
// <button onClick={setModuleId}>Add bear</button>
|
|
35
|
-
// </>
|
|
36
|
-
// )
|
|
37
|
-
// }
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { createStore } from 'zustand';
|
|
2
|
-
|
|
3
|
-
export const goodListIntialValue = {
|
|
4
|
-
dataPic: '',
|
|
5
|
-
goodsName: '',
|
|
6
|
-
goodsCamount: 0,
|
|
7
|
-
skuName: '',
|
|
8
|
-
pricesetNprice: 0
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const initialValueOrder = {
|
|
12
|
-
contractSettlOpno: 0,
|
|
13
|
-
upmMap: {},
|
|
14
|
-
rebMoney: 0,
|
|
15
|
-
goodsCamount: 0,
|
|
16
|
-
shoppingCountPrice: 0,
|
|
17
|
-
totalDiscountPrice: 0,
|
|
18
|
-
accountsSumPrice: 0,
|
|
19
|
-
discount: 0,
|
|
20
|
-
freight: 0,
|
|
21
|
-
comDisMoney: 0,
|
|
22
|
-
copyComDisMoney: 0,
|
|
23
|
-
shoppingType: '',
|
|
24
|
-
promotionCode: '',
|
|
25
|
-
promotionCodes: ''
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type addressInfo = {
|
|
29
|
-
freight: number;
|
|
30
|
-
goodsReceiptMem: string;
|
|
31
|
-
goodsReceiptPhone: string;
|
|
32
|
-
goodsReceiptArrdess: string;
|
|
33
|
-
areaCode: string;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type moduleType = {
|
|
37
|
-
[v: string]: any;
|
|
38
|
-
_ocPoints: Array<any>;
|
|
39
|
-
_ocDiscount: Array<any>;
|
|
40
|
-
_orderAddressInfo: addressInfo;
|
|
41
|
-
_couponList: []; // 订单优惠券列表
|
|
42
|
-
_selectCoupon: []; // 选中的优惠券
|
|
43
|
-
_shoppingList: Array<any>; // 订单商品信息
|
|
44
|
-
_contractGoodsList: Array<typeof goodListIntialValue>; // 确认订单支付模块
|
|
45
|
-
_orderDomainStr: Array<typeof initialValueOrder>; // 确认订单支付模块
|
|
46
|
-
_ocContractSettlList: Array<any>; // 确认订单支付模块
|
|
47
|
-
open?: boolean; //抽屉展示或掩藏
|
|
48
|
-
defaultValue?: object; // 页面模块默认值
|
|
49
|
-
goodNum?: number; // 选择商品数量
|
|
50
|
-
_skuInfo?: { [v:string]:any }; // sku商品数据
|
|
51
|
-
params?: object; //每个模块的请求参数
|
|
52
|
-
breadList?: []; //面包屑
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export interface moduleStore {
|
|
56
|
-
// module_id?: number;
|
|
57
|
-
// current?: number;
|
|
58
|
-
// hotelParams?: object;
|
|
59
|
-
// extraParams?: object; //每个模块的扩展参数
|
|
60
|
-
// title?: string;
|
|
61
|
-
moduleStore: Partial<moduleType>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface ModuleState extends moduleStore {
|
|
65
|
-
setModuleStore: (e: Partial<moduleType>) => void;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export type ModuleStore = ReturnType<typeof createModuleStore>;
|
|
69
|
-
|
|
70
|
-
export const createModuleStore = (initProps?: Partial<moduleStore>) => {
|
|
71
|
-
const DEFAULT_PROPS: moduleStore = {
|
|
72
|
-
moduleStore: {
|
|
73
|
-
_ocDiscount: [],
|
|
74
|
-
_ocPoints: [],
|
|
75
|
-
_couponList: [],
|
|
76
|
-
_selectCoupon: [], // 选中的优惠券
|
|
77
|
-
_shoppingList: [], // 订单商品信息
|
|
78
|
-
_contractGoodsList: [],
|
|
79
|
-
_orderDomainStr: [],
|
|
80
|
-
_ocContractSettlList: [],
|
|
81
|
-
_orderAddressInfo: {
|
|
82
|
-
freight: 0,
|
|
83
|
-
goodsReceiptMem: '',
|
|
84
|
-
goodsReceiptPhone: '',
|
|
85
|
-
goodsReceiptArrdess: '',
|
|
86
|
-
areaCode: ''
|
|
87
|
-
},
|
|
88
|
-
defaultValue: void 0,
|
|
89
|
-
_skuInfo: {},
|
|
90
|
-
params: {},
|
|
91
|
-
breadList: [],
|
|
92
|
-
open: false
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
return createStore<ModuleState>()((set) => ({
|
|
96
|
-
...DEFAULT_PROPS,
|
|
97
|
-
...initProps,
|
|
98
|
-
setModuleStore: (store) =>
|
|
99
|
-
set((state) => {
|
|
100
|
-
return { moduleStore: Object.assign(state.moduleStore, store) };
|
|
101
|
-
})
|
|
102
|
-
}));
|
|
103
|
-
};
|
package/src/store/index.tsx
DELETED
package/src/store/rootModule.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ModuleRootStore, createRootModuleStore, ModuleRootState, moduleRootStore } from './rootStore';
|
|
2
|
-
import { useRef, useContext, createContext } from 'react';
|
|
3
|
-
import { useStore } from 'zustand';
|
|
4
|
-
|
|
5
|
-
const ModuleContext = createContext<ModuleRootStore | null>(null);
|
|
6
|
-
|
|
7
|
-
type ModuleProviderProps = React.PropsWithChildren<Partial<moduleRootStore>>;
|
|
8
|
-
|
|
9
|
-
// Provider wrapper
|
|
10
|
-
export function ModuleRootProvider({ children, ...props }: ModuleProviderProps) {
|
|
11
|
-
const storeRef = useRef<ModuleRootStore>();
|
|
12
|
-
|
|
13
|
-
if (!storeRef.current) {
|
|
14
|
-
storeRef.current = createRootModuleStore(props);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return <ModuleContext.Provider value={storeRef.current}>{children}</ModuleContext.Provider>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function useModuleRootContext<T>(selector: (state: ModuleRootState) => T): T {
|
|
21
|
-
const store = useContext(ModuleContext);
|
|
22
|
-
if (!store) throw new Error('Missing ModuleContext.Provider in the tree');
|
|
23
|
-
return useStore(store, selector);
|
|
24
|
-
}
|
package/src/store/rootStore.tsx
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { createStore } from 'zustand';
|
|
2
|
-
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
3
|
-
|
|
4
|
-
export type moduleType = {
|
|
5
|
-
[v: string]: any;
|
|
6
|
-
_historyList: Array<any>;
|
|
7
|
-
_themeColor: { colorPrimary: string; colorBgTextHover: string };
|
|
8
|
-
_orderCount: { [v: string]: string | number }; // 订单角标
|
|
9
|
-
_userInfo: { [v: string]: any }; // 用户信息
|
|
10
|
-
_cart: number; // 购物车数据
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export interface moduleRootStore {
|
|
14
|
-
// module_id?: number;
|
|
15
|
-
// current?: number;
|
|
16
|
-
// hotelParams?: object;
|
|
17
|
-
// extraParams?: object; //每个模块的扩展参数
|
|
18
|
-
// title?: string;
|
|
19
|
-
rootStore: moduleType;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ModuleRootState extends moduleRootStore {
|
|
23
|
-
setModuleRootStore: (e: Partial<moduleType>) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type ModuleRootStore = ReturnType<typeof createRootModuleStore>;
|
|
27
|
-
|
|
28
|
-
export const createRootModuleStore = (initProps?: Partial<moduleRootStore>) => {
|
|
29
|
-
const DEFAULT_PROPS: moduleRootStore = {
|
|
30
|
-
rootStore: {
|
|
31
|
-
_userInfo: {},
|
|
32
|
-
_historyList: [],
|
|
33
|
-
_themeColor: { colorPrimary: '#1677ff', colorBgTextHover: '#e6r4ff' },
|
|
34
|
-
_orderCount: {},
|
|
35
|
-
_cart: 0,
|
|
36
|
-
_webStore: {},
|
|
37
|
-
_menuChildren: []
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return createStore<ModuleRootState>()(
|
|
41
|
-
persist(
|
|
42
|
-
(set) => ({
|
|
43
|
-
...DEFAULT_PROPS,
|
|
44
|
-
...initProps,
|
|
45
|
-
setModuleRootStore: (store) =>
|
|
46
|
-
set((state) => {
|
|
47
|
-
return { rootStore: Object.assign(state.rootStore, store) };
|
|
48
|
-
})
|
|
49
|
-
}),
|
|
50
|
-
{
|
|
51
|
-
name: 'root-storage', // 存储的 key 名
|
|
52
|
-
storage: createJSONStorage(() => localStorage) // (optional) by default, 'localStorage' is used
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
);
|
|
56
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import type { FieldType } from '@brushes/form';
|
|
2
|
-
// import { useModuleContext } from './commonModule';
|
|
3
|
-
// import markdownit from 'markdown-it';
|
|
4
|
-
//
|
|
5
|
-
// const md = markdownit({
|
|
6
|
-
// tables: true,
|
|
7
|
-
// html: true, // 在源码中启用 HTML 标签
|
|
8
|
-
// xhtmlOut: false, // 使用 '/' 来闭合单标签 (比如 <br />)。
|
|
9
|
-
// // 这个选项只对完全的 CommonMark 模式兼容。
|
|
10
|
-
// breaks: true, // 转换段落里的 '\n' 到 <br>。
|
|
11
|
-
// langPrefix: 'language-', // 给围栏代码块的 CSS 语言前缀。对于额外的高亮代码非常有用。
|
|
12
|
-
// linkify: true, // 将类似 URL 的文本自动转换为链接。
|
|
13
|
-
//
|
|
14
|
-
// // 启用一些语言中立的替换 + 引号美化
|
|
15
|
-
// typographer: false,
|
|
16
|
-
//
|
|
17
|
-
// // 双 + 单引号替换对,当 typographer 启用时。
|
|
18
|
-
// // 或者智能引号等,可以是 String 或 Array。
|
|
19
|
-
// //
|
|
20
|
-
// // 比方说,你可以支持 '«»„“' 给俄罗斯人使用, '„“‚‘' 给德国人使用。
|
|
21
|
-
// // 还有 ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] 给法国人使用(包括 nbsp)。
|
|
22
|
-
// quotes: '“”‘’',
|
|
23
|
-
//
|
|
24
|
-
// // 高亮函数,会返回转义的HTML。
|
|
25
|
-
// // 或 '' 如果源字符串未更改,则应在外部进行转义。
|
|
26
|
-
// // 如果结果以 <pre ... 开头,内部包装器则会跳过。
|
|
27
|
-
// highlight: function (/*str, lang*/) {
|
|
28
|
-
// return '';
|
|
29
|
-
// }
|
|
30
|
-
// });
|
|
31
|
-
//
|
|
32
|
-
// const StoreJsx = () => {
|
|
33
|
-
// const moduleStore = useModuleContext((s) => s.moduleStore);
|
|
34
|
-
// return (
|
|
35
|
-
// <>
|
|
36
|
-
// <p>当前模块数据</p>
|
|
37
|
-
// <div className={'markdown-body 123'} dangerouslySetInnerHTML={{ __html: md.render(JSON.stringify(moduleStore)) }}></div>
|
|
38
|
-
// </>
|
|
39
|
-
// );
|
|
40
|
-
// };
|
|
41
|
-
// export const storeConfig: FieldType[] = [
|
|
42
|
-
// {
|
|
43
|
-
// label: '',
|
|
44
|
-
// name: '___store',
|
|
45
|
-
// type: 'slot',
|
|
46
|
-
// extraProps: {
|
|
47
|
-
// render: StoreJsx
|
|
48
|
-
// }
|
|
49
|
-
// }
|
|
50
|
-
// ];
|
package/src/tool/combine.ts
DELETED
package/src/tool/fullpath.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const baseUrl = process.env.REACT_APP_BASE_URL;
|
|
2
|
-
const path = process.env.REACT_IMG_PATH || '';
|
|
3
|
-
export const fullpath = (str: string = '') => {
|
|
4
|
-
let computedPath = str;
|
|
5
|
-
if (!str) return '';
|
|
6
|
-
if (str.startsWith('http')) {
|
|
7
|
-
return str;
|
|
8
|
-
}
|
|
9
|
-
if (!(str.startsWith(path) || str.startsWith(path.slice(1)))) {
|
|
10
|
-
computedPath = path + str;
|
|
11
|
-
}
|
|
12
|
-
return baseUrl + computedPath;
|
|
13
|
-
};
|
package/src/tool/index.tsx
DELETED