@progress/kendo-vue-gauges
Version:
45 lines (44 loc) • 1.29 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
const c = (t, e) => {
if (e.type)
switch (e.type) {
case "set":
return i.themeItem(t, e);
case "push":
return Object.assign(t, e.payload);
default:
return t;
}
else
return {};
}, i = {
configurationItem(t, e) {
return Object.assign(t, {
[e.gaugeKey]: e.payload
});
},
collectionConfigurationItem(t, e) {
let l = !1;
const [o, r] = e.gaugeCollectionIdxKey.split("_"), a = t[o].map((n, s) => parseInt(r, 10) === s ? (l = !0, e.payload) : n);
return l === !1 && a.splice(parseInt(r, 10), 0, e.payload), Object.assign(t, {
[o]: a
});
},
themeItem(t, e) {
let l = {}, o = Object.assign(l, t);
const { field: r, value: a } = e.payload, n = r.split(".");
let s = n.shift();
for (; n.length > 0; )
l = l[s] = l[s] || {}, s = n.shift();
return l[s] = a, o;
}
};
export {
c as themeReducer
};