jupiter-dynamic-forms 1.0.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/LICENSE +21 -0
- package/README.md +384 -0
- package/dist/core/concept-tree.d.ts +19 -0
- package/dist/core/concept-tree.d.ts.map +1 -0
- package/dist/core/dynamic-form.d.ts +42 -0
- package/dist/core/dynamic-form.d.ts.map +1 -0
- package/dist/core/form-field.d.ts +23 -0
- package/dist/core/form-field.d.ts.map +1 -0
- package/dist/core/form-section.d.ts +20 -0
- package/dist/core/form-section.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +784 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2082 -0
- package/dist/index.mjs.map +1 -0
- package/dist/schema/types.d.ts +151 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/xbrl-types.d.ts +142 -0
- package/dist/schema/xbrl-types.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/xbrl-form-builder.d.ts +52 -0
- package/dist/utils/xbrl-form-builder.d.ts.map +1 -0
- package/package.json +91 -0
- package/wrappers/angular/jupiter-dynamic-forms.module.ts +30 -0
- package/wrappers/angular/public-api.ts +13 -0
- package/wrappers/angular/types.ts +33 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2082 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
const t$1 = (t2) => (e2, o2) => {
|
|
8
|
+
void 0 !== o2 ? o2.addInitializer(() => {
|
|
9
|
+
customElements.define(t2, e2);
|
|
10
|
+
}) : customElements.define(t2, e2);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright 2019 Google LLC
|
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
+
*/
|
|
17
|
+
const t = globalThis, e$1 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s = Symbol(), o$2 = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
let n$2 = class n {
|
|
19
|
+
constructor(t2, e2, o2) {
|
|
20
|
+
if (this._$cssResult$ = true, o2 !== s)
|
|
21
|
+
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
22
|
+
this.cssText = t2, this.t = e2;
|
|
23
|
+
}
|
|
24
|
+
get styleSheet() {
|
|
25
|
+
let t2 = this.o;
|
|
26
|
+
const s2 = this.t;
|
|
27
|
+
if (e$1 && void 0 === t2) {
|
|
28
|
+
const e2 = void 0 !== s2 && 1 === s2.length;
|
|
29
|
+
e2 && (t2 = o$2.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$2.set(s2, t2));
|
|
30
|
+
}
|
|
31
|
+
return t2;
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
return this.cssText;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const r$3 = (t2) => new n$2("string" == typeof t2 ? t2 : t2 + "", void 0, s), S = (s2, o2) => {
|
|
38
|
+
if (e$1)
|
|
39
|
+
s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
|
|
40
|
+
else
|
|
41
|
+
for (const e2 of o2) {
|
|
42
|
+
const o3 = document.createElement("style"), n3 = t.litNonce;
|
|
43
|
+
void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
|
|
44
|
+
}
|
|
45
|
+
}, c$1 = e$1 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
|
|
46
|
+
let e2 = "";
|
|
47
|
+
for (const s2 of t3.cssRules)
|
|
48
|
+
e2 += s2.cssText;
|
|
49
|
+
return r$3(e2);
|
|
50
|
+
})(t2) : t2;
|
|
51
|
+
/**
|
|
52
|
+
* @license
|
|
53
|
+
* Copyright 2017 Google LLC
|
|
54
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
|
+
*/
|
|
56
|
+
const { is: i, defineProperty: e, getOwnPropertyDescriptor: h, getOwnPropertyNames: r$2, getOwnPropertySymbols: o$1, getPrototypeOf: n$1 } = Object, a = globalThis, c = a.trustedTypes, l = c ? c.emptyScript : "", p = a.reactiveElementPolyfillSupport, d = (t2, s2) => t2, u = { toAttribute(t2, s2) {
|
|
57
|
+
switch (s2) {
|
|
58
|
+
case Boolean:
|
|
59
|
+
t2 = t2 ? l : null;
|
|
60
|
+
break;
|
|
61
|
+
case Object:
|
|
62
|
+
case Array:
|
|
63
|
+
t2 = null == t2 ? t2 : JSON.stringify(t2);
|
|
64
|
+
}
|
|
65
|
+
return t2;
|
|
66
|
+
}, fromAttribute(t2, s2) {
|
|
67
|
+
let i2 = t2;
|
|
68
|
+
switch (s2) {
|
|
69
|
+
case Boolean:
|
|
70
|
+
i2 = null !== t2;
|
|
71
|
+
break;
|
|
72
|
+
case Number:
|
|
73
|
+
i2 = null === t2 ? null : Number(t2);
|
|
74
|
+
break;
|
|
75
|
+
case Object:
|
|
76
|
+
case Array:
|
|
77
|
+
try {
|
|
78
|
+
i2 = JSON.parse(t2);
|
|
79
|
+
} catch (t3) {
|
|
80
|
+
i2 = null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return i2;
|
|
84
|
+
} }, f = (t2, s2) => !i(t2, s2), b = { attribute: true, type: String, converter: u, reflect: false, useDefault: false, hasChanged: f };
|
|
85
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a.litPropertyMetadata ?? (a.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
86
|
+
class y extends HTMLElement {
|
|
87
|
+
static addInitializer(t2) {
|
|
88
|
+
this._$Ei(), (this.l ?? (this.l = [])).push(t2);
|
|
89
|
+
}
|
|
90
|
+
static get observedAttributes() {
|
|
91
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
92
|
+
}
|
|
93
|
+
static createProperty(t2, s2 = b) {
|
|
94
|
+
if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
|
|
95
|
+
const i2 = Symbol(), h2 = this.getPropertyDescriptor(t2, i2, s2);
|
|
96
|
+
void 0 !== h2 && e(this.prototype, t2, h2);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
static getPropertyDescriptor(t2, s2, i2) {
|
|
100
|
+
const { get: e2, set: r2 } = h(this.prototype, t2) ?? { get() {
|
|
101
|
+
return this[s2];
|
|
102
|
+
}, set(t3) {
|
|
103
|
+
this[s2] = t3;
|
|
104
|
+
} };
|
|
105
|
+
return { get: e2, set(s3) {
|
|
106
|
+
const h2 = e2 == null ? void 0 : e2.call(this);
|
|
107
|
+
r2 == null ? void 0 : r2.call(this, s3), this.requestUpdate(t2, h2, i2);
|
|
108
|
+
}, configurable: true, enumerable: true };
|
|
109
|
+
}
|
|
110
|
+
static getPropertyOptions(t2) {
|
|
111
|
+
return this.elementProperties.get(t2) ?? b;
|
|
112
|
+
}
|
|
113
|
+
static _$Ei() {
|
|
114
|
+
if (this.hasOwnProperty(d("elementProperties")))
|
|
115
|
+
return;
|
|
116
|
+
const t2 = n$1(this);
|
|
117
|
+
t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
|
|
118
|
+
}
|
|
119
|
+
static finalize() {
|
|
120
|
+
if (this.hasOwnProperty(d("finalized")))
|
|
121
|
+
return;
|
|
122
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
123
|
+
const t3 = this.properties, s2 = [...r$2(t3), ...o$1(t3)];
|
|
124
|
+
for (const i2 of s2)
|
|
125
|
+
this.createProperty(i2, t3[i2]);
|
|
126
|
+
}
|
|
127
|
+
const t2 = this[Symbol.metadata];
|
|
128
|
+
if (null !== t2) {
|
|
129
|
+
const s2 = litPropertyMetadata.get(t2);
|
|
130
|
+
if (void 0 !== s2)
|
|
131
|
+
for (const [t3, i2] of s2)
|
|
132
|
+
this.elementProperties.set(t3, i2);
|
|
133
|
+
}
|
|
134
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
135
|
+
for (const [t3, s2] of this.elementProperties) {
|
|
136
|
+
const i2 = this._$Eu(t3, s2);
|
|
137
|
+
void 0 !== i2 && this._$Eh.set(i2, t3);
|
|
138
|
+
}
|
|
139
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
140
|
+
}
|
|
141
|
+
static finalizeStyles(s2) {
|
|
142
|
+
const i2 = [];
|
|
143
|
+
if (Array.isArray(s2)) {
|
|
144
|
+
const e2 = new Set(s2.flat(1 / 0).reverse());
|
|
145
|
+
for (const s3 of e2)
|
|
146
|
+
i2.unshift(c$1(s3));
|
|
147
|
+
} else
|
|
148
|
+
void 0 !== s2 && i2.push(c$1(s2));
|
|
149
|
+
return i2;
|
|
150
|
+
}
|
|
151
|
+
static _$Eu(t2, s2) {
|
|
152
|
+
const i2 = s2.attribute;
|
|
153
|
+
return false === i2 ? void 0 : "string" == typeof i2 ? i2 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
|
|
154
|
+
}
|
|
155
|
+
constructor() {
|
|
156
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
157
|
+
}
|
|
158
|
+
_$Ev() {
|
|
159
|
+
var _a;
|
|
160
|
+
this._$ES = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (_a = this.constructor.l) == null ? void 0 : _a.forEach((t2) => t2(this));
|
|
161
|
+
}
|
|
162
|
+
addController(t2) {
|
|
163
|
+
var _a;
|
|
164
|
+
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && ((_a = t2.hostConnected) == null ? void 0 : _a.call(t2));
|
|
165
|
+
}
|
|
166
|
+
removeController(t2) {
|
|
167
|
+
var _a;
|
|
168
|
+
(_a = this._$EO) == null ? void 0 : _a.delete(t2);
|
|
169
|
+
}
|
|
170
|
+
_$E_() {
|
|
171
|
+
const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
|
|
172
|
+
for (const i2 of s2.keys())
|
|
173
|
+
this.hasOwnProperty(i2) && (t2.set(i2, this[i2]), delete this[i2]);
|
|
174
|
+
t2.size > 0 && (this._$Ep = t2);
|
|
175
|
+
}
|
|
176
|
+
createRenderRoot() {
|
|
177
|
+
const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
178
|
+
return S(t2, this.constructor.elementStyles), t2;
|
|
179
|
+
}
|
|
180
|
+
connectedCallback() {
|
|
181
|
+
var _a;
|
|
182
|
+
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), (_a = this._$EO) == null ? void 0 : _a.forEach((t2) => {
|
|
183
|
+
var _a2;
|
|
184
|
+
return (_a2 = t2.hostConnected) == null ? void 0 : _a2.call(t2);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
enableUpdating(t2) {
|
|
188
|
+
}
|
|
189
|
+
disconnectedCallback() {
|
|
190
|
+
var _a;
|
|
191
|
+
(_a = this._$EO) == null ? void 0 : _a.forEach((t2) => {
|
|
192
|
+
var _a2;
|
|
193
|
+
return (_a2 = t2.hostDisconnected) == null ? void 0 : _a2.call(t2);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
attributeChangedCallback(t2, s2, i2) {
|
|
197
|
+
this._$AK(t2, i2);
|
|
198
|
+
}
|
|
199
|
+
_$ET(t2, s2) {
|
|
200
|
+
var _a;
|
|
201
|
+
const i2 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i2);
|
|
202
|
+
if (void 0 !== e2 && true === i2.reflect) {
|
|
203
|
+
const h2 = (void 0 !== ((_a = i2.converter) == null ? void 0 : _a.toAttribute) ? i2.converter : u).toAttribute(s2, i2.type);
|
|
204
|
+
this._$Em = t2, null == h2 ? this.removeAttribute(e2) : this.setAttribute(e2, h2), this._$Em = null;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
_$AK(t2, s2) {
|
|
208
|
+
var _a, _b;
|
|
209
|
+
const i2 = this.constructor, e2 = i2._$Eh.get(t2);
|
|
210
|
+
if (void 0 !== e2 && this._$Em !== e2) {
|
|
211
|
+
const t3 = i2.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a = t3.converter) == null ? void 0 : _a.fromAttribute) ? t3.converter : u;
|
|
212
|
+
this._$Em = e2;
|
|
213
|
+
const r2 = h2.fromAttribute(s2, t3.type);
|
|
214
|
+
this[e2] = r2 ?? ((_b = this._$Ej) == null ? void 0 : _b.get(e2)) ?? r2, this._$Em = null;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
requestUpdate(t2, s2, i2) {
|
|
218
|
+
var _a;
|
|
219
|
+
if (void 0 !== t2) {
|
|
220
|
+
const e2 = this.constructor, h2 = this[t2];
|
|
221
|
+
if (i2 ?? (i2 = e2.getPropertyOptions(t2)), !((i2.hasChanged ?? f)(h2, s2) || i2.useDefault && i2.reflect && h2 === ((_a = this._$Ej) == null ? void 0 : _a.get(t2)) && !this.hasAttribute(e2._$Eu(t2, i2))))
|
|
222
|
+
return;
|
|
223
|
+
this.C(t2, s2, i2);
|
|
224
|
+
}
|
|
225
|
+
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
226
|
+
}
|
|
227
|
+
C(t2, s2, { useDefault: i2, reflect: e2, wrapped: h2 }, r2) {
|
|
228
|
+
i2 && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t2) && (this._$Ej.set(t2, r2 ?? s2 ?? this[t2]), true !== h2 || void 0 !== r2) || (this._$AL.has(t2) || (this.hasUpdated || i2 || (s2 = void 0), this._$AL.set(t2, s2)), true === e2 && this._$Em !== t2 && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t2));
|
|
229
|
+
}
|
|
230
|
+
async _$EP() {
|
|
231
|
+
this.isUpdatePending = true;
|
|
232
|
+
try {
|
|
233
|
+
await this._$ES;
|
|
234
|
+
} catch (t3) {
|
|
235
|
+
Promise.reject(t3);
|
|
236
|
+
}
|
|
237
|
+
const t2 = this.scheduleUpdate();
|
|
238
|
+
return null != t2 && await t2, !this.isUpdatePending;
|
|
239
|
+
}
|
|
240
|
+
scheduleUpdate() {
|
|
241
|
+
return this.performUpdate();
|
|
242
|
+
}
|
|
243
|
+
performUpdate() {
|
|
244
|
+
var _a;
|
|
245
|
+
if (!this.isUpdatePending)
|
|
246
|
+
return;
|
|
247
|
+
if (!this.hasUpdated) {
|
|
248
|
+
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
249
|
+
for (const [t4, s3] of this._$Ep)
|
|
250
|
+
this[t4] = s3;
|
|
251
|
+
this._$Ep = void 0;
|
|
252
|
+
}
|
|
253
|
+
const t3 = this.constructor.elementProperties;
|
|
254
|
+
if (t3.size > 0)
|
|
255
|
+
for (const [s3, i2] of t3) {
|
|
256
|
+
const { wrapped: t4 } = i2, e2 = this[s3];
|
|
257
|
+
true !== t4 || this._$AL.has(s3) || void 0 === e2 || this.C(s3, void 0, i2, e2);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
let t2 = false;
|
|
261
|
+
const s2 = this._$AL;
|
|
262
|
+
try {
|
|
263
|
+
t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), (_a = this._$EO) == null ? void 0 : _a.forEach((t3) => {
|
|
264
|
+
var _a2;
|
|
265
|
+
return (_a2 = t3.hostUpdate) == null ? void 0 : _a2.call(t3);
|
|
266
|
+
}), this.update(s2)) : this._$EM();
|
|
267
|
+
} catch (s3) {
|
|
268
|
+
throw t2 = false, this._$EM(), s3;
|
|
269
|
+
}
|
|
270
|
+
t2 && this._$AE(s2);
|
|
271
|
+
}
|
|
272
|
+
willUpdate(t2) {
|
|
273
|
+
}
|
|
274
|
+
_$AE(t2) {
|
|
275
|
+
var _a;
|
|
276
|
+
(_a = this._$EO) == null ? void 0 : _a.forEach((t3) => {
|
|
277
|
+
var _a2;
|
|
278
|
+
return (_a2 = t3.hostUpdated) == null ? void 0 : _a2.call(t3);
|
|
279
|
+
}), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
|
|
280
|
+
}
|
|
281
|
+
_$EM() {
|
|
282
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
283
|
+
}
|
|
284
|
+
get updateComplete() {
|
|
285
|
+
return this.getUpdateComplete();
|
|
286
|
+
}
|
|
287
|
+
getUpdateComplete() {
|
|
288
|
+
return this._$ES;
|
|
289
|
+
}
|
|
290
|
+
shouldUpdate(t2) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
update(t2) {
|
|
294
|
+
this._$Eq && (this._$Eq = this._$Eq.forEach((t3) => this._$ET(t3, this[t3]))), this._$EM();
|
|
295
|
+
}
|
|
296
|
+
updated(t2) {
|
|
297
|
+
}
|
|
298
|
+
firstUpdated(t2) {
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d("elementProperties")] = /* @__PURE__ */ new Map(), y[d("finalized")] = /* @__PURE__ */ new Map(), p == null ? void 0 : p({ ReactiveElement: y }), (a.reactiveElementVersions ?? (a.reactiveElementVersions = [])).push("2.1.1");
|
|
302
|
+
/**
|
|
303
|
+
* @license
|
|
304
|
+
* Copyright 2017 Google LLC
|
|
305
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
306
|
+
*/
|
|
307
|
+
const o = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f }, r$1 = (t2 = o, e2, r2) => {
|
|
308
|
+
const { kind: n3, metadata: i2 } = r2;
|
|
309
|
+
let s2 = globalThis.litPropertyMetadata.get(i2);
|
|
310
|
+
if (void 0 === s2 && globalThis.litPropertyMetadata.set(i2, s2 = /* @__PURE__ */ new Map()), "setter" === n3 && ((t2 = Object.create(t2)).wrapped = true), s2.set(r2.name, t2), "accessor" === n3) {
|
|
311
|
+
const { name: o2 } = r2;
|
|
312
|
+
return { set(r3) {
|
|
313
|
+
const n4 = e2.get.call(this);
|
|
314
|
+
e2.set.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
315
|
+
}, init(e3) {
|
|
316
|
+
return void 0 !== e3 && this.C(o2, void 0, t2, e3), e3;
|
|
317
|
+
} };
|
|
318
|
+
}
|
|
319
|
+
if ("setter" === n3) {
|
|
320
|
+
const { name: o2 } = r2;
|
|
321
|
+
return function(r3) {
|
|
322
|
+
const n4 = this[o2];
|
|
323
|
+
e2.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
throw Error("Unsupported decorator location: " + n3);
|
|
327
|
+
};
|
|
328
|
+
function n2(t2) {
|
|
329
|
+
return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
|
|
330
|
+
const r2 = e3.hasOwnProperty(o3);
|
|
331
|
+
return e3.constructor.createProperty(o3, t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
|
|
332
|
+
})(t2, e2, o2);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* @license
|
|
336
|
+
* Copyright 2017 Google LLC
|
|
337
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
338
|
+
*/
|
|
339
|
+
function r(r2) {
|
|
340
|
+
return n2({ ...r2, state: true, attribute: false });
|
|
341
|
+
}
|
|
342
|
+
class FormValidator {
|
|
343
|
+
/**
|
|
344
|
+
* Validates a field value against its validation rules
|
|
345
|
+
*/
|
|
346
|
+
static validateField(fieldId, conceptId, columnId, value, fieldType, rules = []) {
|
|
347
|
+
const errors = [];
|
|
348
|
+
for (const rule of rules) {
|
|
349
|
+
const error = this.validateRule(fieldId, conceptId, columnId, value, fieldType, rule);
|
|
350
|
+
if (error) {
|
|
351
|
+
errors.push(error);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return errors;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Validates a single rule against a value
|
|
358
|
+
*/
|
|
359
|
+
static validateRule(fieldId, conceptId, columnId, value, _fieldType, rule) {
|
|
360
|
+
const isEmpty = value === null || value === void 0 || value === "";
|
|
361
|
+
switch (rule.type) {
|
|
362
|
+
case "required":
|
|
363
|
+
if (isEmpty) {
|
|
364
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
365
|
+
}
|
|
366
|
+
break;
|
|
367
|
+
case "min":
|
|
368
|
+
if (!isEmpty && typeof value === "number" && value < rule.value) {
|
|
369
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
370
|
+
}
|
|
371
|
+
break;
|
|
372
|
+
case "max":
|
|
373
|
+
if (!isEmpty && typeof value === "number" && value > rule.value) {
|
|
374
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
375
|
+
}
|
|
376
|
+
break;
|
|
377
|
+
case "minLength":
|
|
378
|
+
if (!isEmpty && typeof value === "string" && value.length < rule.value) {
|
|
379
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
case "maxLength":
|
|
383
|
+
if (!isEmpty && typeof value === "string" && value.length > rule.value) {
|
|
384
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
385
|
+
}
|
|
386
|
+
break;
|
|
387
|
+
case "pattern":
|
|
388
|
+
if (!isEmpty && typeof value === "string") {
|
|
389
|
+
const regex = new RegExp(rule.value);
|
|
390
|
+
if (!regex.test(value)) {
|
|
391
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
case "email":
|
|
396
|
+
if (!isEmpty && typeof value === "string") {
|
|
397
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
398
|
+
if (!emailRegex.test(value)) {
|
|
399
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
break;
|
|
403
|
+
case "url":
|
|
404
|
+
if (!isEmpty && typeof value === "string") {
|
|
405
|
+
try {
|
|
406
|
+
new URL(value);
|
|
407
|
+
} catch {
|
|
408
|
+
return this.createError(fieldId, conceptId, columnId, rule);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
break;
|
|
412
|
+
case "custom":
|
|
413
|
+
break;
|
|
414
|
+
default:
|
|
415
|
+
console.warn(`Unknown validation rule type: ${rule.type}`);
|
|
416
|
+
}
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Creates a validation error object
|
|
421
|
+
*/
|
|
422
|
+
static createError(fieldId, conceptId, columnId, rule) {
|
|
423
|
+
return {
|
|
424
|
+
fieldId,
|
|
425
|
+
conceptId,
|
|
426
|
+
columnId,
|
|
427
|
+
message: rule.message,
|
|
428
|
+
severity: rule.severity || "error",
|
|
429
|
+
rule
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Validates data type conversion
|
|
434
|
+
*/
|
|
435
|
+
static validateDataType(value, fieldType) {
|
|
436
|
+
if (value === null || value === void 0 || value === "") {
|
|
437
|
+
return { valid: true, convertedValue: value };
|
|
438
|
+
}
|
|
439
|
+
switch (fieldType) {
|
|
440
|
+
case "number":
|
|
441
|
+
case "decimal":
|
|
442
|
+
case "currency":
|
|
443
|
+
case "percentage": {
|
|
444
|
+
const numValue = Number(value);
|
|
445
|
+
if (isNaN(numValue)) {
|
|
446
|
+
return { valid: false, error: "Invalid number format" };
|
|
447
|
+
}
|
|
448
|
+
return { valid: true, convertedValue: numValue };
|
|
449
|
+
}
|
|
450
|
+
case "date": {
|
|
451
|
+
const dateValue = new Date(value);
|
|
452
|
+
if (isNaN(dateValue.getTime())) {
|
|
453
|
+
return { valid: false, error: "Invalid date format" };
|
|
454
|
+
}
|
|
455
|
+
return { valid: true, convertedValue: dateValue.toISOString().split("T")[0] };
|
|
456
|
+
}
|
|
457
|
+
case "datetime": {
|
|
458
|
+
const datetimeValue = new Date(value);
|
|
459
|
+
if (isNaN(datetimeValue.getTime())) {
|
|
460
|
+
return { valid: false, error: "Invalid datetime format" };
|
|
461
|
+
}
|
|
462
|
+
return { valid: true, convertedValue: datetimeValue.toISOString() };
|
|
463
|
+
}
|
|
464
|
+
case "boolean":
|
|
465
|
+
if (typeof value === "boolean") {
|
|
466
|
+
return { valid: true, convertedValue: value };
|
|
467
|
+
}
|
|
468
|
+
if (typeof value === "string") {
|
|
469
|
+
const boolValue = value.toLowerCase();
|
|
470
|
+
if (boolValue === "true" || boolValue === "1") {
|
|
471
|
+
return { valid: true, convertedValue: true };
|
|
472
|
+
}
|
|
473
|
+
if (boolValue === "false" || boolValue === "0") {
|
|
474
|
+
return { valid: true, convertedValue: false };
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return { valid: false, error: "Invalid boolean format" };
|
|
478
|
+
case "text":
|
|
479
|
+
case "textarea":
|
|
480
|
+
case "email":
|
|
481
|
+
case "url":
|
|
482
|
+
case "tel":
|
|
483
|
+
return { valid: true, convertedValue: String(value) };
|
|
484
|
+
case "select":
|
|
485
|
+
case "multiselect":
|
|
486
|
+
return { valid: true, convertedValue: value };
|
|
487
|
+
default:
|
|
488
|
+
return { valid: true, convertedValue: value };
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Formats value for display based on field type
|
|
493
|
+
*/
|
|
494
|
+
static formatValue(value, fieldType, locale = "en-US") {
|
|
495
|
+
if (value === null || value === void 0)
|
|
496
|
+
return "";
|
|
497
|
+
switch (fieldType) {
|
|
498
|
+
case "number":
|
|
499
|
+
return new Intl.NumberFormat(locale).format(Number(value));
|
|
500
|
+
case "decimal":
|
|
501
|
+
return new Intl.NumberFormat(locale, {
|
|
502
|
+
minimumFractionDigits: 2,
|
|
503
|
+
maximumFractionDigits: 2
|
|
504
|
+
}).format(Number(value));
|
|
505
|
+
case "currency":
|
|
506
|
+
return new Intl.NumberFormat(locale, {
|
|
507
|
+
style: "currency",
|
|
508
|
+
currency: "USD"
|
|
509
|
+
// Should be configurable
|
|
510
|
+
}).format(Number(value));
|
|
511
|
+
case "percentage":
|
|
512
|
+
return new Intl.NumberFormat(locale, {
|
|
513
|
+
style: "percent",
|
|
514
|
+
minimumFractionDigits: 2
|
|
515
|
+
}).format(Number(value) / 100);
|
|
516
|
+
case "date":
|
|
517
|
+
return new Date(value).toLocaleDateString(locale);
|
|
518
|
+
case "datetime":
|
|
519
|
+
return new Date(value).toLocaleString(locale);
|
|
520
|
+
default:
|
|
521
|
+
return String(value);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
class XBRLFormBuilder {
|
|
526
|
+
/**
|
|
527
|
+
* Build form schema from XBRL input data
|
|
528
|
+
* Creates accordion sections for each presentation role
|
|
529
|
+
*/
|
|
530
|
+
static buildFormSchema(xbrlInput) {
|
|
531
|
+
if (!xbrlInput.presentation || xbrlInput.presentation.length === 0) {
|
|
532
|
+
throw new Error("XBRL presentation data is required");
|
|
533
|
+
}
|
|
534
|
+
const presentationData = xbrlInput.presentation[0];
|
|
535
|
+
const sections = [];
|
|
536
|
+
presentationData.roles.forEach((role) => {
|
|
537
|
+
const section = this.buildSectionFromRole(role);
|
|
538
|
+
sections.push(section);
|
|
539
|
+
});
|
|
540
|
+
return {
|
|
541
|
+
formId: `xbrl-form-${Date.now()}`,
|
|
542
|
+
title: `XBRL Form - ${this.extractEntityName(presentationData.entrypoint)}`,
|
|
543
|
+
description: `Dynamic form generated from XBRL taxonomy data`,
|
|
544
|
+
version: "1.0.0",
|
|
545
|
+
sections
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Build a form section from a presentation role
|
|
550
|
+
*/
|
|
551
|
+
static buildSectionFromRole(role) {
|
|
552
|
+
var _a;
|
|
553
|
+
const title = this.extractRoleTitle(role.role);
|
|
554
|
+
const conceptTrees = [];
|
|
555
|
+
if ((_a = role.presentationLinkbase) == null ? void 0 : _a.concepts) {
|
|
556
|
+
role.presentationLinkbase.concepts.forEach((concept) => {
|
|
557
|
+
const conceptTree = this.buildConceptTree(concept, 0);
|
|
558
|
+
if (conceptTree) {
|
|
559
|
+
conceptTrees.push(conceptTree);
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
return {
|
|
564
|
+
id: role.id,
|
|
565
|
+
title,
|
|
566
|
+
description: `Section for ${title}`,
|
|
567
|
+
concepts: conceptTrees,
|
|
568
|
+
expanded: false
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Build concept tree from XBRL presentation concept
|
|
573
|
+
*/
|
|
574
|
+
static buildConceptTree(concept, level) {
|
|
575
|
+
const label = this.getPreferredLabel(concept.labels);
|
|
576
|
+
const fields = [];
|
|
577
|
+
if (!concept.elementAbstract) {
|
|
578
|
+
const field = this.createFieldFromConcept(concept);
|
|
579
|
+
if (field) {
|
|
580
|
+
fields.push(field);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
const children = [];
|
|
584
|
+
if (concept.children && concept.children.length > 0) {
|
|
585
|
+
concept.children.forEach((child) => {
|
|
586
|
+
const childTree = this.buildConceptTree(child, level + 1);
|
|
587
|
+
if (childTree) {
|
|
588
|
+
children.push(childTree);
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
return {
|
|
593
|
+
id: concept.id,
|
|
594
|
+
name: concept.conceptName,
|
|
595
|
+
label,
|
|
596
|
+
description: `${concept.conceptName} (${concept.type})`,
|
|
597
|
+
level,
|
|
598
|
+
children,
|
|
599
|
+
fields,
|
|
600
|
+
collapsed: level > 0
|
|
601
|
+
// Collapse nested levels by default
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Create form field from XBRL concept
|
|
606
|
+
*/
|
|
607
|
+
static createFieldFromConcept(concept) {
|
|
608
|
+
const fieldType = this.mapXBRLTypeToFieldType(concept.type);
|
|
609
|
+
const label = this.getPreferredLabel(concept.labels);
|
|
610
|
+
return {
|
|
611
|
+
id: `${concept.id}_field`,
|
|
612
|
+
conceptId: concept.id,
|
|
613
|
+
columnId: "default",
|
|
614
|
+
// Default column, will be expanded later
|
|
615
|
+
type: fieldType,
|
|
616
|
+
label,
|
|
617
|
+
placeholder: `Enter ${label.toLowerCase()}`,
|
|
618
|
+
required: false,
|
|
619
|
+
// Will be determined by validation rules
|
|
620
|
+
disabled: concept.elementAbstract,
|
|
621
|
+
defaultValue: null
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Map XBRL data type to form field type
|
|
626
|
+
*/
|
|
627
|
+
static mapXBRLTypeToFieldType(xbrlType) {
|
|
628
|
+
const typeMap = {
|
|
629
|
+
"xbrli:stringItemType": "text",
|
|
630
|
+
"xbrli:monetaryItemType": "currency",
|
|
631
|
+
"xbrli:integerItemType": "number",
|
|
632
|
+
"xbrli:decimalItemType": "decimal",
|
|
633
|
+
"xbrli:percentItemType": "percentage",
|
|
634
|
+
"xbrli:dateItemType": "date",
|
|
635
|
+
"xbrli:booleanItemType": "boolean",
|
|
636
|
+
"dtr-types:domainItemType": "select",
|
|
637
|
+
"bw2-titel9:chamberOfCommerceRegistrationNumberItemType": "text"
|
|
638
|
+
};
|
|
639
|
+
return typeMap[xbrlType] || "text";
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Get preferred label from labels array
|
|
643
|
+
*/
|
|
644
|
+
static getPreferredLabel(labels) {
|
|
645
|
+
if (!labels || labels.length === 0)
|
|
646
|
+
return "Unnamed Concept";
|
|
647
|
+
const preferred = labels.find((l2) => l2.preferredLabel);
|
|
648
|
+
if (preferred)
|
|
649
|
+
return preferred.label;
|
|
650
|
+
const standard = labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label");
|
|
651
|
+
if (standard)
|
|
652
|
+
return standard.label;
|
|
653
|
+
const terse = labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/terseLabel");
|
|
654
|
+
if (terse)
|
|
655
|
+
return terse.label;
|
|
656
|
+
return labels[0].label;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Extract entity name from entrypoint URL
|
|
660
|
+
*/
|
|
661
|
+
static extractEntityName(entrypoint) {
|
|
662
|
+
try {
|
|
663
|
+
const url = new URL(entrypoint);
|
|
664
|
+
const pathParts = url.pathname.split("/");
|
|
665
|
+
const filename = pathParts[pathParts.length - 1];
|
|
666
|
+
return filename.replace(".xsd", "").replace(/[^a-zA-Z0-9]/g, " ").trim() || "Entity";
|
|
667
|
+
} catch {
|
|
668
|
+
return "Entity";
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Extract role title from role string
|
|
673
|
+
*/
|
|
674
|
+
static extractRoleTitle(role) {
|
|
675
|
+
const match = role.match(/^\[[\d]+\]\s*(.+)$/);
|
|
676
|
+
return match ? match[1].trim() : role;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Extract role order from role string
|
|
680
|
+
*/
|
|
681
|
+
static extractRoleOrder(role) {
|
|
682
|
+
const match = role.match(/^\[([\d]+)\]/);
|
|
683
|
+
return match ? parseInt(match[1], 10) : 0;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Build columns from XBRL hypercube data (placeholder for now)
|
|
687
|
+
*/
|
|
688
|
+
static buildColumnsFromHypercubes() {
|
|
689
|
+
return [{
|
|
690
|
+
id: "default",
|
|
691
|
+
label: "Values",
|
|
692
|
+
type: "data"
|
|
693
|
+
}];
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
var __defProp$3 = Object.defineProperty;
|
|
697
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
698
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
699
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
700
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
701
|
+
if (decorator = decorators[i2])
|
|
702
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
703
|
+
if (kind && result)
|
|
704
|
+
__defProp$3(target, key, result);
|
|
705
|
+
return result;
|
|
706
|
+
};
|
|
707
|
+
let JupiterFormField = class extends LitElement {
|
|
708
|
+
constructor() {
|
|
709
|
+
super(...arguments);
|
|
710
|
+
this.value = null;
|
|
711
|
+
this.disabled = false;
|
|
712
|
+
this.locale = "en-US";
|
|
713
|
+
this._errors = [];
|
|
714
|
+
this._touched = false;
|
|
715
|
+
}
|
|
716
|
+
willUpdate(changedProperties) {
|
|
717
|
+
if (changedProperties.has("value") || changedProperties.has("field")) {
|
|
718
|
+
this._validateField();
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
_validateField() {
|
|
722
|
+
var _a;
|
|
723
|
+
if ((_a = this.field) == null ? void 0 : _a.validation) {
|
|
724
|
+
this._errors = FormValidator.validateField(
|
|
725
|
+
this.field.id,
|
|
726
|
+
this.conceptId,
|
|
727
|
+
this.columnId,
|
|
728
|
+
this.value,
|
|
729
|
+
this.field.type,
|
|
730
|
+
this.field.validation
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
_handleInput(event) {
|
|
735
|
+
const target = event.target;
|
|
736
|
+
let value = target.value;
|
|
737
|
+
if (this.field.type === "number" || this.field.type === "decimal") {
|
|
738
|
+
value = value === "" ? null : Number(value);
|
|
739
|
+
} else if (this.field.type === "boolean") {
|
|
740
|
+
value = target.checked;
|
|
741
|
+
}
|
|
742
|
+
this.value = value;
|
|
743
|
+
this._touched = true;
|
|
744
|
+
this.dispatchEvent(new CustomEvent("field-change", {
|
|
745
|
+
detail: {
|
|
746
|
+
fieldId: this.field.id,
|
|
747
|
+
conceptId: this.conceptId,
|
|
748
|
+
columnId: this.columnId,
|
|
749
|
+
value,
|
|
750
|
+
oldValue: this.value
|
|
751
|
+
},
|
|
752
|
+
bubbles: true
|
|
753
|
+
}));
|
|
754
|
+
}
|
|
755
|
+
_handleFocus() {
|
|
756
|
+
this.dispatchEvent(new CustomEvent("field-focus", {
|
|
757
|
+
detail: {
|
|
758
|
+
fieldId: this.field.id,
|
|
759
|
+
conceptId: this.conceptId,
|
|
760
|
+
columnId: this.columnId
|
|
761
|
+
},
|
|
762
|
+
bubbles: true
|
|
763
|
+
}));
|
|
764
|
+
}
|
|
765
|
+
_handleBlur() {
|
|
766
|
+
this._touched = true;
|
|
767
|
+
this.dispatchEvent(new CustomEvent("field-blur", {
|
|
768
|
+
detail: {
|
|
769
|
+
fieldId: this.field.id,
|
|
770
|
+
conceptId: this.conceptId,
|
|
771
|
+
columnId: this.columnId
|
|
772
|
+
},
|
|
773
|
+
bubbles: true
|
|
774
|
+
}));
|
|
775
|
+
}
|
|
776
|
+
_renderInput() {
|
|
777
|
+
var _a;
|
|
778
|
+
const hasErrors = this._errors.some((e2) => e2.severity === "error");
|
|
779
|
+
const hasWarnings = this._errors.some((e2) => e2.severity === "warning");
|
|
780
|
+
const cssClass = `field-input ${hasErrors ? "error" : hasWarnings ? "warning" : ""}`;
|
|
781
|
+
switch (this.field.type) {
|
|
782
|
+
case "textarea":
|
|
783
|
+
return html`
|
|
784
|
+
<textarea
|
|
785
|
+
class="${cssClass}"
|
|
786
|
+
.value="${this.value || ""}"
|
|
787
|
+
?disabled="${this.disabled || this.field.disabled}"
|
|
788
|
+
placeholder="${this.field.placeholder || ""}"
|
|
789
|
+
@input="${this._handleInput}"
|
|
790
|
+
@focus="${this._handleFocus}"
|
|
791
|
+
@blur="${this._handleBlur}"
|
|
792
|
+
></textarea>
|
|
793
|
+
`;
|
|
794
|
+
case "select":
|
|
795
|
+
return html`
|
|
796
|
+
<select
|
|
797
|
+
class="${cssClass}"
|
|
798
|
+
.value="${this.value || ""}"
|
|
799
|
+
?disabled="${this.disabled || this.field.disabled}"
|
|
800
|
+
@change="${this._handleInput}"
|
|
801
|
+
@focus="${this._handleFocus}"
|
|
802
|
+
@blur="${this._handleBlur}"
|
|
803
|
+
>
|
|
804
|
+
<option value="">Select...</option>
|
|
805
|
+
${(_a = this.field.options) == null ? void 0 : _a.map((option) => html`
|
|
806
|
+
<option
|
|
807
|
+
value="${option.value}"
|
|
808
|
+
?disabled="${option.disabled}"
|
|
809
|
+
?selected="${this.value === option.value}"
|
|
810
|
+
>
|
|
811
|
+
${option.label}
|
|
812
|
+
</option>
|
|
813
|
+
`)}
|
|
814
|
+
</select>
|
|
815
|
+
`;
|
|
816
|
+
case "boolean":
|
|
817
|
+
return html`
|
|
818
|
+
<div class="checkbox-container">
|
|
819
|
+
<input
|
|
820
|
+
type="checkbox"
|
|
821
|
+
class="field-input"
|
|
822
|
+
.checked="${Boolean(this.value)}"
|
|
823
|
+
?disabled="${this.disabled || this.field.disabled}"
|
|
824
|
+
@change="${this._handleInput}"
|
|
825
|
+
@focus="${this._handleFocus}"
|
|
826
|
+
@blur="${this._handleBlur}"
|
|
827
|
+
/>
|
|
828
|
+
<span>${this.field.label}</span>
|
|
829
|
+
</div>
|
|
830
|
+
`;
|
|
831
|
+
default:
|
|
832
|
+
return html`
|
|
833
|
+
<input
|
|
834
|
+
type="${this._getInputType()}"
|
|
835
|
+
class="${cssClass}"
|
|
836
|
+
.value="${this.value || ""}"
|
|
837
|
+
?disabled="${this.disabled || this.field.disabled}"
|
|
838
|
+
placeholder="${this.field.placeholder || ""}"
|
|
839
|
+
@input="${this._handleInput}"
|
|
840
|
+
@focus="${this._handleFocus}"
|
|
841
|
+
@blur="${this._handleBlur}"
|
|
842
|
+
/>
|
|
843
|
+
`;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
_getInputType() {
|
|
847
|
+
switch (this.field.type) {
|
|
848
|
+
case "number":
|
|
849
|
+
case "decimal":
|
|
850
|
+
case "currency":
|
|
851
|
+
case "percentage":
|
|
852
|
+
return "number";
|
|
853
|
+
case "date":
|
|
854
|
+
return "date";
|
|
855
|
+
case "datetime":
|
|
856
|
+
return "datetime-local";
|
|
857
|
+
case "email":
|
|
858
|
+
return "email";
|
|
859
|
+
case "url":
|
|
860
|
+
return "url";
|
|
861
|
+
case "tel":
|
|
862
|
+
return "tel";
|
|
863
|
+
default:
|
|
864
|
+
return "text";
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
render() {
|
|
868
|
+
const showLabel = this.field.type !== "boolean";
|
|
869
|
+
return html`
|
|
870
|
+
<div class="field-container">
|
|
871
|
+
${showLabel ? html`
|
|
872
|
+
<label class="field-label ${this.field.required ? "required" : ""}">
|
|
873
|
+
${this.field.label}
|
|
874
|
+
</label>
|
|
875
|
+
` : ""}
|
|
876
|
+
|
|
877
|
+
${this._renderInput()}
|
|
878
|
+
|
|
879
|
+
${this._errors.length > 0 && this._touched ? html`
|
|
880
|
+
<div class="field-errors">
|
|
881
|
+
${this._errors.map((error) => html`
|
|
882
|
+
<span class="field-error ${error.severity}">
|
|
883
|
+
${error.message}
|
|
884
|
+
</span>
|
|
885
|
+
`)}
|
|
886
|
+
</div>
|
|
887
|
+
` : ""}
|
|
888
|
+
</div>
|
|
889
|
+
`;
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
JupiterFormField.styles = css`
|
|
893
|
+
:host {
|
|
894
|
+
display: block;
|
|
895
|
+
margin-bottom: 8px;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
.field-container {
|
|
899
|
+
position: relative;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
.field-label {
|
|
903
|
+
display: block;
|
|
904
|
+
font-weight: 500;
|
|
905
|
+
margin-bottom: 4px;
|
|
906
|
+
color: var(--jupiter-text-primary, #333);
|
|
907
|
+
font-size: 14px;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
.field-label.required::after {
|
|
911
|
+
content: ' *';
|
|
912
|
+
color: var(--jupiter-error-color, #d32f2f);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
.field-input {
|
|
916
|
+
width: 100%;
|
|
917
|
+
padding: 8px 12px;
|
|
918
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
919
|
+
border-radius: 4px;
|
|
920
|
+
font-size: 14px;
|
|
921
|
+
font-family: inherit;
|
|
922
|
+
background: var(--jupiter-input-background, #fff);
|
|
923
|
+
color: var(--jupiter-text-primary, #333);
|
|
924
|
+
box-sizing: border-box;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.field-input:focus {
|
|
928
|
+
outline: none;
|
|
929
|
+
border-color: var(--jupiter-primary-color, #1976d2);
|
|
930
|
+
box-shadow: 0 0 0 2px var(--jupiter-primary-color-light, rgba(25, 118, 210, 0.2));
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
.field-input:disabled {
|
|
934
|
+
background: var(--jupiter-disabled-background, #f5f5f5);
|
|
935
|
+
color: var(--jupiter-disabled-text, #999);
|
|
936
|
+
cursor: not-allowed;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
.field-input.error {
|
|
940
|
+
border-color: var(--jupiter-error-color, #d32f2f);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
.field-input.warning {
|
|
944
|
+
border-color: var(--jupiter-warning-color, #ff9800);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
.field-errors {
|
|
948
|
+
margin-top: 4px;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.field-error {
|
|
952
|
+
display: block;
|
|
953
|
+
font-size: 12px;
|
|
954
|
+
margin-bottom: 2px;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.field-error.error {
|
|
958
|
+
color: var(--jupiter-error-color, #d32f2f);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
.field-error.warning {
|
|
962
|
+
color: var(--jupiter-warning-color, #ff9800);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
.field-error.info {
|
|
966
|
+
color: var(--jupiter-info-color, #2196f3);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
select.field-input {
|
|
970
|
+
appearance: none;
|
|
971
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
|
|
972
|
+
background-position: right 8px center;
|
|
973
|
+
background-repeat: no-repeat;
|
|
974
|
+
background-size: 16px;
|
|
975
|
+
padding-right: 32px;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
textarea.field-input {
|
|
979
|
+
resize: vertical;
|
|
980
|
+
min-height: 60px;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
.checkbox-container {
|
|
984
|
+
display: flex;
|
|
985
|
+
align-items: center;
|
|
986
|
+
gap: 8px;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
.checkbox-container input[type="checkbox"] {
|
|
990
|
+
margin: 0;
|
|
991
|
+
width: auto;
|
|
992
|
+
}
|
|
993
|
+
`;
|
|
994
|
+
__decorateClass$3([
|
|
995
|
+
n2({ type: Object })
|
|
996
|
+
], JupiterFormField.prototype, "field", 2);
|
|
997
|
+
__decorateClass$3([
|
|
998
|
+
n2({ type: String })
|
|
999
|
+
], JupiterFormField.prototype, "conceptId", 2);
|
|
1000
|
+
__decorateClass$3([
|
|
1001
|
+
n2({ type: String })
|
|
1002
|
+
], JupiterFormField.prototype, "columnId", 2);
|
|
1003
|
+
__decorateClass$3([
|
|
1004
|
+
n2()
|
|
1005
|
+
], JupiterFormField.prototype, "value", 2);
|
|
1006
|
+
__decorateClass$3([
|
|
1007
|
+
n2({ type: Boolean })
|
|
1008
|
+
], JupiterFormField.prototype, "disabled", 2);
|
|
1009
|
+
__decorateClass$3([
|
|
1010
|
+
n2({ type: String })
|
|
1011
|
+
], JupiterFormField.prototype, "locale", 2);
|
|
1012
|
+
__decorateClass$3([
|
|
1013
|
+
r()
|
|
1014
|
+
], JupiterFormField.prototype, "_errors", 2);
|
|
1015
|
+
__decorateClass$3([
|
|
1016
|
+
r()
|
|
1017
|
+
], JupiterFormField.prototype, "_touched", 2);
|
|
1018
|
+
JupiterFormField = __decorateClass$3([
|
|
1019
|
+
t$1("jupiter-form-field")
|
|
1020
|
+
], JupiterFormField);
|
|
1021
|
+
var __defProp$2 = Object.defineProperty;
|
|
1022
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
1023
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
1024
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
1025
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1026
|
+
if (decorator = decorators[i2])
|
|
1027
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1028
|
+
if (kind && result)
|
|
1029
|
+
__defProp$2(target, key, result);
|
|
1030
|
+
return result;
|
|
1031
|
+
};
|
|
1032
|
+
let JupiterConceptTree = class extends LitElement {
|
|
1033
|
+
constructor() {
|
|
1034
|
+
super(...arguments);
|
|
1035
|
+
this.columns = [];
|
|
1036
|
+
this.formData = {};
|
|
1037
|
+
this.disabled = false;
|
|
1038
|
+
this.locale = "en-US";
|
|
1039
|
+
this._expanded = true;
|
|
1040
|
+
}
|
|
1041
|
+
connectedCallback() {
|
|
1042
|
+
super.connectedCallback();
|
|
1043
|
+
this._expanded = !this.concept.collapsed;
|
|
1044
|
+
}
|
|
1045
|
+
_toggleExpanded() {
|
|
1046
|
+
this._expanded = !this._expanded;
|
|
1047
|
+
this.dispatchEvent(new CustomEvent("concept-expand", {
|
|
1048
|
+
detail: {
|
|
1049
|
+
conceptId: this.concept.id,
|
|
1050
|
+
expanded: this._expanded
|
|
1051
|
+
},
|
|
1052
|
+
bubbles: true
|
|
1053
|
+
}));
|
|
1054
|
+
}
|
|
1055
|
+
_getFieldForColumn(columnId) {
|
|
1056
|
+
return this.concept.fields.find((field) => field.columnId === columnId);
|
|
1057
|
+
}
|
|
1058
|
+
_getFieldValue(field) {
|
|
1059
|
+
var _a;
|
|
1060
|
+
return (_a = this.formData[this.concept.id]) == null ? void 0 : _a[field.columnId];
|
|
1061
|
+
}
|
|
1062
|
+
_handleFieldChange(event) {
|
|
1063
|
+
event.stopPropagation();
|
|
1064
|
+
this.dispatchEvent(new CustomEvent("field-change", {
|
|
1065
|
+
detail: event.detail,
|
|
1066
|
+
bubbles: true
|
|
1067
|
+
}));
|
|
1068
|
+
}
|
|
1069
|
+
render() {
|
|
1070
|
+
const hasChildren = this.concept.children && this.concept.children.length > 0;
|
|
1071
|
+
const level = this.concept.level || 0;
|
|
1072
|
+
return html`
|
|
1073
|
+
<div class="concept-row" style="--level: ${level}">
|
|
1074
|
+
<!-- Concept Label Column -->
|
|
1075
|
+
<div class="concept-header" @click="${this._toggleExpanded}">
|
|
1076
|
+
<div class="concept-indent"></div>
|
|
1077
|
+
<div class="concept-toggle ${hasChildren ? this._expanded ? "expanded" : "" : "no-children"}">
|
|
1078
|
+
${hasChildren ? "▶" : ""}
|
|
1079
|
+
</div>
|
|
1080
|
+
<div class="concept-label">
|
|
1081
|
+
${this.concept.label}
|
|
1082
|
+
${this.concept.description ? html`
|
|
1083
|
+
<span class="concept-description">${this.concept.description}</span>
|
|
1084
|
+
` : ""}
|
|
1085
|
+
</div>
|
|
1086
|
+
</div>
|
|
1087
|
+
|
|
1088
|
+
<!-- Field Columns -->
|
|
1089
|
+
${this.columns.map((column) => {
|
|
1090
|
+
const field = this._getFieldForColumn(column.id);
|
|
1091
|
+
return html`
|
|
1092
|
+
<div class="field-cell ${!field ? "empty" : ""}">
|
|
1093
|
+
${field ? html`
|
|
1094
|
+
<jupiter-form-field
|
|
1095
|
+
.field="${field}"
|
|
1096
|
+
.conceptId="${this.concept.id}"
|
|
1097
|
+
.columnId="${column.id}"
|
|
1098
|
+
.value="${this._getFieldValue(field)}"
|
|
1099
|
+
.disabled="${this.disabled}"
|
|
1100
|
+
.locale="${this.locale}"
|
|
1101
|
+
@field-change="${this._handleFieldChange}"
|
|
1102
|
+
></jupiter-form-field>
|
|
1103
|
+
` : ""}
|
|
1104
|
+
</div>
|
|
1105
|
+
`;
|
|
1106
|
+
})}
|
|
1107
|
+
</div>
|
|
1108
|
+
|
|
1109
|
+
<!-- Children Concepts -->
|
|
1110
|
+
${hasChildren ? html`
|
|
1111
|
+
<div class="children ${!this._expanded ? "collapsed" : ""}">
|
|
1112
|
+
${this.concept.children.map((child) => html`
|
|
1113
|
+
<jupiter-concept-tree
|
|
1114
|
+
.concept="${child}"
|
|
1115
|
+
.columns="${this.columns}"
|
|
1116
|
+
.formData="${this.formData}"
|
|
1117
|
+
.disabled="${this.disabled}"
|
|
1118
|
+
.locale="${this.locale}"
|
|
1119
|
+
@field-change="${this._handleFieldChange}"
|
|
1120
|
+
@concept-expand="${(e2) => {
|
|
1121
|
+
e2.stopPropagation();
|
|
1122
|
+
this.dispatchEvent(new CustomEvent("concept-expand", { detail: e2.detail, bubbles: true }));
|
|
1123
|
+
}}"
|
|
1124
|
+
></jupiter-concept-tree>
|
|
1125
|
+
`)}
|
|
1126
|
+
</div>
|
|
1127
|
+
` : ""}
|
|
1128
|
+
`;
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
JupiterConceptTree.styles = css`
|
|
1132
|
+
:host {
|
|
1133
|
+
display: block;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
.concept-row {
|
|
1137
|
+
display: contents;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.concept-header {
|
|
1141
|
+
display: flex;
|
|
1142
|
+
align-items: center;
|
|
1143
|
+
padding: 8px 12px;
|
|
1144
|
+
background: var(--jupiter-concept-background, #f8f9fa);
|
|
1145
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1146
|
+
border-bottom: none;
|
|
1147
|
+
font-weight: 500;
|
|
1148
|
+
cursor: pointer;
|
|
1149
|
+
user-select: none;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
.concept-header:hover {
|
|
1153
|
+
background: var(--jupiter-concept-hover-background, #e9ecef);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
.concept-indent {
|
|
1157
|
+
width: calc(var(--level, 0) * 20px);
|
|
1158
|
+
flex-shrink: 0;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
.concept-toggle {
|
|
1162
|
+
width: 16px;
|
|
1163
|
+
height: 16px;
|
|
1164
|
+
margin-right: 8px;
|
|
1165
|
+
display: flex;
|
|
1166
|
+
align-items: center;
|
|
1167
|
+
justify-content: center;
|
|
1168
|
+
font-size: 12px;
|
|
1169
|
+
transition: transform 0.2s ease;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
.concept-toggle.expanded {
|
|
1173
|
+
transform: rotate(90deg);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
.concept-toggle.no-children {
|
|
1177
|
+
visibility: hidden;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
.concept-label {
|
|
1181
|
+
flex: 1;
|
|
1182
|
+
color: var(--jupiter-text-primary, #333);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
.concept-description {
|
|
1186
|
+
font-size: 12px;
|
|
1187
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1188
|
+
font-weight: normal;
|
|
1189
|
+
margin-left: 8px;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
.concept-fields {
|
|
1193
|
+
display: contents;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
.field-cell {
|
|
1197
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1198
|
+
border-bottom: none;
|
|
1199
|
+
padding: 8px;
|
|
1200
|
+
background: var(--jupiter-cell-background, #fff);
|
|
1201
|
+
min-height: 40px;
|
|
1202
|
+
display: flex;
|
|
1203
|
+
align-items: center;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
.field-cell:last-child {
|
|
1207
|
+
border-right: 1px solid var(--jupiter-border-color, #ddd);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
.field-cell.empty {
|
|
1211
|
+
background: var(--jupiter-empty-cell-background, #f8f9fa);
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
.children {
|
|
1215
|
+
display: contents;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
.children.collapsed {
|
|
1219
|
+
display: none;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
.concept-row:last-of-type .concept-header,
|
|
1223
|
+
.concept-row:last-of-type .field-cell {
|
|
1224
|
+
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
1225
|
+
}
|
|
1226
|
+
`;
|
|
1227
|
+
__decorateClass$2([
|
|
1228
|
+
n2({ type: Object })
|
|
1229
|
+
], JupiterConceptTree.prototype, "concept", 2);
|
|
1230
|
+
__decorateClass$2([
|
|
1231
|
+
n2({ type: Array })
|
|
1232
|
+
], JupiterConceptTree.prototype, "columns", 2);
|
|
1233
|
+
__decorateClass$2([
|
|
1234
|
+
n2({ type: Object })
|
|
1235
|
+
], JupiterConceptTree.prototype, "formData", 2);
|
|
1236
|
+
__decorateClass$2([
|
|
1237
|
+
n2({ type: Boolean })
|
|
1238
|
+
], JupiterConceptTree.prototype, "disabled", 2);
|
|
1239
|
+
__decorateClass$2([
|
|
1240
|
+
n2({ type: String })
|
|
1241
|
+
], JupiterConceptTree.prototype, "locale", 2);
|
|
1242
|
+
__decorateClass$2([
|
|
1243
|
+
r()
|
|
1244
|
+
], JupiterConceptTree.prototype, "_expanded", 2);
|
|
1245
|
+
JupiterConceptTree = __decorateClass$2([
|
|
1246
|
+
t$1("jupiter-concept-tree")
|
|
1247
|
+
], JupiterConceptTree);
|
|
1248
|
+
var __defProp$1 = Object.defineProperty;
|
|
1249
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
1250
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
1251
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
1252
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1253
|
+
if (decorator = decorators[i2])
|
|
1254
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1255
|
+
if (kind && result)
|
|
1256
|
+
__defProp$1(target, key, result);
|
|
1257
|
+
return result;
|
|
1258
|
+
};
|
|
1259
|
+
let JupiterFormSection = class extends LitElement {
|
|
1260
|
+
constructor() {
|
|
1261
|
+
super(...arguments);
|
|
1262
|
+
this.columns = [];
|
|
1263
|
+
this.formData = {};
|
|
1264
|
+
this.disabled = false;
|
|
1265
|
+
this.collapsible = true;
|
|
1266
|
+
this.locale = "en-US";
|
|
1267
|
+
this._expanded = true;
|
|
1268
|
+
}
|
|
1269
|
+
connectedCallback() {
|
|
1270
|
+
super.connectedCallback();
|
|
1271
|
+
this._expanded = this.section.expanded !== false;
|
|
1272
|
+
}
|
|
1273
|
+
_toggleExpanded() {
|
|
1274
|
+
if (!this.collapsible)
|
|
1275
|
+
return;
|
|
1276
|
+
this._expanded = !this._expanded;
|
|
1277
|
+
this.dispatchEvent(new CustomEvent("section-expand", {
|
|
1278
|
+
detail: {
|
|
1279
|
+
sectionId: this.section.id,
|
|
1280
|
+
expanded: this._expanded
|
|
1281
|
+
},
|
|
1282
|
+
bubbles: true
|
|
1283
|
+
}));
|
|
1284
|
+
}
|
|
1285
|
+
_handleRemoveColumn(columnId) {
|
|
1286
|
+
this.dispatchEvent(new CustomEvent("column-remove", {
|
|
1287
|
+
detail: { columnId },
|
|
1288
|
+
bubbles: true
|
|
1289
|
+
}));
|
|
1290
|
+
}
|
|
1291
|
+
_handleFieldChange(event) {
|
|
1292
|
+
event.stopPropagation();
|
|
1293
|
+
this.dispatchEvent(new CustomEvent("field-change", {
|
|
1294
|
+
detail: event.detail,
|
|
1295
|
+
bubbles: true
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
_handleConceptExpand(event) {
|
|
1299
|
+
event.stopPropagation();
|
|
1300
|
+
this.dispatchEvent(new CustomEvent("concept-expand", {
|
|
1301
|
+
detail: event.detail,
|
|
1302
|
+
bubbles: true
|
|
1303
|
+
}));
|
|
1304
|
+
}
|
|
1305
|
+
render() {
|
|
1306
|
+
if (!this.section.concepts || this.section.concepts.length === 0) {
|
|
1307
|
+
return html`
|
|
1308
|
+
<div class="section-header ${!this.collapsible ? "not-collapsible" : ""}"
|
|
1309
|
+
@click="${this._toggleExpanded}">
|
|
1310
|
+
<div>
|
|
1311
|
+
<h3 class="section-title">${this.section.title}</h3>
|
|
1312
|
+
${this.section.description ? html`
|
|
1313
|
+
<p class="section-description">${this.section.description}</p>
|
|
1314
|
+
` : ""}
|
|
1315
|
+
</div>
|
|
1316
|
+
<div class="section-toggle ${this.collapsible ? this._expanded ? "expanded" : "" : "hidden"}">
|
|
1317
|
+
${this.collapsible ? "▶" : ""}
|
|
1318
|
+
</div>
|
|
1319
|
+
</div>
|
|
1320
|
+
|
|
1321
|
+
<div class="section-content ${!this._expanded ? "collapsed" : ""}">
|
|
1322
|
+
<div class="empty-section">
|
|
1323
|
+
No concepts defined for this section.
|
|
1324
|
+
</div>
|
|
1325
|
+
</div>
|
|
1326
|
+
`;
|
|
1327
|
+
}
|
|
1328
|
+
return html`
|
|
1329
|
+
<div class="section-header ${!this.collapsible ? "not-collapsible" : ""}"
|
|
1330
|
+
@click="${this._toggleExpanded}">
|
|
1331
|
+
<div>
|
|
1332
|
+
<h3 class="section-title">${this.section.title}</h3>
|
|
1333
|
+
${this.section.description ? html`
|
|
1334
|
+
<p class="section-description">${this.section.description}</p>
|
|
1335
|
+
` : ""}
|
|
1336
|
+
</div>
|
|
1337
|
+
<div class="section-toggle ${this.collapsible ? this._expanded ? "expanded" : "" : "hidden"}">
|
|
1338
|
+
${this.collapsible ? "▶" : ""}
|
|
1339
|
+
</div>
|
|
1340
|
+
</div>
|
|
1341
|
+
|
|
1342
|
+
<div class="section-content ${!this._expanded ? "collapsed" : ""}">
|
|
1343
|
+
<div class="table-container">
|
|
1344
|
+
<table class="form-table">
|
|
1345
|
+
<thead class="table-header">
|
|
1346
|
+
<tr>
|
|
1347
|
+
<th class="header-cell concept-column">Concept</th>
|
|
1348
|
+
${this.columns.map((column) => html`
|
|
1349
|
+
<th class="header-cell ${column.removable ? "removable" : ""}">
|
|
1350
|
+
${column.title}
|
|
1351
|
+
${column.description ? html`<div style="font-weight: normal; font-size: 12px; color: var(--jupiter-text-secondary, #666);">${column.description}</div>` : ""}
|
|
1352
|
+
${column.removable ? html`
|
|
1353
|
+
<button
|
|
1354
|
+
class="remove-column-btn"
|
|
1355
|
+
@click="${(e2) => {
|
|
1356
|
+
e2.stopPropagation();
|
|
1357
|
+
this._handleRemoveColumn(column.id);
|
|
1358
|
+
}}"
|
|
1359
|
+
title="Remove column"
|
|
1360
|
+
>×</button>
|
|
1361
|
+
` : ""}
|
|
1362
|
+
</th>
|
|
1363
|
+
`)}
|
|
1364
|
+
</tr>
|
|
1365
|
+
</thead>
|
|
1366
|
+
<tbody class="table-body">
|
|
1367
|
+
${this.section.concepts.map((concept) => html`
|
|
1368
|
+
<jupiter-concept-tree
|
|
1369
|
+
.concept="${concept}"
|
|
1370
|
+
.columns="${this.columns}"
|
|
1371
|
+
.formData="${this.formData}"
|
|
1372
|
+
.disabled="${this.disabled}"
|
|
1373
|
+
.locale="${this.locale}"
|
|
1374
|
+
@field-change="${this._handleFieldChange}"
|
|
1375
|
+
@concept-expand="${this._handleConceptExpand}"
|
|
1376
|
+
></jupiter-concept-tree>
|
|
1377
|
+
`)}
|
|
1378
|
+
</tbody>
|
|
1379
|
+
</table>
|
|
1380
|
+
</div>
|
|
1381
|
+
</div>
|
|
1382
|
+
`;
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
JupiterFormSection.styles = css`
|
|
1386
|
+
:host {
|
|
1387
|
+
display: block;
|
|
1388
|
+
margin-bottom: 16px;
|
|
1389
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1390
|
+
border-radius: 6px;
|
|
1391
|
+
overflow: hidden;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
.section-header {
|
|
1395
|
+
background: var(--jupiter-section-header-background, #f0f2f5);
|
|
1396
|
+
padding: 16px;
|
|
1397
|
+
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
1398
|
+
cursor: pointer;
|
|
1399
|
+
user-select: none;
|
|
1400
|
+
display: flex;
|
|
1401
|
+
align-items: center;
|
|
1402
|
+
justify-content: space-between;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
.section-header:hover {
|
|
1406
|
+
background: var(--jupiter-section-header-hover-background, #e4e7ea);
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
.section-header.not-collapsible {
|
|
1410
|
+
cursor: default;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
.section-header.not-collapsible:hover {
|
|
1414
|
+
background: var(--jupiter-section-header-background, #f0f2f5);
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
.section-title {
|
|
1418
|
+
font-size: 18px;
|
|
1419
|
+
font-weight: 600;
|
|
1420
|
+
color: var(--jupiter-text-primary, #333);
|
|
1421
|
+
margin: 0;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
.section-description {
|
|
1425
|
+
font-size: 14px;
|
|
1426
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1427
|
+
margin: 4px 0 0 0;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
.section-toggle {
|
|
1431
|
+
width: 24px;
|
|
1432
|
+
height: 24px;
|
|
1433
|
+
display: flex;
|
|
1434
|
+
align-items: center;
|
|
1435
|
+
justify-content: center;
|
|
1436
|
+
font-size: 16px;
|
|
1437
|
+
transition: transform 0.2s ease;
|
|
1438
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
.section-toggle.expanded {
|
|
1442
|
+
transform: rotate(90deg);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
.section-toggle.hidden {
|
|
1446
|
+
visibility: hidden;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
.section-content {
|
|
1450
|
+
display: block;
|
|
1451
|
+
transition: max-height 0.3s ease;
|
|
1452
|
+
overflow: hidden;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
.section-content.collapsed {
|
|
1456
|
+
display: none;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
.table-container {
|
|
1460
|
+
overflow-x: auto;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
.form-table {
|
|
1464
|
+
width: 100%;
|
|
1465
|
+
border-collapse: collapse;
|
|
1466
|
+
background: var(--jupiter-table-background, #fff);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
.table-header {
|
|
1470
|
+
background: var(--jupiter-header-background, #f8f9fa);
|
|
1471
|
+
position: sticky;
|
|
1472
|
+
top: 0;
|
|
1473
|
+
z-index: 1;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
.header-cell {
|
|
1477
|
+
padding: 12px;
|
|
1478
|
+
text-align: left;
|
|
1479
|
+
font-weight: 600;
|
|
1480
|
+
color: var(--jupiter-text-primary, #333);
|
|
1481
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1482
|
+
background: var(--jupiter-header-background, #f8f9fa);
|
|
1483
|
+
min-width: 150px;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
.header-cell.concept-column {
|
|
1487
|
+
min-width: 300px;
|
|
1488
|
+
position: sticky;
|
|
1489
|
+
left: 0;
|
|
1490
|
+
z-index: 2;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
.header-cell.removable {
|
|
1494
|
+
position: relative;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
.remove-column-btn {
|
|
1498
|
+
position: absolute;
|
|
1499
|
+
top: 4px;
|
|
1500
|
+
right: 4px;
|
|
1501
|
+
width: 20px;
|
|
1502
|
+
height: 20px;
|
|
1503
|
+
border: none;
|
|
1504
|
+
background: var(--jupiter-error-color, #d32f2f);
|
|
1505
|
+
color: white;
|
|
1506
|
+
border-radius: 50%;
|
|
1507
|
+
font-size: 12px;
|
|
1508
|
+
cursor: pointer;
|
|
1509
|
+
display: flex;
|
|
1510
|
+
align-items: center;
|
|
1511
|
+
justify-content: center;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
.remove-column-btn:hover {
|
|
1515
|
+
background: var(--jupiter-error-color-dark, #b71c1c);
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
.table-body {
|
|
1519
|
+
display: table-row-group;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
.empty-section {
|
|
1523
|
+
padding: 24px;
|
|
1524
|
+
text-align: center;
|
|
1525
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1526
|
+
font-style: italic;
|
|
1527
|
+
}
|
|
1528
|
+
`;
|
|
1529
|
+
__decorateClass$1([
|
|
1530
|
+
n2({ type: Object })
|
|
1531
|
+
], JupiterFormSection.prototype, "section", 2);
|
|
1532
|
+
__decorateClass$1([
|
|
1533
|
+
n2({ type: Array })
|
|
1534
|
+
], JupiterFormSection.prototype, "columns", 2);
|
|
1535
|
+
__decorateClass$1([
|
|
1536
|
+
n2({ type: Object })
|
|
1537
|
+
], JupiterFormSection.prototype, "formData", 2);
|
|
1538
|
+
__decorateClass$1([
|
|
1539
|
+
n2({ type: Boolean })
|
|
1540
|
+
], JupiterFormSection.prototype, "disabled", 2);
|
|
1541
|
+
__decorateClass$1([
|
|
1542
|
+
n2({ type: Boolean })
|
|
1543
|
+
], JupiterFormSection.prototype, "collapsible", 2);
|
|
1544
|
+
__decorateClass$1([
|
|
1545
|
+
n2({ type: String })
|
|
1546
|
+
], JupiterFormSection.prototype, "locale", 2);
|
|
1547
|
+
__decorateClass$1([
|
|
1548
|
+
r()
|
|
1549
|
+
], JupiterFormSection.prototype, "_expanded", 2);
|
|
1550
|
+
JupiterFormSection = __decorateClass$1([
|
|
1551
|
+
t$1("jupiter-form-section")
|
|
1552
|
+
], JupiterFormSection);
|
|
1553
|
+
var __defProp = Object.defineProperty;
|
|
1554
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1555
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
1556
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
1557
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1558
|
+
if (decorator = decorators[i2])
|
|
1559
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1560
|
+
if (kind && result)
|
|
1561
|
+
__defProp(target, key, result);
|
|
1562
|
+
return result;
|
|
1563
|
+
};
|
|
1564
|
+
let JupiterDynamicForm = class extends LitElement {
|
|
1565
|
+
constructor() {
|
|
1566
|
+
super(...arguments);
|
|
1567
|
+
this.config = {};
|
|
1568
|
+
this.initialData = {};
|
|
1569
|
+
this.disabled = false;
|
|
1570
|
+
this.readonly = false;
|
|
1571
|
+
this._formData = {};
|
|
1572
|
+
this._columns = [];
|
|
1573
|
+
this._errors = [];
|
|
1574
|
+
this._touched = /* @__PURE__ */ new Set();
|
|
1575
|
+
this._dirty = false;
|
|
1576
|
+
this._valid = true;
|
|
1577
|
+
this._submitted = false;
|
|
1578
|
+
}
|
|
1579
|
+
connectedCallback() {
|
|
1580
|
+
super.connectedCallback();
|
|
1581
|
+
this._initializeForm();
|
|
1582
|
+
}
|
|
1583
|
+
updated(changedProperties) {
|
|
1584
|
+
if (changedProperties.has("xbrlInput") || changedProperties.has("schema")) {
|
|
1585
|
+
this._initializeForm();
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
_initializeForm() {
|
|
1589
|
+
var _a;
|
|
1590
|
+
if (this.xbrlInput) {
|
|
1591
|
+
try {
|
|
1592
|
+
console.log("🔄 Initializing form from XBRL input:", this.xbrlInput);
|
|
1593
|
+
this._currentSchema = XBRLFormBuilder.buildFormSchema(this.xbrlInput);
|
|
1594
|
+
console.log("✅ Generated schema with sections:", this._currentSchema.sections.length);
|
|
1595
|
+
this._columns = [
|
|
1596
|
+
{
|
|
1597
|
+
id: "base",
|
|
1598
|
+
title: "Value",
|
|
1599
|
+
description: "Base values for concepts",
|
|
1600
|
+
type: "base",
|
|
1601
|
+
order: 0,
|
|
1602
|
+
removable: false
|
|
1603
|
+
}
|
|
1604
|
+
];
|
|
1605
|
+
} catch (error) {
|
|
1606
|
+
console.error("❌ Error building form from XBRL input:", error);
|
|
1607
|
+
this._currentSchema = this._getDefaultSchema();
|
|
1608
|
+
this._columns = this._getDefaultColumns();
|
|
1609
|
+
}
|
|
1610
|
+
} else if (this.schema) {
|
|
1611
|
+
this._currentSchema = this.schema;
|
|
1612
|
+
this._columns = this._getDefaultColumns();
|
|
1613
|
+
} else {
|
|
1614
|
+
this._currentSchema = this._getDefaultSchema();
|
|
1615
|
+
this._columns = this._getDefaultColumns();
|
|
1616
|
+
}
|
|
1617
|
+
this._formData = { ...this.initialData };
|
|
1618
|
+
if ((_a = this.xbrlInput) == null ? void 0 : _a.initialData) {
|
|
1619
|
+
this._formData = { ...this._formData, ...this.xbrlInput.initialData };
|
|
1620
|
+
}
|
|
1621
|
+
this._validateForm();
|
|
1622
|
+
}
|
|
1623
|
+
_getDefaultSchema() {
|
|
1624
|
+
return {
|
|
1625
|
+
version: "1.0",
|
|
1626
|
+
formId: "default-form",
|
|
1627
|
+
title: "Dynamic Form",
|
|
1628
|
+
description: "Please provide form schema or XBRL input data",
|
|
1629
|
+
sections: []
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
_getDefaultColumns() {
|
|
1633
|
+
return [
|
|
1634
|
+
{
|
|
1635
|
+
id: "base",
|
|
1636
|
+
title: "Value",
|
|
1637
|
+
description: "Base values for concepts",
|
|
1638
|
+
type: "base",
|
|
1639
|
+
order: 0,
|
|
1640
|
+
removable: false
|
|
1641
|
+
}
|
|
1642
|
+
];
|
|
1643
|
+
}
|
|
1644
|
+
_validateForm() {
|
|
1645
|
+
var _a;
|
|
1646
|
+
const errors = [];
|
|
1647
|
+
const schema = this._currentSchema;
|
|
1648
|
+
if (!schema)
|
|
1649
|
+
return;
|
|
1650
|
+
for (const section of schema.sections) {
|
|
1651
|
+
for (const concept of section.concepts) {
|
|
1652
|
+
for (const field of concept.fields) {
|
|
1653
|
+
const value = (_a = this._formData[concept.id]) == null ? void 0 : _a[field.columnId];
|
|
1654
|
+
const fieldErrors = FormValidator.validateField(
|
|
1655
|
+
field.id,
|
|
1656
|
+
concept.id,
|
|
1657
|
+
field.columnId,
|
|
1658
|
+
value,
|
|
1659
|
+
field.type,
|
|
1660
|
+
field.validation || []
|
|
1661
|
+
);
|
|
1662
|
+
errors.push(...fieldErrors);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
this._errors = errors;
|
|
1667
|
+
this._valid = errors.filter((e2) => e2.severity === "error").length === 0;
|
|
1668
|
+
}
|
|
1669
|
+
_handleFieldChange(event) {
|
|
1670
|
+
const { fieldId, conceptId, columnId, value } = event.detail;
|
|
1671
|
+
if (!this._formData[conceptId]) {
|
|
1672
|
+
this._formData[conceptId] = {};
|
|
1673
|
+
}
|
|
1674
|
+
const oldValue = this._formData[conceptId][columnId];
|
|
1675
|
+
this._formData[conceptId][columnId] = value;
|
|
1676
|
+
this._touched.add(`${conceptId}-${columnId}`);
|
|
1677
|
+
this._dirty = true;
|
|
1678
|
+
this._validateForm();
|
|
1679
|
+
this.requestUpdate();
|
|
1680
|
+
this.dispatchEvent(new CustomEvent("field-change", {
|
|
1681
|
+
detail: { fieldId, conceptId, columnId, value, oldValue },
|
|
1682
|
+
bubbles: true
|
|
1683
|
+
}));
|
|
1684
|
+
}
|
|
1685
|
+
_handleSectionExpand(event) {
|
|
1686
|
+
this.dispatchEvent(new CustomEvent("section-expand", {
|
|
1687
|
+
detail: event.detail,
|
|
1688
|
+
bubbles: true
|
|
1689
|
+
}));
|
|
1690
|
+
}
|
|
1691
|
+
_handleConceptExpand(event) {
|
|
1692
|
+
this.dispatchEvent(new CustomEvent("concept-expand", {
|
|
1693
|
+
detail: event.detail,
|
|
1694
|
+
bubbles: true
|
|
1695
|
+
}));
|
|
1696
|
+
}
|
|
1697
|
+
_handleColumnRemove(event) {
|
|
1698
|
+
const { columnId } = event.detail;
|
|
1699
|
+
this._columns = this._columns.filter((col) => col.id !== columnId);
|
|
1700
|
+
for (const conceptId in this._formData) {
|
|
1701
|
+
if (this._formData[conceptId][columnId] !== void 0) {
|
|
1702
|
+
delete this._formData[conceptId][columnId];
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
this._dirty = true;
|
|
1706
|
+
this._validateForm();
|
|
1707
|
+
this.requestUpdate();
|
|
1708
|
+
this.dispatchEvent(new CustomEvent("column-remove", {
|
|
1709
|
+
detail: { columnId },
|
|
1710
|
+
bubbles: true
|
|
1711
|
+
}));
|
|
1712
|
+
}
|
|
1713
|
+
_addColumn() {
|
|
1714
|
+
const newColumnId = `dim-${Date.now()}`;
|
|
1715
|
+
const newColumn = {
|
|
1716
|
+
id: newColumnId,
|
|
1717
|
+
title: `Dimension ${this._columns.length}`,
|
|
1718
|
+
description: "Additional dimension column",
|
|
1719
|
+
type: "dimension",
|
|
1720
|
+
order: this._columns.length,
|
|
1721
|
+
removable: true,
|
|
1722
|
+
dimensionData: {
|
|
1723
|
+
dimensionId: "custom",
|
|
1724
|
+
memberValue: "default",
|
|
1725
|
+
memberLabel: "Default Member"
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
this._columns = [...this._columns, newColumn];
|
|
1729
|
+
this.requestUpdate();
|
|
1730
|
+
this.dispatchEvent(new CustomEvent("column-add", {
|
|
1731
|
+
detail: { column: newColumn },
|
|
1732
|
+
bubbles: true
|
|
1733
|
+
}));
|
|
1734
|
+
}
|
|
1735
|
+
_handleSubmit() {
|
|
1736
|
+
this._submitted = true;
|
|
1737
|
+
this._validateForm();
|
|
1738
|
+
this.dispatchEvent(new CustomEvent("form-submit", {
|
|
1739
|
+
detail: {
|
|
1740
|
+
data: this._formData,
|
|
1741
|
+
valid: this._valid,
|
|
1742
|
+
errors: this._errors
|
|
1743
|
+
},
|
|
1744
|
+
bubbles: true
|
|
1745
|
+
}));
|
|
1746
|
+
}
|
|
1747
|
+
_handleReset() {
|
|
1748
|
+
this._formData = { ...this.initialData };
|
|
1749
|
+
this._touched.clear();
|
|
1750
|
+
this._dirty = false;
|
|
1751
|
+
this._submitted = false;
|
|
1752
|
+
this._validateForm();
|
|
1753
|
+
this.requestUpdate();
|
|
1754
|
+
this.dispatchEvent(new CustomEvent("form-reset", {
|
|
1755
|
+
detail: {},
|
|
1756
|
+
bubbles: true
|
|
1757
|
+
}));
|
|
1758
|
+
}
|
|
1759
|
+
_getFormState() {
|
|
1760
|
+
return {
|
|
1761
|
+
data: this._formData,
|
|
1762
|
+
errors: this._errors,
|
|
1763
|
+
touched: this._touched,
|
|
1764
|
+
dirty: this._dirty,
|
|
1765
|
+
valid: this._valid,
|
|
1766
|
+
submitted: this._submitted
|
|
1767
|
+
};
|
|
1768
|
+
}
|
|
1769
|
+
// Public API methods
|
|
1770
|
+
getData() {
|
|
1771
|
+
return { ...this._formData };
|
|
1772
|
+
}
|
|
1773
|
+
setData(data) {
|
|
1774
|
+
this._formData = { ...data };
|
|
1775
|
+
this._dirty = true;
|
|
1776
|
+
this._validateForm();
|
|
1777
|
+
this.requestUpdate();
|
|
1778
|
+
}
|
|
1779
|
+
validate() {
|
|
1780
|
+
this._validateForm();
|
|
1781
|
+
return this._valid;
|
|
1782
|
+
}
|
|
1783
|
+
reset() {
|
|
1784
|
+
this._handleReset();
|
|
1785
|
+
}
|
|
1786
|
+
getState() {
|
|
1787
|
+
return this._getFormState();
|
|
1788
|
+
}
|
|
1789
|
+
render() {
|
|
1790
|
+
const errorCount = this._errors.filter((e2) => e2.severity === "error").length;
|
|
1791
|
+
const showValidationSummary = this.config.showValidationSummary !== false && errorCount > 0 && this._submitted;
|
|
1792
|
+
const schema = this._currentSchema;
|
|
1793
|
+
if (!schema) {
|
|
1794
|
+
return html`<div>Loading form...</div>`;
|
|
1795
|
+
}
|
|
1796
|
+
return html`
|
|
1797
|
+
<div class="form-container">
|
|
1798
|
+
<!-- Form Header -->
|
|
1799
|
+
<div class="form-header">
|
|
1800
|
+
<h1 class="form-title">${schema.title}</h1>
|
|
1801
|
+
${schema.description ? html`
|
|
1802
|
+
<p class="form-description">${schema.description}</p>
|
|
1803
|
+
` : ""}
|
|
1804
|
+
</div>
|
|
1805
|
+
|
|
1806
|
+
<!-- Add Column Section -->
|
|
1807
|
+
${this.config.enableColumnManagement !== false ? html`
|
|
1808
|
+
<div class="add-column-container">
|
|
1809
|
+
<button
|
|
1810
|
+
class="add-column-btn"
|
|
1811
|
+
@click="${this._addColumn}"
|
|
1812
|
+
?disabled="${this.disabled || this.readonly || this.config.maxColumns && this._columns.length >= this.config.maxColumns}"
|
|
1813
|
+
>
|
|
1814
|
+
Add Dimension Column
|
|
1815
|
+
</button>
|
|
1816
|
+
</div>
|
|
1817
|
+
` : ""}
|
|
1818
|
+
|
|
1819
|
+
<!-- Form Content -->
|
|
1820
|
+
<div class="form-sections">
|
|
1821
|
+
<!-- Validation Summary -->
|
|
1822
|
+
${showValidationSummary ? html`
|
|
1823
|
+
<div class="validation-summary">
|
|
1824
|
+
<h4 class="validation-summary-title">Please fix the following errors:</h4>
|
|
1825
|
+
<ul class="validation-summary-list">
|
|
1826
|
+
${this._errors.filter((e2) => e2.severity === "error").map((error) => html`
|
|
1827
|
+
<li class="validation-summary-item">${error.message}</li>
|
|
1828
|
+
`)}
|
|
1829
|
+
</ul>
|
|
1830
|
+
</div>
|
|
1831
|
+
` : ""}
|
|
1832
|
+
|
|
1833
|
+
<!-- Form Sections -->
|
|
1834
|
+
${schema.sections.map((section) => html`
|
|
1835
|
+
<jupiter-form-section
|
|
1836
|
+
.section="${section}"
|
|
1837
|
+
.columns="${this._columns}"
|
|
1838
|
+
.formData="${this._formData}"
|
|
1839
|
+
.disabled="${this.disabled || this.readonly}"
|
|
1840
|
+
.collapsible="${this.config.collapsibleSections !== false}"
|
|
1841
|
+
.locale="${this.config.locale || "en-US"}"
|
|
1842
|
+
@field-change="${this._handleFieldChange}"
|
|
1843
|
+
@section-expand="${this._handleSectionExpand}"
|
|
1844
|
+
@concept-expand="${this._handleConceptExpand}"
|
|
1845
|
+
@column-remove="${this._handleColumnRemove}"
|
|
1846
|
+
></jupiter-form-section>
|
|
1847
|
+
`)}
|
|
1848
|
+
</div>
|
|
1849
|
+
|
|
1850
|
+
<!-- Form Actions -->
|
|
1851
|
+
<div class="form-actions">
|
|
1852
|
+
<button
|
|
1853
|
+
class="btn-primary"
|
|
1854
|
+
@click="${this._handleSubmit}"
|
|
1855
|
+
?disabled="${this.disabled || this.readonly}"
|
|
1856
|
+
>
|
|
1857
|
+
Submit
|
|
1858
|
+
</button>
|
|
1859
|
+
|
|
1860
|
+
<button
|
|
1861
|
+
class="btn-outline"
|
|
1862
|
+
@click="${this._handleReset}"
|
|
1863
|
+
?disabled="${this.disabled || !this._dirty}"
|
|
1864
|
+
>
|
|
1865
|
+
Reset
|
|
1866
|
+
</button>
|
|
1867
|
+
|
|
1868
|
+
<div class="form-meta">
|
|
1869
|
+
<span>Errors: ${errorCount}</span>
|
|
1870
|
+
<span>Modified: ${this._dirty ? "Yes" : "No"}</span>
|
|
1871
|
+
<span>Valid: ${this._valid ? "Yes" : "No"}</span>
|
|
1872
|
+
</div>
|
|
1873
|
+
</div>
|
|
1874
|
+
</div>
|
|
1875
|
+
`;
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
JupiterDynamicForm.styles = css`
|
|
1879
|
+
:host {
|
|
1880
|
+
display: block;
|
|
1881
|
+
font-family: var(--jupiter-font-family, system-ui, -apple-system, sans-serif);
|
|
1882
|
+
color: var(--jupiter-text-primary, #333);
|
|
1883
|
+
background: var(--jupiter-background, #fff);
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
.form-container {
|
|
1887
|
+
width: 100%;
|
|
1888
|
+
max-width: var(--jupiter-max-width, none);
|
|
1889
|
+
margin: 0 auto;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
.form-header {
|
|
1893
|
+
padding: 24px;
|
|
1894
|
+
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
1895
|
+
background: var(--jupiter-form-header-background, #fff);
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
.form-title {
|
|
1899
|
+
font-size: 24px;
|
|
1900
|
+
font-weight: 600;
|
|
1901
|
+
margin: 0 0 8px 0;
|
|
1902
|
+
color: var(--jupiter-text-primary, #333);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
.form-description {
|
|
1906
|
+
font-size: 16px;
|
|
1907
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1908
|
+
margin: 0;
|
|
1909
|
+
line-height: 1.5;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
.form-actions {
|
|
1913
|
+
padding: 16px 24px;
|
|
1914
|
+
border-top: 1px solid var(--jupiter-border-color, #ddd);
|
|
1915
|
+
background: var(--jupiter-form-actions-background, #f8f9fa);
|
|
1916
|
+
display: flex;
|
|
1917
|
+
gap: 12px;
|
|
1918
|
+
align-items: center;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.add-column-container {
|
|
1922
|
+
padding: 16px 24px;
|
|
1923
|
+
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
1924
|
+
background: var(--jupiter-form-actions-background, #f8f9fa);
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
.add-column-btn {
|
|
1928
|
+
padding: 8px 16px;
|
|
1929
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
1930
|
+
color: white;
|
|
1931
|
+
border: none;
|
|
1932
|
+
border-radius: 4px;
|
|
1933
|
+
cursor: pointer;
|
|
1934
|
+
font-size: 14px;
|
|
1935
|
+
font-weight: 500;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
.add-column-btn:hover {
|
|
1939
|
+
background: var(--jupiter-primary-color-dark, #1565c0);
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
.add-column-btn:disabled {
|
|
1943
|
+
background: var(--jupiter-disabled-background, #ccc);
|
|
1944
|
+
cursor: not-allowed;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
.form-sections {
|
|
1948
|
+
padding: 24px;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
.validation-summary {
|
|
1952
|
+
margin-bottom: 16px;
|
|
1953
|
+
padding: 16px;
|
|
1954
|
+
border-radius: 4px;
|
|
1955
|
+
background: var(--jupiter-error-background, #ffebee);
|
|
1956
|
+
border: 1px solid var(--jupiter-error-color, #d32f2f);
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
.validation-summary-title {
|
|
1960
|
+
font-weight: 600;
|
|
1961
|
+
color: var(--jupiter-error-color, #d32f2f);
|
|
1962
|
+
margin: 0 0 8px 0;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
.validation-summary-list {
|
|
1966
|
+
margin: 0;
|
|
1967
|
+
padding-left: 20px;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
.validation-summary-item {
|
|
1971
|
+
color: var(--jupiter-error-color, #d32f2f);
|
|
1972
|
+
margin-bottom: 4px;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
.form-actions button {
|
|
1976
|
+
padding: 10px 20px;
|
|
1977
|
+
border: none;
|
|
1978
|
+
border-radius: 4px;
|
|
1979
|
+
font-size: 14px;
|
|
1980
|
+
font-weight: 500;
|
|
1981
|
+
cursor: pointer;
|
|
1982
|
+
transition: background-color 0.2s ease;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
.btn-primary {
|
|
1986
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
1987
|
+
color: white;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
.btn-primary:hover:not(:disabled) {
|
|
1991
|
+
background: var(--jupiter-primary-color-dark, #1565c0);
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
.btn-secondary {
|
|
1995
|
+
background: var(--jupiter-secondary-color, #757575);
|
|
1996
|
+
color: white;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
.btn-secondary:hover:not(:disabled) {
|
|
2000
|
+
background: var(--jupiter-secondary-color-dark, #616161);
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
.btn-outline {
|
|
2004
|
+
background: transparent;
|
|
2005
|
+
color: var(--jupiter-primary-color, #1976d2);
|
|
2006
|
+
border: 1px solid var(--jupiter-primary-color, #1976d2);
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
.btn-outline:hover:not(:disabled) {
|
|
2010
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
2011
|
+
color: white;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
button:disabled {
|
|
2015
|
+
opacity: 0.6;
|
|
2016
|
+
cursor: not-allowed;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
.form-meta {
|
|
2020
|
+
display: flex;
|
|
2021
|
+
gap: 16px;
|
|
2022
|
+
align-items: center;
|
|
2023
|
+
font-size: 12px;
|
|
2024
|
+
color: var(--jupiter-text-secondary, #666);
|
|
2025
|
+
margin-left: auto;
|
|
2026
|
+
}
|
|
2027
|
+
`;
|
|
2028
|
+
__decorateClass([
|
|
2029
|
+
n2({ type: Object })
|
|
2030
|
+
], JupiterDynamicForm.prototype, "schema", 2);
|
|
2031
|
+
__decorateClass([
|
|
2032
|
+
n2({ type: Object })
|
|
2033
|
+
], JupiterDynamicForm.prototype, "xbrlInput", 2);
|
|
2034
|
+
__decorateClass([
|
|
2035
|
+
n2({ type: Object })
|
|
2036
|
+
], JupiterDynamicForm.prototype, "config", 2);
|
|
2037
|
+
__decorateClass([
|
|
2038
|
+
n2({ type: Object })
|
|
2039
|
+
], JupiterDynamicForm.prototype, "initialData", 2);
|
|
2040
|
+
__decorateClass([
|
|
2041
|
+
n2({ type: Boolean })
|
|
2042
|
+
], JupiterDynamicForm.prototype, "disabled", 2);
|
|
2043
|
+
__decorateClass([
|
|
2044
|
+
n2({ type: Boolean })
|
|
2045
|
+
], JupiterDynamicForm.prototype, "readonly", 2);
|
|
2046
|
+
__decorateClass([
|
|
2047
|
+
r()
|
|
2048
|
+
], JupiterDynamicForm.prototype, "_formData", 2);
|
|
2049
|
+
__decorateClass([
|
|
2050
|
+
r()
|
|
2051
|
+
], JupiterDynamicForm.prototype, "_columns", 2);
|
|
2052
|
+
__decorateClass([
|
|
2053
|
+
r()
|
|
2054
|
+
], JupiterDynamicForm.prototype, "_errors", 2);
|
|
2055
|
+
__decorateClass([
|
|
2056
|
+
r()
|
|
2057
|
+
], JupiterDynamicForm.prototype, "_touched", 2);
|
|
2058
|
+
__decorateClass([
|
|
2059
|
+
r()
|
|
2060
|
+
], JupiterDynamicForm.prototype, "_dirty", 2);
|
|
2061
|
+
__decorateClass([
|
|
2062
|
+
r()
|
|
2063
|
+
], JupiterDynamicForm.prototype, "_valid", 2);
|
|
2064
|
+
__decorateClass([
|
|
2065
|
+
r()
|
|
2066
|
+
], JupiterDynamicForm.prototype, "_submitted", 2);
|
|
2067
|
+
__decorateClass([
|
|
2068
|
+
r()
|
|
2069
|
+
], JupiterDynamicForm.prototype, "_currentSchema", 2);
|
|
2070
|
+
JupiterDynamicForm = __decorateClass([
|
|
2071
|
+
t$1("jupiter-dynamic-form")
|
|
2072
|
+
], JupiterDynamicForm);
|
|
2073
|
+
const version = "1.0.0";
|
|
2074
|
+
export {
|
|
2075
|
+
FormValidator,
|
|
2076
|
+
JupiterConceptTree,
|
|
2077
|
+
JupiterDynamicForm,
|
|
2078
|
+
JupiterFormField,
|
|
2079
|
+
JupiterFormSection,
|
|
2080
|
+
version
|
|
2081
|
+
};
|
|
2082
|
+
//# sourceMappingURL=index.mjs.map
|