@univerjs/sheets-conditional-formatting-ui 0.5.3-experimental.20250106-e3b7a39 → 0.5.3-experimental.20250107-3e6579c

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/lib/cjs/index.js CHANGED
@@ -28,7 +28,7 @@
28
28
  ${d===q?pe.active:""}
29
29
  `,onClick:ne=>{ne.stopPropagation(),L(H),T([])},children:x.jsx(Pt,{})})]})},`${H.cfId}`))}):null})]})},xi="univer-cf-color-picker",Ei="univer-cf-color-picker-icon",Oi="univer-icon-dropdown",Qt={cfColorPicker:xi,cfColorPickerIcon:Ei,iconDropdown:Oi},Ne=t=>{const{color:e,onChange:r,disable:n=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:l=!0}=t,v=S.useDependency(me.ComponentManager),p=N.useMemo(()=>new S.ColorKit(e),[e]),b=v.get(o);return b&&(n?x.jsx(b,{className:i,extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}):x.jsx(re.DropdownLegacy,{overlay:x.jsx("div",{className:`
30
30
  ${Qt.cfColorPicker}
31
- `,children:x.jsx(re.ColorPicker,{color:e,onChange:r})}),children:x.jsxs("span",{className:`
31
+ `,children:x.jsx(re.ColorPicker,{value:e,onChange:r})}),children:x.jsxs("span",{className:`
32
32
  ${Qt.cfColorPickerIcon}
33
33
  ${i}
