@iyulab/enterprise 0.5.0 → 0.6.0
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/dist/FormRow.d.ts +1 -1
- package/dist/FormSection.d.ts +1 -1
- package/dist/index.js +2 -265
- package/package.json +4 -4
package/dist/FormRow.d.ts
CHANGED
package/dist/FormSection.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { HttpClient } from "@iyulab/http-client";
|
|
3
|
+
import buildQuery from "odata-query";
|
|
3
4
|
//#region src/FormSection.tsx
|
|
4
5
|
/**
|
|
5
6
|
* L2 폼 블록 — 제목이 붙은 필드 묶음.
|
|
@@ -540,270 +541,6 @@ var ApiConfig = class {
|
|
|
540
541
|
}
|
|
541
542
|
};
|
|
542
543
|
//#endregion
|
|
543
|
-
//#region node_modules/odata-query/dist/index.mjs
|
|
544
|
-
var e = [
|
|
545
|
-
"eq",
|
|
546
|
-
"ne",
|
|
547
|
-
"gt",
|
|
548
|
-
"ge",
|
|
549
|
-
"lt",
|
|
550
|
-
"le"
|
|
551
|
-
];
|
|
552
|
-
var t = [
|
|
553
|
-
"and",
|
|
554
|
-
"or",
|
|
555
|
-
"not"
|
|
556
|
-
];
|
|
557
|
-
var n = ["any", "all"];
|
|
558
|
-
var r = [
|
|
559
|
-
"startswith",
|
|
560
|
-
"endswith",
|
|
561
|
-
"contains",
|
|
562
|
-
"matchespattern"
|
|
563
|
-
];
|
|
564
|
-
var i = [
|
|
565
|
-
"expand",
|
|
566
|
-
"levels",
|
|
567
|
-
"select",
|
|
568
|
-
"skip",
|
|
569
|
-
"top",
|
|
570
|
-
"count",
|
|
571
|
-
"orderby",
|
|
572
|
-
"filter"
|
|
573
|
-
];
|
|
574
|
-
var a = /\((.*)\)/;
|
|
575
|
-
var o = /(?!indexof)\((\w+)\)/;
|
|
576
|
-
function g(e, t) {
|
|
577
|
-
if (t) {
|
|
578
|
-
let n = e === "", r = o.test(e), i = a.test(e);
|
|
579
|
-
return n ? t : r ? y(e, t, o) : i ? y(e, t, a) : `${t}/${e}`;
|
|
580
|
-
}
|
|
581
|
-
return e;
|
|
582
|
-
}
|
|
583
|
-
function _(e) {
|
|
584
|
-
return t.indexOf(e) !== -1;
|
|
585
|
-
}
|
|
586
|
-
function v(e) {
|
|
587
|
-
return `not (${e.join(" and ")})`;
|
|
588
|
-
}
|
|
589
|
-
function y(e, t, n) {
|
|
590
|
-
return e.replace(n, (e, n) => n.trim() === "" ? `(${t})` : `(${t}/${n.trim()})`);
|
|
591
|
-
}
|
|
592
|
-
function b(e, t, n = []) {
|
|
593
|
-
return `${e} eq ${w(t, n)}`;
|
|
594
|
-
}
|
|
595
|
-
function x({ key: e, value: t, aliases: n, propPrefix: r }) {
|
|
596
|
-
let i = [], a = e, o = _(a), s = t.map((e) => O(e, n, r)).filter((e) => e).map((e) => o ? `(${e})` : e);
|
|
597
|
-
return s.length && (o ? a === "not" ? i.push(v(s)) : i.push(`(${s.join(` ${a} `)})`) : i.push(s.join(` ${a} `))), i;
|
|
598
|
-
}
|
|
599
|
-
function S({ propName: e, value: t }) {
|
|
600
|
-
let n = [], r = e, i = Object.keys(t).map((e) => k({ [e]: t[e] }));
|
|
601
|
-
return i.length && (r === "not" ? n.push(v(i)) : n.push(`(${i.join(` ${r} `)})`)), n;
|
|
602
|
-
}
|
|
603
|
-
function C({ key: i, propName: a, value: o, aliases: s }) {
|
|
604
|
-
let c = [];
|
|
605
|
-
return "type" in o ? c.push(b(a, o, s)) : Object.keys(o).forEach((l) => {
|
|
606
|
-
if (o[l] !== void 0) if (e.indexOf(l) !== -1) c.push(`${a} ${l} ${w(o[l], s)}`);
|
|
607
|
-
else if (t.indexOf(l) !== -1) Array.isArray(o[l]) ? c.push(o[l].map((e) => "(" + O(e, s, a) + ")").join(` ${l} `)) : c.push("(" + O(o[l], s, a) + ")");
|
|
608
|
-
else if (n.indexOf(l) !== -1) {
|
|
609
|
-
let e = A({
|
|
610
|
-
lambdaParameter: i.toLowerCase(),
|
|
611
|
-
value: o[l],
|
|
612
|
-
op: l,
|
|
613
|
-
propName: a,
|
|
614
|
-
aliases: s
|
|
615
|
-
});
|
|
616
|
-
e && c.push(e);
|
|
617
|
-
} else if (l === "has") c.push(`${a} ${l} ${w(o[l], s)}`);
|
|
618
|
-
else if (l === "in") {
|
|
619
|
-
let e = Array.isArray(o[l]) ? o[l] : o[l].value.map((e) => ({
|
|
620
|
-
type: o[l].type,
|
|
621
|
-
value: e
|
|
622
|
-
}));
|
|
623
|
-
c.push(a + " in (" + e.map((e) => w(e, s)).join(",") + ")");
|
|
624
|
-
} else if (r.indexOf(l) !== -1) c.push(`${l}(${a},${w(o[l], s)})`);
|
|
625
|
-
else {
|
|
626
|
-
let e = /\/not/g.test(a), t = e ? a.replace(/\/not/g, "") : a, n = e ? v([O({ [l]: o[l] }, s, t)]) : O({ [l]: o[l] }, s, t);
|
|
627
|
-
n && c.push(n);
|
|
628
|
-
}
|
|
629
|
-
}), c;
|
|
630
|
-
}
|
|
631
|
-
function w(e, t) {
|
|
632
|
-
if (typeof e == "string") return `'${D(e)}'`;
|
|
633
|
-
if (e instanceof Date) return e.toISOString();
|
|
634
|
-
if (typeof e == "number") return e;
|
|
635
|
-
if (Array.isArray(e)) return `[${e.map((e) => w(e)).join(",")}]`;
|
|
636
|
-
if (e === null) return e;
|
|
637
|
-
if (typeof e == "object") switch (e.type) {
|
|
638
|
-
case "raw":
|
|
639
|
-
case "guid": return e.value;
|
|
640
|
-
case "duration": return `duration'${e.value}'`;
|
|
641
|
-
case "binary": return `binary'${e.value}'`;
|
|
642
|
-
case "alias": return Array.isArray(t) && t.push(e), `@${e.name}`;
|
|
643
|
-
case "json": return escape(JSON.stringify(e.value));
|
|
644
|
-
case "decimal": return `${e.value}M`;
|
|
645
|
-
default: return Object.entries(e).filter(([, e]) => e !== void 0).map(([e, n]) => `${e}=${w(n, t)}`).join(",");
|
|
646
|
-
}
|
|
647
|
-
return e;
|
|
648
|
-
}
|
|
649
|
-
function T(e, t, n, r) {
|
|
650
|
-
return `${r}/${n}(${e}: ${e} ${n == "all" ? "ne" : "eq"} '${t}')`;
|
|
651
|
-
}
|
|
652
|
-
function E(e) {
|
|
653
|
-
return e.replace(/'/g, "''");
|
|
654
|
-
}
|
|
655
|
-
function D(e) {
|
|
656
|
-
return encodeURIComponent(E(e));
|
|
657
|
-
}
|
|
658
|
-
function O(e = {}, t = [], n = "") {
|
|
659
|
-
return (Array.isArray(e) ? e : [e]).reduce((e, r) => {
|
|
660
|
-
if (r) {
|
|
661
|
-
let i = k(r, t, n);
|
|
662
|
-
i && e.push(i);
|
|
663
|
-
}
|
|
664
|
-
return e;
|
|
665
|
-
}, []).join(" and ");
|
|
666
|
-
}
|
|
667
|
-
function k(e = {}, t = [], n = "") {
|
|
668
|
-
let r = "";
|
|
669
|
-
return typeof e == "string" ? r = e : e && typeof e == "object" && (r = Object.keys(e).reduce((r, i) => {
|
|
670
|
-
let a = e[i];
|
|
671
|
-
if (a === void 0) return r;
|
|
672
|
-
let o = i === "", s = g(i, n);
|
|
673
|
-
if (o && Array.isArray(a)) return r.concat(a.map((e) => b(s, e)));
|
|
674
|
-
let c = [
|
|
675
|
-
"number",
|
|
676
|
-
"string",
|
|
677
|
-
"boolean"
|
|
678
|
-
].indexOf(typeof a) !== -1 || a instanceof Date || a === null, l = Array.isArray(a), u = typeof a == "object";
|
|
679
|
-
if (c) r.push(b(s, a, t));
|
|
680
|
-
else if (l) r.push(...x({
|
|
681
|
-
key: i,
|
|
682
|
-
value: a,
|
|
683
|
-
aliases: t,
|
|
684
|
-
propPrefix: n
|
|
685
|
-
}));
|
|
686
|
-
else if (_(s)) r.push(...S({
|
|
687
|
-
propName: s,
|
|
688
|
-
value: a
|
|
689
|
-
}));
|
|
690
|
-
else if (u) r.push(...C({
|
|
691
|
-
key: i,
|
|
692
|
-
propName: s,
|
|
693
|
-
value: a,
|
|
694
|
-
aliases: t
|
|
695
|
-
}));
|
|
696
|
-
else throw Error(`Unexpected value type: ${a}`);
|
|
697
|
-
return r;
|
|
698
|
-
}, []).join(" and ")), r;
|
|
699
|
-
}
|
|
700
|
-
function A({ lambdaParameter: e, value: t, op: n, propName: r, aliases: i }) {
|
|
701
|
-
let a = "";
|
|
702
|
-
if (typeof t == "string" || t instanceof String) a = T(e, t, n, r);
|
|
703
|
-
else if (t) {
|
|
704
|
-
let o = O(Array.isArray(t) ? t.reduce((e, t) => t.hasOwnProperty("") ? (e.hasOwnProperty("") || (e[""] = []), e[""].push(t[""]), e) : {
|
|
705
|
-
...e,
|
|
706
|
-
...t
|
|
707
|
-
}, {}) : t, i, e);
|
|
708
|
-
a = `${r}/${n}(${o ? `${e}:${o}` : ""})`;
|
|
709
|
-
}
|
|
710
|
-
return a;
|
|
711
|
-
}
|
|
712
|
-
function j(e) {
|
|
713
|
-
if (typeof e == "number") return e;
|
|
714
|
-
if (typeof e == "string") return e.indexOf("/") === -1 ? e : e.split("/").reverse().reduce((e, t, n, r) => n === 0 ? `$expand=${t}` : n === r.length - 1 ? `${t}(${e})` : `$expand=${t}(${e})`, "");
|
|
715
|
-
if (Array.isArray(e)) return `${e.map((e) => j(e)).join(",")}`;
|
|
716
|
-
if (typeof e == "object") {
|
|
717
|
-
let t = Object.keys(e);
|
|
718
|
-
return t.some((e) => i.indexOf(e.toLowerCase()) !== -1) ? t.map((t) => {
|
|
719
|
-
let n;
|
|
720
|
-
switch (t) {
|
|
721
|
-
case "filter":
|
|
722
|
-
n = O(e[t]);
|
|
723
|
-
break;
|
|
724
|
-
case "orderBy":
|
|
725
|
-
n = F(e[t]);
|
|
726
|
-
break;
|
|
727
|
-
case "levels":
|
|
728
|
-
case "count":
|
|
729
|
-
case "skip":
|
|
730
|
-
case "top":
|
|
731
|
-
n = `${e[t]}`;
|
|
732
|
-
break;
|
|
733
|
-
default: n = j(e[t]);
|
|
734
|
-
}
|
|
735
|
-
return `$${t.toLowerCase()}=${n}`;
|
|
736
|
-
}).join(";") : t.map((t) => {
|
|
737
|
-
let n = j(e[t]);
|
|
738
|
-
return n ? `${t}(${n})` : t;
|
|
739
|
-
}).join(",");
|
|
740
|
-
}
|
|
741
|
-
return "";
|
|
742
|
-
}
|
|
743
|
-
function M(e) {
|
|
744
|
-
return (Array.isArray(e) ? e : [e]).reduce((e, t) => {
|
|
745
|
-
for (let n of Object.keys(t)) switch (n) {
|
|
746
|
-
case "aggregate": {
|
|
747
|
-
let r = t[n];
|
|
748
|
-
r && e.push(`aggregate(${N(r)})`);
|
|
749
|
-
break;
|
|
750
|
-
}
|
|
751
|
-
case "filter": {
|
|
752
|
-
let r = t[n];
|
|
753
|
-
if (r) {
|
|
754
|
-
let t = O(r);
|
|
755
|
-
t && e.push(`filter(${t})`);
|
|
756
|
-
}
|
|
757
|
-
break;
|
|
758
|
-
}
|
|
759
|
-
case "groupBy": {
|
|
760
|
-
let r = t[n];
|
|
761
|
-
r && e.push(`groupby(${P(r)})`);
|
|
762
|
-
break;
|
|
763
|
-
}
|
|
764
|
-
default: throw Error(`Unsupported transform: ${n}`);
|
|
765
|
-
}
|
|
766
|
-
return e;
|
|
767
|
-
}, []).join("/") || void 0;
|
|
768
|
-
}
|
|
769
|
-
function N(e) {
|
|
770
|
-
return (Array.isArray(e) ? e : [e]).map((e) => typeof e == "string" ? e : Object.keys(e).map((t) => {
|
|
771
|
-
let n = e[t];
|
|
772
|
-
if (!n.with && n.as) return `${t} as ${n.as}`;
|
|
773
|
-
if (!n.with) throw Error(`'with' property required for '${t}'`);
|
|
774
|
-
if (!n.as) throw Error(`'as' property required for '${t}'`);
|
|
775
|
-
return `${t} with ${n.with} as ${n.as}`;
|
|
776
|
-
})).join(",");
|
|
777
|
-
}
|
|
778
|
-
function P(e) {
|
|
779
|
-
if (!e.properties) throw Error("'properties' property required for groupBy");
|
|
780
|
-
let t = `(${e.properties.join(",")})`;
|
|
781
|
-
return e.transform && (t += `,${M(e.transform)}`), t;
|
|
782
|
-
}
|
|
783
|
-
function F(e, t = "") {
|
|
784
|
-
return Array.isArray(e) ? e.map((e) => Array.isArray(e) && e.length === 2 && ["asc", "desc"].indexOf(e[1]) !== -1 ? e.join(" ") : e).map((e) => `${t}${String(e)}`).join(",") : typeof e == "object" ? Object.entries(e).map(([e, t]) => F(t, `${e}/`)).map((e) => `${t}${e}`).join(",") : `${t}${String(e)}`;
|
|
785
|
-
}
|
|
786
|
-
function I(e, t) {
|
|
787
|
-
let n = Object.getOwnPropertyNames(t).filter((e) => t[e] !== void 0 && t[e] !== "").map((e) => `${e}=${t[e]}`);
|
|
788
|
-
return n.length ? `${e}?${n.join("&")}` : e;
|
|
789
|
-
}
|
|
790
|
-
function L({ select: e, search: t, skiptoken: n, format: r, top: i, skip: a, filter: o, transform: s, orderBy: c, key: l, count: u, expand: d, action: f, func: p } = {}) {
|
|
791
|
-
let m = "", h = [], g = {};
|
|
792
|
-
if (l != null && (m += `(${w(l, h)})`), (o || typeof u == "object") && (g.$filter = O(typeof u == "object" ? u : o, h)), s && (g.$apply = M(s)), d && (g.$expand = j(d)), c && (g.$orderby = F(c)), u && (typeof u == "boolean" ? g.$count = !0 : m += "/$count"), typeof i == "number" && (g.$top = i), typeof a == "number" && (g.$skip = a), f && (m += `/${f}`), p) {
|
|
793
|
-
if (typeof p == "string") m += `/${p}`;
|
|
794
|
-
else if (typeof p == "object") {
|
|
795
|
-
let [e] = Object.keys(p), t = w(p[e], h);
|
|
796
|
-
m += `/${e}`, t !== "" && (m += `(${t})`);
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
return h.length > 0 && Object.assign(g, h.reduce((e, t) => Object.assign(e, { [`@${t.name}`]: w(t.value) }), {})), t && (g.$search = encodeURIComponent(t)), I(m, {
|
|
800
|
-
$select: e,
|
|
801
|
-
$skiptoken: n,
|
|
802
|
-
$format: r,
|
|
803
|
-
...g
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
//#endregion
|
|
807
544
|
//#region src/data/ODataService.ts
|
|
808
545
|
/**
|
|
809
546
|
* OData v4 + custom REST 서비스 팩토리.
|
|
@@ -929,7 +666,7 @@ function createODataService(config) {
|
|
|
929
666
|
return res.json();
|
|
930
667
|
}
|
|
931
668
|
async function odataCount(entity, filter) {
|
|
932
|
-
const qs =
|
|
669
|
+
const qs = buildQuery({
|
|
933
670
|
filter,
|
|
934
671
|
top: 0,
|
|
935
672
|
count: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/enterprise",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Enterprise utilities and components for iyulab framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"enterprise",
|
|
@@ -32,10 +32,7 @@
|
|
|
32
32
|
"test": "vitest run"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@iyulab/components": "^1.8.0",
|
|
36
|
-
"@iyulab/data-components": "^0.7.0",
|
|
37
35
|
"@iyulab/http-client": "^0.10.0",
|
|
38
|
-
"@iyulab/modern-app": "^0.6.0",
|
|
39
36
|
"odata-query": "^8.1.0"
|
|
40
37
|
},
|
|
41
38
|
"devDependencies": {
|
|
@@ -44,5 +41,8 @@
|
|
|
44
41
|
"vite": "^8.1.4",
|
|
45
42
|
"vite-plugin-dts": "^5.0.3",
|
|
46
43
|
"vitest": "^4.1.10"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": ">=18"
|
|
47
47
|
}
|
|
48
48
|
}
|