@burgantech/pseudo-ui 0.1.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.
Files changed (38) hide show
  1. package/README.md +336 -0
  2. package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
  3. package/dist/adapters/vue/DynamicRenderer.vue.d.ts +8 -0
  4. package/dist/adapters/vue/DynamicRenderer.vue.js +7 -0
  5. package/dist/adapters/vue/DynamicRenderer.vue2.js +1302 -0
  6. package/dist/adapters/vue/ErrorBoundary.vue.d.ts +16 -0
  7. package/dist/adapters/vue/ErrorBoundary.vue.js +7 -0
  8. package/dist/adapters/vue/ErrorBoundary.vue2.js +27 -0
  9. package/dist/adapters/vue/NestedComponentWrapper.vue.d.ts +15 -0
  10. package/dist/adapters/vue/NestedComponentWrapper.vue.js +96 -0
  11. package/dist/adapters/vue/NestedComponentWrapper.vue2.js +4 -0
  12. package/dist/adapters/vue/PseudoView.vue.d.ts +18 -0
  13. package/dist/adapters/vue/PseudoView.vue.js +59 -0
  14. package/dist/adapters/vue/PseudoView.vue2.js +4 -0
  15. package/dist/adapters/vue/index.d.ts +6 -0
  16. package/dist/adapters/vue/index.js +17 -0
  17. package/dist/adapters/vue/injection.d.ts +3 -0
  18. package/dist/adapters/vue/injection.js +14 -0
  19. package/dist/adapters/vue/useFormContext.d.ts +4 -0
  20. package/dist/adapters/vue/useFormContext.js +35 -0
  21. package/dist/adapters/vue/useLookups.d.ts +4 -0
  22. package/dist/adapters/vue/useLookups.js +38 -0
  23. package/dist/engine/conditionalEngine.d.ts +6 -0
  24. package/dist/engine/conditionalEngine.js +56 -0
  25. package/dist/engine/dataClient.d.ts +5 -0
  26. package/dist/engine/dataClient.js +39 -0
  27. package/dist/engine/expressionResolver.d.ts +13 -0
  28. package/dist/engine/expressionResolver.js +136 -0
  29. package/dist/engine/index.d.ts +7 -0
  30. package/dist/engine/schemaResolver.d.ts +14 -0
  31. package/dist/engine/schemaResolver.js +97 -0
  32. package/dist/engine/types.d.ts +155 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +23 -0
  35. package/dist/pseudo-ui.css +1 -0
  36. package/package.json +57 -0
  37. package/vocabularies/view-model-vocabulary.json +474 -0
  38. package/vocabularies/view-vocabulary.json +1104 -0
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ };
4
+ declare var __VLS_1: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ };
8
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
12
+ type __VLS_WithSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
@@ -0,0 +1,7 @@
1
+ import o from "./ErrorBoundary.vue2.js";
2
+ /* empty css */
3
+ import r from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-d8e1bfd2"]]);
5
+ export {
6
+ f as default
7
+ };
@@ -0,0 +1,27 @@
1
+ import { defineComponent as a, ref as s, onErrorCaptured as i, openBlock as u, createElementBlock as d, createElementVNode as o, toDisplayString as t, createTextVNode as p, renderSlot as c } from "vue";
2
+ const m = {
3
+ key: 0,
4
+ class: "d-error-boundary",
5
+ role: "alert"
6
+ }, g = /* @__PURE__ */ a({
7
+ __name: "ErrorBoundary",
8
+ props: {
9
+ label: {}
10
+ },
11
+ setup(l) {
12
+ const r = s(null);
13
+ return i((e) => (r.value = e instanceof Error ? e.message : String(e), !1)), (e, n) => r.value ? (u(), d("div", m, [
14
+ n[0] || (n[0] = o("i", {
15
+ class: "pi pi-exclamation-triangle",
16
+ style: { "margin-right": "0.5rem", color: "var(--p-red-500)" }
17
+ }, null, -1)),
18
+ o("span", null, [
19
+ o("strong", null, t(l.label || "Component") + " render error:", 1),
20
+ p(" " + t(r.value), 1)
21
+ ])
22
+ ])) : c(e.$slots, "default", { key: 1 }, void 0, !0);
23
+ }
24
+ });
25
+ export {
26
+ g as default
27
+ };
@@ -0,0 +1,15 @@
1
+ import type { DataSchema, ViewDefinition } from '../../engine/types';
2
+ type __VLS_Props = {
3
+ schema: DataSchema;
4
+ view: ViewDefinition;
5
+ lang: string;
6
+ boundValues?: Record<string, unknown>;
7
+ boundInstanceValues?: Record<string, unknown>;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
10
+ update: (data: Record<string, unknown>) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onUpdate?: ((data: Record<string, unknown>) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,96 @@
1
+ import { defineComponent as k, watch as p, onMounted as w, nextTick as y, openBlock as O, createBlock as j } from "vue";
2
+ import { createFormContext as C, provideFormContext as x } from "./useFormContext.js";
3
+ import { resolveFilterParams as V } from "../../engine/expressionResolver.js";
4
+ import { useLookups as F } from "./useLookups.js";
5
+ import { fetchLovData as f } from "../../engine/dataClient.js";
6
+ import { useDelegate as L } from "./injection.js";
7
+ import $ from "./DynamicRenderer.vue.js";
8
+ const B = /* @__PURE__ */ k({
9
+ __name: "NestedComponentWrapper",
10
+ props: {
11
+ schema: {},
12
+ view: {},
13
+ lang: {},
14
+ boundValues: {},
15
+ boundInstanceValues: {}
16
+ },
17
+ emits: ["update"],
18
+ setup(d, { emit: v }) {
19
+ const t = d, b = v, u = L(), r = u.onLog ?? (() => {
20
+ });
21
+ r("debug", "NestedComponent initializing", void 0, { source: "NestedComponent", boundKeys: [...Object.keys(t.boundValues ?? {}), ...Object.keys(t.boundInstanceValues ?? {})] });
22
+ const o = C(t.schema, t.lang);
23
+ x(o), t.view.uiState && (Object.assign(o.uiState, t.view.uiState), r("info", "Nested component UI state initialized", void 0, { keys: Object.keys(t.view.uiState) }));
24
+ const l = {
25
+ ...t.boundValues,
26
+ ...t.boundInstanceValues
27
+ };
28
+ Object.assign(o.params, l), Object.assign(o.formData, l), Object.assign(o.instanceData, l), g();
29
+ function g() {
30
+ if (!t.schema.properties) return;
31
+ const e = Object.keys(l);
32
+ for (const [s, a] of Object.entries(t.schema.properties))
33
+ a["x-binding"] === "required" && !e.includes(s) && r("warn", `Missing required input "${s}". Parent must bind this property.`, void 0, { source: "Component", field: s });
34
+ }
35
+ p(() => t.lang, (e) => {
36
+ o.lang = e;
37
+ }), p(() => o.formData, (e) => {
38
+ b("update", { ...e });
39
+ }, { deep: !0 }), p([() => t.boundValues, () => t.boundInstanceValues], ([e, s]) => {
40
+ const a = { ...e, ...s }, i = [];
41
+ for (const [c, n] of Object.entries(a))
42
+ o.params[c] !== n && (i.push(c), o.params[c] = n, o.formData[c] = n, o.instanceData[c] = n);
43
+ i.length > 0 && h(i);
44
+ }, { deep: !0 });
45
+ async function m(e, s) {
46
+ const a = t.schema.properties?.[e];
47
+ if (!a?.["x-lov"]) return;
48
+ const i = a["x-lov"], c = i.filter;
49
+ try {
50
+ if (c?.length) {
51
+ const n = V(c, o.formData, o.instanceData, o.params);
52
+ if (n === null) {
53
+ o.lovData[e] = [];
54
+ return;
55
+ }
56
+ const D = await f(u.requestData, i, n, r);
57
+ o.lovData[e] = D;
58
+ } else {
59
+ const n = await f(u.requestData, i, void 0, r);
60
+ o.lovData[e] = n;
61
+ }
62
+ } catch (n) {
63
+ r("error", `Failed to load LOV for field "${e}"`, n, { source: "NestedComponent", field: e }), o.lovData[e] = [];
64
+ }
65
+ }
66
+ function h(e) {
67
+ if (t.schema.properties)
68
+ for (const [s, a] of Object.entries(t.schema.properties)) {
69
+ const i = a["x-lov"];
70
+ if (!i?.filter) continue;
71
+ i.filter.some(
72
+ (n) => n.value.startsWith("$param.") && e.includes(n.value.slice(7)) || n.value.startsWith("$form.") && e.includes(n.value.slice(6)) || n.value.startsWith("$instance.") && e.includes(n.value.slice(10))
73
+ ) && (o.formData[s] = void 0, m(s));
74
+ }
75
+ }
76
+ return w(async () => {
77
+ if (t.schema.properties) {
78
+ for (const [e, s] of Object.entries(t.schema.properties))
79
+ if (s["x-lov"])
80
+ try {
81
+ await m(e);
82
+ } catch (a) {
83
+ r("warn", `Failed to load LOV for ${e}`, a, { source: "NestedComponent", field: e });
84
+ }
85
+ y(() => {
86
+ t.view.lookups?.length && (r("debug", `NestedComponent initializing ${t.view.lookups.length} lookup(s)`, void 0, { source: "NestedComponent", lookups: t.view.lookups }), F(t.view.lookups, o, u.requestData, r));
87
+ });
88
+ }
89
+ }), (e, s) => (O(), j($, {
90
+ node: d.view.view
91
+ }, null, 8, ["node"]));
92
+ }
93
+ });
94
+ export {
95
+ B as default
96
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./NestedComponentWrapper.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,18 @@
1
+ import type { DataSchema, ViewDefinition, PseudoViewDelegate } from '../../engine/types';
2
+ type __VLS_Props = {
3
+ schema: DataSchema;
4
+ view: ViewDefinition;
5
+ formData?: Record<string, unknown>;
6
+ instanceData?: Record<string, unknown>;
7
+ lang?: string;
8
+ delegate: PseudoViewDelegate;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
11
+ formChange: (data: Record<string, unknown>) => any;
12
+ validationChange: (errors: Record<string, string>) => any;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ onFormChange?: ((data: Record<string, unknown>) => any) | undefined;
15
+ onValidationChange?: ((errors: Record<string, string>) => any) | undefined;
16
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -0,0 +1,59 @@
1
+ import { defineComponent as p, watch as n, onMounted as h, nextTick as v, openBlock as k, createBlock as D } from "vue";
2
+ import { createFormContext as y, provideFormContext as b } from "./useFormContext.js";
3
+ import { provideDelegate as j } from "./injection.js";
4
+ import { useLookups as O } from "./useLookups.js";
5
+ import x from "./DynamicRenderer.vue.js";
6
+ const S = /* @__PURE__ */ p({
7
+ __name: "PseudoView",
8
+ props: {
9
+ schema: {},
10
+ view: {},
11
+ formData: {},
12
+ instanceData: {},
13
+ lang: {},
14
+ delegate: {}
15
+ },
16
+ emits: ["formChange", "validationChange"],
17
+ setup(r, { emit: u }) {
18
+ const e = r, f = u, i = e.delegate.onLog ?? (() => {
19
+ });
20
+ j(e.delegate), i("info", "PseudoView initializing", void 0, { schema: e.schema.$id, lang: e.lang });
21
+ const a = y(e.schema, e.lang ?? "tr");
22
+ b(a), e.view.uiState && (Object.assign(a.uiState, e.view.uiState), i("info", "UI state initialized from view definition", void 0, { keys: Object.keys(e.view.uiState) })), e.formData && (Object.assign(a.formData, e.formData), i("info", "Initial form data applied", void 0, { keys: Object.keys(e.formData) })), e.instanceData && (Object.assign(a.instanceData, e.instanceData), i("info", "Instance data applied", void 0, { keys: Object.keys(e.instanceData) }), m("instanceData", e.instanceData));
23
+ function m(t, o) {
24
+ if (!e.schema.properties) return;
25
+ const l = Object.keys(e.schema.properties), g = Object.keys(o), s = l.filter((d) => !g.includes(d)), c = g.filter((d) => !l.includes(d));
26
+ s.length > 0 && i("info", `${t}: ${s.length} schema field(s) not present in data`, void 0, {
27
+ source: "Diagnostics",
28
+ missing: s
29
+ }), c.length > 0 && i("info", `${t}: ${c.length} field(s) in data not defined in schema`, void 0, {
30
+ source: "Diagnostics",
31
+ extra: c
32
+ });
33
+ }
34
+ return n(() => e.lang, (t) => {
35
+ t && (a.lang = t, i("info", `Language changed to "${t}"`));
36
+ }), n(() => e.schema, (t) => {
37
+ a.schema = t, i("info", "Schema updated", void 0, { schema: t.$id });
38
+ }), n(() => e.formData, (t) => {
39
+ t && (Object.assign(a.formData, t), i("info", "Form data updated", void 0, { keys: Object.keys(t) }));
40
+ }, { deep: !0 }), n(() => e.instanceData, (t) => {
41
+ for (const o of Object.keys(a.instanceData))
42
+ delete a.instanceData[o];
43
+ t && (Object.assign(a.instanceData, t), m("instanceData", t)), i("info", "Instance data updated", void 0, { keys: t ? Object.keys(t) : [] });
44
+ }, { deep: !0 }), n(() => a.formData, (t) => {
45
+ f("formChange", { ...t });
46
+ }, { deep: !0 }), n(() => a.errors, (t) => {
47
+ f("validationChange", { ...t });
48
+ }, { deep: !0 }), h(() => {
49
+ i("info", "PseudoView mounted"), v(() => {
50
+ e.view.lookups?.length && (i("debug", `Initializing ${e.view.lookups.length} lookup(s)`, void 0, { lookups: e.view.lookups }), O(e.view.lookups, a, e.delegate.requestData, i));
51
+ });
52
+ }), (t, o) => (k(), D(x, {
53
+ node: r.view.view
54
+ }, null, 8, ["node"]));
55
+ }
56
+ });
57
+ export {
58
+ S as default
59
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./PseudoView.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,6 @@
1
+ export { default as PseudoView } from './PseudoView.vue';
2
+ export { default as DynamicRenderer } from './DynamicRenderer.vue';
3
+ export { default as NestedComponentWrapper } from './NestedComponentWrapper.vue';
4
+ export { createFormContext, provideFormContext, useFormContext } from './useFormContext';
5
+ export { useLookups } from './useLookups';
6
+ export { provideDelegate, useDelegate } from './injection';
@@ -0,0 +1,17 @@
1
+ import { default as r } from "./PseudoView.vue.js";
2
+ import { default as p } from "./DynamicRenderer.vue.js";
3
+ import { default as m } from "./NestedComponentWrapper.vue.js";
4
+ import { createFormContext as s, provideFormContext as x, useFormContext as d } from "./useFormContext.js";
5
+ import { useLookups as n } from "./useLookups.js";
6
+ import { provideDelegate as i, useDelegate as C } from "./injection.js";
7
+ export {
8
+ p as DynamicRenderer,
9
+ m as NestedComponentWrapper,
10
+ r as PseudoView,
11
+ s as createFormContext,
12
+ i as provideDelegate,
13
+ x as provideFormContext,
14
+ C as useDelegate,
15
+ d as useFormContext,
16
+ n as useLookups
17
+ };
@@ -0,0 +1,3 @@
1
+ import type { PseudoViewDelegate } from '../../engine/types';
2
+ export declare function provideDelegate(delegate: PseudoViewDelegate): void;
3
+ export declare function useDelegate(): PseudoViewDelegate;
@@ -0,0 +1,14 @@
1
+ import { inject as t, provide as r } from "vue";
2
+ const o = /* @__PURE__ */ Symbol("PseudoViewDelegate");
3
+ function n(e) {
4
+ r(o, e);
5
+ }
6
+ function d() {
7
+ const e = t(o);
8
+ if (!e) throw new Error("PseudoViewDelegate not provided. Wrap your component tree with <PseudoView>.");
9
+ return e;
10
+ }
11
+ export {
12
+ n as provideDelegate,
13
+ d as useDelegate
14
+ };
@@ -0,0 +1,4 @@
1
+ import type { DataSchema, FormContext } from '../../engine/types';
2
+ export declare function createFormContext(schema: DataSchema, lang?: string): FormContext;
3
+ export declare function provideFormContext(ctx: FormContext): void;
4
+ export declare function useFormContext(): FormContext;
@@ -0,0 +1,35 @@
1
+ import { inject as i, reactive as a, provide as c } from "vue";
2
+ const n = /* @__PURE__ */ Symbol("FormContext");
3
+ function f(t, o = "tr") {
4
+ return a({
5
+ schema: t,
6
+ formData: p(t),
7
+ instanceData: {},
8
+ params: {},
9
+ uiState: {},
10
+ lovData: {},
11
+ lookupData: {},
12
+ lang: o,
13
+ errors: {}
14
+ });
15
+ }
16
+ function d(t) {
17
+ c(n, t);
18
+ }
19
+ function m() {
20
+ const t = i(n);
21
+ if (!t) throw new Error("FormContext not provided. Wrap your component tree with a FormContext provider.");
22
+ return t;
23
+ }
24
+ function p(t) {
25
+ const o = {};
26
+ if (!t.properties) return o;
27
+ for (const [r, e] of Object.entries(t.properties))
28
+ e.default !== void 0 && (o[r] = e.default);
29
+ return o;
30
+ }
31
+ export {
32
+ f as createFormContext,
33
+ d as provideFormContext,
34
+ m as useFormContext
35
+ };
@@ -0,0 +1,4 @@
1
+ import type { FormContext, RequestDataFn, PseudoViewDelegate } from '../../engine/types';
2
+ type LogFn = NonNullable<PseudoViewDelegate['onLog']>;
3
+ export declare function useLookups(lookupNames: string[], ctx: FormContext, requestData: RequestDataFn, log?: LogFn): void;
4
+ export {};
@@ -0,0 +1,38 @@
1
+ import { watch as m } from "vue";
2
+ import { extractDynamicFilterFields as d, areRequiredFiltersMet as k, resolveFilterParams as c } from "../../engine/expressionResolver.js";
3
+ import { fetchLookupData as h } from "../../engine/dataClient.js";
4
+ function g(n, e, f, t = () => {
5
+ }) {
6
+ if (!(!n.length || !e.schema.properties))
7
+ for (const o of n) {
8
+ const u = e.schema.properties[o];
9
+ if (!u?.["x-lookup"]) continue;
10
+ const i = u["x-lookup"];
11
+ async function p() {
12
+ const a = i.filter?.length ? c(i.filter, e.formData, e.instanceData, e.params) : {};
13
+ if (a === null) {
14
+ t("debug", `Lookup "${o}" skipped — required filter params not met`, void 0, { source: "Lookup", field: o }), delete e.lookupData[o];
15
+ return;
16
+ }
17
+ t("debug", `Fetching lookup "${o}"`, void 0, { source: "Lookup", field: o, params: a });
18
+ const r = await h(f, i, a, t);
19
+ r ? (e.lookupData[o] = r, t("info", `Lookup "${o}" loaded`, void 0, { source: "Lookup", field: o, keys: Object.keys(r) })) : delete e.lookupData[o];
20
+ }
21
+ if (i.filter?.length) {
22
+ const { formFields: a, instanceFields: r, paramFields: l } = d(i.filter);
23
+ a.length > 0 || r.length > 0 || l.length > 0 ? (t("debug", `Lookup "${o}" watching fields`, void 0, { source: "Lookup", field: o, formFields: a, instanceFields: r, paramFields: l }), m(
24
+ () => [
25
+ ...a.map((s) => e.formData[s]),
26
+ ...r.map((s) => e.instanceData[s]),
27
+ ...l.map((s) => e.params[s])
28
+ ],
29
+ () => p(),
30
+ { immediate: k(i.filter, e.formData, e.instanceData, e.params) }
31
+ )) : p();
32
+ } else
33
+ p();
34
+ }
35
+ }
36
+ export {
37
+ g as useLookups
38
+ };
@@ -0,0 +1,6 @@
1
+ import type { ConditionalDefinition } from './types';
2
+ export interface ConditionalState {
3
+ visible: boolean;
4
+ enabled: boolean;
5
+ }
6
+ export declare function evaluateConditional(conditional: ConditionalDefinition | undefined, formData: Record<string, unknown>, instanceData?: Record<string, unknown>, params?: Record<string, unknown>): ConditionalState;
@@ -0,0 +1,56 @@
1
+ function l(e, t, r = {}, a = {}) {
2
+ if (!e) return { visible: !0, enabled: !0 };
3
+ const s = { ...a, ...r, ...t };
4
+ let u = !0, i = !0;
5
+ return e.showIf && (u = n(e.showIf, s)), e.hideIf && (u = !n(e.hideIf, s)), e.enableIf && (i = n(e.enableIf, s)), e.disableIf && (i = !n(e.disableIf, s)), { visible: u, enabled: i };
6
+ }
7
+ function n(e, t) {
8
+ if (e.allOf)
9
+ return e.allOf.every((s) => n(s, t));
10
+ if (e.anyOf)
11
+ return e.anyOf.some((s) => n(s, t));
12
+ if (e.not)
13
+ return !n(e.not, t);
14
+ if (!e.field) return !0;
15
+ const r = f(t, e.field);
16
+ switch (e.operator || "equals") {
17
+ case "equals":
18
+ return r === e.value;
19
+ case "notEquals":
20
+ return r !== e.value;
21
+ case "in":
22
+ return Array.isArray(e.value) && e.value.includes(r);
23
+ case "notIn":
24
+ return Array.isArray(e.value) && !e.value.includes(r);
25
+ case "greaterThan":
26
+ return Number(r) > Number(e.value);
27
+ case "lessThan":
28
+ return Number(r) < Number(e.value);
29
+ case "greaterThanOrEquals":
30
+ return Number(r) >= Number(e.value);
31
+ case "lessThanOrEquals":
32
+ return Number(r) <= Number(e.value);
33
+ case "contains":
34
+ return typeof r == "string" && r.includes(String(e.value));
35
+ case "startsWith":
36
+ return typeof r == "string" && r.startsWith(String(e.value));
37
+ case "endsWith":
38
+ return typeof r == "string" && r.endsWith(String(e.value));
39
+ case "isEmpty":
40
+ return r == null || r === "";
41
+ case "isNotEmpty":
42
+ return r != null && r !== "";
43
+ default:
44
+ return !0;
45
+ }
46
+ }
47
+ function f(e, t) {
48
+ if (t)
49
+ return t.split(".").reduce((r, a) => {
50
+ if (!(r == null || typeof r != "object"))
51
+ return r[a];
52
+ }, e);
53
+ }
54
+ export {
55
+ l as evaluateConditional
56
+ };
@@ -0,0 +1,5 @@
1
+ import type { LovDefinition, LovItem, LookupDefinition, RequestDataFn, PseudoViewDelegate } from './types';
2
+ type LogFn = NonNullable<PseudoViewDelegate['onLog']>;
3
+ export declare function fetchLovData(requestData: RequestDataFn, lov: LovDefinition, queryParams?: Record<string, string>, log?: LogFn): Promise<LovItem[]>;
4
+ export declare function fetchLookupData(requestData: RequestDataFn, lookup: LookupDefinition, queryParams?: Record<string, string>, log?: LogFn): Promise<Record<string, unknown> | null>;
5
+ export {};
@@ -0,0 +1,39 @@
1
+ import { navigatePath as y } from "./expressionResolver.js";
2
+ function o() {
3
+ }
4
+ function d(s, e) {
5
+ return y(s, e.replace(/^\$\./, "").split("."));
6
+ }
7
+ async function p(s, e, u, r = o) {
8
+ try {
9
+ r("debug", `requestData → ${e.source}`, void 0, { source: "LOV", ref: e.source, params: u });
10
+ const c = await s(e.source, u);
11
+ r("debug", `requestData ← ${e.source} responded`, void 0, { source: "LOV", ref: e.source });
12
+ const t = d(c, e.valueField.replace(/\.[^.]+$/, ""));
13
+ if (!Array.isArray(t))
14
+ return r("warn", `Expected array at data path for ${e.source}, got ${typeof t}`, void 0, { source: "LOV", ref: e.source }), [];
15
+ const i = e.valueField.split(".").pop(), f = e.displayField.split(".").pop(), a = t.map((n) => ({
16
+ ...n,
17
+ value: String(n[i] ?? ""),
18
+ display: String(n[f] ?? "")
19
+ }));
20
+ return r("debug", `LOV "${e.source}" extracted ${a.length} item(s)`, void 0, { source: "LOV", ref: e.source, count: a.length }), a;
21
+ } catch (c) {
22
+ return r("error", `Failed to fetch LOV: ${e.source}`, c, { source: "LOV", ref: e.source }), [];
23
+ }
24
+ }
25
+ async function $(s, e, u, r = o) {
26
+ try {
27
+ r("debug", `requestData → ${e.source}`, void 0, { source: "LOOKUP", ref: e.source, params: u });
28
+ const c = await s(e.source, u);
29
+ r("debug", `requestData ← ${e.source} responded`, void 0, { source: "LOOKUP", ref: e.source });
30
+ const t = d(c, e.resultField);
31
+ return t == null || typeof t != "object" ? (r("warn", `Expected object at ${e.resultField} for ${e.source}, got ${typeof t}`, void 0, { source: "LOOKUP", ref: e.source }), null) : (r("debug", `Lookup "${e.source}" extracted`, void 0, { source: "LOOKUP", ref: e.source, keys: Object.keys(t) }), t);
32
+ } catch (c) {
33
+ return r("error", `Failed to fetch lookup: ${e.source}`, c, { source: "LOOKUP", ref: e.source }), null;
34
+ }
35
+ }
36
+ export {
37
+ $ as fetchLookupData,
38
+ p as fetchLovData
39
+ };
@@ -0,0 +1,13 @@
1
+ import type { FormContext, MultiLangText, LovFilterParam } from './types';
2
+ export declare function resolveExpression(expr: string, ctx: FormContext, item?: Record<string, unknown>): unknown;
3
+ export declare function resolveTextContent(content: string | MultiLangText | undefined, ctx: FormContext, item?: Record<string, unknown>): string;
4
+ export declare function resolveMultiLang(text: MultiLangText | undefined, lang: string): string;
5
+ export declare function resolveFilterParams(filter: LovFilterParam[], formData: Record<string, unknown>, instanceData?: Record<string, unknown>, params?: Record<string, unknown>): Record<string, string> | null;
6
+ export interface DynamicFilterFields {
7
+ formFields: string[];
8
+ instanceFields: string[];
9
+ paramFields: string[];
10
+ }
11
+ export declare function extractDynamicFilterFields(filter: LovFilterParam[]): DynamicFilterFields;
12
+ export declare function areRequiredFiltersMet(filter: LovFilterParam[], formData: Record<string, unknown>, instanceData: Record<string, unknown>, params?: Record<string, unknown>): boolean;
13
+ export declare function navigatePath(obj: unknown, path: string[]): unknown;
@@ -0,0 +1,136 @@
1
+ function p(l, e, r) {
2
+ if (!l || !l.startsWith("$")) return l;
3
+ const i = l.split("."), t = i[0], a = i.slice(1);
4
+ let s;
5
+ switch (t) {
6
+ case "$schema": {
7
+ const u = a[0], o = u ? e.schema.properties?.[u] : void 0;
8
+ o && a[1] === "label" ? s = o["x-labels"] : o ? s = n(o, a.slice(1)) : s = n(e.schema, a);
9
+ break;
10
+ }
11
+ case "$form":
12
+ s = n(e.formData, a);
13
+ break;
14
+ case "$instance":
15
+ s = n(e.instanceData, a);
16
+ break;
17
+ case "$param":
18
+ s = n(e.params, a);
19
+ break;
20
+ case "$lov": {
21
+ if (a.length === 0) {
22
+ s = e.lovData;
23
+ break;
24
+ }
25
+ const u = a[0], o = e.lovData[u];
26
+ if (a.length >= 2 && a[1] === "display") {
27
+ const f = e.params[u] ?? e.formData[u] ?? e.instanceData[u];
28
+ o && f != null ? s = o.find((v) => v.value === f)?.display ?? String(f) : s = f;
29
+ } else
30
+ s = o;
31
+ break;
32
+ }
33
+ case "$lookup":
34
+ if (a.length > 0) {
35
+ const u = e.lookupData[a[0]];
36
+ s = a.length > 1 ? n(u, a.slice(1)) : u;
37
+ } else
38
+ s = e.lookupData;
39
+ break;
40
+ case "$ui":
41
+ s = n(e.uiState, a);
42
+ break;
43
+ case "$item":
44
+ s = r ? n(r, a) : void 0;
45
+ break;
46
+ case "$context":
47
+ a[0] === "lang" && (s = e.lang);
48
+ break;
49
+ default:
50
+ s = l;
51
+ }
52
+ return s;
53
+ }
54
+ function $(l, e, r) {
55
+ if (!l) return "";
56
+ if (typeof l == "string") {
57
+ if (l.startsWith("$")) {
58
+ const i = p(l, e, r);
59
+ if (typeof i == "object" && i !== null)
60
+ return c(i, e.lang);
61
+ const t = String(i ?? "");
62
+ return m(l, t, e) ?? t;
63
+ }
64
+ return l;
65
+ }
66
+ return c(l, e.lang);
67
+ }
68
+ function m(l, e, r) {
69
+ if (!e || !r.schema.properties) return null;
70
+ const i = l.split(".");
71
+ if (i.length < 2) return null;
72
+ const t = i[1], a = r.schema.properties[t];
73
+ return a?.["x-enum"]?.[e] ? c(a["x-enum"][e], r.lang) : null;
74
+ }
75
+ function c(l, e) {
76
+ return l && (l[e] || l.en || l.tr || Object.values(l)[0]) || "";
77
+ }
78
+ function b(l, e, r = {}, i = {}) {
79
+ const t = {};
80
+ for (const a of l) {
81
+ let s;
82
+ if (a.value.startsWith("$param."))
83
+ s = n(i, a.value.slice(7).split("."));
84
+ else if (a.value.startsWith("$form."))
85
+ s = n(e, a.value.slice(6).split("."));
86
+ else if (a.value.startsWith("$instance."))
87
+ s = n(r, a.value.slice(10).split("."));
88
+ else {
89
+ t[a.param] = a.value;
90
+ continue;
91
+ }
92
+ if (s != null && s !== "")
93
+ t[a.param] = String(s);
94
+ else if (a.required)
95
+ return null;
96
+ }
97
+ return t;
98
+ }
99
+ function d(l) {
100
+ return {
101
+ formFields: l.filter((e) => e.value.startsWith("$form.")).map((e) => e.value.slice(6)),
102
+ instanceFields: l.filter((e) => e.value.startsWith("$instance.")).map((e) => e.value.slice(10)),
103
+ paramFields: l.filter((e) => e.value.startsWith("$param.")).map((e) => e.value.slice(7))
104
+ };
105
+ }
106
+ function g(l, e, r, i = {}) {
107
+ return l.filter((t) => t.required).every((t) => {
108
+ let a;
109
+ if (t.value.startsWith("$param."))
110
+ a = i[t.value.slice(7)];
111
+ else if (t.value.startsWith("$form."))
112
+ a = e[t.value.slice(6)];
113
+ else if (t.value.startsWith("$instance."))
114
+ a = r[t.value.slice(10)];
115
+ else
116
+ return !0;
117
+ return a != null && a !== "";
118
+ });
119
+ }
120
+ function n(l, e) {
121
+ let r = l;
122
+ for (const i of e) {
123
+ if (r == null || typeof r != "object") return;
124
+ r = r[i];
125
+ }
126
+ return r;
127
+ }
128
+ export {
129
+ g as areRequiredFiltersMet,
130
+ d as extractDynamicFilterFields,
131
+ n as navigatePath,
132
+ p as resolveExpression,
133
+ b as resolveFilterParams,
134
+ c as resolveMultiLang,
135
+ $ as resolveTextContent
136
+ };
@@ -0,0 +1,7 @@
1
+ export * from './types';
2
+ export { resolveExpression, resolveTextContent, resolveMultiLang, resolveFilterParams, extractDynamicFilterFields, areRequiredFiltersMet, navigatePath } from './expressionResolver';
3
+ export type { DynamicFilterFields } from './expressionResolver';
4
+ export { evaluateConditional } from './conditionalEngine';
5
+ export type { ConditionalState } from './conditionalEngine';
6
+ export { getSchemaProperty, getFieldLabel, getFieldErrorMessage, isFieldRequired, getEnumOptions, mapLovItemsToOptions, validateField } from './schemaResolver';
7
+ export { fetchLovData, fetchLookupData } from './dataClient';