34
34
  `,children:[x.jsx(b,{extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}),l&&x.jsx(qt,{className:Qt.iconDropdown})]})}))},Pi="univer-cf-rule-style-editor",Mi="univer-cf-preview-wrap",Fi="univer-text",Di="univer-position-relative",Ni="univer-btn-list",ji="univer-util-item",Li="univer-icon-set",Ui="univer-render-config",Vi="univer-flex",$i="univer-width45",zi="univer-icon-wrap",Ai="univer-icon",qi="univer-dropdown-icon",Wi="univer-error-input",Hi="univer-error-text",ki="univer-icon-group-list",Bi="univer-title",Gi="univer-group",Xi="univer-item-content",Yi="univer-item-wrap",Ki="univer-item",Zi="univer-icon-item-list-wrap",Ji="univer-none",Qi="univer-icon-item-list",ea="univer-width100",ta="univer-stress",k={cfRuleStyleEditor:Pi,cfPreviewWrap:Mi,text:Fi,positionRelative:Di,btnList:Ni,utilItem:ji,iconSet:Li,renderConfig:Ui,flex:Vi,width45:$i,iconWrap:zi,icon:Ai,dropdownIcon:qi,errorInput:Wi,errorText:Hi,iconGroupList:ki,title:Bi,group:Gi,itemContent:Xi,itemWrap:Yi,item:Ki,iconItemListWrap:Zi,none:Ji,iconItemList:Qi,width100:ea,stress:ta},De=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),en=t=>{var T;const{type:e,className:r,onChange:n,id:o,value:i}=t,l=S.useDependency(S.IUniverInstanceService),v=l.getCurrentUnitForType(S.UniverInstanceType.UNIVER_SHEET).getUnitId(),p=(T=l.getCurrentUnitForType(S.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:T.getSheetId(),b=N.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),m=N.useMemo(()=>[c.CFValueType.max,c.CFValueType.min,"none"].includes(e)?{disabled:!0}:[c.CFValueType.percent,c.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),R=N.useRef({}),[_,I]=N.useState(!1);return me.useSidebarClick(w=>{var a;const h=(a=R.current)==null?void 0:a.handleOutClick;h&&h(w,()=>I(!1))}),e===c.CFValueType.formula?x.jsx("div",{style:{width:"100%",marginLeft:4},children:x.jsx(pt.FormulaEditor,{initValue:b,unitId:v,subUnitId:p,isFocus:_,onChange:(w="")=>{n(w||"")},onFocus:()=>I(!0),actions:R.current})}):x.jsx(re.InputNumber,{className:r,value:Number(t.value)||0,onChange:w=>t.onChange(w||0),...m})},na=t=>{var L;const{interceptorManager:e}=t,r=S.useDependency(S.LocaleService),n=((L=t.rule)==null?void 0:L.type)===c.CFRuleType.colorScale?t.rule:void 0,o=[De(c.CFValueType.num,r),De(c.CFValueType.percent,r),De(c.CFValueType.percentile,r),De(c.CFValueType.formula,r)],i=[De(c.CFValueType.min,r),...o],l=[De("none",r),...o],v=[De(c.CFValueType.max,r),...o],[p,b]=N.useState(()=>{var F;const E=c.CFValueType.min;return n&&((F=n.config[0])==null?void 0:F.value.type)||E}),[m,R]=N.useState(()=>{var F;const E="none";return!n||n.config.length!==3?E:((F=n.config[1])==null?void 0:F.value.type)||E}),[_,I]=N.useState(()=>{var F;const E=c.CFValueType.max;return n&&((F=n.config[n.config.length-1])==null?void 0:F.value.type)||E}),[T,w]=N.useState(()=>{if(!n)return 10;const F=n.config[0];return(F==null?void 0:F.value.value)===void 0?10:F==null?void 0:F.value.value}),[h,a]=N.useState(()=>{var z;if(!n||n.config.length!==3)return 50;const F=(z=n.config[1])==null?void 0:z.value.value;return F===void 0?50:F}),[s,d]=N.useState(()=>{var z;if(!n)return 90;const F=(z=n.config[n.config.length-1])==null?void 0:z.value.value;return F===void 0?90:F}),[y,u]=N.useState(()=>{var F;const E="#d0d9fb";return n&&((F=n.config[0])==null?void 0:F.color)||E}),[g,f]=N.useState(()=>{var F;const E="#7790f3";return!n||n.config.length!==3?E:((F=n.config[1])==null?void 0:F.color)||E}),[C,M]=N.useState(()=>{var F;const E="#2e55ef";return n&&((F=n.config[n.config.length-1])==null?void 0:F.color)||E}),j=N.useMemo(()=>E=>{const{minType:F,medianType:z,maxType:B,minValue:X,medianValue:te,maxValue:Q,minColor:H,medianColor:q,maxColor:ne}=E,oe=[];return oe.push({color:H,value:{type:F,value:X}}),z!=="none"&&oe.push({color:q,value:{type:z,value:te}}),oe.push({color:ne,value:{type:B,value:Q}}),{config:oe.map((fe,ge)=>({...fe,index:ge})),type:c.CFRuleType.colorScale}},[]);N.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return j({minType:p,medianType:m,maxType:_,minValue:T,medianValue:h,maxValue:s,minColor:y,medianColor:g,maxColor:C})}}),[j,p,m,_,T,h,s,y,g,C,e]);const U=E=>{t.onChange(j(E))};return x.jsxs("div",{children:[x.jsx("div",{className:$.title,children:r.t("sheet.cf.panel.styleRule")}),x.jsx("div",{className:`
package/lib/es/index.js CHANGED
@@ -4752,7 +4752,7 @@ const Za = (t) => {
4752
4752
  className: `
4753
4753
  ${Gn.cfColorPicker}
4754
4754
  `,
4755
- children: /* @__PURE__ */ x.jsx(Qi, { color: e, onChange: r })
4755
+ children: /* @__PURE__ */ x.jsx(Qi, { value: e, onChange: r })
4756
4756
  }
4757
4757
  ),
