jedison 1.23.0 → 1.23.1
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 +3 -1
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +36 -2
- 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 +1 -1
package/dist/esm/jedison.js
CHANGED
|
@@ -4371,7 +4371,8 @@ class EditorObject extends Editor {
|
|
|
4371
4371
|
getObjectControlConfig() {
|
|
4372
4372
|
let addProperty = true;
|
|
4373
4373
|
const additionalProperties2 = getSchemaAdditionalProperties(this.instance.schema);
|
|
4374
|
-
|
|
4374
|
+
const patternProperties2 = getSchemaPatternProperties(this.instance.schema);
|
|
4375
|
+
if (isSet(additionalProperties2) && additionalProperties2 === false && !isSet(patternProperties2)) {
|
|
4375
4376
|
addProperty = false;
|
|
4376
4377
|
}
|
|
4377
4378
|
const objectAdd = getSchemaXOption(this.instance.schema, "objectAdd") ?? this.instance.jedison.getOption("objectAdd");
|
|
@@ -4430,10 +4431,38 @@ class EditorObject extends Editor {
|
|
|
4430
4431
|
ariaLiveMessage.textContent = label + " " + this.instance.jedison.translator.translate("objectPropertyAdded");
|
|
4431
4432
|
this.control.ariaLive.appendChild(ariaLiveMessage);
|
|
4432
4433
|
}
|
|
4434
|
+
/**
|
|
4435
|
+
* A name is only rejected when `additionalProperties: false` is enforced and the
|
|
4436
|
+
* name matches neither `properties` nor `patternProperties` (issue #82) - mirrors
|
|
4437
|
+
* the check InstanceObject.removeNotListedPropertiesFromValue() applies on setValue.
|
|
4438
|
+
*/
|
|
4439
|
+
isAddPropertyNameAllowed(propertyName) {
|
|
4440
|
+
const additionalProperties2 = getSchemaAdditionalProperties(this.instance.schema);
|
|
4441
|
+
if (!isSet(additionalProperties2) || additionalProperties2 !== false) {
|
|
4442
|
+
return true;
|
|
4443
|
+
}
|
|
4444
|
+
const schemaEnforceAdditionalProperties = getSchemaXOption(this.instance.schema, "enforceAdditionalProperties");
|
|
4445
|
+
const enforceAdditionalProperties = isSet(schemaEnforceAdditionalProperties) ? schemaEnforceAdditionalProperties : this.instance.jedison.getOption("enforceAdditionalProperties");
|
|
4446
|
+
if (!enforceAdditionalProperties) {
|
|
4447
|
+
return true;
|
|
4448
|
+
}
|
|
4449
|
+
const declaredProperties = getSchemaProperties(this.instance.schema) || {};
|
|
4450
|
+
if (hasOwn(declaredProperties, propertyName)) {
|
|
4451
|
+
return true;
|
|
4452
|
+
}
|
|
4453
|
+
const patternProperties2 = getSchemaPatternProperties(this.instance.schema) || {};
|
|
4454
|
+
return Object.keys(patternProperties2).some((pattern2) => new RegExp(pattern2).test(propertyName));
|
|
4455
|
+
}
|
|
4433
4456
|
addProperty(input, postAction) {
|
|
4434
4457
|
const propertyName = input.value.split(" ").join("");
|
|
4435
4458
|
if (propertyName.length === 0) return;
|
|
4436
4459
|
if (isSet(this.instance.value[propertyName])) return;
|
|
4460
|
+
this.control.quickAddPropertyControl.messages.replaceChildren();
|
|
4461
|
+
if (!this.isAddPropertyNameAllowed(propertyName)) {
|
|
4462
|
+
const message = compileTemplate(this.instance.jedison.translator.translate("errorAddPropertyPatternMismatch"), { property: propertyName });
|
|
4463
|
+
this.control.quickAddPropertyControl.messages.appendChild(this.getErrorFeedback({ message }));
|
|
4464
|
+
return;
|
|
4465
|
+
}
|
|
4437
4466
|
const schema = this.instance.getPropertySchema(propertyName);
|
|
4438
4467
|
const child = this.instance.createChild(schema, propertyName);
|
|
4439
4468
|
child.activate();
|
|
@@ -7245,6 +7274,7 @@ class UiResolver {
|
|
|
7245
7274
|
}
|
|
7246
7275
|
}
|
|
7247
7276
|
const defaultTranslations = {
|
|
7277
|
+
errorAddPropertyPatternMismatch: 'Property name "{{ property }}" does not match any allowed property or pattern.',
|
|
7248
7278
|
errorAdditionalProperties: 'Has additional property "{{ property }}" but no additional properties are allowed.',
|
|
7249
7279
|
errorAnyOf: "Must validate against at least one of the provided schemas.",
|
|
7250
7280
|
errorConst: "Must have value of: {{ const }}.",
|
|
@@ -7293,6 +7323,7 @@ const defaultTranslations = {
|
|
|
7293
7323
|
};
|
|
7294
7324
|
const translations = {
|
|
7295
7325
|
en: {
|
|
7326
|
+
errorAddPropertyPatternMismatch: 'Property name "{{ property }}" does not match any allowed property or pattern.',
|
|
7296
7327
|
errorAdditionalProperties: 'Has additional property "{{ property }}" but no additional properties are allowed.',
|
|
7297
7328
|
errorAnyOf: "Must validate against at least one of the provided schemas.",
|
|
7298
7329
|
errorConst: "Must have value of: {{ const }}.",
|
|
@@ -7339,6 +7370,7 @@ const translations = {
|
|
|
7339
7370
|
collapseToggle: "Collapse"
|
|
7340
7371
|
},
|
|
7341
7372
|
de: {
|
|
7373
|
+
errorAddPropertyPatternMismatch: 'Der Eigenschaftsname "{{ property }}" entspricht keiner erlaubten Eigenschaft oder keinem erlaubten Muster.',
|
|
7342
7374
|
errorAdditionalProperties: 'Hat die zusätzliche Eigenschaft "{{ property }}", aber keine zusätzlichen Eigenschaften sind erlaubt.',
|
|
7343
7375
|
errorAnyOf: "Muss mindestens einem der bereitgestellten Schemata entsprechen.",
|
|
7344
7376
|
errorConst: "Muss den Wert {{ const }} haben.",
|
|
@@ -7385,6 +7417,7 @@ const translations = {
|
|
|
7385
7417
|
collapseToggle: "Einklappen"
|
|
7386
7418
|
},
|
|
7387
7419
|
it: {
|
|
7420
|
+
errorAddPropertyPatternMismatch: 'Il nome della proprietà "{{ property }}" non corrisponde a nessuna proprietà o modello consentito.',
|
|
7388
7421
|
errorAdditionalProperties: 'Ha la proprietà aggiuntiva "{{ property }}" ma non sono consentite proprietà aggiuntive.',
|
|
7389
7422
|
errorAnyOf: "Deve rispettare almeno uno degli schemi forniti.",
|
|
7390
7423
|
errorConst: "Deve avere il valore: {{ const }}.",
|
|
@@ -7431,6 +7464,7 @@ const translations = {
|
|
|
7431
7464
|
collapseToggle: "Comprimi"
|
|
7432
7465
|
},
|
|
7433
7466
|
es: {
|
|
7467
|
+
errorAddPropertyPatternMismatch: 'El nombre de propiedad "{{ property }}" no coincide con ninguna propiedad o patrón permitido.',
|
|
7434
7468
|
errorAdditionalProperties: 'Tiene la propiedad adicional "{{ property }}" pero no se permiten propiedades adicionales.',
|
|
7435
7469
|
errorAnyOf: "Debe cumplir con al menos uno de los esquemas proporcionados.",
|
|
7436
7470
|
errorConst: "Debe tener el valor: {{ const }}.",
|
|
@@ -7524,7 +7558,7 @@ class JsonWalker {
|
|
|
7524
7558
|
}
|
|
7525
7559
|
}
|
|
7526
7560
|
}
|
|
7527
|
-
const version = "1.23.
|
|
7561
|
+
const version = "1.23.1";
|
|
7528
7562
|
class Jedison extends EventEmitter {
|
|
7529
7563
|
/**
|
|
7530
7564
|
* Creates a Jedison instance.
|