jedison 1.8.0 → 1.9.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 +11 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +140 -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 +8 -4
package/dist/esm/jedison.js
CHANGED
|
@@ -116,11 +116,13 @@ function getType(value) {
|
|
|
116
116
|
}
|
|
117
117
|
return type2;
|
|
118
118
|
}
|
|
119
|
+
const UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
119
120
|
function mergeDeep(target, ...sources) {
|
|
120
121
|
if (!sources.length) return target;
|
|
121
122
|
const source = sources.shift();
|
|
122
123
|
if (isObject(target) && isObject(source)) {
|
|
123
124
|
Object.keys(source).forEach((key) => {
|
|
125
|
+
if (UNSAFE_KEYS.has(key)) return;
|
|
124
126
|
if (isObject(source[key])) {
|
|
125
127
|
if (!target[key]) {
|
|
126
128
|
Object.assign(target, {
|
|
@@ -144,6 +146,7 @@ function combineDeep(target, ...sources) {
|
|
|
144
146
|
target.push(...source);
|
|
145
147
|
} else if (isObject(target) && isObject(source)) {
|
|
146
148
|
Object.keys(source).forEach((key) => {
|
|
149
|
+
if (UNSAFE_KEYS.has(key)) return;
|
|
147
150
|
if (isObject(source[key])) {
|
|
148
151
|
if (!target[key]) {
|
|
149
152
|
Object.assign(target, {
|
|
@@ -199,10 +202,20 @@ function getValueByJSONPath(data, path) {
|
|
|
199
202
|
return value;
|
|
200
203
|
}
|
|
201
204
|
function compileTemplate(template, data) {
|
|
202
|
-
return template.replace(/{{(.*?)}}/g, (
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
205
|
+
return template.replace(/{{(.*?)}}/g, (_, inner) => {
|
|
206
|
+
inner = inner.trim();
|
|
207
|
+
const pipeIdx = inner.indexOf("||");
|
|
208
|
+
let path, fallback;
|
|
209
|
+
if (pipeIdx !== -1) {
|
|
210
|
+
path = inner.slice(0, pipeIdx).trim();
|
|
211
|
+
const raw = inner.slice(pipeIdx + 2).trim();
|
|
212
|
+
fallback = raw.replace(/^['"]|['"]$/g, "");
|
|
213
|
+
} else {
|
|
214
|
+
path = inner;
|
|
215
|
+
fallback = "";
|
|
216
|
+
}
|
|
217
|
+
const value = getValueByJSONPath(data, path);
|
|
218
|
+
return value !== void 0 && value !== null ? value : fallback;
|
|
206
219
|
});
|
|
207
220
|
}
|
|
208
221
|
function clamp(number, min, max) {
|
|
@@ -270,6 +283,15 @@ const Utils = {
|
|
|
270
283
|
removeDuplicatesFromArray,
|
|
271
284
|
generateRandomID
|
|
272
285
|
};
|
|
286
|
+
const OPTION_ALIASES = {
|
|
287
|
+
enforceEnumDefault: "enforceEnum"
|
|
288
|
+
};
|
|
289
|
+
function resolveAlias(name) {
|
|
290
|
+
return OPTION_ALIASES[name] ?? name;
|
|
291
|
+
}
|
|
292
|
+
function getAliasesFor(canonicalName) {
|
|
293
|
+
return Object.keys(OPTION_ALIASES).filter((old) => OPTION_ALIASES[old] === canonicalName);
|
|
294
|
+
}
|
|
273
295
|
function getSchemaX(schema, keyword) {
|
|
274
296
|
const key = "x-" + keyword;
|
|
275
297
|
return schema[key];
|
|
@@ -405,7 +427,21 @@ function getSchemaXOption(schema, option) {
|
|
|
405
427
|
if (isSet(schema[xOption])) {
|
|
406
428
|
return schema[xOption];
|
|
407
429
|
}
|
|
408
|
-
|
|
430
|
+
if (schema["x-options"] && isSet(schema["x-options"][option])) {
|
|
431
|
+
return schema["x-options"][option];
|
|
432
|
+
}
|
|
433
|
+
for (const alias of getAliasesFor(option)) {
|
|
434
|
+
const xAlias = "x-" + alias;
|
|
435
|
+
if (isSet(schema[xAlias])) {
|
|
436
|
+
console.warn(`Jedison: schema option "${xAlias}" is deprecated. Use "${xOption}" instead.`);
|
|
437
|
+
return schema[xAlias];
|
|
438
|
+
}
|
|
439
|
+
if (schema["x-options"] && isSet(schema["x-options"][alias])) {
|
|
440
|
+
console.warn(`Jedison: schema x-options.${alias} is deprecated. Use x-options.${option} instead.`);
|
|
441
|
+
return schema["x-options"][alias];
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return void 0;
|
|
409
445
|
}
|
|
410
446
|
function getSchemaPattern(schema) {
|
|
411
447
|
return isString(schema.pattern) ? clone(schema.pattern) : void 0;
|
|
@@ -1802,7 +1838,7 @@ class Instance extends EventEmitter {
|
|
|
1802
1838
|
this.setDefaultValue();
|
|
1803
1839
|
this.registerWatcher();
|
|
1804
1840
|
this.setValueFormTemplate();
|
|
1805
|
-
if (this.jedison.
|
|
1841
|
+
if (this.jedison.getOption("container")) {
|
|
1806
1842
|
this.setUI();
|
|
1807
1843
|
}
|
|
1808
1844
|
this.on("notifyParent", (initiator) => {
|
|
@@ -1865,13 +1901,9 @@ class Instance extends EventEmitter {
|
|
|
1865
1901
|
* Sets the default value of the instance based on it's type
|
|
1866
1902
|
*/
|
|
1867
1903
|
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;
|
|
1904
|
+
const enforceEnum = getSchemaXOption(this.schema, "enforceEnum") ?? this.jedison.getOption("enforceEnum");
|
|
1873
1905
|
const schemaEnum = getSchemaEnum(this.schema);
|
|
1874
|
-
if (isSet(schemaEnum) && !schemaEnum.includes(this.getValueRaw()) && isSet(schemaEnum[0]) &&
|
|
1906
|
+
if (isSet(schemaEnum) && !schemaEnum.includes(this.getValueRaw()) && isSet(schemaEnum[0]) && enforceEnum) {
|
|
1875
1907
|
this.setValue(schemaEnum[0], false);
|
|
1876
1908
|
}
|
|
1877
1909
|
if (notSet(this.value)) {
|
|
@@ -1892,7 +1924,7 @@ class Instance extends EventEmitter {
|
|
|
1892
1924
|
if (isSet(schemaDefault)) {
|
|
1893
1925
|
this.setValue(schemaDefault, false);
|
|
1894
1926
|
}
|
|
1895
|
-
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.
|
|
1927
|
+
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.getOption("enforceConst");
|
|
1896
1928
|
if (isSet(enforceConst) && equal(enforceConst, true)) {
|
|
1897
1929
|
const schemaConst = getSchemaConst(this.schema);
|
|
1898
1930
|
if (isSet(schemaConst)) {
|
|
@@ -1949,7 +1981,7 @@ class Instance extends EventEmitter {
|
|
|
1949
1981
|
const templateData = {
|
|
1950
1982
|
...this.arrayTemplateData,
|
|
1951
1983
|
value: this.getValueRaw(),
|
|
1952
|
-
settings: this.jedison.
|
|
1984
|
+
settings: this.jedison.getOption("settings")
|
|
1953
1985
|
};
|
|
1954
1986
|
if (typeof this.value === "string") {
|
|
1955
1987
|
templateData.length = this.value.length;
|
|
@@ -1959,7 +1991,7 @@ class Instance extends EventEmitter {
|
|
|
1959
1991
|
}
|
|
1960
1992
|
if (template == null ? void 0 : template.includes("{{ functions.")) {
|
|
1961
1993
|
templateData.functions = this.resolveTemplateFunctions(
|
|
1962
|
-
this.jedison.
|
|
1994
|
+
this.jedison.getOption("functions")
|
|
1963
1995
|
);
|
|
1964
1996
|
}
|
|
1965
1997
|
if (this.parent) {
|
|
@@ -1974,7 +2006,7 @@ class Instance extends EventEmitter {
|
|
|
1974
2006
|
return Object.fromEntries(Object.entries(functionsObject).map(([functionName, functionValue]) => [functionName, functionValue(context)]));
|
|
1975
2007
|
}
|
|
1976
2008
|
purify(value) {
|
|
1977
|
-
if (typeof value === "string" && this.jedison.
|
|
2009
|
+
if (typeof value === "string" && this.jedison.getOption("purifyData") && typeof window !== "undefined" && window.DOMPurify) {
|
|
1978
2010
|
value = window.DOMPurify.sanitize(value);
|
|
1979
2011
|
}
|
|
1980
2012
|
return value;
|
|
@@ -1990,7 +2022,7 @@ class Instance extends EventEmitter {
|
|
|
1990
2022
|
const purifiedValue = this.purify(newValue);
|
|
1991
2023
|
const wasPurified = newValue !== purifiedValue;
|
|
1992
2024
|
newValue = purifiedValue;
|
|
1993
|
-
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.
|
|
2025
|
+
const enforceConst = getSchemaXOption(this.schema, "enforceConst") ?? this.jedison.getOption("enforceConst");
|
|
1994
2026
|
if (isSet(enforceConst) && equal(enforceConst, true)) {
|
|
1995
2027
|
const schemaConst = getSchemaConst(this.schema);
|
|
1996
2028
|
if (isSet(schemaConst)) {
|
|
@@ -2116,7 +2148,7 @@ class Editor {
|
|
|
2116
2148
|
this.setVisibility();
|
|
2117
2149
|
this.setContainerAttributes();
|
|
2118
2150
|
this.refreshUI();
|
|
2119
|
-
const alwaysShowErrors = this.instance.jedison.
|
|
2151
|
+
const alwaysShowErrors = this.instance.jedison.getOption("showErrors") === "always" || getSchemaXOption(this.instance.schema, "showErrors") === "always";
|
|
2120
2152
|
if (alwaysShowErrors) {
|
|
2121
2153
|
this.showValidationErrors(this.instance.getErrors());
|
|
2122
2154
|
}
|
|
@@ -2133,8 +2165,8 @@ class Editor {
|
|
|
2133
2165
|
*/
|
|
2134
2166
|
init() {
|
|
2135
2167
|
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.
|
|
2168
|
+
this.markdownEnabled = getSchemaXOption(this.instance.schema, "parseMarkdown") ?? this.instance.jedison.getOption("parseMarkdown");
|
|
2169
|
+
this.purifyEnabled = getSchemaXOption(this.instance.schema, "purifyHtml") ?? this.instance.jedison.getOption("purifyHtml");
|
|
2138
2170
|
}
|
|
2139
2171
|
/**
|
|
2140
2172
|
* Gets the json path level by counting how many "/" it has
|
|
@@ -2200,7 +2232,7 @@ class Editor {
|
|
|
2200
2232
|
}
|
|
2201
2233
|
}
|
|
2202
2234
|
getIdFromPath(path) {
|
|
2203
|
-
const optionId = this.instance.jedison.
|
|
2235
|
+
const optionId = this.instance.jedison.getOption("id");
|
|
2204
2236
|
return optionId ? optionId + "-" + pathToAttribute(path) : pathToAttribute(path);
|
|
2205
2237
|
}
|
|
2206
2238
|
/**
|
|
@@ -2208,7 +2240,7 @@ class Editor {
|
|
|
2208
2240
|
* @returns {string} - 'input' or 'change'
|
|
2209
2241
|
*/
|
|
2210
2242
|
getValidationEventType() {
|
|
2211
|
-
const showErrors = getSchemaXOption(this.instance.schema, "showErrors") ?? this.instance.jedison.
|
|
2243
|
+
const showErrors = getSchemaXOption(this.instance.schema, "showErrors") ?? this.instance.jedison.getOption("showErrors");
|
|
2212
2244
|
return showErrors === "input" ? "input" : "change";
|
|
2213
2245
|
}
|
|
2214
2246
|
/**
|
|
@@ -2240,11 +2272,11 @@ class Editor {
|
|
|
2240
2272
|
this.control.messages.innerHTML = "";
|
|
2241
2273
|
this.showingValidationErrors = false;
|
|
2242
2274
|
this.setAriaInvalid(false);
|
|
2243
|
-
const neverShowErrors = this.instance.jedison.
|
|
2275
|
+
const neverShowErrors = this.instance.jedison.getOption("showErrors") === "never" || getSchemaXOption(this.instance.schema, "showErrors") === "never";
|
|
2244
2276
|
if (neverShowErrors && !force || errors.length === 0) {
|
|
2245
2277
|
return;
|
|
2246
2278
|
}
|
|
2247
|
-
const muteValidationMessages = getSchemaXOption(this.instance.schema, "muteValidationMessages") ?? this.instance.jedison.
|
|
2279
|
+
const muteValidationMessages = getSchemaXOption(this.instance.schema, "muteValidationMessages") ?? this.instance.jedison.getOption("muteValidationMessages") ?? [];
|
|
2248
2280
|
let hasErrors = false;
|
|
2249
2281
|
errors.forEach((error) => {
|
|
2250
2282
|
if (muteValidationMessages.includes(error.constraint)) {
|
|
@@ -2309,7 +2341,7 @@ class Editor {
|
|
|
2309
2341
|
* Clean out HTML tags from txt
|
|
2310
2342
|
*/
|
|
2311
2343
|
purifyContent(content, domPurifyOptions) {
|
|
2312
|
-
if (this.instance.jedison.
|
|
2344
|
+
if (this.instance.jedison.getOption("purifyHtml") && typeof window !== "undefined" && window.DOMPurify) {
|
|
2313
2345
|
return window.DOMPurify.sanitize(content, domPurifyOptions);
|
|
2314
2346
|
} else {
|
|
2315
2347
|
const tmp = document.createElement("div");
|
|
@@ -2331,7 +2363,7 @@ class Editor {
|
|
|
2331
2363
|
if (titleFromSchema) {
|
|
2332
2364
|
this.title = compileTemplate(this.title, this.instance.getTemplateData(this.title));
|
|
2333
2365
|
this.title = this.markdownEnabled ? this.getHtmlFromMarkdown(this.title) : this.title;
|
|
2334
|
-
const domPurifyOptions = combineDeep({}, this.instance.jedison.
|
|
2366
|
+
const domPurifyOptions = combineDeep({}, this.instance.jedison.getOption("domPurifyOptions"), {
|
|
2335
2367
|
FORBID_TAGS: ["p"]
|
|
2336
2368
|
});
|
|
2337
2369
|
this.title = this.purifyEnabled ? this.purifyContent(this.title, domPurifyOptions) : this.title;
|
|
@@ -2343,7 +2375,7 @@ class Editor {
|
|
|
2343
2375
|
if (isSet(schemaDescription)) {
|
|
2344
2376
|
this.description = compileTemplate(schemaDescription, this.instance.getTemplateData(this.description));
|
|
2345
2377
|
this.description = this.markdownEnabled ? this.getHtmlFromMarkdown(this.description) : this.description;
|
|
2346
|
-
const domPurifyOptions = this.instance.jedison.
|
|
2378
|
+
const domPurifyOptions = this.instance.jedison.getOption("domPurifyOptions");
|
|
2347
2379
|
this.description = this.purifyEnabled ? this.purifyContent(this.description, domPurifyOptions) : this.description;
|
|
2348
2380
|
}
|
|
2349
2381
|
return this.description;
|
|
@@ -2354,7 +2386,7 @@ class Editor {
|
|
|
2354
2386
|
if (!isSet(schemaInfo)) {
|
|
2355
2387
|
return schemaInfo;
|
|
2356
2388
|
}
|
|
2357
|
-
const domPurifyOptions = this.instance.jedison.
|
|
2389
|
+
const domPurifyOptions = this.instance.jedison.getOption("domPurifyOptions");
|
|
2358
2390
|
if (isSet(schemaInfo.title)) {
|
|
2359
2391
|
schemaInfo.title = this.markdownEnabled ? this.getHtmlFromMarkdown(schemaInfo.title) : schemaInfo.title;
|
|
2360
2392
|
schemaInfo.title = this.purifyEnabled ? this.purifyContent(schemaInfo.title, domPurifyOptions) : schemaInfo.title;
|
|
@@ -2561,7 +2593,7 @@ class InstanceIfThenElse extends Instance {
|
|
|
2561
2593
|
if (indexChanged && initiator !== "api") {
|
|
2562
2594
|
instanceValue = overwriteExistingProperties(startingValue, withoutIf);
|
|
2563
2595
|
} else {
|
|
2564
|
-
const audacity = this.jedison.
|
|
2596
|
+
const audacity = this.jedison.getOption("audacity");
|
|
2565
2597
|
if (audacity && initiator === "api" && index2 === fittestIndex) {
|
|
2566
2598
|
const prePassValue = mergeDeep({}, instance.getValue(), value);
|
|
2567
2599
|
instance.setValue(prePassValue, false, "api");
|
|
@@ -2774,11 +2806,15 @@ class InstanceMultiple extends Instance {
|
|
|
2774
2806
|
this.switchInstance(fittestIndex, this.value);
|
|
2775
2807
|
}
|
|
2776
2808
|
switchInstance(index2, value, initiator = "api") {
|
|
2809
|
+
if (this.activeInstance) {
|
|
2810
|
+
this.activeInstance.children.forEach((child) => child.unregister());
|
|
2811
|
+
}
|
|
2777
2812
|
this.index = index2;
|
|
2778
2813
|
this.activeInstance = this.instances[index2];
|
|
2779
2814
|
if (isSet(value)) {
|
|
2780
2815
|
this.activeInstance.setValue(value, false, initiator);
|
|
2781
2816
|
}
|
|
2817
|
+
this.activeInstance.children.forEach((child) => child.register());
|
|
2782
2818
|
this.setValue(this.activeInstance.getValueRaw(), true, initiator);
|
|
2783
2819
|
}
|
|
2784
2820
|
onSetValue() {
|
|
@@ -2850,7 +2886,7 @@ class InstanceObject extends Instance {
|
|
|
2850
2886
|
this.properties[key] = { schema };
|
|
2851
2887
|
let musstCreateChild = true;
|
|
2852
2888
|
const isRecursive = isSet(schema["x-recursive"]);
|
|
2853
|
-
const optionsDeactivateNonRequired = this.jedison.
|
|
2889
|
+
const optionsDeactivateNonRequired = this.jedison.getOption("deactivateNonRequired");
|
|
2854
2890
|
const deactivateNonRequired = getSchemaXOption(this.schema, "deactivateNonRequired");
|
|
2855
2891
|
const schemaDeactivateNonRequired = getSchemaXOption(schema, "deactivateNonRequired");
|
|
2856
2892
|
const isReq = this.isRequired(key);
|
|
@@ -2871,7 +2907,7 @@ class InstanceObject extends Instance {
|
|
|
2871
2907
|
}
|
|
2872
2908
|
});
|
|
2873
2909
|
}
|
|
2874
|
-
if (isSet(schemaRequired) && this.jedison.isEditor && this.jedison.
|
|
2910
|
+
if (isSet(schemaRequired) && this.jedison.isEditor && this.jedison.getOption("enforceRequired") === true) {
|
|
2875
2911
|
schemaRequired.forEach((requiredProperty) => {
|
|
2876
2912
|
this.requiredProperties.add(requiredProperty);
|
|
2877
2913
|
if (!hasOwn(this.properties, requiredProperty)) {
|
|
@@ -2889,7 +2925,7 @@ class InstanceObject extends Instance {
|
|
|
2889
2925
|
}
|
|
2890
2926
|
removeNotListedPropertiesFromValue(value) {
|
|
2891
2927
|
const schemaEnforceAdditionalProperties = getSchemaXOption(this.schema, "enforceAdditionalProperties");
|
|
2892
|
-
const enforceAdditionalProperties = isSet(schemaEnforceAdditionalProperties) ? schemaEnforceAdditionalProperties : this.jedison.
|
|
2928
|
+
const enforceAdditionalProperties = isSet(schemaEnforceAdditionalProperties) ? schemaEnforceAdditionalProperties : this.jedison.getOption("enforceAdditionalProperties");
|
|
2893
2929
|
const schemaAdditionalProperties = this.schemaAdditionalProperties;
|
|
2894
2930
|
const schemaPatternProperties = this.schemaPatternProperties || {};
|
|
2895
2931
|
if (this.jedison.isEditor && enforceAdditionalProperties && isSet(schemaAdditionalProperties) && schemaAdditionalProperties === false) {
|
|
@@ -2904,7 +2940,7 @@ class InstanceObject extends Instance {
|
|
|
2904
2940
|
}
|
|
2905
2941
|
}
|
|
2906
2942
|
addMissingRequiredPropertiesToValue(value) {
|
|
2907
|
-
const enforceRequired = getSchemaXOption(this.schema, "enforceRequired") ?? this.jedison.
|
|
2943
|
+
const enforceRequired = getSchemaXOption(this.schema, "enforceRequired") ?? this.jedison.getOption("enforceRequired");
|
|
2908
2944
|
if (this.jedison.isEditor && enforceRequired) {
|
|
2909
2945
|
this.requiredProperties.forEach((propertyName) => {
|
|
2910
2946
|
if (!hasOwn(value, propertyName)) {
|
|
@@ -2953,7 +2989,7 @@ class InstanceObject extends Instance {
|
|
|
2953
2989
|
});
|
|
2954
2990
|
this.children.push(instance);
|
|
2955
2991
|
this.value[key] = instance.getValue();
|
|
2956
|
-
const deactivateNonRequired = getSchemaXOption(this.schema, "deactivateNonRequired") ?? this.jedison.
|
|
2992
|
+
const deactivateNonRequired = getSchemaXOption(this.schema, "deactivateNonRequired") ?? this.jedison.getOption("deactivateNonRequired");
|
|
2957
2993
|
if (!this.isRequired(key) && isSet(deactivateNonRequired) && deactivateNonRequired === true && !activate) {
|
|
2958
2994
|
instance.deactivate();
|
|
2959
2995
|
}
|
|
@@ -3087,10 +3123,14 @@ class InstanceObject extends Instance {
|
|
|
3087
3123
|
class InstanceArray extends Instance {
|
|
3088
3124
|
prepare() {
|
|
3089
3125
|
this.schemaItems = getSchemaItems(this.schema);
|
|
3126
|
+
if (isObject(this.schemaItems) && this.jedison.refParser && this.jedison.refParser.hasRef(this.schemaItems) && !this.schemaItems["x-recursive"]) {
|
|
3127
|
+
this.schemaItems = this.jedison.refParser.expand(this.schemaItems);
|
|
3128
|
+
this.schema.items = this.schemaItems;
|
|
3129
|
+
}
|
|
3090
3130
|
this.schemaPrefixItems = getSchemaPrefixItems(this.schema);
|
|
3091
3131
|
const schemaMinItems = getSchemaMinItems(this.schema);
|
|
3092
3132
|
const schemaEnforceMinItems = getSchemaXOption(this.schema, "enforceMinItems");
|
|
3093
|
-
const enforceMinItems = isSet(schemaEnforceMinItems) ? schemaEnforceMinItems : this.jedison.
|
|
3133
|
+
const enforceMinItems = isSet(schemaEnforceMinItems) ? schemaEnforceMinItems : this.jedison.getOption("enforceMinItems");
|
|
3094
3134
|
const isEditor = this.jedison.isEditor;
|
|
3095
3135
|
const hasEnforceMinItems = isSet(enforceMinItems) && enforceMinItems === true;
|
|
3096
3136
|
const hasMinItems = isSet(schemaMinItems);
|
|
@@ -3600,7 +3640,7 @@ class EditorStringTextarea extends EditorString {
|
|
|
3600
3640
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
3601
3641
|
info: this.getInfo()
|
|
3602
3642
|
});
|
|
3603
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
3643
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
3604
3644
|
if (useConstraintAttributes === true) {
|
|
3605
3645
|
const schemaMinLength = getSchemaMinLength(this.instance.schema);
|
|
3606
3646
|
const schemaMaxLength = getSchemaMaxLength(this.instance.schema);
|
|
@@ -3736,7 +3776,7 @@ class EditorStringInput extends EditorString {
|
|
|
3736
3776
|
if (optionFormat === "color" && this.instance.value.length === 0) {
|
|
3737
3777
|
this.instance.setValue("#000000", false, "user");
|
|
3738
3778
|
}
|
|
3739
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
3779
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
3740
3780
|
if (useConstraintAttributes === true) {
|
|
3741
3781
|
const schemaMinLength = getSchemaMinLength(this.instance.schema);
|
|
3742
3782
|
const schemaMaxLength = getSchemaMaxLength(this.instance.schema);
|
|
@@ -3917,7 +3957,7 @@ class EditorNumberInput extends EditorNumber {
|
|
|
3917
3957
|
info: this.getInfo()
|
|
3918
3958
|
});
|
|
3919
3959
|
this.control.input.setAttribute("step", "any");
|
|
3920
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
3960
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
3921
3961
|
if (useConstraintAttributes === true) {
|
|
3922
3962
|
const schemaMinimum = getSchemaMinimum(this.instance.schema);
|
|
3923
3963
|
const schemaMaximum = getSchemaMaximum(this.instance.schema);
|
|
@@ -4006,13 +4046,13 @@ class EditorObject extends Editor {
|
|
|
4006
4046
|
if (isSet(additionalProperties2) && additionalProperties2 === false) {
|
|
4007
4047
|
addProperty = false;
|
|
4008
4048
|
}
|
|
4009
|
-
const objectAdd = getSchemaXOption(this.instance.schema, "objectAdd") ?? this.instance.jedison.
|
|
4049
|
+
const objectAdd = getSchemaXOption(this.instance.schema, "objectAdd") ?? this.instance.jedison.getOption("objectAdd");
|
|
4010
4050
|
if (isSet(objectAdd) && objectAdd === false) {
|
|
4011
4051
|
addProperty = false;
|
|
4012
4052
|
}
|
|
4013
4053
|
let enablePropertiesToggle = false;
|
|
4014
|
-
if (isSet(this.instance.jedison.
|
|
4015
|
-
enablePropertiesToggle = this.instance.jedison.
|
|
4054
|
+
if (isSet(this.instance.jedison.getOption("enablePropertiesToggle"))) {
|
|
4055
|
+
enablePropertiesToggle = this.instance.jedison.getOption("enablePropertiesToggle");
|
|
4016
4056
|
}
|
|
4017
4057
|
const schemaEnablePropertiesToggle = getSchemaXOption(this.instance.schema, "enablePropertiesToggle");
|
|
4018
4058
|
if (isSet(schemaEnablePropertiesToggle)) {
|
|
@@ -4025,11 +4065,11 @@ class EditorObject extends Editor {
|
|
|
4025
4065
|
id: this.getIdFromPath(this.instance.path),
|
|
4026
4066
|
enablePropertiesToggle,
|
|
4027
4067
|
addProperty,
|
|
4028
|
-
enableCollapseToggle: getSchemaXOption(this.instance.schema, "enableCollapseToggle") ?? this.instance.jedison.
|
|
4029
|
-
startCollapsed: getSchemaXOption(this.instance.schema, "startCollapsed") ?? this.instance.jedison.
|
|
4068
|
+
enableCollapseToggle: getSchemaXOption(this.instance.schema, "enableCollapseToggle") ?? this.instance.jedison.getOption("enableCollapseToggle"),
|
|
4069
|
+
startCollapsed: getSchemaXOption(this.instance.schema, "startCollapsed") ?? this.instance.jedison.getOption("startCollapsed"),
|
|
4030
4070
|
readOnly: this.instance.isReadOnly(),
|
|
4031
4071
|
info: this.getInfo(),
|
|
4032
|
-
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.
|
|
4072
|
+
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.getOption("editJsonData"),
|
|
4033
4073
|
propertiesToggleContent: getSchemaXOption(this.instance.schema, "propertiesToggleContent") ?? this.instance.jedison.translator.translate("propertiesToggle"),
|
|
4034
4074
|
collapseToggleContent: getSchemaXOption(this.instance.schema, "collapseToggleContent") ?? this.instance.jedison.translator.translate("collapseToggle"),
|
|
4035
4075
|
addPropertyContent: getSchemaXOption(this.instance.schema, "addPropertyContent") ?? this.instance.jedison.translator.translate("objectAddProperty")
|
|
@@ -4084,7 +4124,7 @@ class EditorObject extends Editor {
|
|
|
4084
4124
|
return this.theme.getAlert(config);
|
|
4085
4125
|
}
|
|
4086
4126
|
refreshPropertiesSlot() {
|
|
4087
|
-
const schemaOptionEnablePropertiesToggle = getSchemaXOption(this.instance.schema, "enablePropertiesToggle") ?? this.instance.jedison.
|
|
4127
|
+
const schemaOptionEnablePropertiesToggle = getSchemaXOption(this.instance.schema, "enablePropertiesToggle") ?? this.instance.jedison.getOption("enablePropertiesToggle");
|
|
4088
4128
|
if (equal(schemaOptionEnablePropertiesToggle, true)) {
|
|
4089
4129
|
const declaredProperties = Object.keys(this.instance.properties);
|
|
4090
4130
|
const instanceProperties = this.instance.children.map((child) => child.getKey());
|
|
@@ -4348,7 +4388,16 @@ class EditorObjectCategories extends EditorObject {
|
|
|
4348
4388
|
if (!categoriesMap.has(this.activeCategoryName)) {
|
|
4349
4389
|
this.activeCategoryName = categoriesMap.keys().next().value;
|
|
4350
4390
|
}
|
|
4351
|
-
|
|
4391
|
+
const categoryOrder = getSchemaXOption(this.instance.schema, "categoryOrder");
|
|
4392
|
+
const allNames = Array.from(categoriesMap.keys());
|
|
4393
|
+
let orderedCategoryNames = allNames;
|
|
4394
|
+
if (isSet(categoryOrder) && isArray(categoryOrder)) {
|
|
4395
|
+
const specifiedFirst = categoryOrder.filter((name) => categoriesMap.has(name));
|
|
4396
|
+
const unspecified = allNames.filter((name) => !categoryOrder.includes(name));
|
|
4397
|
+
orderedCategoryNames = [...specifiedFirst, ...unspecified];
|
|
4398
|
+
}
|
|
4399
|
+
orderedCategoryNames.forEach((categoryName) => {
|
|
4400
|
+
const category = categoriesMap.get(categoryName);
|
|
4352
4401
|
const active = categoryName === this.activeCategoryName;
|
|
4353
4402
|
const { children, id } = category;
|
|
4354
4403
|
const hasErrors = navWarning && children.some((child) => child.hasNestedValidationErrors());
|
|
@@ -4480,19 +4529,19 @@ class EditorArray extends Editor {
|
|
|
4480
4529
|
description: this.getDescription(),
|
|
4481
4530
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
4482
4531
|
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.
|
|
4532
|
+
enableCollapseToggle: getSchemaXOption(this.instance.schema, "enableCollapseToggle") ?? this.instance.jedison.getOption("enableCollapseToggle"),
|
|
4533
|
+
startCollapsed: getSchemaXOption(this.instance.schema, "startCollapsed") ?? this.instance.jedison.getOption("startCollapsed"),
|
|
4485
4534
|
readOnly: this.instance.isReadOnly(),
|
|
4486
4535
|
info: this.getInfo(),
|
|
4487
|
-
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.
|
|
4488
|
-
arrayAdd: getSchemaXOption(this.instance.schema, "arrayAdd") ?? this.instance.jedison.
|
|
4536
|
+
editJsonData: getSchemaXOption(this.instance.schema, "editJsonData") ?? this.instance.jedison.getOption("editJsonData"),
|
|
4537
|
+
arrayAdd: getSchemaXOption(this.instance.schema, "arrayAdd") ?? this.instance.jedison.getOption("arrayAdd"),
|
|
4489
4538
|
arrayAddContent: getSchemaXOption(this.instance.schema, "arrayAddContent") ?? this.instance.jedison.translator.translate("arrayAdd"),
|
|
4490
|
-
arrayFooterAdd: getSchemaXOption(this.instance.schema, "arrayFooterAdd") ?? this.instance.jedison.
|
|
4539
|
+
arrayFooterAdd: getSchemaXOption(this.instance.schema, "arrayFooterAdd") ?? this.instance.jedison.getOption("arrayFooterAdd"),
|
|
4491
4540
|
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.
|
|
4541
|
+
arrayFooterButtonsPosition: getSchemaXOption(this.instance.schema, "arrayFooterButtonsPosition") ?? this.instance.jedison.getOption("arrayFooterButtonsPosition"),
|
|
4542
|
+
arrayDeleteAll: getSchemaXOption(this.instance.schema, "arrayDeleteAll") ?? this.instance.jedison.getOption("arrayDeleteAll"),
|
|
4494
4543
|
arrayDeleteAllContent: getSchemaXOption(this.instance.schema, "arrayDeleteAllContent") ?? this.instance.jedison.translator.translate("arrayDeleteAll"),
|
|
4495
|
-
arrayFooterDeleteAll: getSchemaXOption(this.instance.schema, "arrayFooterDeleteAll") ?? this.instance.jedison.
|
|
4544
|
+
arrayFooterDeleteAll: getSchemaXOption(this.instance.schema, "arrayFooterDeleteAll") ?? this.instance.jedison.getOption("arrayFooterDeleteAll"),
|
|
4496
4545
|
arrayFooterDeleteAllContent: getSchemaXOption(this.instance.schema, "arrayFooterDeleteAllContent") ?? this.instance.jedison.translator.translate("arrayDeleteAll"),
|
|
4497
4546
|
collapseToggleContent: getSchemaXOption(this.instance.schema, "collapseToggleContent") ?? this.instance.jedison.translator.translate("collapseToggle")
|
|
4498
4547
|
});
|
|
@@ -4500,7 +4549,7 @@ class EditorArray extends Editor {
|
|
|
4500
4549
|
}
|
|
4501
4550
|
deleteAllItems() {
|
|
4502
4551
|
const schemaConfirm = getSchemaXOption(this.instance.schema, "arrayDeleteConfirm");
|
|
4503
|
-
const globalConfirm = this.instance.jedison.
|
|
4552
|
+
const globalConfirm = this.instance.jedison.getOption("arrayDeleteConfirm");
|
|
4504
4553
|
const shouldConfirm = isSet(schemaConfirm) ? schemaConfirm : globalConfirm;
|
|
4505
4554
|
const doDeleteAll = () => {
|
|
4506
4555
|
this.instance.setValue([], true, "user");
|
|
@@ -4579,7 +4628,7 @@ class EditorArray extends Editor {
|
|
|
4579
4628
|
const btnGroup = this.theme.getBtnGroup();
|
|
4580
4629
|
deleteBtn.addEventListener("click", () => {
|
|
4581
4630
|
const schemaConfirm = getSchemaXOption(this.instance.schema, "arrayDeleteConfirm");
|
|
4582
|
-
const globalConfirm = this.instance.jedison.
|
|
4631
|
+
const globalConfirm = this.instance.jedison.getOption("arrayDeleteConfirm");
|
|
4583
4632
|
const shouldConfirm = isSet(schemaConfirm) ? schemaConfirm : globalConfirm;
|
|
4584
4633
|
const doDelete = () => {
|
|
4585
4634
|
this.activeItemIndex = clamp(index2 - 1, 0, this.instance.value.length - 1);
|
|
@@ -4654,7 +4703,7 @@ class EditorArray extends Editor {
|
|
|
4654
4703
|
}
|
|
4655
4704
|
refreshAddBtn() {
|
|
4656
4705
|
const maxItems2 = getSchemaMaxItems(this.instance.schema);
|
|
4657
|
-
const enforceMaxItems = getSchemaXOption(this.instance.schema, "enforceMaxItems") ?? this.instance.jedison.
|
|
4706
|
+
const enforceMaxItems = getSchemaXOption(this.instance.schema, "enforceMaxItems") ?? this.instance.jedison.getOption("enforceMaxItems");
|
|
4658
4707
|
if (isSet(maxItems2) && enforceMaxItems && maxItems2 <= this.instance.value.length) {
|
|
4659
4708
|
this.control.addBtn.setAttribute("disabled", "");
|
|
4660
4709
|
this.control.addBtn.setAttribute("always-disabled", true);
|
|
@@ -4680,9 +4729,9 @@ class EditorArray extends Editor {
|
|
|
4680
4729
|
refreshUI() {
|
|
4681
4730
|
super.refreshUI();
|
|
4682
4731
|
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.
|
|
4732
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
4733
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
4734
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
4686
4735
|
this.control.childrenSlot.innerHTML = "";
|
|
4687
4736
|
this.instance.children.forEach((child, index2) => {
|
|
4688
4737
|
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup, addAfterBtn } = this.getButtons(index2);
|
|
@@ -4817,10 +4866,10 @@ class EditorArrayTable extends EditorArray {
|
|
|
4817
4866
|
this.control.childrenSlot.innerHTML = "";
|
|
4818
4867
|
const table = this.theme.getTable();
|
|
4819
4868
|
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.
|
|
4869
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
4870
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
4871
|
+
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.getOption("arrayButtonsPosition");
|
|
4872
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
4824
4873
|
const th = this.theme.getTableHeader();
|
|
4825
4874
|
const { label } = this.theme.getFakeLabel({
|
|
4826
4875
|
content: "Controls",
|
|
@@ -4961,10 +5010,10 @@ class EditorArrayTableObject extends EditorArray {
|
|
|
4961
5010
|
this.control.childrenSlot.innerHTML = "";
|
|
4962
5011
|
const table = this.theme.getTable();
|
|
4963
5012
|
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.
|
|
5013
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
5014
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
5015
|
+
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.getOption("arrayButtonsPosition");
|
|
5016
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
4968
5017
|
const th = this.theme.getTableHeader();
|
|
4969
5018
|
const { label } = this.theme.getFakeLabel({
|
|
4970
5019
|
content: "Controls",
|
|
@@ -5251,9 +5300,9 @@ class EditorArrayNav extends EditorArray {
|
|
|
5251
5300
|
const tabList = this.theme.getTabList({
|
|
5252
5301
|
variant
|
|
5253
5302
|
});
|
|
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.
|
|
5303
|
+
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.getOption("arrayDelete");
|
|
5304
|
+
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.getOption("arrayMove");
|
|
5305
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.getOption("arrayAddAfter");
|
|
5257
5306
|
this.control.childrenSlot.appendChild(row);
|
|
5258
5307
|
row.appendChild(tabListCol);
|
|
5259
5308
|
row.appendChild(tabContentCol);
|
|
@@ -5331,8 +5380,8 @@ class EditorMultiple extends Editor {
|
|
|
5331
5380
|
return isSet(schemaAnyOf) || isSet(schemaOneOf) || schemaType === "any" || isArray(schemaType) || notSet(schemaType);
|
|
5332
5381
|
}
|
|
5333
5382
|
build() {
|
|
5334
|
-
this.switcherInput = getSchemaXOption(this.instance.schema, "switcherInput") ?? this.instance.jedison.
|
|
5335
|
-
this.embedSwitcher = getSchemaXOption(this.instance.schema, "embedSwitcher") ?? this.instance.jedison.
|
|
5383
|
+
this.switcherInput = getSchemaXOption(this.instance.schema, "switcherInput") ?? this.instance.jedison.getOption("switcherInput");
|
|
5384
|
+
this.embedSwitcher = getSchemaXOption(this.instance.schema, "embedSwitcher") ?? this.instance.jedison.getOption("embedSwitcher");
|
|
5336
5385
|
this.control = this.theme.getMultipleControl({
|
|
5337
5386
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
5338
5387
|
id: this.getIdFromPath(this.instance.path),
|
|
@@ -5639,7 +5688,7 @@ class EditorStringIMask extends EditorString {
|
|
|
5639
5688
|
try {
|
|
5640
5689
|
const schemaImask = getSchemaXOption(this.instance.schema, "imask") ?? {};
|
|
5641
5690
|
const schemaImaskSettings = schemaImask["x-settings"];
|
|
5642
|
-
const settings = schemaImaskSettings && this.instance.jedison.
|
|
5691
|
+
const settings = schemaImaskSettings && this.instance.jedison.getOption("settings")[schemaImaskSettings] ? this.instance.jedison.getOption("settings")[schemaImaskSettings] : {};
|
|
5643
5692
|
const imaskOptions = { ...schemaImask, ...settings };
|
|
5644
5693
|
this.imask = window.IMask(this.control.input, imaskOptions);
|
|
5645
5694
|
this.useMaskedValue = schemaImask["x-masked"] ?? false;
|
|
@@ -5682,7 +5731,7 @@ class EditorNumberIMask extends EditorNumber {
|
|
|
5682
5731
|
try {
|
|
5683
5732
|
const schemaImask = getSchemaXOption(this.instance.schema, "imask") ?? {};
|
|
5684
5733
|
const schemaImaskSettings = schemaImask["x-settings"];
|
|
5685
|
-
const settings = schemaImaskSettings && this.instance.jedison.
|
|
5734
|
+
const settings = schemaImaskSettings && this.instance.jedison.getOption("settings")[schemaImaskSettings] ? this.instance.jedison.getOption("settings")[schemaImaskSettings] : {};
|
|
5686
5735
|
const imaskOptions = {
|
|
5687
5736
|
mask: Number,
|
|
5688
5737
|
...schemaImask,
|
|
@@ -5960,7 +6009,7 @@ class EditorNumberRange extends EditorNumber {
|
|
|
5960
6009
|
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
5961
6010
|
info: this.getInfo()
|
|
5962
6011
|
});
|
|
5963
|
-
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.
|
|
6012
|
+
const useConstraintAttributes = getSchemaXOption(this.instance.schema, "useConstraintAttributes") ?? this.instance.jedison.getOption("useConstraintAttributes");
|
|
5964
6013
|
if (useConstraintAttributes === true) {
|
|
5965
6014
|
this.control.input.setAttribute("min", optionMin);
|
|
5966
6015
|
this.control.input.setAttribute("max", optionMax);
|
|
@@ -6475,8 +6524,6 @@ class Jedison extends EventEmitter {
|
|
|
6475
6524
|
mergeAllOf: false,
|
|
6476
6525
|
enforceConst: false,
|
|
6477
6526
|
enforceRequired: true,
|
|
6478
|
-
enforceEnumDefault: true,
|
|
6479
|
-
// todo: deprecated
|
|
6480
6527
|
enforceAdditionalProperties: true,
|
|
6481
6528
|
enforceMinItems: true,
|
|
6482
6529
|
enforceMaxItems: true,
|
|
@@ -6694,9 +6741,6 @@ class Jedison extends EventEmitter {
|
|
|
6694
6741
|
node.oneOf[index2] = this.refParser.expand(subschema);
|
|
6695
6742
|
});
|
|
6696
6743
|
}
|
|
6697
|
-
if (isObject(node.items) && this.refParser.hasRef(node.items)) {
|
|
6698
|
-
node.items = this.refParser.expand(node.items);
|
|
6699
|
-
}
|
|
6700
6744
|
});
|
|
6701
6745
|
}
|
|
6702
6746
|
if (this.isEditor) {
|
|
@@ -6725,10 +6769,11 @@ class Jedison extends EventEmitter {
|
|
|
6725
6769
|
if (sequentialIfThenElse === null) {
|
|
6726
6770
|
sequentialIfThenElse = conditionals[i];
|
|
6727
6771
|
} else {
|
|
6772
|
+
const inner = sequentialIfThenElse;
|
|
6728
6773
|
sequentialIfThenElse = {
|
|
6729
6774
|
if: conditionals[i].if,
|
|
6730
|
-
then: conditionals[i].then,
|
|
6731
|
-
else:
|
|
6775
|
+
then: combineDeep({}, conditionals[i].then || {}, inner),
|
|
6776
|
+
else: combineDeep({}, conditionals[i].else || {}, inner)
|
|
6732
6777
|
};
|
|
6733
6778
|
}
|
|
6734
6779
|
}
|
|
@@ -6817,6 +6862,18 @@ class Jedison extends EventEmitter {
|
|
|
6817
6862
|
getInstance(path) {
|
|
6818
6863
|
return this.instances.get(path);
|
|
6819
6864
|
}
|
|
6865
|
+
/**
|
|
6866
|
+
* Returns the value of a jedison option
|
|
6867
|
+
* @param {string} option
|
|
6868
|
+
* @return {*}
|
|
6869
|
+
*/
|
|
6870
|
+
getOption(option) {
|
|
6871
|
+
const canonical = resolveAlias(option);
|
|
6872
|
+
if (canonical !== option) {
|
|
6873
|
+
console.warn(`Jedison: option "${option}" is deprecated. Use "${canonical}" instead.`);
|
|
6874
|
+
}
|
|
6875
|
+
return this.options[canonical];
|
|
6876
|
+
}
|
|
6820
6877
|
/**
|
|
6821
6878
|
* Navigates to a specific instance by path, activating any ancestor nav/categories tabs as needed.
|
|
6822
6879
|
* @param {string} path - The instance path (e.g. '#/address/street')
|