@pure-ds/core 0.4.19 → 0.4.20
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-form.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-form.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAGF,yBAEC;IAgBC,gBAA2B;IAC3B,cAAyB;IACzB,aAAwB;IACxB,YAAuB;IACvB,eAAoB;IACpB,qBAAwB;IACxB,oBAA2B;IAC3B,mBAAyB;IACzB,mBAAsB;IACtB,oBAAuB;IAiBzB,8CAEC;IACD,4BAEC;IAGD,oBAEC;IAkBD;;;MAIC;IAED,uBAEC;IAED,cAIC;IAED,0BAcC;IAGD,+BAyBC;IA4eD,cA4CC;;
|
|
1
|
+
{"version":3,"file":"pds-form.d.ts","sourceRoot":"","sources":["../../../../../../public/assets/pds/components/pds-form.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAGF,yBAEC;IAgBC,gBAA2B;IAC3B,cAAyB;IACzB,aAAwB;IACxB,YAAuB;IACvB,eAAoB;IACpB,qBAAwB;IACxB,oBAA2B;IAC3B,mBAAyB;IACzB,mBAAsB;IACtB,oBAAuB;IAiBzB,8CAEC;IACD,4BAEC;IAGD,oBAEC;IAkBD;;;MAIC;IAED,uBAEC;IAED,cAIC;IAED,0BAcC;IAGD,+BAyBC;IA4eD,cA4CC;;CAumDF"}
|
package/package.json
CHANGED
|
@@ -1116,6 +1116,7 @@ export class SchemaForm extends LitElement {
|
|
|
1116
1116
|
this.#deleteByPathPrefix(this.#data, path + "/");
|
|
1117
1117
|
this.requestUpdate();
|
|
1118
1118
|
this.#emit("pw:value-change", {
|
|
1119
|
+
path,
|
|
1119
1120
|
name: path,
|
|
1120
1121
|
value: i,
|
|
1121
1122
|
validity: { valid: true },
|
|
@@ -1865,7 +1866,6 @@ export class SchemaForm extends LitElement {
|
|
|
1865
1866
|
<select
|
|
1866
1867
|
id=${id}
|
|
1867
1868
|
name=${path}
|
|
1868
|
-
.value=${value ?? ""}
|
|
1869
1869
|
?disabled=${!!attrs.disabled}
|
|
1870
1870
|
?required=${!!attrs.required}
|
|
1871
1871
|
?data-dropdown=${useDropdown}
|
|
@@ -1874,7 +1874,7 @@ export class SchemaForm extends LitElement {
|
|
|
1874
1874
|
<option value="" ?selected=${value == null}>—</option>
|
|
1875
1875
|
${enumValues.map(
|
|
1876
1876
|
(v, i) =>
|
|
1877
|
-
html`<option value=${String(v)}>
|
|
1877
|
+
html`<option value=${String(v)} ?selected=${String(value) === String(v)}>
|
|
1878
1878
|
${String(enumLabels[i])}
|
|
1879
1879
|
</option>`
|
|
1880
1880
|
)}
|
|
@@ -2092,17 +2092,28 @@ export class SchemaForm extends LitElement {
|
|
|
2092
2092
|
const withoutSlash = path.startsWith("/") ? path.substring(1) : path;
|
|
2093
2093
|
if (this.uiSchema[withoutSlash]) return this.uiSchema[withoutSlash];
|
|
2094
2094
|
|
|
2095
|
-
// Try nested navigation (e.g.,
|
|
2095
|
+
// Try nested navigation (e.g., /accountType/companyName)
|
|
2096
2096
|
// Skip array indices (numeric parts and wildcard *) when navigating UI schema
|
|
2097
2097
|
const parts = path.replace(/^\//, "").split("/");
|
|
2098
2098
|
let current = this.uiSchema;
|
|
2099
|
-
for (
|
|
2099
|
+
for (let i = 0; i < parts.length; i++) {
|
|
2100
|
+
const part = parts[i];
|
|
2100
2101
|
// Skip numeric array indices and wildcard in UI schema navigation
|
|
2101
2102
|
if (/^\d+$/.test(part) || part === "*") continue;
|
|
2102
2103
|
|
|
2104
|
+
// Try both with and without leading slash for each segment
|
|
2103
2105
|
if (current && typeof current === "object" && part in current) {
|
|
2104
2106
|
current = current[part];
|
|
2107
|
+
} else if (current && typeof current === "object" && ("/" + part) in current) {
|
|
2108
|
+
current = current["/" + part];
|
|
2105
2109
|
} else {
|
|
2110
|
+
// If this is the first segment, try looking up the full path from root
|
|
2111
|
+
if (i === 0) {
|
|
2112
|
+
const fullPath = "/" + parts.join("/");
|
|
2113
|
+
if (this.uiSchema[fullPath]) {
|
|
2114
|
+
return this.uiSchema[fullPath];
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2106
2117
|
return undefined;
|
|
2107
2118
|
}
|
|
2108
2119
|
}
|
|
@@ -2227,17 +2238,23 @@ export class SchemaForm extends LitElement {
|
|
|
2227
2238
|
this.#setByPath(this.#data, path, val);
|
|
2228
2239
|
|
|
2229
2240
|
// Apply calculated values for any dependent fields
|
|
2230
|
-
|
|
2241
|
+
// This will call requestUpdate() if there are dependents
|
|
2242
|
+
const hadDependents = this.#applyCalculatedValues(path);
|
|
2243
|
+
|
|
2244
|
+
// Only request update here if there were no dependents
|
|
2245
|
+
// (to avoid double render)
|
|
2246
|
+
if (!hadDependents) {
|
|
2247
|
+
this.requestUpdate();
|
|
2248
|
+
}
|
|
2231
2249
|
|
|
2232
|
-
this.requestUpdate();
|
|
2233
2250
|
const validity = { valid: true };
|
|
2234
|
-
this.#emit("pw:value-change", { name: path, value: val, validity });
|
|
2251
|
+
this.#emit("pw:value-change", { path, name: path, value: val, validity });
|
|
2235
2252
|
}
|
|
2236
2253
|
|
|
2237
2254
|
#applyCalculatedValues(changedPath) {
|
|
2238
2255
|
// Find fields that depend on the changed path
|
|
2239
2256
|
const dependents = this.#dependencies.get(changedPath);
|
|
2240
|
-
if (!dependents) return;
|
|
2257
|
+
if (!dependents || dependents.size === 0) return false;
|
|
2241
2258
|
|
|
2242
2259
|
for (const targetPath of dependents) {
|
|
2243
2260
|
const ui = this.#uiFor(targetPath);
|
|
@@ -2255,6 +2272,11 @@ export class SchemaForm extends LitElement {
|
|
|
2255
2272
|
}
|
|
2256
2273
|
}
|
|
2257
2274
|
}
|
|
2275
|
+
|
|
2276
|
+
// Force re-render since there were dependents
|
|
2277
|
+
// This ensures ui:visibleWhen, ui:requiredWhen, ui:disabledWhen get re-evaluated
|
|
2278
|
+
this.requestUpdate();
|
|
2279
|
+
return true; // Indicate that we triggered a re-render
|
|
2258
2280
|
}
|
|
2259
2281
|
|
|
2260
2282
|
#getByPath(obj, path) {
|