@luzmo/analytics-components-kit 1.0.1-alpha.21 → 1.0.1-alpha.22
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/components/utils.cjs +1 -1
- package/components/utils.js +61 -59
- package/package.json +1 -1
- package/utils/switch-item/index.d.ts +0 -4
package/components/utils.cjs
CHANGED
@@ -17,4 +17,4 @@
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
18
|
* SOFTWARE.
|
19
19
|
* */
|
20
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
20
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./decompose-numeric-format-B3rVVHpO.cjs"),A=require("./formatter-DiJYkB6b.cjs"),q=require("./localize-r7ALOUy_.cjs"),S=require("./index-DXyAeBh6.cjs");function z(o){var a,m,h,C;const c=[],f=[];Object.keys(S.slotsConfigs).forEach(e=>{e.replace("SlotsConfig","");const t=e.replace("SlotsConfig","").replaceAll(/([A-Z])/g,"-$1").toLowerCase();f.push({type:t,slotsConfig:S.slotsConfigs[e]})});const i=f.find(e=>e.type===(o==null?void 0:o.oldItemType)),n=f.find(e=>e.type===(o==null?void 0:o.newItemType)),s=structuredClone((n==null?void 0:n.slotsConfig)??[]);if(!n)return{type:(i==null?void 0:i.type)??"bar-chart",slots:o.slots??[]};const r=structuredClone(o.slots??[]);for(const e of r){const t=i==null?void 0:i.slotsConfig.find(T=>T.name===e.name);e.type=(t==null?void 0:t.type)??(e==null?void 0:e.type)}const u=r.filter(e=>e.type==="mixed").sort((e,t)=>e.order-t.order),y=s.filter(e=>e.type==="mixed").sort((e,t)=>e.order-t.order),x=r.filter(e=>e.type==="numeric").sort((e,t)=>e.order-t.order),O=s.filter(e=>e.type==="numeric").sort((e,t)=>e.order-t.order),l=[];for(const e of x)for(const t of e.content)t.key="old-measure-"+(e==null?void 0:e.name)+"-"+e.content.indexOf(t),l.push(t);for(const e of u)for(const t of e.content)t.type==="numeric"&&(t.key="old-mixed-"+(e==null?void 0:e.name)+"-"+e.content.indexOf(t),l.push(t));const k=[...O,...y].sort((e,t)=>s.indexOf(e)-s.indexOf(t));for(const e of l)for(const t of k)c.includes(e.key)||(t.content=(t==null?void 0:t.content)??[],(((a=t==null?void 0:t.content)==null?void 0:a.length)===0||((m=t==null?void 0:t.content)==null?void 0:m.length)>0&&(t==null?void 0:t.canAcceptMultipleColumns)===!0)&&(t.content.push(e),c.push(e.key)));const w=r.filter(e=>e.type==="categorical").sort((e,t)=>e.order-t.order),M=s.filter(e=>e.type==="categorical").sort((e,t)=>e.order-t.order),p=[];for(const e of w)for(const t of e.content)t.key="old-dimension-"+(e==null?void 0:e.name)+"-"+e.content.indexOf(t),p.push(t);for(const e of u)for(const t of e.content)t.type!=="numeric"&&(t.key="old-mixed-"+(e==null?void 0:e.name)+"-"+e.content.indexOf(t),p.push(t));const b=[...M,...y].sort((e,t)=>s.indexOf(e)-s.indexOf(t));for(const e of p)if(!c.includes(e.key))for(const t of b)t&&!c.includes(e.key)&&(t.content=(t==null?void 0:t.content)??[],(((h=t==null?void 0:t.content)==null?void 0:h.length)===0||((C=t==null?void 0:t.content)==null?void 0:C.length)>0&&(t==null?void 0:t.canAcceptMultipleColumns)===!0)&&(t.content.push(e),c.push(e.key)));let d={...o.options};return n.setInitialOptions&&(d=n==null?void 0:n.setInitialOptions({...d})),{type:n.type??"bar-chart",slots:s.map(e=>({name:e.name,content:e.content??[]}))??[],options:d??{...o.options}}}exports.decomposeNumericFormat=g.decomposeNumericFormat;exports.formatter=A.formatter;exports.localize=q.localize;exports.switchItem=z;
|
package/components/utils.js
CHANGED
@@ -17,74 +17,76 @@
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
18
|
* SOFTWARE.
|
19
19
|
* */
|
20
|
-
import { d as
|
21
|
-
import { f as
|
22
|
-
import { l as
|
23
|
-
import { s as
|
24
|
-
function
|
25
|
-
var
|
26
|
-
const f = [];
|
27
|
-
Object.keys(
|
28
|
-
|
29
|
-
const o =
|
20
|
+
import { d as j } from "./decompose-numeric-format-BuZcjH2k.js";
|
21
|
+
import { f as E } from "./formatter-CQDms6fU.js";
|
22
|
+
import { l as N } from "./localize-BX7q0S0M.js";
|
23
|
+
import { s as C } from "./index-Di00QW2f.js";
|
24
|
+
function g(t) {
|
25
|
+
var a, m, h, x;
|
26
|
+
const c = [], f = [];
|
27
|
+
Object.keys(C).forEach((e) => {
|
28
|
+
e.replace("SlotsConfig", "");
|
29
|
+
const o = e.replace("SlotsConfig", "").replaceAll(/([A-Z])/g, "-$1").toLowerCase();
|
30
30
|
f.push({
|
31
31
|
type: o,
|
32
|
-
slotsConfig:
|
32
|
+
slotsConfig: C[e]
|
33
33
|
});
|
34
34
|
});
|
35
|
-
const
|
36
|
-
(
|
37
|
-
),
|
38
|
-
(
|
39
|
-
),
|
40
|
-
if (!
|
35
|
+
const r = f.find(
|
36
|
+
(e) => e.type === (t == null ? void 0 : t.oldItemType)
|
37
|
+
), n = f.find(
|
38
|
+
(e) => e.type === (t == null ? void 0 : t.newItemType)
|
39
|
+
), s = structuredClone((n == null ? void 0 : n.slotsConfig) ?? []);
|
40
|
+
if (!n)
|
41
41
|
return {
|
42
|
-
type: (
|
43
|
-
slots:
|
44
|
-
unassignedMeasureSlots: [],
|
45
|
-
unassignedDimensionSlots: []
|
42
|
+
type: (r == null ? void 0 : r.type) ?? "bar-chart",
|
43
|
+
slots: t.slots ?? []
|
46
44
|
};
|
47
|
-
const
|
48
|
-
for (const
|
49
|
-
const o =
|
50
|
-
(
|
45
|
+
const i = structuredClone(t.slots ?? []);
|
46
|
+
for (const e of i) {
|
47
|
+
const o = r == null ? void 0 : r.slotsConfig.find(
|
48
|
+
(T) => T.name === e.name
|
51
49
|
);
|
52
|
-
|
50
|
+
e.type = (o == null ? void 0 : o.type) ?? (e == null ? void 0 : e.type);
|
53
51
|
}
|
54
|
-
const
|
55
|
-
for (const
|
56
|
-
for (const o of
|
57
|
-
|
58
|
-
for (const
|
59
|
-
for (const o of
|
60
|
-
o.type === "numeric" &&
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
52
|
+
const y = i.filter((e) => e.type === "mixed").sort((e, o) => e.order - o.order), u = s.filter((e) => e.type === "mixed").sort((e, o) => e.order - o.order), S = i.filter((e) => e.type === "numeric").sort((e, o) => e.order - o.order), O = s.filter((e) => e.type === "numeric").sort((e, o) => e.order - o.order), l = [];
|
53
|
+
for (const e of S)
|
54
|
+
for (const o of e.content)
|
55
|
+
o.key = "old-measure-" + (e == null ? void 0 : e.name) + "-" + e.content.indexOf(o), l.push(o);
|
56
|
+
for (const e of y)
|
57
|
+
for (const o of e.content)
|
58
|
+
o.type === "numeric" && (o.key = "old-mixed-" + (e == null ? void 0 : e.name) + "-" + e.content.indexOf(o), l.push(o));
|
59
|
+
const k = [...O, ...u].sort(
|
60
|
+
(e, o) => s.indexOf(e) - s.indexOf(o)
|
61
|
+
);
|
62
|
+
for (const e of l)
|
63
|
+
for (const o of k)
|
64
|
+
c.includes(e.key) || (o.content = (o == null ? void 0 : o.content) ?? [], (((a = o == null ? void 0 : o.content) == null ? void 0 : a.length) === 0 || ((m = o == null ? void 0 : o.content) == null ? void 0 : m.length) > 0 && (o == null ? void 0 : o.canAcceptMultipleColumns) === !0) && (o.content.push(e), c.push(e.key)));
|
65
|
+
const w = i.filter((e) => e.type === "categorical").sort((e, o) => e.order - o.order), M = s.filter((e) => e.type === "categorical").sort((e, o) => e.order - o.order), p = [];
|
66
|
+
for (const e of w)
|
67
|
+
for (const o of e.content)
|
68
|
+
o.key = "old-dimension-" + (e == null ? void 0 : e.name) + "-" + e.content.indexOf(o), p.push(o);
|
69
|
+
for (const e of y)
|
70
|
+
for (const o of e.content)
|
71
|
+
o.type !== "numeric" && (o.key = "old-mixed-" + (e == null ? void 0 : e.name) + "-" + e.content.indexOf(o), p.push(o));
|
72
|
+
const A = [
|
73
|
+
...M,
|
74
|
+
...u
|
75
|
+
].sort((e, o) => s.indexOf(e) - s.indexOf(o));
|
76
|
+
for (const e of p)
|
77
|
+
if (!c.includes(e.key))
|
78
|
+
for (const o of A)
|
79
|
+
o && !c.includes(e.key) && (o.content = (o == null ? void 0 : o.content) ?? [], (((h = o == null ? void 0 : o.content) == null ? void 0 : h.length) === 0 || ((x = o == null ? void 0 : o.content) == null ? void 0 : x.length) > 0 && (o == null ? void 0 : o.canAcceptMultipleColumns) === !0) && (o.content.push(e), c.push(e.key)));
|
80
|
+
let d = { ...t.options };
|
81
|
+
return n.setInitialOptions && (d = n == null ? void 0 : n.setInitialOptions({ ...d })), {
|
82
|
+
type: n.type ?? "bar-chart",
|
83
|
+
slots: s.map((e) => ({ name: e.name, content: e.content ?? [] })) ?? [],
|
84
|
+
options: d ?? { ...t.options }
|
83
85
|
};
|
84
86
|
}
|
85
87
|
export {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
j as decomposeNumericFormat,
|
89
|
+
E as formatter,
|
90
|
+
N as localize,
|
91
|
+
g as switchItem
|
90
92
|
};
|
package/package.json
CHANGED
@@ -3,8 +3,6 @@ export declare function switchItem(args: {
|
|
3
3
|
newItemType: string;
|
4
4
|
slots?: any[];
|
5
5
|
options?: any;
|
6
|
-
unassignedSlots?: any;
|
7
|
-
inapplicableOptions?: any;
|
8
6
|
customItemSlotsConfigs?: {
|
9
7
|
type: string;
|
10
8
|
slotsConfig: any;
|
@@ -13,6 +11,4 @@ export declare function switchItem(args: {
|
|
13
11
|
type: string;
|
14
12
|
slots: any[];
|
15
13
|
options?: any;
|
16
|
-
unassignedMeasureSlots: any[];
|
17
|
-
unassignedDimensionSlots: any[];
|
18
14
|
};
|