@easy-editor/materials-dashboard-text 0.0.16 → 0.0.17
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/CHANGELOG.md +6 -0
- package/dist/component.min.js +1 -1
- package/dist/index.min.js +1 -1
- package/dist/meta.min.js +1 -1
- package/package.json +1 -1
- package/src/component.tsx +27 -2
- package/src/configure.ts +4 -0
- package/src/snippets.ts +2 -2
package/CHANGELOG.md
CHANGED
package/dist/component.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsTextComponent={},e.React,e.jsxRuntime)}(this,function(e,t,n){"use strict";function o(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=o(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function r(...e){return function(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=o(e))&&(r&&(r+=" "),r+=t);return r}(e)}var i="component-module__container___VbZSk",l="component-module__text___nFUOn",a="component-module__link___20asF",c="component-module__underline___0oAJz",
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsTextComponent={},e.React,e.jsxRuntime)}(this,function(e,t,n){"use strict";function o(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=o(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function r(...e){return function(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=o(e))&&(r&&(r+=" "),r+=t);return r}(e)}var i="component-module__container___VbZSk",l="component-module__text___nFUOn",a="component-module__link___20asF",c="component-module__underline___0oAJz",s="component-module__alignLeft___IOvpO",_="component-module__alignCenter___EIwIC",d="component-module__alignRight___p3ReL",u="component-module__valignTop___-5DmK",f="component-module__valignMiddle___i0are",m="component-module__valignBottom___97zzw";function p(e,t){if(!t)return e;const n=t.split(".");let o=e;for(const e of n){if(null==o)return;if("object"!=typeof o)return;o=o[e]}return o}function g(e){return void 0===e?[]:Array.isArray(e)?e:e&&"object"==typeof e?[e]:[]}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".component-module__container___VbZSk{display:flex;height:100%;width:100%}.component-module__text___nFUOn{display:inline-block;word-break:break-word}.component-module__link___20asF{cursor:pointer;text-decoration:none;transition:opacity .2s ease}.component-module__link___20asF:hover{opacity:.8}.component-module__underline___0oAJz{text-decoration:underline}.component-module__alignLeft___IOvpO{justify-content:flex-start;text-align:left}.component-module__alignCenter___EIwIC{justify-content:center;text-align:center}.component-module__alignRight___p3ReL{justify-content:flex-end;text-align:right}.component-module__valignTop___-5DmK{align-items:flex-start}.component-module__valignMiddle___i0are{align-items:center}.component-module__valignBottom___97zzw{align-items:flex-end}");const y=({ref:e,$data:o,__dataSource:y,fontSize:h=16,fontWeight:x="normal",fontFamily:v="inherit",color:b="#ffffff",textAlign:k="left",verticalAlign:C="middle",lineHeight:j=1.5,letterSpacing:w=0,isLink:M=!1,href:T="",target:A="_blank",underline:I=!1,glowEnable:S=!1,glowColor:E="#00d4ff",glowIntensity:F=1,rotation:z=0,opacity:L=100,background:$="transparent",style:D,onClick:O,onDoubleClick:N,onMouseEnter:R,onMouseLeave:B})=>{const q=t.useMemo(()=>{if(!o)return"";let e=[];if("static"===o.sourceType)e=Array.isArray(o.staticData)?o.staticData:[];else if("global"===o.sourceType&&o.datasourceId){const t=y?.page?.[o.datasourceId];e=g(t)}else if("datasource"===o.sourceType&&o.datasourceId){const t=y?.component?.[o.datasourceId];e=g(t)}const t=function(e,t){return t&&0!==t.length?e.map(e=>{const n={};for(const{componentField:o,sourceField:r}of t)o&&r&&(n[o]=p(e,r));return n}):e}(e,o.fieldMappings);return t.length>0&&void 0!==t[0].text?String(t[0].text):""},[o,y]),H={fontSize:h,fontWeight:x,fontFamily:v,color:b,lineHeight:j,letterSpacing:w,textShadow:S?`0 0 ${10*F}px ${E}, 0 0 ${20*F}px ${E}, 0 0 ${30*F}px ${E}`:void 0},J={...D,transform:0!==z?`rotate(${z}deg)`:void 0,opacity:L/100,backgroundColor:$},K=r(i,(e=>{switch(e){case"left":default:return s;case"center":return _;case"right":return d}})(k),(e=>{switch(e){case"top":return u;case"middle":default:return f;case"bottom":return m}})(C)),U=r(l,M&&a,I&&c);if(M&&T){const t="_blank"===A?"noopener noreferrer":"";return n.jsx("div",{className:K,ref:e,style:J,onClick:O,onDoubleClick:N,onMouseEnter:R,onMouseLeave:B,children:n.jsx("a",{className:U,href:T,rel:t,style:H,target:A,children:q})})}return n.jsx("div",{className:K,ref:e,style:J,onClick:O,onDoubleClick:N,onMouseEnter:R,onMouseLeave:B,children:n.jsx("span",{className:U,style:H,children:q})})};e.Text=y,e.default=y,Object.defineProperty(e,"__esModule",{value:!0})});
|
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsText={},e.React,e.jsxRuntime)}(this,function(e,t,o){"use strict";function n(e){var t,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(o=n(e[t]))&&(r&&(r+=" "),r+=o)}else for(o in e)e[o]&&(r&&(r+=" "),r+=o);return r}function r(...e){return function(){for(var e,t,o=0,r="",a=arguments.length;o<a;o++)(e=arguments[o])&&(t=n(e))&&(r&&(r+=" "),r+=t);return r}(e)}var a="component-module__container___VbZSk",
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsText={},e.React,e.jsxRuntime)}(this,function(e,t,o){"use strict";function n(e){var t,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(o=n(e[t]))&&(r&&(r+=" "),r+=o)}else for(o in e)e[o]&&(r&&(r+=" "),r+=o);return r}function r(...e){return function(){for(var e,t,o=0,r="",a=arguments.length;o<a;o++)(e=arguments[o])&&(t=n(e))&&(r&&(r+=" "),r+=t);return r}(e)}var a="component-module__container___VbZSk",l="component-module__text___nFUOn",i="component-module__link___20asF",s="component-module__underline___0oAJz",c="component-module__alignLeft___IOvpO",p="component-module__alignCenter___EIwIC",d="component-module__alignRight___p3ReL",u="component-module__valignTop___-5DmK",m="component-module__valignMiddle___i0are",f="component-module__valignBottom___97zzw";function g(e,t){if(!t)return e;const o=t.split(".");let n=e;for(const e of o){if(null==n)return;if("object"!=typeof n)return;n=n[e]}return n}function _(e){return void 0===e?[]:Array.isArray(e)?e:e&&"object"==typeof e?[e]:[]}!function(e,t){void 0===t&&(t={});var o=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".component-module__container___VbZSk{display:flex;height:100%;width:100%}.component-module__text___nFUOn{display:inline-block;word-break:break-word}.component-module__link___20asF{cursor:pointer;text-decoration:none;transition:opacity .2s ease}.component-module__link___20asF:hover{opacity:.8}.component-module__underline___0oAJz{text-decoration:underline}.component-module__alignLeft___IOvpO{justify-content:flex-start;text-align:left}.component-module__alignCenter___EIwIC{justify-content:center;text-align:center}.component-module__alignRight___p3ReL{justify-content:flex-end;text-align:right}.component-module__valignTop___-5DmK{align-items:flex-start}.component-module__valignMiddle___i0are{align-items:center}.component-module__valignBottom___97zzw{align-items:flex-end}");const h=(e,t,o)=>({type:"group",title:e,setter:{componentName:"CollapseSetter",props:{icon:!1,...o}},items:t}),x={name:"nodeInfo",title:"节点信息",setter:"NodeInfoSetter",extraProps:{label:!1}},b="EasyEditorMaterialsText",y=e=>({sourceType:"static",staticData:[{text:e}],fieldMappings:[{componentField:"text",sourceField:"text"}]});const S={componentName:b,title:"文本",group:"basic",devMode:"proCode",npm:{package:"@easy-editor/materials-dashboard-text",version:"0.0.16",globalName:b,componentName:b},configure:{props:[{type:"group",title:"属性",setter:"TabSetter",items:[{type:"group",key:"config",title:"配置",items:[x,h("基础配置",[{name:"title",title:"标题",setter:"StringSetter",extraProps:{getValue:e=>e.getExtraPropValue("title"),setValue(e,t){e.setExtraPropValue("title",t)}}},{name:"rect",title:"位置尺寸",setter:"RectSetter",extraProps:{getValue:e=>e.getExtraPropValue("$dashboard.rect"),setValue(e,t){e.setExtraPropValue("$dashboard.rect",t)}}},{name:"rotation",title:"旋转角度",setter:{componentName:"SliderSetter",props:{min:0,max:360,suffix:"°"}},extraProps:{defaultValue:0}},{name:"opacity",title:"不透明度",setter:{componentName:"SliderSetter",props:{min:0,max:100,suffix:"%"}},extraProps:{defaultValue:100}},{name:"background",title:"背景颜色",setter:"ColorSetter",extraProps:{defaultValue:"transparent"}}]),h("组件配置",[{type:"group",title:"组件配置",setter:"SubTabSetter",items:[{type:"group",key:"content",title:"内容",items:[{name:"isLink",title:"作为链接",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"href",title:"链接地址",setter:"StringSetter"},{name:"target",title:"打开方式",setter:{componentName:"SelectSetter",props:{options:[{label:"新窗口",value:"_blank"},{label:"当前窗口",value:"_self"}]}},extraProps:{defaultValue:"_blank"}}]},{type:"group",key:"font",title:"字体",items:[{name:"fontSize",title:"字体大小",setter:"NumberSetter",extraProps:{defaultValue:16}},{name:"fontWeight",title:"字体粗细",setter:{componentName:"SelectSetter",props:{options:[{label:"正常",value:"normal"},{label:"粗体",value:"bold"}]}},extraProps:{defaultValue:"normal"}},{name:"color",title:"颜色",setter:"ColorSetter",extraProps:{defaultValue:"#ffffff"}},{name:"lineHeight",title:"行高",setter:"NumberSetter",extraProps:{defaultValue:1.5}}]},{type:"group",key:"align",title:"对齐",items:[{name:"textAlign",title:"水平对齐",setter:{componentName:"SegmentedSetter",props:{options:[{label:"左",value:"left"},{label:"中",value:"center"},{label:"右",value:"right"}]}},extraProps:{defaultValue:"left"}},{name:"verticalAlign",title:"垂直对齐",setter:{componentName:"SegmentedSetter",props:{options:[{label:"上",value:"top"},{label:"中",value:"middle"},{label:"下",value:"bottom"}]}},extraProps:{defaultValue:"middle"}}]},{type:"group",key:"effect",title:"效果",items:[{name:"underline",title:"下划线",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"glowEnable",title:"发光效果",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"glowColor",title:"发光颜色",setter:"ColorSetter",extraProps:{defaultValue:"#00d4ff"}}]}]}],{padding:"6px 16px 12px"})]},{type:"group",key:"data",title:"数据",items:[x,{name:"$data",title:"数据配置",setter:{componentName:"DataSetter",props:{expectedFields:[{name:"text",label:"text",type:"string",required:!0,description:"文本内容"}],showPreview:!0,previewLimit:10}},extraProps:{label:!1}}]},{type:"group",key:"advanced",title:"高级",items:[x,h("事件绑定",[{name:"events",title:"事件",setter:{componentName:"EventSetter",props:{events:[{title:"点击事件",children:[{label:"点击",value:"onClick",description:"鼠标点击时触发"},{label:"双击",value:"onDoubleClick",description:"鼠标双击时触发"}]},{title:"鼠标事件",children:[{label:"鼠标进入",value:"onMouseEnter",description:"鼠标进入时触发"},{label:"鼠标离开",value:"onMouseLeave",description:"鼠标离开时触发"}]}]}},extraProps:{label:!1}}]),h("高级配置",[{title:"条件渲染",setter:"SwitchSetter",extraProps:{supportVariable:!0,getValue:e=>e.getNode().getExtraPropValue("condition"),setValue(e,t){e.getNode().setExtraProp("condition",t)}}}])]}]}],component:{},supports:{},advanced:{}},snippets:[{title:"普通文本",screenshot:"",schema:{componentName:b,title:"普通文本",props:{fontSize:16,color:"#ffffff",rotation:0,opacity:100,background:"transparent",$data:y("普通文本")},$dashboard:{rect:{width:120,height:40}}}},{title:"标题文本",screenshot:"",schema:{componentName:b,title:"标题文本",props:{fontSize:32,fontWeight:"bold",color:"#ffffff",textAlign:"center",rotation:0,opacity:100,background:"transparent",$data:y("标题文本")},$dashboard:{rect:{width:200,height:60}}}},{title:"发光标题",screenshot:"",schema:{componentName:b,title:"发光标题",props:{fontSize:36,fontWeight:"bold",color:"#00d4ff",textAlign:"center",glowEnable:!0,glowColor:"#00d4ff",glowIntensity:1.5,rotation:0,opacity:100,background:"transparent",$data:y("发光标题")},$dashboard:{rect:{width:240,height:80}}}},{title:"链接文本",screenshot:"",schema:{componentName:b,title:"链接文本",props:{fontSize:16,color:"#00d4ff",isLink:!0,href:"https://easy-editor-docs.vercel.app/",target:"_blank",underline:!0,rotation:0,opacity:100,background:"transparent",$data:y("点击跳转")},$dashboard:{rect:{width:120,height:40}}}},{title:"标签文本",screenshot:"",schema:{componentName:b,title:"标签文本",props:{fontSize:14,color:"#ffffff",textAlign:"center",verticalAlign:"middle",rotation:0,opacity:100,background:"rgba(0, 212, 255, 0.2)",$data:y("标签")},$dashboard:{rect:{width:80,height:32}}}}]};e.component=({ref:e,$data:n,__dataSource:h,fontSize:x=16,fontWeight:b="normal",fontFamily:y="inherit",color:S="#ffffff",textAlign:v="left",verticalAlign:k="middle",lineHeight:w=1.5,letterSpacing:N=0,isLink:V=!1,href:P="",target:C="_blank",underline:E=!1,glowEnable:$=!1,glowColor:A="#00d4ff",glowIntensity:M=1,rotation:T=0,opacity:j=100,background:z="transparent",style:I,onClick:F,onDoubleClick:L,onMouseEnter:D,onMouseLeave:R})=>{const O=t.useMemo(()=>{if(!n)return"";let e=[];if("static"===n.sourceType)e=Array.isArray(n.staticData)?n.staticData:[];else if("global"===n.sourceType&&n.datasourceId){const t=h?.page?.[n.datasourceId];e=_(t)}else if("datasource"===n.sourceType&&n.datasourceId){const t=h?.component?.[n.datasourceId];e=_(t)}const t=function(e,t){return t&&0!==t.length?e.map(e=>{const o={};for(const{componentField:n,sourceField:r}of t)n&&r&&(o[n]=g(e,r));return o}):e}(e,n.fieldMappings);return t.length>0&&void 0!==t[0].text?String(t[0].text):""},[n,h]),W={fontSize:x,fontWeight:b,fontFamily:y,color:S,lineHeight:w,letterSpacing:N,textShadow:$?`0 0 ${10*M}px ${A}, 0 0 ${20*M}px ${A}, 0 0 ${30*M}px ${A}`:void 0},B={...I,transform:0!==T?`rotate(${T}deg)`:void 0,opacity:j/100,backgroundColor:z},q=r(a,(e=>{switch(e){case"left":default:return c;case"center":return p;case"right":return d}})(v),(e=>{switch(e){case"top":return u;case"middle":default:return m;case"bottom":return f}})(k)),H=r(l,V&&i,E&&s);if(V&&P){const t="_blank"===C?"noopener noreferrer":"";return o.jsx("div",{className:q,ref:e,style:B,onClick:F,onDoubleClick:L,onMouseEnter:D,onMouseLeave:R,children:o.jsx("a",{className:H,href:P,rel:t,style:W,target:C,children:O})})}return o.jsx("div",{className:q,ref:e,style:B,onClick:F,onDoubleClick:L,onMouseEnter:D,onMouseLeave:R,children:o.jsx("span",{className:H,style:W,children:O})})},e.meta=S});
|
package/dist/meta.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsTextMeta={})}(this,function(e){"use strict";const t=(e,t,a)=>({type:"group",title:e,setter:{componentName:"CollapseSetter",props:{icon:!1,...a}},items:t}),a={name:"nodeInfo",title:"节点信息",setter:"NodeInfoSetter",extraProps:{label:!1}},o="EasyEditorMaterialsText";const
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsTextMeta={})}(this,function(e){"use strict";const t=(e,t,a)=>({type:"group",title:e,setter:{componentName:"CollapseSetter",props:{icon:!1,...a}},items:t}),a={name:"nodeInfo",title:"节点信息",setter:"NodeInfoSetter",extraProps:{label:!1}},o="EasyEditorMaterialsText",r=e=>({sourceType:"static",staticData:[{text:e}],fieldMappings:[{componentField:"text",sourceField:"text"}]});const l={componentName:o,title:"文本",group:"basic",devMode:"proCode",npm:{package:"@easy-editor/materials-dashboard-text",version:"0.0.16",globalName:o,componentName:o},configure:{props:[{type:"group",title:"属性",setter:"TabSetter",items:[{type:"group",key:"config",title:"配置",items:[a,t("基础配置",[{name:"title",title:"标题",setter:"StringSetter",extraProps:{getValue:e=>e.getExtraPropValue("title"),setValue(e,t){e.setExtraPropValue("title",t)}}},{name:"rect",title:"位置尺寸",setter:"RectSetter",extraProps:{getValue:e=>e.getExtraPropValue("$dashboard.rect"),setValue(e,t){e.setExtraPropValue("$dashboard.rect",t)}}},{name:"rotation",title:"旋转角度",setter:{componentName:"SliderSetter",props:{min:0,max:360,suffix:"°"}},extraProps:{defaultValue:0}},{name:"opacity",title:"不透明度",setter:{componentName:"SliderSetter",props:{min:0,max:100,suffix:"%"}},extraProps:{defaultValue:100}},{name:"background",title:"背景颜色",setter:"ColorSetter",extraProps:{defaultValue:"transparent"}}]),t("组件配置",[{type:"group",title:"组件配置",setter:"SubTabSetter",items:[{type:"group",key:"content",title:"内容",items:[{name:"isLink",title:"作为链接",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"href",title:"链接地址",setter:"StringSetter"},{name:"target",title:"打开方式",setter:{componentName:"SelectSetter",props:{options:[{label:"新窗口",value:"_blank"},{label:"当前窗口",value:"_self"}]}},extraProps:{defaultValue:"_blank"}}]},{type:"group",key:"font",title:"字体",items:[{name:"fontSize",title:"字体大小",setter:"NumberSetter",extraProps:{defaultValue:16}},{name:"fontWeight",title:"字体粗细",setter:{componentName:"SelectSetter",props:{options:[{label:"正常",value:"normal"},{label:"粗体",value:"bold"}]}},extraProps:{defaultValue:"normal"}},{name:"color",title:"颜色",setter:"ColorSetter",extraProps:{defaultValue:"#ffffff"}},{name:"lineHeight",title:"行高",setter:"NumberSetter",extraProps:{defaultValue:1.5}}]},{type:"group",key:"align",title:"对齐",items:[{name:"textAlign",title:"水平对齐",setter:{componentName:"SegmentedSetter",props:{options:[{label:"左",value:"left"},{label:"中",value:"center"},{label:"右",value:"right"}]}},extraProps:{defaultValue:"left"}},{name:"verticalAlign",title:"垂直对齐",setter:{componentName:"SegmentedSetter",props:{options:[{label:"上",value:"top"},{label:"中",value:"middle"},{label:"下",value:"bottom"}]}},extraProps:{defaultValue:"middle"}}]},{type:"group",key:"effect",title:"效果",items:[{name:"underline",title:"下划线",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"glowEnable",title:"发光效果",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"glowColor",title:"发光颜色",setter:"ColorSetter",extraProps:{defaultValue:"#00d4ff"}}]}]}],{padding:"6px 16px 12px"})]},{type:"group",key:"data",title:"数据",items:[a,{name:"$data",title:"数据配置",setter:{componentName:"DataSetter",props:{expectedFields:[{name:"text",label:"text",type:"string",required:!0,description:"文本内容"}],showPreview:!0,previewLimit:10}},extraProps:{label:!1}}]},{type:"group",key:"advanced",title:"高级",items:[a,t("事件绑定",[{name:"events",title:"事件",setter:{componentName:"EventSetter",props:{events:[{title:"点击事件",children:[{label:"点击",value:"onClick",description:"鼠标点击时触发"},{label:"双击",value:"onDoubleClick",description:"鼠标双击时触发"}]},{title:"鼠标事件",children:[{label:"鼠标进入",value:"onMouseEnter",description:"鼠标进入时触发"},{label:"鼠标离开",value:"onMouseLeave",description:"鼠标离开时触发"}]}]}},extraProps:{label:!1}}]),t("高级配置",[{title:"条件渲染",setter:"SwitchSetter",extraProps:{supportVariable:!0,getValue:e=>e.getNode().getExtraPropValue("condition"),setValue(e,t){e.getNode().setExtraProp("condition",t)}}}])]}]}],component:{},supports:{},advanced:{}},snippets:[{title:"普通文本",screenshot:"",schema:{componentName:o,title:"普通文本",props:{fontSize:16,color:"#ffffff",rotation:0,opacity:100,background:"transparent",$data:r("普通文本")},$dashboard:{rect:{width:120,height:40}}}},{title:"标题文本",screenshot:"",schema:{componentName:o,title:"标题文本",props:{fontSize:32,fontWeight:"bold",color:"#ffffff",textAlign:"center",rotation:0,opacity:100,background:"transparent",$data:r("标题文本")},$dashboard:{rect:{width:200,height:60}}}},{title:"发光标题",screenshot:"",schema:{componentName:o,title:"发光标题",props:{fontSize:36,fontWeight:"bold",color:"#00d4ff",textAlign:"center",glowEnable:!0,glowColor:"#00d4ff",glowIntensity:1.5,rotation:0,opacity:100,background:"transparent",$data:r("发光标题")},$dashboard:{rect:{width:240,height:80}}}},{title:"链接文本",screenshot:"",schema:{componentName:o,title:"链接文本",props:{fontSize:16,color:"#00d4ff",isLink:!0,href:"https://easy-editor-docs.vercel.app/",target:"_blank",underline:!0,rotation:0,opacity:100,background:"transparent",$data:r("点击跳转")},$dashboard:{rect:{width:120,height:40}}}},{title:"标签文本",screenshot:"",schema:{componentName:o,title:"标签文本",props:{fontSize:14,color:"#ffffff",textAlign:"center",verticalAlign:"middle",rotation:0,opacity:100,background:"rgba(0, 212, 255, 0.2)",$data:r("标签")},$dashboard:{rect:{width:80,height:32}}}}]};e.meta=l});
|
package/package.json
CHANGED
package/src/component.tsx
CHANGED
|
@@ -123,6 +123,11 @@ export interface TextProps {
|
|
|
123
123
|
condition?: boolean
|
|
124
124
|
/** 外部样式 */
|
|
125
125
|
style?: CSSProperties
|
|
126
|
+
/** 事件处理 */
|
|
127
|
+
onClick?: (e: React.MouseEvent) => void
|
|
128
|
+
onDoubleClick?: (e: React.MouseEvent) => void
|
|
129
|
+
onMouseEnter?: (e: React.MouseEvent) => void
|
|
130
|
+
onMouseLeave?: (e: React.MouseEvent) => void
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
const getAlignClass = (align: TextAlign): string => {
|
|
@@ -174,6 +179,10 @@ export const Text: React.FC<TextProps> = ({
|
|
|
174
179
|
opacity = 100,
|
|
175
180
|
background = 'transparent',
|
|
176
181
|
style: externalStyle,
|
|
182
|
+
onClick,
|
|
183
|
+
onDoubleClick,
|
|
184
|
+
onMouseEnter,
|
|
185
|
+
onMouseLeave,
|
|
177
186
|
}) => {
|
|
178
187
|
// 解析数据配置,获取实际显示内容
|
|
179
188
|
const resolvedContent = useMemo(() => {
|
|
@@ -240,7 +249,15 @@ export const Text: React.FC<TextProps> = ({
|
|
|
240
249
|
if (isLink && href) {
|
|
241
250
|
const relValue = target === '_blank' ? 'noopener noreferrer' : ''
|
|
242
251
|
return (
|
|
243
|
-
<div
|
|
252
|
+
<div
|
|
253
|
+
className={containerClass}
|
|
254
|
+
ref={ref}
|
|
255
|
+
style={containerStyle}
|
|
256
|
+
onClick={onClick}
|
|
257
|
+
onDoubleClick={onDoubleClick}
|
|
258
|
+
onMouseEnter={onMouseEnter}
|
|
259
|
+
onMouseLeave={onMouseLeave}
|
|
260
|
+
>
|
|
244
261
|
<a className={textClass} href={href} rel={relValue} style={textStyle} target={target}>
|
|
245
262
|
{resolvedContent}
|
|
246
263
|
</a>
|
|
@@ -250,7 +267,15 @@ export const Text: React.FC<TextProps> = ({
|
|
|
250
267
|
|
|
251
268
|
// 普通文本
|
|
252
269
|
return (
|
|
253
|
-
<div
|
|
270
|
+
<div
|
|
271
|
+
className={containerClass}
|
|
272
|
+
ref={ref}
|
|
273
|
+
style={containerStyle}
|
|
274
|
+
onClick={onClick}
|
|
275
|
+
onDoubleClick={onDoubleClick}
|
|
276
|
+
onMouseEnter={onMouseEnter}
|
|
277
|
+
onMouseLeave={onMouseLeave}
|
|
278
|
+
>
|
|
254
279
|
<span className={textClass} style={textStyle}>
|
|
255
280
|
{resolvedContent}
|
|
256
281
|
</span>
|
package/src/configure.ts
CHANGED
package/src/snippets.ts
CHANGED
|
@@ -12,7 +12,7 @@ const generateStaticDataSource = (text: string) => {
|
|
|
12
12
|
sourceType: "static",
|
|
13
13
|
staticData: [
|
|
14
14
|
{
|
|
15
|
-
text
|
|
15
|
+
text
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
fieldMappings: [
|
|
@@ -131,7 +131,6 @@ export const snippets: Snippet[] = [
|
|
|
131
131
|
componentName: COMPONENT_NAME,
|
|
132
132
|
title: '标签文本',
|
|
133
133
|
props: {
|
|
134
|
-
content: '标签',
|
|
135
134
|
fontSize: 14,
|
|
136
135
|
color: '#ffffff',
|
|
137
136
|
textAlign: 'center',
|
|
@@ -139,6 +138,7 @@ export const snippets: Snippet[] = [
|
|
|
139
138
|
rotation: 0,
|
|
140
139
|
opacity: 100,
|
|
141
140
|
background: 'rgba(0, 212, 255, 0.2)',
|
|
141
|
+
$data: generateStaticDataSource('标签'),
|
|
142
142
|
},
|
|
143
143
|
$dashboard: {
|
|
144
144
|
rect: {
|