jedison 1.8.0 → 1.9.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/CHANGELOG.md +7 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +137 -83
- 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 +3 -3
package/dist/esm/jedison.js
CHANGED
|
@@ -199,10 +199,20 @@ function getValueByJSONPath(data, path) {
|
|
|
199
199
|
return value;
|
|
200
200
|
}
|
|
201
201
|
function compileTemplate(template, data) {
|
|
202
|
-
return template.replace(/{{(.*?)}}/g, (
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
202
|
+
return template.replace(/{{(.*?)}}/g, (_, inner) => {
|
|
203
|
+
inner = inner.trim();
|
|
204
|
+
const pipeIdx = inner.indexOf("||");
|
|
205
|
+
let path, fallback;
|
|
206
|
+
if (pipeIdx !== -1) {
|
|
207
|
+
path = inner.slice(0, pipeIdx).trim();
|
|
208
|
+
const raw = inner.slice(pipeIdx + 2).trim();
|
|
209
|
+
fallback = raw.replace(/^['"]|['"]$/g, "");
|
|
210
|
+
} else {
|
|
211
|
+
path = inner;
|
|
212
|
+
fallback = "";
|
|
213
|
+
}
|
|
214
|
+
const value = getValueByJSONPath(data, path);
|
|
215
|
+
return value !== void 0 && value !== null ? value : fallback;
|
|
206
216
|
});
|
|
207
217
|
}
|
|
208
218
|
function clamp(number, min, max) {
|
|
@@ -270,6 +280,15 @@ const Utils = {
|
|
|
270
280
|
removeDuplicatesFromArray,
|
|
271
281
|
generateRandomID
|
|
272
282
|
};
|
|
283
|
+
const OPTION_ALIASES = {
|
|
284
|
+
enforceEnumDefault: "enforceEnum"
|
|
285
|
+
};
|
|
286
|
+
function resolveAlias(name) {
|
|
287
|
+
return OPTION_ALIASES[name] ?? name;
|
|
288
|
+
}
|
|
289
|
+
function getAliasesFor(canonicalName) {
|
|
290
|
+
return Object.keys(OPTION_ALIASES).filter((old) => OPTION_ALIASES[old] === canonicalName);
|
|
291
|
+
}
|
|
273
292
|
function getSchemaX(schema, keyword) {
|
|
274
293
|
const key = "x-" + keyword;
|
|
275
294
|
return schema[key];
|
|
@@ -405,7 +424,21 @@ function getSchemaXOption(schema, option) {
|
|
|
405
424
|
if (isSet(schema[xOption])) {
|
|
406
425
|
return schema[xOption];
|
|
407
426
|
}
|
|
408
|
-
|
|
427
|
+
if (schema["x-options"] && isSet(schema["x-options"][option])) {
|
|
428
|
+
return schema["x-options"][option];
|
|
429
|
+
}
|
|
430
|
+
for (const alias of getAliasesFor(option)) {
|
|
431
|
+
const xAlias = "x-" + alias;
|
|
432
|
+
if (isSet(schema[xAlias])) {
|
|
433
|
+
console.warn(`Jedison: schema option "${xAlias}" is deprecated. Use "${xOption}" instead.`);
|
|
434
|
+
return schema[xAlias];
|
|
435
|
+
}
|
|
436
|
+
if (schema["x-options"] && isSet(schema["x-options"][alias])) {
|
|
437
|
+
console.warn(`Jedison: schema x-options.${alias} is deprecated. Use x-options.${option} instead.`);
|
|
438
|
+
return schema["x-options"][alias];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return void 0;
|
|
409
442
|
}
|
|
410
443
|
function getSchemaPattern(schema) {
|
|
411
444
|
return isString(schema.pattern) ? clone(schema.pattern) : void 0;
|
|
@@ -1802,7 +1835,7 @@ class Instance extends EventEmitter {
|
|
|
1802
1835
|
this.setDefaultValue();
|
|
1803
1836
|
this.registerWatcher();
|
|
1804
1837
|
this.setValueFormTemplate();
|
|
1805
|
-
if (this.jedison.
|
|
1838
|
+
if (this.jedison.getOption("container")) {
|
|
1806
1839
|
this.setUI();
|
|
1807
1840
|
}
|
|
1808
1841
|
this.on("notifyParent", (initiator) => {
|
|
@@ -1865,13 +1898,9 @@ class Instance extends EventEmitter {
|
|
|
1865
1898
|
* Sets the default value of the instance based on it's type
|
|
1866
1899
|
*/
|
|
1867
1900
|
setInitialValue() {
|
|
1868
|
-
const
|
|
1869
|
-
const schemaEnforceEnum = getSchemaXOption(this.schema, "enforceEnum");
|
|
1870
|
-
const enforceEnumDefault = schemaEnforceEnumDefault ?? this.jedison.options.enforceEnumDefault;
|
|
1871
|
-
const enforceEnum = schemaEnforceEnum ?? this.jedison.options.enforceEnum;
|
|
1872
|
-
const finalEnforceEnum = isSet(schemaEnforceEnum) ? enforceEnum : enforceEnumDefault;
|
|
1901
|
+
const enforceEnum = getSchemaXOption(this.schema, "enforceEnum") ?? this.jedison.getOption("enforceEnum");
|
|
1873
1902
|
const schemaEnum = getSchemaEnum(this.schema);
|
|
1874
|
-
if (isSet(schemaEnum) && !schemaEnum.includes(this.getValueRaw()) && isSet(schemaEnum[0]) &&
|
|
1903
|
+
if (isSet(schemaEnum) && !schemaEnum.includes(this.getValueRaw()) && isSet(schemaEnum[0]) && enforceEnum) {
|
|
1875
1904
|
this.setValue(schemaEnum[0], false);
|
|
1876
1905
|
}
|
|
1877
1906
|
if (notSet(this.value)) {
|
|
@@ -1892,7 +1921,7 @@ class Instance extends EventEmitter {
|
|
|
1892
1921
|
if (isSet(schemaDefault)) {
|
|
1893
1922
|
this.setValue(schemaDefault, false);
|
|
1894
1923
|
}
|
|
1895
|
-
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.
|
|
1924
|
+
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.getOption("enforceConst");
|
|
1896
1925
|
if (isSet(enforceConst) && equal(enforceConst, true)) {
|
|
1897
1926
|
const schemaConst = getSchemaConst(this.schema);
|
|
1898
1927
|
if (isSet(schemaConst)) {
|
|
@@ -1949,7 +1978,7 @@ class Instance extends EventEmitter {
|
|
|
1949
1978
|
const templateData = {
|
|
1950
1979
|
...this.arrayTemplateData,
|
|
1951
1980
|
value: this.getValueRaw(),
|
|
1952
|
-
settings: this.jedison.
|
|
1981
|
+
settings: this.jedison.getOption("settings")
|
|
1953
1982
|
};
|
|
1954
1983
|
if (typeof this.value === "string") {
|
|
1955
1984
|
templateData.length = this.value.length;
|
|
@@ -1959,7 +1988,7 @@ class Instance extends EventEmitter {
|
|
|
1959
1988
|
}
|
|
1960
1989
|
if (template == null ? void 0 : template.includes("{{ functions.")) {
|
|
1961
1990
|
templateData.functions = this.resolveTemplateFunctions(
|
|
1962
|
-
this.jedison.
|
|
1991
|
+
this.jedison.getOption("functions")
|
|
1963
1992
|
);
|
|
1964
1993
|
}
|
|
1965
1994
|
if (this.parent) {
|
|
@@ -1974,7 +2003,7 @@ class Instance extends EventEmitter {
|
|
|
1974
2003
|
return Object.fromEntries(Object.entries(functionsObject).map(([functionName, functionValue]) => [functionName, functionValue(context)]));
|
|
1975
2004
|
}
|
|
1976
2005
|
purify(value) {
|
|
1977
|
-
if (typeof value === "string" && this.jedison.
|
|
2006
|
+
if (typeof value === "string" && this.jedison.getOption("purifyData") && typeof window !== "undefined" && window.DOMPurify) {
|
|
1978
2007
|
value = window.DOMPurify.sanitize(value);
|
|
1979
2008
|
}
|
|
1980
2009
|
return value;
|
|
@@ -1990,7 +2019,7 @@ class Instance extends EventEmitter {
|
|
|
1990
2019
|
const purifiedValue = this.purify(newValue);
|
|
1991
2020
|
const wasPurified = newValue !== purifiedValue;
|
|
1992
2021
|
newValue = purifiedValue;
|
|
1993
|
-
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.
|
|
2022
|
+
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.getOption("enforceConst");
|
|
1994
2023
|
if (isSet(enforceConst) && equal(enforceConst, true)) {
|
|
1995
2024
|
const schemaConst = getSchemaConst(this.schema);
|
|
1996
2025
|
if (isSet(schemaConst)) {
|
|
@@ -2116,7 +2145,7 @@ class Editor {
|
|
|
2116
2145
|
this.setVisibility();
|
|
2117
2146
|
this.setContainerAttributes();
|
|
2118
2147
|
this.refreshUI();
|
|
2119
|
-
const alwaysShowErrors = this.instance.jedison.
|
|
2148
|
+
const alwaysShowErrors = this.instance.jedison.getOption("showErrors") === "always" || getSchemaXOption(this.instance.schema, "showErrors") === "always";
|
|
2120
2149
|
if (alwaysShowErrors) {
|
|
2121
2150
|
this.showValidationErrors(this.instance.getErrors());
|
|
2122
2151
|
}
|
|
@@ -2133,8 +2162,8 @@ class Editor {
|
|
|
2133
2162
|
*/
|
|
2134
2163
|
init() {
|
|
2135
2164
|
this.theme = this.instance.jedison.theme;
|
|
2136
|
-
this.markdownEnabled = getSchemaXOption(this.instance.schema, "parseMarkdown") ?? this.instance.jedison.
|
|
2137
|
-
this.purifyEnabled = getSchemaXOption(this.instance.schema, "purifyHtml") ?? this.instance.jedison.
|
|
2165
|
+
this.markdownEnabled = getSchemaXOption(this.instance.schema, "parseMarkdown") ?? this.instance.jedison.getOption("parseMarkdown");
|
|
2166
|
+
this.purifyEnabled = getSchemaXOption(this.instance.schema, "purifyHtml") ?? this.instance.jedison.getOption("purifyHtml");
|
|
2138
2167
|
}
|
|
2139
2168
|
/**
|
|
2140
2169
|
* Gets the json path level by counting how many "/" it has
|
|
@@ -2200,7 +2229,7 @@ class Editor {
|
|
|
2200
2229
|
}
|
|
2201
2230
|
}
|
|
2202
2231
|
getIdFromPath(path) {
|
|
2203
|
-
const optionId = this.instance.jedison.
|
|
2232
|
+
const optionId = this.instance.jedison.getOption("id");
|
|
2204
2233
|
return optionId ? optionId + "-" + pathToAttribute(path) : pathToAttribute(path);
|
|
2205
2234
|
}
|
|
2206
2235
|
/**
|
|
@@ -2208,7 +2237,7 @@ class Editor {
|
|
|
2208
2237
|
* @returns {string} - 'input' or 'change'
|
|
2209
2238
|
*/
|
|
2210
2239
|
getValidationEventType() {
|
|
2211
|
-
const showErrors = getSchemaXOption(this.instance.schema, "showErrors") ?? this.instance.jedison.
|
|
2240
|
+
const showErrors = getSchemaXOption(this.instance.schema, "showErrors") ?? this.instance.jedison.getOption("showErrors");
|
|
2212
2241
|
return showErrors === "input" ? "input" : "change";
|
|
2213
2242
|
}
|
|
2214
2243
|
/**
|
|
@@ -2240,11 +2269,11 @@ class Editor {
|
|
|
2240
2269
|
this.control.messages.innerHTML = "";
|
|
2241
2270
|
this.showingValidationErrors = false;
|
|
2242
2271
|
this.setAriaInvalid(false);
|
|
2243
|
-
const neverShowErrors = this.instance.jedison.
|
|
2272
|
+
const neverShowErrors = this.instance.jedison.getOption("showErrors") === "never" || getSchemaXOption(this.instance.schema, "showErrors") === "never";
|
|
2244
2273
|
if (neverShowErrors && !force || errors.length === 0) {
|
|
2245
2274
|
return;
|
|
2246
2275
|
}
|
|
2247
|
-
const muteValidationMessages = getSchemaXOption(this.instance.schema, "muteValidationMessages") ?? this.instance.jedison.
|
|
2276
|
+
const muteValidationMessages = getSchemaXOption(this.instance.schema, "muteValidationMessages") ?? this.instance.jedison.getOption("muteValidationMessages") ?? [];
|
|
2248
2277
|
let hasErrors = false;
|
|
2249
2278
|
errors.forEach((error) => {
|
|
2250
2279
|
if (muteValidationMessages.includes(error.constraint)) {
|
|
@@ -2309,7 +2338,7 @@ class Editor {
|
|
|
2309
2338
|
* Clean out HTML tags from txt
|
|
2310
2339
|
*/
|
|
2311
2340
|
purifyContent(content, domPurifyOptions) {
|
|
2312
|
-
if (this.instance.jedison.
|
|
2341
|
+
if (this.instance.jedison.getOption("purifyHtml") && typeof window !== "undefined" && window.DOMPurify) {
|
|
2313
2342
|
return window.DOMPurify.sanitize(content, domPurifyOptions);
|
|
2314
2343
|
} else {
|
|
2315
2344
|
const tmp = document.createElement("div");
|
|
@@ -2331,7 +2360,7 @@ class Editor {
|
|
|
2331
2360
|
if (titleFromSchema) {
|
|
2332
2361
|
this.title = compileTemplate(this.title, this.instance.getTemplateData(this.title));
|
|
2333
2362
|
this.title = this.markdownEnabled ? this.getHtmlFromMarkdown(this.title) : this.title;
|
|
2334
|
-
const domPurifyOptions = combineDeep({}, this.instance.jedison.
|
|
2363
|
+
const domPurifyOptions = combineDeep({}, this.instance.jedison.getOption("domPurifyOptions"), {
|
|
2335
2364
|
FORBID_TAGS: ["p"]
|
|
2336
2365
|
});
|
|
2337
2366
|
this.title = this.purifyEnabled ? this.purifyContent(this.title, domPurifyOptions) : this.title;
|
|
@@ -2343,7 +2372,7 @@ class Editor {
|
|
|
2343
2372
|
if (isSet(schemaDescription)) {
|
|
2344
2373
|
this.description = compileTemplate(schemaDescription, this.instance.getTemplateData(this.description));
|
|
2345
2374
|
this.description = this.markdownEnabled ? this.getHtmlFromMarkdown(this.description) : this.description;
|
|
2346
|
-
const domPurifyOptions = this.instance.jedison.
|
|
2375
|
+
const domPurifyOptions = this.instance.jedison.getOption("domPurifyOptions");
|
|
2347
2376
|
this.description = this.purifyEnabled ? this.purifyContent(this.description, domPurifyOptions) : this.description;
|
|
2348
2377
|
}
|
|
2349
2378
|
return this.description;
|
|
@@ -2354,7 +2383,7 @@ class Editor {
|
|
|
2354
2383
|
if (!isSet(schemaInfo)) {
|
|
2355
2384
|
return schemaInfo;
|
|
2356
2385
|
}
|
|
2357
|
-
const domPurifyOptions = this.instance.jedison.
|
|
2386
|
+
const domPurifyOptions = this.instance.jedison.getOption("domPurifyOptions");
|
|
2358
2387
|
if (isSet(schemaInfo.title)) {
|
|
2359
2388
|
schemaInfo.title = this.markdownEnabled ? this.getHtmlFromMarkdown(schemaInfo.title) : schemaInfo.title;
|
|
2360
2389
|
schemaInfo.title = this.purifyEnabled ? this.purifyContent(schemaInfo.title, domPurifyOptions) : schemaInfo.title;
|
|
@@ -2561,7 +2590,7 @@ class InstanceIfThenElse extends Instance {
|
|
|
2561
2590
|
if (indexChanged && initiator !== "api") {
|
|
2562
2591
|
instanceValue = overwriteExistingProperties(startingValue, withoutIf);
|
|
2563
2592
|
} else {
|
|
2564
|
-
const audacity = this.jedison.
|
|
2593
|
+
const audacity = this.jedison.getOption("audacity");
|
|
2565
2594
|
if (audacity && initiator === "api" && index2 === fittestIndex) {
|
|
2566
2595
|
const prePassValue = mergeDeep({}, instance.getValue(), value);
|
|
2567
2596
|
instance.setValue(prePassValue, false, "api");
|
|
@@ -2774,11 +2803,15 @@ class InstanceMultiple extends Instance {
|
|
|
2774
2803
|
this.switchInstance(fittestIndex, this.value);
|
|
2775
2804
|
}
|
|
2776
2805
|
switchInstance(index2, value, initiator = "api") {
|
|
2806
|
+
if (this.activeInstance) {
|
|
2807
|
+
this.activeInstance.children.forEach((child) => child.unregister());
|
|
2808
|
+
}
|
|
2777
2809
|
this.index = index2;
|
|
2778
2810
|
this.activeInstance = this.instances[index2];
|
|
2779
2811
|
if (isSet(value)) {
|
|
2780
2812
|
this.activeInstance.setValue(value, false, initiator);
|
|
2781
2813
|
}
|
|
2814
|
+
this.activeInstance.children.forEach((child) => child.register());
|
|
2782
2815
|
this.setValue(this.activeInstance.getValueRaw(), true, initiator);
|
|
2783
2816
|
}
|
|
2784
2817
|
onSetValue() {
|
|
@@ -2850,7 +2883,7 @@ class InstanceObject extends Instance {
|
|
|
2850
2883
|
this.properties[key] = { schema };
|
|
2851
2884
|
let musstCreateChild = true;
|
|
2852
2885
|
const isRecursive = isSet(schema["x-recursive"]);
|
|
2853
|
-
const optionsDeactivateNonRequired = this.jedison.
|
|
2886
|
+
const optionsDeactivateNonRequired = this.jedison.getOption("deactivateNonRequired");
|
|
2854
2887
|
const deactivateNonRequired = getSchemaXOption(this.schema, "deactivateNonRequired");
|
|
2855
2888
|
const schemaDeactivateNonRequired = getSchemaXOption(schema, "deactivateNonRequired");
|
|
2856
2889
|
const isReq = this.isRequired(key);
|
|
@@ -2871,7 +2904,7 @@ class InstanceObject extends Instance {
|
|
|
2871
2904
|
}
|
|
2872
2905
|
});
|
|
2873
2906
|
}
|
|
2874
|
-
if (isSet(schemaRequired) && this.jedison.isEditor && this.jedison.
|
|
2907
|
+
if (isSet(schemaRequired) && this.jedison.isEditor && this.jedison.getOption("enforceRequired") === true) {
|
|
2875
2908
|
schemaRequired.forEach((requiredProperty) => {
|
|
2876
2909
|
this.requiredProperties.add(requiredProperty);
|
|
2877
2910
|
if (!hasOwn(this.properties, requiredProperty)) {
|
|
@@ -2889,7 +2922,7 @@ class InstanceObject extends Instance {
|
|
|
2889
2922
|
}
|
|
2890
2923
|
removeNotListedPropertiesFromValue(value) {
|
|
2891
2924
|
const schemaEnforceAdditionalProperties = getSchemaXOption(this.schema, "enforceAdditionalProperties");
|
|
2892
|
-
const enforceAdditionalProperties = isSet(schemaEnforceAdditionalProperties) ? schemaEnforceAdditionalProperties : this.jedison.
|
|
2925
|
+
const enforceAdditionalProperties = isSet(schemaEnforceAdditionalProperties) ? schemaEnforceAdditionalProperties : this.jedison.getOption("enforceAdditionalProperties");
|
|
2893
2926
|
const schemaAdditionalProperties = this.schemaAdditionalProperties;
|
|
2894
2927
|
const schemaPatternProperties = this.schemaPatternProperties || {};
|
|
2895
2928
|
if (this.jedison.isEditor && enforceAdditionalProperties && isSet(schemaAdditionalProperties) && schemaAdditionalProperties === false) {
|
|
@@ -2904,7 +2937,7 @@ class InstanceObject extends Instance {
|
|
|
2904
2937
|
}
|
|
2905
2938
|
}
|
|
2906
2939
|
addMissingRequiredPropertiesToValue(value) {
|
|
2907
|
-
const enforceRequired = getSchemaXOption(this.schema, "enforceRequired") ?? this.jedison.
|
|
2940
|
+
const enforceRequired = getSchemaXOption(this.schema, "enforceRequired") ?? this.jedison.getOption("enforceRequired");
|
|
2908
2941
|
if (this.jedison.isEditor && enforceRequired) {
|
|
2909
2942
|
this.requiredProperties.forEach((propertyName) => {
|
|
2910
2943
|
if (!hasOwn(value, propertyName)) {
|
|
@@ -2953,7 +2986,7 @@ class InstanceObject extends Instance {
|
|
|
2953
2986
|
});
|
|
2954
2987
|
this.children.push(instance);
|
|
2955
2988
|
this.value[key] = instance.getValue();
|
|
2956
|
-
const deactivateNonRequired = getSchemaXOption(this.schema, "deactivateNonRequired") ?? this.jedison.
|
|
2989
|
+
const deactivateNonRequired = getSchemaXOption(this.schema, "deactivateNonRequired") ?? this.jedison.getOption("deactivateNonRequired");
|
|
2957
2990
|
if (!this.isRequired(key) && isSet(deactivateNonRequired) && deactivateNonRequired === true && !activate) {
|
|
2958
2991
|
instance.deactivate();
|
|
2959
2992
|
}
|
|
@@ -3087,10 +3120,14 @@ class InstanceObject extends Instance {
|
|
|
3087
3120
|
class InstanceArray extends Instance {
|
|
3088
3121
|
prepare() {
|
|
3089
3122
|
this.schemaItems = getSchemaItems(this.schema);
|
|
3123
|
+
if (isObject(this.schemaItems) && this.jedison.refParser && this.jedison.refParser.hasRef(this.schemaItems) && !this.schemaItems["x-recursive"]) {
|
|
3124
|
+
this.schemaItems = this.jedison.refParser.expand(this.schemaItems);
|
|
3125
|
+
this.schema.items = this.schemaItems;
|
|
3126
|
+
}
|
|
3090
3127
|
this.schemaPrefixItems = getSchemaPrefixItems(this.schema);
|
|
3091
3128
|
const schemaMinItems = getSchemaMinItems(this.schema);
|
|
3092
3129
|
const schemaEnforceMinItems = getSchemaXOption(this.schema, "enforceMinItems");
|
|
3093
|
-
const enforceMinItems = isSet(schemaEnforceMinItems) ? schemaEnforceMinItems : this.jedison.
|
|
3130
|
+
const enforceMinItems = isSet(schemaEnforceMinItems) ? schemaEnforceMinItems : this.jedison.getOption("enforceMinItems");
|
|
3094
3131
|
const isEditor = this.jedison.isEditor;
|
|
3095
3132
|
const hasEnforceMinItems = isSet(enforceMinItems) && enforceMinItems === true;
|
|
3096
3133
|
const hasMinItems = isSet(schemaMinItems);
|
|
@@ -3600,7 +3637,7 @@ class EditorStringTextarea extends EditorString {
|
|
|
3600
3637
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
3601
3638
|
info: this.getInfo()
|
|
3602
3639
|
});
|
|
3603
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
3640
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
3604
3641
|
if (useConstraintAttributes === true) {
|
|
3605
3642
|
const schemaMinLength = getSchemaMinLength(this.instance.schema);
|
|
3606
3643
|
const schemaMaxLength = getSchemaMaxLength(this.instance.schema);
|
|
@@ -3736,7 +3773,7 @@ class EditorStringInput extends EditorString {
|
|
|
3736
3773
|
if (optionFormat === "color" && this.instance.value.length === 0) {
|
|
3737
3774
|
this.instance.setValue("#000000", false, "user");
|
|
3738
3775
|
}
|
|
3739
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
3776
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
3740
3777
|
if (useConstraintAttributes === true) {
|
|
3741
3778
|
const schemaMinLength = getSchemaMinLength(this.instance.schema);
|
|
3742
3779
|
const schemaMaxLength = getSchemaMaxLength(this.instance.schema);
|
|
@@ -3917,7 +3954,7 @@ class EditorNumberInput extends EditorNumber {
|
|
|
3917
3954
|
info: this.getInfo()
|
|
3918
3955
|
});
|
|
3919
3956
|
this.control.input.setAttribute("step", "any");
|
|
3920
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
3957
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
3921
3958
|
if (useConstraintAttributes === true) {
|
|
3922
3959
|
const schemaMinimum = getSchemaMinimum(this.instance.schema);
|
|
3923
3960
|
const schemaMaximum = getSchemaMaximum(this.instance.schema);
|
|
@@ -4006,13 +4043,13 @@ class EditorObject extends Editor {
|
|
|
4006
4043
|
if (isSet(additionalProperties2) && additionalProperties2 === false) {
|
|
4007
4044
|
addProperty = false;
|
|
4008
4045
|
}
|
|
4009
|
-
const objectAdd = getSchemaXOption(this.instance.schema, "objectAdd") ?? this.instance.jedison.
|
|
4046
|
+
const objectAdd = getSchemaXOption(this.instance.schema, "objectAdd") ?? this.instance.jedison.getOption("objectAdd");
|
|
4010
4047
|
if (isSet(objectAdd) && objectAdd === false) {
|
|
4011
4048
|
addProperty = false;
|
|
4012
4049
|
}
|
|
4013
4050
|
let enablePropertiesToggle = false;
|
|
4014
|
-
if (isSet(this.instance.jedison.
|
|
4015
|
-
enablePropertiesToggle = this.instance.jedison.
|
|
4051
|
+
if (isSet(this.instance.jedison.getOption("enablePropertiesToggle"))) {
|
|
4052
|
+
enablePropertiesToggle = this.instance.jedison.getOption("enablePropertiesToggle");
|
|
4016
4053
|
}
|
|
4017
4054
|
const schemaEnablePropertiesToggle = getSchemaXOption(this.instance.schema, "enablePropertiesToggle");
|
|
4018
4055
|
if (isSet(schemaEnablePropertiesToggle)) {
|
|
@@ -4025,11 +4062,11 @@ class EditorObject extends Editor {
|
|
|
4025
4062
|
id: this.getIdFromPath(this.instance.path),
|
|
4026
4063
|
enablePropertiesToggle,
|
|
4027
4064
|
addProperty,
|
|
4028
|
-
enableCollapseToggle: getSchemaXOption(this.instance.schema, "enableCollapseToggle") ?? this.instance.jedison.
|
|
4029
|
-
startCollapsed: getSchemaXOption(this.instance.schema, "startCollapsed") ?? this.instance.jedison.
|
|
4065
|
+
enableCollapseToggle: getSchemaXOption(this.instance.schema, "enableCollapseToggle") ?? this.instance.jedison.getOption("enableCollapseToggle"),
|
|
4066
|
+
startCollapsed: getSchemaXOption(this.instance.schema, "startCollapsed") ?? this.instance.jedison.getOption("startCollapsed"),
|
|
4030
4067
|
readOnly: this.instance.isReadOnly(),
|
|
4031
4068
|
info: this.getInfo(),
|
|
4032
|
-
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.
|
|
4069
|
+
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.getOption("editJsonData"),
|
|
4033
4070
|
propertiesToggleContent: getSchemaXOption(this.instance.schema, "propertiesToggleContent") ?? this.instance.jedison.translator.translate("propertiesToggle"),
|
|
4034
4071
|
collapseToggleContent: getSchemaXOption(this.instance.schema, "collapseToggleContent") ?? this.instance.jedison.translator.translate("collapseToggle"),
|
|
4035
4072
|
addPropertyContent: getSchemaXOption(this.instance.schema, "addPropertyContent") ?? this.instance.jedison.translator.translate("objectAddProperty")
|
|
@@ -4084,7 +4121,7 @@ class EditorObject extends Editor {
|
|
|
4084
4121
|
return this.theme.getAlert(config);
|
|
4085
4122
|
}
|
|
4086
4123
|
refreshPropertiesSlot() {
|
|
4087
|
-
const schemaOptionEnablePropertiesToggle = getSchemaXOption(this.instance.schema, "enablePropertiesToggle") ?? this.instance.jedison.
|
|
4124
|
+
const schemaOptionEnablePropertiesToggle = getSchemaXOption(this.instance.schema, "enablePropertiesToggle") ?? this.instance.jedison.getOption("enablePropertiesToggle");
|
|
4088
4125
|
if (equal(schemaOptionEnablePropertiesToggle, true)) {
|
|
4089
4126
|
const declaredProperties = Object.keys(this.instance.properties);
|
|
4090
4127
|
const instanceProperties = this.instance.children.map((child) => child.getKey());
|
|
@@ -4348,7 +4385,16 @@ class EditorObjectCategories extends EditorObject {
|
|
|
4348
4385
|
if (!categoriesMap.has(this.activeCategoryName)) {
|
|
4349
4386
|
this.activeCategoryName = categoriesMap.keys().next().value;
|
|
4350
4387
|
}
|
|
4351
|
-
|
|
4388
|
+
const categoryOrder = getSchemaXOption(this.instance.schema, "categoryOrder");
|
|
4389
|
+
const allNames = Array.from(categoriesMap.keys());
|
|
4390
|
+
let orderedCategoryNames = allNames;
|
|
4391
|
+
if (isSet(categoryOrder) && isArray(categoryOrder)) {
|
|
4392
|
+
const specifiedFirst = categoryOrder.filter((name) => categoriesMap.has(name));
|
|
4393
|
+
const unspecified = allNames.filter((name) => !categoryOrder.includes(name));
|
|
4394
|
+
orderedCategoryNames = [...specifiedFirst, ...unspecified];
|
|
4395
|
+
}
|
|
4396
|
+
orderedCategoryNames.forEach((categoryName) => {
|
|
4397
|
+
const category = categoriesMap.get(categoryName);
|
|
4352
4398
|
const active = categoryName === this.activeCategoryName;
|
|
4353
4399
|
const { children, id } = category;
|
|
4354
4400
|
const hasErrors = navWarning && children.some((child) => child.hasNestedValidationErrors());
|
|
@@ -4480,19 +4526,19 @@ class EditorArray extends Editor {
|
|
|
4480
4526
|
description: this.getDescription(),
|
|
4481
4527
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
4482
4528
|
id: this.getIdFromPath(this.instance.path),
|
|
4483
|
-
enableCollapseToggle: getSchemaXOption(this.instance.schema, "enableCollapseToggle") ?? this.instance.jedison.
|
|
4484
|
-
startCollapsed: getSchemaXOption(this.instance.schema, "startCollapsed") ?? this.instance.jedison.
|
|
4529
|
+
enableCollapseToggle: getSchemaXOption(this.instance.schema, "enableCollapseToggle") ?? this.instance.jedison.getOption("enableCollapseToggle"),
|
|
4530
|
+
startCollapsed: getSchemaXOption(this.instance.schema, "startCollapsed") ?? this.instance.jedison.getOption("startCollapsed"),
|
|
4485
4531
|
readOnly: this.instance.isReadOnly(),
|
|
4486
4532
|
info: this.getInfo(),
|
|
4487
|
-
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.
|
|
4488
|
-
arrayAdd: getSchemaXOption(this.instance.schema, "arrayAdd") ?? this.instance.jedison.
|
|
4533
|
+
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.getOption("editJsonData"),
|
|
4534
|
+
arrayAdd: getSchemaXOption(this.instance.schema, "arrayAdd") ?? this.instance.jedison.getOption("arrayAdd"),
|
|
4489
4535
|
arrayAddContent: getSchemaXOption(this.instance.schema, "arrayAddContent") ?? this.instance.jedison.translator.translate("arrayAdd"),
|
|
4490
|
-
arrayFooterAdd: getSchemaXOption(this.instance.schema, "arrayFooterAdd") ?? this.instance.jedison.
|
|
4536
|
+
arrayFooterAdd: getSchemaXOption(this.instance.schema, "arrayFooterAdd") ?? this.instance.jedison.getOption("arrayFooterAdd"),
|
|
4491
4537
|
arrayFooterAddContent: getSchemaXOption(this.instance.schema, "arrayFooterAddContent") ?? this.instance.jedison.translator.translate("arrayAdd"),
|
|
4492
|
-
arrayFooterButtonsPosition: getSchemaXOption(this.instance.schema, "arrayFooterButtonsPosition") ?? this.instance.jedison.
|
|
4493
|
-
arrayDeleteAll: getSchemaXOption(this.instance.schema, "arrayDeleteAll") ?? this.instance.jedison.
|
|
4538
|
+
arrayFooterButtonsPosition: getSchemaXOption(this.instance.schema, "arrayFooterButtonsPosition") ?? this.instance.jedison.getOption("arrayFooterButtonsPosition"),
|
|
4539
|
+
arrayDeleteAll: getSchemaXOption(this.instance.schema, "arrayDeleteAll") ?? this.instance.jedison.getOption("arrayDeleteAll"),
|
|
4494
4540
|
arrayDeleteAllContent: getSchemaXOption(this.instance.schema, "arrayDeleteAllContent") ?? this.instance.jedison.translator.translate("arrayDeleteAll"),
|
|
4495
|
-
arrayFooterDeleteAll: getSchemaXOption(this.instance.schema, "arrayFooterDeleteAll") ?? this.instance.jedison.
|
|
4541
|
+
arrayFooterDeleteAll: getSchemaXOption(this.instance.schema, "arrayFooterDeleteAll") ?? this.instance.jedison.getOption("arrayFooterDeleteAll"),
|
|
4496
4542
|
arrayFooterDeleteAllContent: getSchemaXOption(this.instance.schema, "arrayFooterDeleteAllContent") ?? this.instance.jedison.translator.translate("arrayDeleteAll"),
|
|
4497
4543
|
collapseToggleContent: getSchemaXOption(this.instance.schema, "collapseToggleContent") ?? this.instance.jedison.translator.translate("collapseToggle")
|
|
4498
4544
|
});
|
|
@@ -4500,7 +4546,7 @@ class EditorArray extends Editor {
|
|
|
4500
4546
|
}
|
|
4501
4547
|
deleteAllItems() {
|
|
4502
4548
|
const schemaConfirm = getSchemaXOption(this.instance.schema, "arrayDeleteConfirm");
|
|
4503
|
-
const globalConfirm = this.instance.jedison.
|
|
4549
|
+
const globalConfirm = this.instance.jedison.getOption("arrayDeleteConfirm");
|
|
4504
4550
|
const shouldConfirm = isSet(schemaConfirm) ? schemaConfirm : globalConfirm;
|
|
4505
4551
|
const doDeleteAll = () => {
|
|
4506
4552
|
this.instance.setValue([], true, "user");
|
|
@@ -4579,7 +4625,7 @@ class EditorArray extends Editor {
|
|
|
4579
4625
|
const btnGroup = this.theme.getBtnGroup();
|
|
4580
4626
|
deleteBtn.addEventListener("click", () => {
|
|
4581
4627
|
const schemaConfirm = getSchemaXOption(this.instance.schema, "arrayDeleteConfirm");
|
|
4582
|
-
const globalConfirm = this.instance.jedison.
|
|
4628
|
+
const globalConfirm = this.instance.jedison.getOption("arrayDeleteConfirm");
|
|
4583
4629
|
const shouldConfirm = isSet(schemaConfirm) ? schemaConfirm : globalConfirm;
|
|
4584
4630
|
const doDelete = () => {
|
|
4585
4631
|
this.activeItemIndex = clamp(index2 - 1, 0, this.instance.value.length - 1);
|
|
@@ -4654,7 +4700,7 @@ class EditorArray extends Editor {
|
|
|
4654
4700
|
}
|
|
4655
4701
|
refreshAddBtn() {
|
|
4656
4702
|
const maxItems2 = getSchemaMaxItems(this.instance.schema);
|
|
4657
|
-
const enforceMaxItems = getSchemaXOption(this.instance.schema, "enforceMaxItems") ?? this.instance.jedison.
|
|
4703
|
+
const enforceMaxItems = getSchemaXOption(this.instance.schema, "enforceMaxItems") ?? this.instance.jedison.getOption("enforceMaxItems");
|
|
4658
4704
|
if (isSet(maxItems2) && enforceMaxItems && maxItems2 <= this.instance.value.length) {
|
|
4659
4705
|
this.control.addBtn.setAttribute("disabled", "");
|
|
4660
4706
|
this.control.addBtn.setAttribute("always-disabled", true);
|
|
@@ -4680,9 +4726,9 @@ class EditorArray extends Editor {
|
|
|
4680
4726
|
refreshUI() {
|
|
4681
4727
|
super.refreshUI();
|
|
4682
4728
|
const minItems2 = getSchemaMinItems(this.instance.schema);
|
|
4683
|
-
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.
|
|
4684
|
-
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.
|
|
4685
|
-
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.
|
|
4729
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
4730
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
4731
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
4686
4732
|
this.control.childrenSlot.innerHTML = "";
|
|
4687
4733
|
this.instance.children.forEach((child, index2) => {
|
|
4688
4734
|
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup, addAfterBtn } = this.getButtons(index2);
|
|
@@ -4817,10 +4863,10 @@ class EditorArrayTable extends EditorArray {
|
|
|
4817
4863
|
this.control.childrenSlot.innerHTML = "";
|
|
4818
4864
|
const table = this.theme.getTable();
|
|
4819
4865
|
this.control.childrenSlot.appendChild(table.container);
|
|
4820
|
-
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.
|
|
4821
|
-
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.
|
|
4822
|
-
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.
|
|
4823
|
-
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.
|
|
4866
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
4867
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
4868
|
+
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.getOption("arrayButtonsPosition");
|
|
4869
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
4824
4870
|
const th = this.theme.getTableHeader();
|
|
4825
4871
|
const { label } = this.theme.getFakeLabel({
|
|
4826
4872
|
content: "Controls",
|
|
@@ -4961,10 +5007,10 @@ class EditorArrayTableObject extends EditorArray {
|
|
|
4961
5007
|
this.control.childrenSlot.innerHTML = "";
|
|
4962
5008
|
const table = this.theme.getTable();
|
|
4963
5009
|
this.control.childrenSlot.appendChild(table.container);
|
|
4964
|
-
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.
|
|
4965
|
-
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.
|
|
4966
|
-
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.
|
|
4967
|
-
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.
|
|
5010
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
5011
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
5012
|
+
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.getOption("arrayButtonsPosition");
|
|
5013
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
4968
5014
|
const th = this.theme.getTableHeader();
|
|
4969
5015
|
const { label } = this.theme.getFakeLabel({
|
|
4970
5016
|
content: "Controls",
|
|
@@ -5251,9 +5297,9 @@ class EditorArrayNav extends EditorArray {
|
|
|
5251
5297
|
const tabList = this.theme.getTabList({
|
|
5252
5298
|
variant
|
|
5253
5299
|
});
|
|
5254
|
-
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.
|
|
5255
|
-
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.
|
|
5256
|
-
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.
|
|
5300
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
5301
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
5302
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
5257
5303
|
this.control.childrenSlot.appendChild(row);
|
|
5258
5304
|
row.appendChild(tabListCol);
|
|
5259
5305
|
row.appendChild(tabContentCol);
|
|
@@ -5331,8 +5377,8 @@ class EditorMultiple extends Editor {
|
|
|
5331
5377
|
return isSet(schemaAnyOf) || isSet(schemaOneOf) || schemaType === "any" || isArray(schemaType) || notSet(schemaType);
|
|
5332
5378
|
}
|
|
5333
5379
|
build() {
|
|
5334
|
-
this.switcherInput = getSchemaXOption(this.instance.schema, "switcherInput") ?? this.instance.jedison.
|
|
5335
|
-
this.embedSwitcher = getSchemaXOption(this.instance.schema, "embedSwitcher") ?? this.instance.jedison.
|
|
5380
|
+
this.switcherInput = getSchemaXOption(this.instance.schema, "switcherInput") ?? this.instance.jedison.getOption("switcherInput");
|
|
5381
|
+
this.embedSwitcher = getSchemaXOption(this.instance.schema, "embedSwitcher") ?? this.instance.jedison.getOption("embedSwitcher");
|
|
5336
5382
|
this.control = this.theme.getMultipleControl({
|
|
5337
5383
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
5338
5384
|
id: this.getIdFromPath(this.instance.path),
|
|
@@ -5639,7 +5685,7 @@ class EditorStringIMask extends EditorString {
|
|
|
5639
5685
|
try {
|
|
5640
5686
|
const schemaImask = getSchemaXOption(this.instance.schema, "imask") ?? {};
|
|
5641
5687
|
const schemaImaskSettings = schemaImask["x-settings"];
|
|
5642
|
-
const settings = schemaImaskSettings && this.instance.jedison.
|
|
5688
|
+
const settings = schemaImaskSettings && this.instance.jedison.getOption("settings")[schemaImaskSettings] ? this.instance.jedison.getOption("settings")[schemaImaskSettings] : {};
|
|
5643
5689
|
const imaskOptions = { ...schemaImask, ...settings };
|
|
5644
5690
|
this.imask = window.IMask(this.control.input, imaskOptions);
|
|
5645
5691
|
this.useMaskedValue = schemaImask["x-masked"] ?? false;
|
|
@@ -5682,7 +5728,7 @@ class EditorNumberIMask extends EditorNumber {
|
|
|
5682
5728
|
try {
|
|
5683
5729
|
const schemaImask = getSchemaXOption(this.instance.schema, "imask") ?? {};
|
|
5684
5730
|
const schemaImaskSettings = schemaImask["x-settings"];
|
|
5685
|
-
const settings = schemaImaskSettings && this.instance.jedison.
|
|
5731
|
+
const settings = schemaImaskSettings && this.instance.jedison.getOption("settings")[schemaImaskSettings] ? this.instance.jedison.getOption("settings")[schemaImaskSettings] : {};
|
|
5686
5732
|
const imaskOptions = {
|
|
5687
5733
|
mask: Number,
|
|
5688
5734
|
...schemaImask,
|
|
@@ -5960,7 +6006,7 @@ class EditorNumberRange extends EditorNumber {
|
|
|
5960
6006
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
5961
6007
|
info: this.getInfo()
|
|
5962
6008
|
});
|
|
5963
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
6009
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
5964
6010
|
if (useConstraintAttributes === true) {
|
|
5965
6011
|
this.control.input.setAttribute("min", optionMin);
|
|
5966
6012
|
this.control.input.setAttribute("max", optionMax);
|
|
@@ -6475,8 +6521,6 @@ class Jedison extends EventEmitter {
|
|
|
6475
6521
|
mergeAllOf: false,
|
|
6476
6522
|
enforceConst: false,
|
|
6477
6523
|
enforceRequired: true,
|
|
6478
|
-
enforceEnumDefault: true,
|
|
6479
|
-
// todo: deprecated
|
|
6480
6524
|
enforceAdditionalProperties: true,
|
|
6481
6525
|
enforceMinItems: true,
|
|
6482
6526
|
enforceMaxItems: true,
|
|
@@ -6694,9 +6738,6 @@ class Jedison extends EventEmitter {
|
|
|
6694
6738
|
node.oneOf[index2] = this.refParser.expand(subschema);
|
|
6695
6739
|
});
|
|
6696
6740
|
}
|
|
6697
|
-
if (isObject(node.items) && this.refParser.hasRef(node.items)) {
|
|
6698
|
-
node.items = this.refParser.expand(node.items);
|
|
6699
|
-
}
|
|
6700
6741
|
});
|
|
6701
6742
|
}
|
|
6702
6743
|
if (this.isEditor) {
|
|
@@ -6725,10 +6766,11 @@ class Jedison extends EventEmitter {
|
|
|
6725
6766
|
if (sequentialIfThenElse === null) {
|
|
6726
6767
|
sequentialIfThenElse = conditionals[i];
|
|
6727
6768
|
} else {
|
|
6769
|
+
const inner = sequentialIfThenElse;
|
|
6728
6770
|
sequentialIfThenElse = {
|
|
6729
6771
|
if: conditionals[i].if,
|
|
6730
|
-
then: conditionals[i].then,
|
|
6731
|
-
else:
|
|
6772
|
+
then: combineDeep({}, conditionals[i].then || {}, inner),
|
|
6773
|
+
else: combineDeep({}, conditionals[i].else || {}, inner)
|
|
6732
6774
|
};
|
|
6733
6775
|
}
|
|
6734
6776
|
}
|
|
@@ -6817,6 +6859,18 @@ class Jedison extends EventEmitter {
|
|
|
6817
6859
|
getInstance(path) {
|
|
6818
6860
|
return this.instances.get(path);
|
|
6819
6861
|
}
|
|
6862
|
+
/**
|
|
6863
|
+
* Returns the value of a jedison option
|
|
6864
|
+
* @param {string} option
|
|
6865
|
+
* @return {*}
|
|
6866
|
+
*/
|
|
6867
|
+
getOption(option) {
|
|
6868
|
+
const canonical = resolveAlias(option);
|
|
6869
|
+
if (canonical !== option) {
|
|
6870
|
+
console.warn(`Jedison: option "${option}" is deprecated. Use "${canonical}" instead.`);
|
|
6871
|
+
}
|
|
6872
|
+
return this.options[canonical];
|
|
6873
|
+
}
|
|
6820
6874
|
/**
|
|
6821
6875
|
* Navigates to a specific instance by path, activating any ancestor nav/categories tabs as needed.
|
|
6822
6876
|
* @param {string} path - The instance path (e.g. '#/address/street')
|