4758
4758
  children: /* @__PURE__ */ x.jsxs(
package/lib/umd/index.js CHANGED
@@ -28,7 +28,7 @@
28
28
  ${d===k?pe.active:""}
29
29
  `,onClick:oe=>{oe.stopPropagation(),U(F),T([])},children:_.jsx(Ct,{})})]})},`${F.cfId}`))}):null})]})},gn={cfColorPicker:"univer-cf-color-picker",cfColorPickerIcon:"univer-cf-color-picker-icon",iconDropdown:"univer-icon-dropdown"},De=t=>{const{color:e,onChange:r,disable:n=!1,iconId:o="PaintBucket",className:i,isNeedDropdownIcon:l=!0}=t,y=v.useDependency(ge.ComponentManager),p=j.useMemo(()=>new v.ColorKit(e),[e]),R=y.get(o);return R&&(n?_.jsx(R,{className:i,extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}):_.jsx(re.DropdownLegacy,{overlay:_.jsx("div",{className:`
30
30
  ${gn.cfColorPicker}
31
- `,children:_.jsx(re.ColorPicker,{color:e,onChange:r})}),children:_.jsxs("span",{className:`
31
+ `,children:_.jsx(re.ColorPicker,{value:e,onChange:r})}),children:_.jsxs("span",{className:`
32
32
  ${gn.cfColorPickerIcon}
33
33
  ${i}
34
34
  `,children:[_.jsx(R,{extend:{colorChannel1:p.isValid?e:"rgb(var(--primary-color))"}}),l&&_.jsx(Tt,{className:gn.iconDropdown})]})}))},G={cfRuleStyleEditor:"univer-cf-rule-style-editor",cfPreviewWrap:"univer-cf-preview-wrap",text:"univer-text",positionRelative:"univer-position-relative",btnList:"univer-btn-list",utilItem:"univer-util-item",iconSet:"univer-icon-set",renderConfig:"univer-render-config",flex:"univer-flex",width45:"univer-width45",iconWrap:"univer-icon-wrap",icon:"univer-icon",dropdownIcon:"univer-dropdown-icon",errorInput:"univer-error-input",errorText:"univer-error-text",iconGroupList:"univer-icon-group-list",title:"univer-title",group:"univer-group",itemContent:"univer-item-content",itemWrap:"univer-item-wrap",item:"univer-item",iconItemListWrap:"univer-icon-item-list-wrap",none:"univer-none",iconItemList:"univer-icon-item-list",width100:"univer-width100",stress:"univer-stress"},Ne=(t,e)=>({label:e.t(`sheet.cf.valueType.${t}`),value:t}),vn=t=>{var T;const{type:e,className:r,onChange:n,id:o,value:i}=t,l=v.useDependency(v.IUniverInstanceService),y=l.getCurrentUnitForType(v.UniverInstanceType.UNIVER_SHEET).getUnitId(),p=(T=l.getCurrentUnitForType(v.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:T.getSheetId(),R=j.useMemo(()=>String(i).startsWith("=")?String(i):"=",[i]),m=j.useMemo(()=>[u.CFValueType.max,u.CFValueType.min,"none"].includes(e)?{disabled:!0}:[u.CFValueType.percent,u.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),C=j.useRef({}),[x,I]=j.useState(!1);return ge.useSidebarClick(w=>{var a;const h=(a=C.current)==null?void 0:a.handleOutClick;h&&h(w,()=>I(!1))}),e===u.CFValueType.formula?_.jsx("div",{style:{width:"100%",marginLeft:4},children:_.jsx(Ge.FormulaEditor,{initValue:R,unitId:y,subUnitId:p,isFocus:x,onChange:(w="")=>{n(w||"")},onFocus:()=>I(!0),actions:C.current})}):_.jsx(re.InputNumber,{className:r,value:Number(t.value)||0,onChange:w=>t.onChange(w||0),...m})},Wo=t=>{var U;const{interceptorManager:e}=t,r=v.useDependency(v.LocaleService),n=((U=t.rule)==null?void 0:U.type)===u.CFRuleType.colorScale?t.rule:void 0,o=[Ne(u.CFValueType.num,r),Ne(u.CFValueType.percent,r),Ne(u.CFValueType.percentile,r),Ne(u.CFValueType.formula,r)],i=[Ne(u.CFValueType.min,r),...o],l=[Ne("none",r),...o],y=[Ne(u.CFValueType.max,r),...o],[p,R]=j.useState(()=>{var D;const E=u.CFValueType.min;return n&&((D=n.config[0])==null?void 0:D.value.type)||E}),[m,C]=j.useState(()=>{var D;const E="none";return!n||n.config.length!==3?E:((D=n.config[1])==null?void 0:D.value.type)||E}),[x,I]=j.useState(()=>{var D;const E=u.CFValueType.max;return n&&((D=n.config[n.config.length-1])==null?void 0:D.value.type)||E}),[T,w]=j.useState(()=>{if(!n)return 10;const D=n.config[0];return(D==null?void 0:D.value.value)===void 0?10:D==null?void 0:D.value.value}),[h,a]=j.useState(()=>{var W;if(!n||n.config.length!==3)return 50;const D=(W=n.config[1])==null?void 0:W.value.value;return D===void 0?50:D}),[s,d]=j.useState(()=>{var W;if(!n)return 90;const D=(W=n.config[n.config.length-1])==null?void 0:W.value.value;return D===void 0?90:D}),[S,c]=j.useState(()=>{var D;const E="#d0d9fb";return n&&((D=n.config[0])==null?void 0:D.color)||E}),[g,f]=j.useState(()=>{var D;const E="#7790f3";return!n||n.config.length!==3?E:((D=n.config[1])==null?void 0:D.color)||E}),[b,M]=j.useState(()=>{var D;const E="#2e55ef";return n&&((D=n.config[n.config.length-1])==null?void 0:D.color)||E}),L=j.useMemo(()=>E=>{const{minType:D,medianType:W,maxType:X,minValue:Y,medianValue:ne,maxValue:ee,minColor:F,medianColor:k,maxColor:oe}=E,ae=[];return ae.push({color:F,value:{type:D,value:Y}}),W!=="none"&&ae.push({color:k,value:{type:W,value:ne}}),ae.push({color:oe,value:{type:X,value:ee}}),{config:ae.map((he,ye)=>({...he,index:ye})),type:u.CFRuleType.colorScale}},[]);j.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return L({minType:p,medianType:m,maxType:x,minValue:T,medianValue:h,maxValue:s,minColor:S,medianColor:g,maxColor:b})}}),[L,p,m,x,T,h,s,S,g,b,e]);const V=E=>{t.onChange(L(E))};return _.jsxs("div",{children:[_.jsx("div",{className:A.title,children:r.t("sheet.cf.panel.styleRule")}),_.jsx("div",{className:`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-conditional-formatting-ui",
3
- "version": "0.5.3-experimental.20250106-e3b7a39",
3
+ "version": "0.5.3-experimental.20250107-3e6579c",
4
4
  "private": false,
5
5
  "description": "Conditional formatting plugin for Univer Sheets",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -55,19 +55,19 @@
55
55
  "rxjs": ">=7.0.0"
56
56
  },
