jedison 0.3.13 → 0.3.15
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/CHANGELOG.md +8 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +34 -6
- package/dist/esm/jedison.js.map +1 -1
- package/dist/umd/jedison.umd.js +1 -1
- package/dist/umd/jedison.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/jedison.js
CHANGED
|
@@ -2295,6 +2295,9 @@ class InstanceIfThenElse extends Instance {
|
|
|
2295
2295
|
this.emit("change", initiator2);
|
|
2296
2296
|
});
|
|
2297
2297
|
});
|
|
2298
|
+
if (initiator === "api" && this.hasNullableFields(this.activeInstance)) {
|
|
2299
|
+
this.activeInstance.setValue(value, false, "secondary");
|
|
2300
|
+
}
|
|
2298
2301
|
this.value = this.activeInstance.getValue();
|
|
2299
2302
|
}
|
|
2300
2303
|
getWithoutIfValueFromValue(value) {
|
|
@@ -2324,6 +2327,35 @@ class InstanceIfThenElse extends Instance {
|
|
|
2324
2327
|
});
|
|
2325
2328
|
}
|
|
2326
2329
|
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Check if an instance has nullable fields in its schema or children
|
|
2332
|
+
*/
|
|
2333
|
+
hasNullableFields(instance) {
|
|
2334
|
+
if (!instance) return false;
|
|
2335
|
+
if (this.isNullableSchema(instance.schema)) {
|
|
2336
|
+
return true;
|
|
2337
|
+
}
|
|
2338
|
+
if (instance.children) {
|
|
2339
|
+
return instance.children.some((child) => this.hasNullableFields(child));
|
|
2340
|
+
}
|
|
2341
|
+
return false;
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Check if a schema is nullable (has x-format: 'number-nullable' or similar nullable formats)
|
|
2345
|
+
*/
|
|
2346
|
+
isNullableSchema(schema) {
|
|
2347
|
+
if (!schema) return false;
|
|
2348
|
+
if (schema["x-format"] && schema["x-format"].includes("nullable")) {
|
|
2349
|
+
return true;
|
|
2350
|
+
}
|
|
2351
|
+
if (Array.isArray(schema.type) && schema.type.includes("null")) {
|
|
2352
|
+
return true;
|
|
2353
|
+
}
|
|
2354
|
+
if (schema.properties) {
|
|
2355
|
+
return Object.values(schema.properties).some((prop) => this.isNullableSchema(prop));
|
|
2356
|
+
}
|
|
2357
|
+
return false;
|
|
2358
|
+
}
|
|
2327
2359
|
/**
|
|
2328
2360
|
* Returns the index of the instance that has less validation errors
|
|
2329
2361
|
*/
|
|
@@ -4654,12 +4686,8 @@ class EditorNumberRange extends EditorNumber {
|
|
|
4654
4686
|
if (!isNumericType) {
|
|
4655
4687
|
return false;
|
|
4656
4688
|
}
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
}
|
|
4660
|
-
const hasMin = isSet(schema.minimum) || isSet(schema.exclusiveMinimum);
|
|
4661
|
-
const hasMax = isSet(schema.maximum) || isSet(schema.exclusiveMaximum);
|
|
4662
|
-
return hasMin && hasMax;
|
|
4689
|
+
const hasFormatRange = getSchemaXOption(schema, "format") === "range";
|
|
4690
|
+
return isNumericType && hasFormatRange;
|
|
4663
4691
|
}
|
|
4664
4692
|
build() {
|
|
4665
4693
|
let optionMin = 0;
|