@splunk/dynamic-editors 0.38.0 → 0.38.1

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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.38.1](https://cd.splunkdev.com/devplat/splunk-dynamic-editors/compare/v0.38.0...v0.38.1) (2025-09-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **SCP-75614:** series color by field name state issue ([b5f5619](https://cd.splunkdev.com/devplat/splunk-dynamic-editors/commits/b5f5619e7c36a79136575315a6c798316e971645))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.38.0](https://cd.splunkdev.com/devplat/splunk-dynamic-editors/compare/v0.37.5...v0.38.0) (2025-08-29)
7
18
 
8
19
 
package/DynamicEditor.js CHANGED
@@ -202,7 +202,7 @@
202
202
  height: 412px;
203
203
  overflow-y: auto;
204
204
  padding: 8px 10px;
205
- `;t.ColorFlyoutEditor=({colors:e,CustomColorMatchEditor:t,handleColorRemove:o,handleColorChange:a,flyoutTitle:n,addColorButtonLabel:r,handleColorAdd:l,handleColorMove:s})=>{const u=(0,i.useMemo)((()=>e.map(((e,n)=>{const r=null==t;return i.default.createElement(p.default.Row,{index:n,key:(0,m.createDOMID)(),"data-color":e,onRequestRemove:o},i.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},i.default.createElement(C.default,{value:e,key:(0,m.createDOMID)(),onChange:a(n),hideLabel:!0,label:" ",name:"color",style:{marginBottom:0,marginTop:0,width:r?"100%":32},showTextInput:r}),"function"==typeof t&&i.default.createElement(t,{index:n})))}))),[e,t,o,a]);return i.default.createElement(j,{"data-test":"MultiColorPickerFlyoutContent"},i.default.createElement(P,{"data-test":"MultiColorPickerFlyoutTitle"},n),i.default.createElement(w,null,i.default.createElement(p.default,{addLabel:r,onRequestAdd:l,onRequestMove:s,"data-test":"ColorListEditor"},u)))};let T=0;const S=({CustomColorMatchEditor:e,onChange:o=c.noop,canReorderColors:a=!0,value:n=h.VIZ_CATEGORICAL,flyoutTitle:r=(0,f._)("Customize colors"),addColorButtonLabel:l=(0,f._)("Add color"),name:s="seriesColors",label:u="",labelPosition:d="top",labelWidth:p,isDisabled:g=!1,hideLabel:v=!0,canAddNewColors:C=!0})=>{const[j,P]=(0,i.useState)(!1),[w,S]=(0,i.useState)(n),D=(0,i.useRef)(null);(0,i.useEffect)((()=>{S(n)}),[n]);const M=(0,i.useCallback)((()=>{o(null,s,[...w,h.VIZ_CATEGORICAL[T%h.VIZ_CATEGORICAL.length]]),T+=1}),[s,o,w]),k=(0,i.useCallback)((e=>(t,a,n)=>{const r=[...w];r.splice(e,1,n),o(null,s,r)}),[s,o,w]),F=(0,i.useCallback)(((e,{index:t})=>{const a=[...w];a.splice(t,1),o(null,s,a)}),[s,o,w]),R=(0,i.useCallback)((({fromIndex:e,toIndex:t})=>{const a=[...w],n=a[e];a.splice(e,1),a.splice(t,0,n),o(null,s,a)}),[s,o,w]),B=(0,i.useCallback)((({event:e,reason:t})=>{var o;(null===(o=null==e?void 0:e.srcElement)||void 0===o?void 0:o.sortableHandle)||P(!1),"escapeKey"===t&&D.current.focus()}),[]),A=(0,i.useMemo)((()=>w.map((e=>i.default.createElement(x,{color:e,key:(0,m.createDOMID)()})))),[w]),I=(0,i.useCallback)((()=>{P((e=>!e))}),[]);return i.default.createElement(y.default,{label:u,labelPosition:d,labelWidth:p,hideLabel:v,"data-test":"MultiColorPickerEditor"},i.default.createElement(E,{inline:!1,"data-test":"MultiColorPickerButton",appearance:"default",ref:D,onClick:I,disabled:g,style:O},A),i.default.createElement(b.default,{"data-test":"MultiColorPickerFlyout",open:j,anchor:D.current,defaultPlacement:"horizontal",style:_,onRequestClose:B,takeFocus:!0},i.default.createElement(t.ColorFlyoutEditor,{colors:w,CustomColorMatchEditor:e,handleColorRemove:F,handleColorChange:k,handleColorAdd:C?M:void 0,handleColorMove:a?R:void 0,flyoutTitle:r,addColorButtonLabel:l})))};S.propTypes=Object.assign(Object.assign({},v.BaseEditorPropTypes),{canReorderColors:s.bool,canAddNewColors:s.bool,value:s.arrayOf(s.string),flyoutTitle:s.string,addColorButtonLabel:s.string,CustomColorMatchEditor:s.func,hideLabel:s.bool}),t.default=S},4215:function(e,t,o){var a=this&&this.__createBinding||(Object.create?function(e,t,o,a){void 0===a&&(a=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,a,n)}:function(e,t,o,a){void 0===a&&(a=o),e[a]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&a(t,e,o);return n(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(o(9497)),s=l(o(232)),u=l(o(4566)),c=l(o(7020)),d=l(o(1551)),f=l(o(6769)),p=o(3563),m=l(o(1668)),g=l(o(4008)),b=(0,s.default)(m.default)`
205
+ `;t.ColorFlyoutEditor=({colors:e,CustomColorMatchEditor:t,handleColorRemove:o,handleColorChange:a,flyoutTitle:n,addColorButtonLabel:r,handleColorAdd:l,handleColorMove:s})=>{const u=(0,i.useMemo)((()=>e.map(((e,n)=>{const r=null==t;return i.default.createElement(p.default.Row,{index:n,key:(0,m.createDOMID)(),"data-color":e,onRequestRemove:o},i.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},i.default.createElement(C.default,{value:e,key:(0,m.createDOMID)(),onChange:a(n),hideLabel:!0,label:" ",name:"color",style:{marginBottom:0,marginTop:0,width:r?"100%":32},showTextInput:r}),"function"==typeof t&&i.default.createElement(t,{index:n})))}))),[e,t,o,a]);return i.default.createElement(j,{"data-test":"MultiColorPickerFlyoutContent"},i.default.createElement(P,{"data-test":"MultiColorPickerFlyoutTitle"},n),i.default.createElement(w,null,i.default.createElement(p.default,{addLabel:r,onRequestAdd:l,onRequestMove:s,"data-test":"ColorListEditor"},u)))};const T=({CustomColorMatchEditor:e,onChange:o=c.noop,canReorderColors:a=!0,value:n=h.VIZ_CATEGORICAL,flyoutTitle:r=(0,f._)("Customize colors"),addColorButtonLabel:l=(0,f._)("Add color"),name:s="seriesColors",label:u="",labelPosition:d="top",labelWidth:p,isDisabled:g=!1,hideLabel:v=!0,canAddNewColors:C=!0})=>{const[j,P]=(0,i.useState)(!1),[w,T]=(0,i.useState)(n),S=(0,i.useRef)(null);(0,i.useEffect)((()=>{T(n)}),[n]);const D=(0,i.useCallback)((()=>{const e=new Set(w);let t=h.VIZ_CATEGORICAL.find((t=>!e.has(t)));if(!t){const e=new Map;h.VIZ_CATEGORICAL.forEach((t=>e.set(t,0))),w.forEach((t=>{e.set(t,(e.get(t)||0)+1)}));let o=1/0;h.VIZ_CATEGORICAL.forEach((a=>{const n=e.get(a)||0;n<o&&(o=n,t=a)}))}o(null,s,[...w,t])}),[s,o,w]),M=(0,i.useCallback)((e=>(t,a,n)=>{const r=[...w];r.splice(e,1,n),o(null,s,r)}),[s,o,w]),k=(0,i.useCallback)(((e,{index:t})=>{const a=[...w];a.splice(t,1),o(null,s,a)}),[s,o,w]),F=(0,i.useCallback)((({fromIndex:e,toIndex:t})=>{const a=[...w],n=a[e];a.splice(e,1),a.splice(t,0,n),o(null,s,a)}),[s,o,w]),R=(0,i.useCallback)((({event:e,reason:t})=>{var o;(null===(o=null==e?void 0:e.srcElement)||void 0===o?void 0:o.sortableHandle)||P(!1),"escapeKey"===t&&S.current.focus()}),[]),B=(0,i.useMemo)((()=>w.map((e=>i.default.createElement(x,{color:e,key:(0,m.createDOMID)()})))),[w]),A=(0,i.useCallback)((()=>{P((e=>!e))}),[]);return i.default.createElement(y.default,{label:u,labelPosition:d,labelWidth:p,hideLabel:v,"data-test":"MultiColorPickerEditor"},i.default.createElement(E,{inline:!1,"data-test":"MultiColorPickerButton",appearance:"default",ref:S,onClick:A,disabled:g,style:O},B),i.default.createElement(b.default,{"data-test":"MultiColorPickerFlyout",open:j,anchor:S.current,defaultPlacement:"horizontal",style:_,onRequestClose:R,takeFocus:!0},i.default.createElement(t.ColorFlyoutEditor,{colors:w,CustomColorMatchEditor:e,handleColorRemove:k,handleColorChange:M,handleColorAdd:C?D:void 0,handleColorMove:a?F:void 0,flyoutTitle:r,addColorButtonLabel:l})))};T.propTypes=Object.assign(Object.assign({},v.BaseEditorPropTypes),{canReorderColors:s.bool,canAddNewColors:s.bool,value:s.arrayOf(s.string),flyoutTitle:s.string,addColorButtonLabel:s.string,CustomColorMatchEditor:s.func,hideLabel:s.bool}),t.default=T},4215:function(e,t,o){var a=this&&this.__createBinding||(Object.create?function(e,t,o,a){void 0===a&&(a=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,a,n)}:function(e,t,o,a){void 0===a&&(a=o),e[a]=t[o]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&a(t,e,o);return n(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(o(9497)),s=l(o(232)),u=l(o(4566)),c=l(o(7020)),d=l(o(1551)),f=l(o(6769)),p=o(3563),m=l(o(1668)),g=l(o(4008)),b=(0,s.default)(m.default)`
206
206
  background-color: ${u.default.backgroundColorPopup};
207
207
  `,h=s.default.span`
208
208
  font-weight: 500;