57
57
  "dependencies": {
58
- "@univerjs/icons": "^0.2.10",
58
+ "@univerjs/icons": "^0.2.11",
59
59
  "clsx": "^2.1.1",
60
60
  "react-grid-layout": "^1.4.4",
61
61
  "react-resizable": "^3.0.5",
62
- "@univerjs/core": "0.5.3-experimental.20250106-e3b7a39",
63
- "@univerjs/design": "0.5.3-experimental.20250106-e3b7a39",
64
- "@univerjs/engine-formula": "0.5.3-experimental.20250106-e3b7a39",
65
- "@univerjs/engine-render": "0.5.3-experimental.20250106-e3b7a39",
66
- "@univerjs/sheets": "0.5.3-experimental.20250106-e3b7a39",
67
- "@univerjs/sheets-formula-ui": "0.5.3-experimental.20250106-e3b7a39",
68
- "@univerjs/sheets-ui": "0.5.3-experimental.20250106-e3b7a39",
69
- "@univerjs/sheets-conditional-formatting": "0.5.3-experimental.20250106-e3b7a39",
70
- "@univerjs/ui": "0.5.3-experimental.20250106-e3b7a39"
62
+ "@univerjs/design": "0.5.3-experimental.20250107-3e6579c",
63
+ "@univerjs/engine-formula": "0.5.3-experimental.20250107-3e6579c",
64
+ "@univerjs/engine-render": "0.5.3-experimental.20250107-3e6579c",
65
+ "@univerjs/core": "0.5.3-experimental.20250107-3e6579c",
66
+ "@univerjs/sheets-conditional-formatting": "0.5.3-experimental.20250107-3e6579c",
67
+ "@univerjs/sheets": "0.5.3-experimental.20250107-3e6579c",
68
+ "@univerjs/sheets-ui": "0.5.3-experimental.20250107-3e6579c",
69
+ "@univerjs/ui": "0.5.3-experimental.20250107-3e6579c",
70
+ "@univerjs/sheets-formula-ui": "0.5.3-experimental.20250107-3e6579c"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/react-grid-layout": "^1.3.5",