fastapi-rtk 0.2.42 → 0.2.43
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/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/JsonFormsWithCustomizer/JsonFormsWithCustomizer.cjs +17 -8
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineEnumArrayInput.cjs +1 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineEnumInput.cjs +1 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineOneOfEnumInput.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useMultiSelectProps.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useSelectProps.cjs +1 -6
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/JsonFormsWithCustomizer/JsonFormsWithCustomizer.mjs +17 -8
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineEnumArrayInput.mjs +1 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineEnumInput.mjs +1 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineOneOfEnumInput.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useMultiSelectProps.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useSelectProps.mjs +1 -6
- package/dist/.external/cjs/{dompurify@3.2.6 → dompurify@3.2.7}/dompurify/dist/purify.es.cjs +26 -16
- package/dist/.external/esm/{dompurify@3.2.6 → dompurify@3.2.7}/dompurify/dist/purify.es.mjs +26 -16
- package/dist/core/cjs/ActionIcons/utils/convertToFormInputs.cjs +4 -5
- package/dist/core/cjs/Dialogs/AddDialog.cjs +17 -2
- package/dist/core/cjs/Dialogs/EditDialog.cjs +17 -2
- package/dist/core/cjs/Tables/DataGrid/Main/Body/Field/Field.cjs +1 -1
- package/dist/core/esm/ActionIcons/utils/convertToFormInputs.mjs +4 -5
- package/dist/core/esm/Dialogs/AddDialog.mjs +17 -2
- package/dist/core/esm/Dialogs/EditDialog.mjs +17 -2
- package/dist/core/esm/Tables/DataGrid/Main/Body/Field/Field.mjs +1 -1
- package/dist/core/lib/Dialogs/AddDialog.d.ts +16 -1
- package/dist/core/lib/Dialogs/EditDialog.d.ts +16 -1
- package/dist/core/lib/hooks/api/useApi.d.ts +8 -0
- package/dist/jsonforms/cjs/JsonFormsWithCustomizer/JsonFormsWithCustomizer.cjs +17 -8
- package/dist/jsonforms/cjs/MantineInputs/MantineEnumArrayInput.cjs +1 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineEnumInput.cjs +1 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineOneOfEnumInput.cjs +2 -2
- package/dist/jsonforms/cjs/hooks/useMultiSelectProps.cjs +2 -2
- package/dist/jsonforms/cjs/hooks/useSelectProps.cjs +1 -6
- package/dist/jsonforms/esm/JsonFormsWithCustomizer/JsonFormsWithCustomizer.mjs +17 -8
- package/dist/jsonforms/esm/MantineInputs/MantineEnumArrayInput.mjs +1 -1
- package/dist/jsonforms/esm/MantineInputs/MantineEnumInput.mjs +1 -1
- package/dist/jsonforms/esm/MantineInputs/MantineOneOfEnumInput.mjs +2 -2
- package/dist/jsonforms/esm/hooks/useMultiSelectProps.mjs +2 -2
- package/dist/jsonforms/esm/hooks/useSelectProps.mjs +1 -6
- package/dist/jsonforms/lib/JsonFormsWithCustomizer/JsonFormsWithCustomizer.d.ts +1 -0
- package/dist/jsonforms/lib/hooks/useMultiSelectProps.d.ts +11 -8
- package/dist/jsonforms/lib/hooks/useSelectProps.d.ts +7 -12
- package/package.json +1 -1
|
@@ -8,6 +8,12 @@ const React = require("react");
|
|
|
8
8
|
const useThemeCustomizer = require("../hooks/useThemeCustomizer.cjs");
|
|
9
9
|
const mantineCells = require("../renderers/mantineCells.cjs");
|
|
10
10
|
const mantineRenderers = require("../renderers/mantineRenderers.cjs");
|
|
11
|
+
const defaultCreateTranslator = (locale, translations = {}, hideWarning = false) => (key, defaultMessage) => {
|
|
12
|
+
if (!(key in translations) && !hideWarning) {
|
|
13
|
+
core.FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
14
|
+
}
|
|
15
|
+
return (translations == null ? void 0 : translations[key]) ?? defaultMessage;
|
|
16
|
+
};
|
|
11
17
|
const JsonFormsWithCustomizer = React.memo(function JsonFormsWithCustomizer2({
|
|
12
18
|
schema,
|
|
13
19
|
uischema,
|
|
@@ -16,19 +22,22 @@ const JsonFormsWithCustomizer = React.memo(function JsonFormsWithCustomizer2({
|
|
|
16
22
|
customizer,
|
|
17
23
|
debounce = false,
|
|
18
24
|
translations,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
core.FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
22
|
-
}
|
|
23
|
-
return (translations2 == null ? void 0 : translations2[key]) ?? defaultMessage;
|
|
24
|
-
},
|
|
25
|
+
hideWarnings,
|
|
26
|
+
createTranslator = defaultCreateTranslator,
|
|
25
27
|
...props
|
|
26
28
|
}) {
|
|
27
29
|
const theme = useThemeCustomizer.useThemeCustomizer({ ...customizer, __: { debounce } });
|
|
28
30
|
const { currentLanguage } = core.useLang({ throwOnError: false });
|
|
29
31
|
const i18n = React.useMemo(
|
|
30
|
-
() => currentLanguage && translations ? {
|
|
31
|
-
|
|
32
|
+
() => currentLanguage && translations ? {
|
|
33
|
+
locale: currentLanguage,
|
|
34
|
+
translate: createTranslator(
|
|
35
|
+
currentLanguage,
|
|
36
|
+
translations == null ? void 0 : translations[currentLanguage],
|
|
37
|
+
hideWarnings === true || hideWarnings === currentLanguage
|
|
38
|
+
) || typeof hideWarnings === "object" && !Array.isArray(hideWarnings) && (hideWarnings == null ? void 0 : hideWarnings[currentLanguage]) || Array.isArray(hideWarnings) && hideWarnings.includes(currentLanguage)
|
|
39
|
+
} : void 0,
|
|
40
|
+
[createTranslator, currentLanguage, hideWarnings, translations]
|
|
32
41
|
);
|
|
33
42
|
return /* @__PURE__ */ jsxRuntime.jsx(core$1.MantineThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
43
|
jsonformsReact_esm.JsonForms,
|
package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineEnumArrayInput.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const useMultiSelectProps = require("../hooks/useMultiSelectProps.cjs");
|
|
|
9
9
|
function MantineEnumArrayInput({ margin, ...props }) {
|
|
10
10
|
const { value, ...commonProps } = useCommonProps.useCommonProps(props);
|
|
11
11
|
const { path } = props;
|
|
12
|
-
const multiSelectProps = useMultiSelectProps.useMultiSelectProps(value, props.
|
|
12
|
+
const multiSelectProps = useMultiSelectProps.useMultiSelectProps(value, props.options, { onChange: commonProps.onChange });
|
|
13
13
|
const componentProps = React.useMemo(() => ({ ...commonProps, ...multiSelectProps }), [commonProps, multiSelectProps]);
|
|
14
14
|
const [Component, _props] = useContextProps.useContextProps("EnumArray", path, componentProps, props);
|
|
15
15
|
if (!props.visible) {
|
package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineEnumInput.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const useSelectProps = require("../hooks/useSelectProps.cjs");
|
|
|
9
9
|
function MantineEnumInput({ margin, ...props }) {
|
|
10
10
|
const { value, ...commonProps } = useCommonProps.useCommonProps(props);
|
|
11
11
|
const { path } = props;
|
|
12
|
-
const selectProps = useSelectProps.useSelectProps(value, props.
|
|
12
|
+
const selectProps = useSelectProps.useSelectProps(value, props.options);
|
|
13
13
|
const componentProps = React.useMemo(() => ({ ...commonProps, ...selectProps }), [commonProps, selectProps]);
|
|
14
14
|
const [Component, _props] = useContextProps.useContextProps("Enum", path, componentProps, props);
|
|
15
15
|
if (!props.visible) {
|
package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineOneOfEnumInput.cjs
CHANGED
|
@@ -8,8 +8,8 @@ const useContextProps = require("../hooks/useContextProps.cjs");
|
|
|
8
8
|
const useSelectProps = require("../hooks/useSelectProps.cjs");
|
|
9
9
|
function MantineOneOfEnumInput({ margin, ...props }) {
|
|
10
10
|
const { value, ...commonProps } = useCommonProps.useCommonProps(props);
|
|
11
|
-
const { path
|
|
12
|
-
const selectProps = useSelectProps.useSelectProps(value,
|
|
11
|
+
const { path } = props;
|
|
12
|
+
const selectProps = useSelectProps.useSelectProps(value, props.options);
|
|
13
13
|
const errorProps = React.useMemo(() => {
|
|
14
14
|
var _a;
|
|
15
15
|
const isNull = value === null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const useSelectProps = require("./useSelectProps.cjs");
|
|
4
|
-
function useMultiSelectProps(value,
|
|
5
|
-
const props = useSelectProps.useSelectProps(value,
|
|
4
|
+
function useMultiSelectProps(value, options, { onChange }) {
|
|
5
|
+
const props = useSelectProps.useSelectProps(value, options);
|
|
6
6
|
return {
|
|
7
7
|
...props,
|
|
8
8
|
value: props.value || [],
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
function useSelectProps(value, schema) {
|
|
5
|
-
const options = React.useMemo(
|
|
6
|
-
() => schema.oneOf ? schema.oneOf.map((option) => ({ value: option.const, label: option.title })) : schema.enum,
|
|
7
|
-
[schema.enum, schema.oneOf]
|
|
8
|
-
);
|
|
3
|
+
function useSelectProps(value, options) {
|
|
9
4
|
return { data: options, value: value || null, searchable: true };
|
|
10
5
|
}
|
|
11
6
|
exports.useSelectProps = useSelectProps;
|
|
@@ -6,6 +6,12 @@ import { memo, useMemo } from "react";
|
|
|
6
6
|
import { useThemeCustomizer } from "../hooks/useThemeCustomizer.mjs";
|
|
7
7
|
import { mantineCells } from "../renderers/mantineCells.mjs";
|
|
8
8
|
import { mantineRenderers } from "../renderers/mantineRenderers.mjs";
|
|
9
|
+
const defaultCreateTranslator = (locale, translations = {}, hideWarning = false) => (key, defaultMessage) => {
|
|
10
|
+
if (!(key in translations) && !hideWarning) {
|
|
11
|
+
FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
12
|
+
}
|
|
13
|
+
return (translations == null ? void 0 : translations[key]) ?? defaultMessage;
|
|
14
|
+
};
|
|
9
15
|
const JsonFormsWithCustomizer = memo(function JsonFormsWithCustomizer2({
|
|
10
16
|
schema,
|
|
11
17
|
uischema,
|
|
@@ -14,19 +20,22 @@ const JsonFormsWithCustomizer = memo(function JsonFormsWithCustomizer2({
|
|
|
14
20
|
customizer,
|
|
15
21
|
debounce = false,
|
|
16
22
|
translations,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
20
|
-
}
|
|
21
|
-
return (translations2 == null ? void 0 : translations2[key]) ?? defaultMessage;
|
|
22
|
-
},
|
|
23
|
+
hideWarnings,
|
|
24
|
+
createTranslator = defaultCreateTranslator,
|
|
23
25
|
...props
|
|
24
26
|
}) {
|
|
25
27
|
const theme = useThemeCustomizer({ ...customizer, __: { debounce } });
|
|
26
28
|
const { currentLanguage } = useLang({ throwOnError: false });
|
|
27
29
|
const i18n = useMemo(
|
|
28
|
-
() => currentLanguage && translations ? {
|
|
29
|
-
|
|
30
|
+
() => currentLanguage && translations ? {
|
|
31
|
+
locale: currentLanguage,
|
|
32
|
+
translate: createTranslator(
|
|
33
|
+
currentLanguage,
|
|
34
|
+
translations == null ? void 0 : translations[currentLanguage],
|
|
35
|
+
hideWarnings === true || hideWarnings === currentLanguage
|
|
36
|
+
) || typeof hideWarnings === "object" && !Array.isArray(hideWarnings) && (hideWarnings == null ? void 0 : hideWarnings[currentLanguage]) || Array.isArray(hideWarnings) && hideWarnings.includes(currentLanguage)
|
|
37
|
+
} : void 0,
|
|
38
|
+
[createTranslator, currentLanguage, hideWarnings, translations]
|
|
30
39
|
);
|
|
31
40
|
return /* @__PURE__ */ jsx(MantineThemeProvider, { theme, children: /* @__PURE__ */ jsx(
|
|
32
41
|
JsonForms,
|
package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineEnumArrayInput.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { useMultiSelectProps } from "../hooks/useMultiSelectProps.mjs";
|
|
|
7
7
|
function MantineEnumArrayInput({ margin, ...props }) {
|
|
8
8
|
const { value, ...commonProps } = useCommonProps(props);
|
|
9
9
|
const { path } = props;
|
|
10
|
-
const multiSelectProps = useMultiSelectProps(value, props.
|
|
10
|
+
const multiSelectProps = useMultiSelectProps(value, props.options, { onChange: commonProps.onChange });
|
|
11
11
|
const componentProps = useMemo(() => ({ ...commonProps, ...multiSelectProps }), [commonProps, multiSelectProps]);
|
|
12
12
|
const [Component, _props] = useContextProps("EnumArray", path, componentProps, props);
|
|
13
13
|
if (!props.visible) {
|
package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineEnumInput.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { useSelectProps } from "../hooks/useSelectProps.mjs";
|
|
|
7
7
|
function MantineEnumInput({ margin, ...props }) {
|
|
8
8
|
const { value, ...commonProps } = useCommonProps(props);
|
|
9
9
|
const { path } = props;
|
|
10
|
-
const selectProps = useSelectProps(value, props.
|
|
10
|
+
const selectProps = useSelectProps(value, props.options);
|
|
11
11
|
const componentProps = useMemo(() => ({ ...commonProps, ...selectProps }), [commonProps, selectProps]);
|
|
12
12
|
const [Component, _props] = useContextProps("Enum", path, componentProps, props);
|
|
13
13
|
if (!props.visible) {
|
package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineOneOfEnumInput.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import { useContextProps } from "../hooks/useContextProps.mjs";
|
|
|
6
6
|
import { useSelectProps } from "../hooks/useSelectProps.mjs";
|
|
7
7
|
function MantineOneOfEnumInput({ margin, ...props }) {
|
|
8
8
|
const { value, ...commonProps } = useCommonProps(props);
|
|
9
|
-
const { path
|
|
10
|
-
const selectProps = useSelectProps(value,
|
|
9
|
+
const { path } = props;
|
|
10
|
+
const selectProps = useSelectProps(value, props.options);
|
|
11
11
|
const errorProps = useMemo(() => {
|
|
12
12
|
var _a;
|
|
13
13
|
const isNull = value === null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSelectProps } from "./useSelectProps.mjs";
|
|
2
|
-
function useMultiSelectProps(value,
|
|
3
|
-
const props = useSelectProps(value,
|
|
2
|
+
function useMultiSelectProps(value, options, { onChange }) {
|
|
3
|
+
const props = useSelectProps(value, options);
|
|
4
4
|
return {
|
|
5
5
|
...props,
|
|
6
6
|
value: props.value || [],
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function useSelectProps(value, schema) {
|
|
3
|
-
const options = useMemo(
|
|
4
|
-
() => schema.oneOf ? schema.oneOf.map((option) => ({ value: option.const, label: option.title })) : schema.enum,
|
|
5
|
-
[schema.enum, schema.oneOf]
|
|
6
|
-
);
|
|
1
|
+
function useSelectProps(value, options) {
|
|
7
2
|
return { data: options, value: value || null, searchable: true };
|
|
8
3
|
}
|
|
9
4
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*! @license DOMPurify 3.2.
|
|
2
|
+
/*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
|
|
3
3
|
const {
|
|
4
4
|
entries,
|
|
5
5
|
setPrototypeOf,
|
|
@@ -27,12 +27,18 @@ if (!seal) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
if (!apply) {
|
|
30
|
-
apply = function apply2(
|
|
31
|
-
|
|
30
|
+
apply = function apply2(func, thisArg) {
|
|
31
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
32
|
+
args[_key - 2] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
return func.apply(thisArg, args);
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
if (!construct) {
|
|
35
|
-
construct = function construct2(Func
|
|
38
|
+
construct = function construct2(Func) {
|
|
39
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
40
|
+
args[_key2 - 1] = arguments[_key2];
|
|
41
|
+
}
|
|
36
42
|
return new Func(...args);
|
|
37
43
|
};
|
|
38
44
|
}
|
|
@@ -55,18 +61,18 @@ function unapply(func) {
|
|
|
55
61
|
if (thisArg instanceof RegExp) {
|
|
56
62
|
thisArg.lastIndex = 0;
|
|
57
63
|
}
|
|
58
|
-
for (var
|
|
59
|
-
args[
|
|
64
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
65
|
+
args[_key3 - 1] = arguments[_key3];
|
|
60
66
|
}
|
|
61
67
|
return apply(func, thisArg, args);
|
|
62
68
|
};
|
|
63
69
|
}
|
|
64
|
-
function unconstruct(
|
|
70
|
+
function unconstruct(Func) {
|
|
65
71
|
return function() {
|
|
66
|
-
for (var
|
|
67
|
-
args[
|
|
72
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
73
|
+
args[_key4] = arguments[_key4];
|
|
68
74
|
}
|
|
69
|
-
return construct(
|
|
75
|
+
return construct(Func, args);
|
|
70
76
|
};
|
|
71
77
|
}
|
|
72
78
|
function addToSet(set, array) {
|
|
@@ -133,14 +139,14 @@ function lookupGetter(object, prop) {
|
|
|
133
139
|
}
|
|
134
140
|
return fallbackValue;
|
|
135
141
|
}
|
|
136
|
-
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
|
137
|
-
const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
|
142
|
+
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
|
143
|
+
const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "slot", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
|
138
144
|
const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
|
|
139
145
|
const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
|
|
140
146
|
const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
|
|
141
147
|
const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
|
|
142
148
|
const text = freeze(["#text"]);
|
|
143
|
-
const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
|
|
149
|
+
const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
|
|
144
150
|
const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
|
|
145
151
|
const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
|
|
146
152
|
const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
|
|
@@ -224,7 +230,7 @@ const _createHooksMap = function _createHooksMap2() {
|
|
|
224
230
|
function createDOMPurify() {
|
|
225
231
|
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
226
232
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
227
|
-
DOMPurify.version = "3.2.
|
|
233
|
+
DOMPurify.version = "3.2.7";
|
|
228
234
|
DOMPurify.removed = [];
|
|
229
235
|
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
|
|
230
236
|
DOMPurify.isSupported = false;
|
|
@@ -706,7 +712,7 @@ function createDOMPurify() {
|
|
|
706
712
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
707
713
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
708
714
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
709
|
-
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
715
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
710
716
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
711
717
|
lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
|
|
712
718
|
) ;
|
|
@@ -761,7 +767,11 @@ function createDOMPurify() {
|
|
|
761
767
|
_removeAttribute(name, currentNode);
|
|
762
768
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
763
769
|
}
|
|
764
|
-
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
770
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
|
|
771
|
+
_removeAttribute(name, currentNode);
|
|
772
|
+
continue;
|
|
773
|
+
}
|
|
774
|
+
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
765
775
|
_removeAttribute(name, currentNode);
|
|
766
776
|
continue;
|
|
767
777
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @license DOMPurify 3.2.
|
|
1
|
+
/*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
|
|
2
2
|
const {
|
|
3
3
|
entries,
|
|
4
4
|
setPrototypeOf,
|
|
@@ -26,12 +26,18 @@ if (!seal) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
if (!apply) {
|
|
29
|
-
apply = function apply2(
|
|
30
|
-
|
|
29
|
+
apply = function apply2(func, thisArg) {
|
|
30
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
31
|
+
args[_key - 2] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
return func.apply(thisArg, args);
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
if (!construct) {
|
|
34
|
-
construct = function construct2(Func
|
|
37
|
+
construct = function construct2(Func) {
|
|
38
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
39
|
+
args[_key2 - 1] = arguments[_key2];
|
|
40
|
+
}
|
|
35
41
|
return new Func(...args);
|
|
36
42
|
};
|
|
37
43
|
}
|
|
@@ -54,18 +60,18 @@ function unapply(func) {
|
|
|
54
60
|
if (thisArg instanceof RegExp) {
|
|
55
61
|
thisArg.lastIndex = 0;
|
|
56
62
|
}
|
|
57
|
-
for (var
|
|
58
|
-
args[
|
|
63
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
64
|
+
args[_key3 - 1] = arguments[_key3];
|
|
59
65
|
}
|
|
60
66
|
return apply(func, thisArg, args);
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
|
-
function unconstruct(
|
|
69
|
+
function unconstruct(Func) {
|
|
64
70
|
return function() {
|
|
65
|
-
for (var
|
|
66
|
-
args[
|
|
71
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
72
|
+
args[_key4] = arguments[_key4];
|
|
67
73
|
}
|
|
68
|
-
return construct(
|
|
74
|
+
return construct(Func, args);
|
|
69
75
|
};
|
|
70
76
|
}
|
|
71
77
|
function addToSet(set, array) {
|
|
@@ -132,14 +138,14 @@ function lookupGetter(object, prop) {
|
|
|
132
138
|
}
|
|
133
139
|
return fallbackValue;
|
|
134
140
|
}
|
|
135
|
-
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
|
136
|
-
const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
|
141
|
+
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
|
142
|
+
const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "slot", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
|
137
143
|
const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
|
|
138
144
|
const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
|
|
139
145
|
const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
|
|
140
146
|
const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
|
|
141
147
|
const text = freeze(["#text"]);
|
|
142
|
-
const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
|
|
148
|
+
const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
|
|
143
149
|
const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
|
|
144
150
|
const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
|
|
145
151
|
const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
|
|
@@ -223,7 +229,7 @@ const _createHooksMap = function _createHooksMap2() {
|
|
|
223
229
|
function createDOMPurify() {
|
|
224
230
|
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
225
231
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
226
|
-
DOMPurify.version = "3.2.
|
|
232
|
+
DOMPurify.version = "3.2.7";
|
|
227
233
|
DOMPurify.removed = [];
|
|
228
234
|
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
|
|
229
235
|
DOMPurify.isSupported = false;
|
|
@@ -705,7 +711,7 @@ function createDOMPurify() {
|
|
|
705
711
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
706
712
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
707
713
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
708
|
-
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
714
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
709
715
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
710
716
|
lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
|
|
711
717
|
) ;
|
|
@@ -760,7 +766,11 @@ function createDOMPurify() {
|
|
|
760
766
|
_removeAttribute(name, currentNode);
|
|
761
767
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
762
768
|
}
|
|
763
|
-
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
769
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
|
|
770
|
+
_removeAttribute(name, currentNode);
|
|
771
|
+
continue;
|
|
772
|
+
}
|
|
773
|
+
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
764
774
|
_removeAttribute(name, currentNode);
|
|
765
775
|
continue;
|
|
766
776
|
}
|
|
@@ -7,14 +7,13 @@ function convertToFormInputs(item, schema) {
|
|
|
7
7
|
Object.entries(schema.properties || {}).forEach(([key, value]) => {
|
|
8
8
|
var _a;
|
|
9
9
|
const schemaOptions = value.items ? value.items : value;
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const values = items.map((item2) => item2.value ?? item2);
|
|
10
|
+
const options = schemaOptions.oneOf ? schemaOptions.oneOf.map((option) => option.const) : schemaOptions.enum;
|
|
11
|
+
if (options) {
|
|
13
12
|
if (_bundledJsonforms.isSchemaTypeInclude(value.type, "array") && Array.isArray(item[key])) {
|
|
14
13
|
const existingValues = ((_a = item[key]) == null ? void 0 : _a.map((item2) => String(utils.getItemId(item2) ?? item2))) || [];
|
|
15
|
-
result[key] =
|
|
14
|
+
result[key] = options.filter((val) => existingValues.includes(val));
|
|
16
15
|
} else {
|
|
17
|
-
result[key] =
|
|
16
|
+
result[key] = options.find((val) => val === String(utils.getItemId(item[key]) ?? item[key]));
|
|
18
17
|
}
|
|
19
18
|
} else {
|
|
20
19
|
result[key] = utils.getItemId(item[key]) ?? item[key] ?? void 0;
|
|
@@ -18,7 +18,15 @@ const normalProps = require("../Modals/normalProps.cjs");
|
|
|
18
18
|
const overlayProps = require("../Modals/overlayProps.cjs");
|
|
19
19
|
const FormField = require("../Tables/DataGrid/FormField/FormField.cjs");
|
|
20
20
|
const useTranslation = require("../../../.external/cjs/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.cjs");
|
|
21
|
-
function AddDialog({
|
|
21
|
+
function AddDialog({
|
|
22
|
+
jsonForms: __jsonForms,
|
|
23
|
+
onSuccess,
|
|
24
|
+
onError,
|
|
25
|
+
translations,
|
|
26
|
+
hideWarnings,
|
|
27
|
+
jsonFormsProps,
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
22
30
|
var _a;
|
|
23
31
|
const { info, refetch, refetchInfo, addEntry } = useApi.useApi();
|
|
24
32
|
const { t } = useTranslation.useTranslation();
|
|
@@ -26,6 +34,10 @@ function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
26
34
|
const [loading, setLoading] = hooks.useDebouncedState(false, constants.DEBOUNCE_LOADING_DELAY);
|
|
27
35
|
const { jsonForms: _jsonForms } = core.useProps("AddDialog", {}, {});
|
|
28
36
|
const jsonForms = React.useMemo(() => utils.deepMerge(_jsonForms, __jsonForms), [_jsonForms, __jsonForms]);
|
|
37
|
+
const mergedTranslations = React.useMemo(
|
|
38
|
+
() => (info == null ? void 0 : info.add_translations) ?? translations ? utils.deepMerge(info.add_translations, translations) : void 0,
|
|
39
|
+
[info == null ? void 0 : info.add_translations, translations]
|
|
40
|
+
);
|
|
29
41
|
const onSubmit = React.useCallback(
|
|
30
42
|
(e) => {
|
|
31
43
|
e == null ? void 0 : e.preventDefault();
|
|
@@ -91,7 +103,10 @@ function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
91
103
|
uischema: info.add_uischema,
|
|
92
104
|
data: state.data,
|
|
93
105
|
onChange: setState,
|
|
94
|
-
customizer: jsonForms
|
|
106
|
+
customizer: jsonForms,
|
|
107
|
+
translations: mergedTranslations,
|
|
108
|
+
hideWarnings,
|
|
109
|
+
...jsonFormsProps
|
|
95
110
|
}
|
|
96
111
|
)
|
|
97
112
|
}
|
|
@@ -21,7 +21,15 @@ const normalProps = require("../Modals/normalProps.cjs");
|
|
|
21
21
|
const overlayProps = require("../Modals/overlayProps.cjs");
|
|
22
22
|
const FormField = require("../Tables/DataGrid/FormField/FormField.cjs");
|
|
23
23
|
const useTranslation = require("../../../.external/cjs/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.cjs");
|
|
24
|
-
function EditDialog({
|
|
24
|
+
function EditDialog({
|
|
25
|
+
jsonForms: __jsonForms,
|
|
26
|
+
onSuccess,
|
|
27
|
+
onError,
|
|
28
|
+
translations,
|
|
29
|
+
hideWarnings,
|
|
30
|
+
jsonFormsProps,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
25
33
|
var _a;
|
|
26
34
|
const { info, refetch, refetchInfo, updateEntry } = useApi.useApi();
|
|
27
35
|
const { t } = useTranslation.useTranslation();
|
|
@@ -32,6 +40,10 @@ function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
32
40
|
() => utils.deepMerge({ __: { setNull: true } }, _jsonForms, __jsonForms),
|
|
33
41
|
[_jsonForms, __jsonForms]
|
|
34
42
|
);
|
|
43
|
+
const mergedTranslations = React.useMemo(
|
|
44
|
+
() => (info == null ? void 0 : info.edit_translations) ?? translations ? utils.deepMerge(info.edit_translations, translations) : void 0,
|
|
45
|
+
[info == null ? void 0 : info.edit_translations, translations]
|
|
46
|
+
);
|
|
35
47
|
const { fab } = useInfo.useInfo();
|
|
36
48
|
const initialState = React.useMemo(
|
|
37
49
|
() => ({
|
|
@@ -116,7 +128,10 @@ function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
116
128
|
uischema: info.edit_uischema,
|
|
117
129
|
data: state.data,
|
|
118
130
|
onChange: setState,
|
|
119
|
-
customizer: jsonForms
|
|
131
|
+
customizer: jsonForms,
|
|
132
|
+
translations: mergedTranslations,
|
|
133
|
+
hideWarnings,
|
|
134
|
+
...jsonFormsProps
|
|
120
135
|
}
|
|
121
136
|
)
|
|
122
137
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const core = require("@mantine/core");
|
|
5
|
-
const purify_es = require("../../../../../../../.external/cjs/dompurify@3.2.
|
|
5
|
+
const purify_es = require("../../../../../../../.external/cjs/dompurify@3.2.7/dompurify/dist/purify.es.cjs");
|
|
6
6
|
const React = require("react");
|
|
7
7
|
const FallbackWrapper = require("../../../../NextGenDataGrid/FallbackWrapper.cjs");
|
|
8
8
|
const Field_module = require("./Field.module.css.cjs");
|
|
@@ -5,14 +5,13 @@ function convertToFormInputs(item, schema) {
|
|
|
5
5
|
Object.entries(schema.properties || {}).forEach(([key, value]) => {
|
|
6
6
|
var _a;
|
|
7
7
|
const schemaOptions = value.items ? value.items : value;
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const values = items.map((item2) => item2.value ?? item2);
|
|
8
|
+
const options = schemaOptions.oneOf ? schemaOptions.oneOf.map((option) => option.const) : schemaOptions.enum;
|
|
9
|
+
if (options) {
|
|
11
10
|
if (isSchemaTypeInclude(value.type, "array") && Array.isArray(item[key])) {
|
|
12
11
|
const existingValues = ((_a = item[key]) == null ? void 0 : _a.map((item2) => String(getItemId(item2) ?? item2))) || [];
|
|
13
|
-
result[key] =
|
|
12
|
+
result[key] = options.filter((val) => existingValues.includes(val));
|
|
14
13
|
} else {
|
|
15
|
-
result[key] =
|
|
14
|
+
result[key] = options.find((val) => val === String(getItemId(item[key]) ?? item[key]));
|
|
16
15
|
}
|
|
17
16
|
} else {
|
|
18
17
|
result[key] = getItemId(item[key]) ?? item[key] ?? void 0;
|
|
@@ -16,7 +16,15 @@ import { normalProps } from "../Modals/normalProps.mjs";
|
|
|
16
16
|
import { overlayProps } from "../Modals/overlayProps.mjs";
|
|
17
17
|
import { FormField } from "../Tables/DataGrid/FormField/FormField.mjs";
|
|
18
18
|
import { useTranslation } from "../../../.external/esm/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.mjs";
|
|
19
|
-
function AddDialog({
|
|
19
|
+
function AddDialog({
|
|
20
|
+
jsonForms: __jsonForms,
|
|
21
|
+
onSuccess,
|
|
22
|
+
onError,
|
|
23
|
+
translations,
|
|
24
|
+
hideWarnings,
|
|
25
|
+
jsonFormsProps,
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
20
28
|
var _a;
|
|
21
29
|
const { info, refetch, refetchInfo, addEntry } = useApi();
|
|
22
30
|
const { t } = useTranslation();
|
|
@@ -24,6 +32,10 @@ function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
24
32
|
const [loading, setLoading] = useDebouncedState(false, DEBOUNCE_LOADING_DELAY);
|
|
25
33
|
const { jsonForms: _jsonForms } = useProps("AddDialog", {}, {});
|
|
26
34
|
const jsonForms = useMemo(() => deepMerge(_jsonForms, __jsonForms), [_jsonForms, __jsonForms]);
|
|
35
|
+
const mergedTranslations = useMemo(
|
|
36
|
+
() => (info == null ? void 0 : info.add_translations) ?? translations ? deepMerge(info.add_translations, translations) : void 0,
|
|
37
|
+
[info == null ? void 0 : info.add_translations, translations]
|
|
38
|
+
);
|
|
27
39
|
const onSubmit = useCallback(
|
|
28
40
|
(e) => {
|
|
29
41
|
e == null ? void 0 : e.preventDefault();
|
|
@@ -89,7 +101,10 @@ function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
89
101
|
uischema: info.add_uischema,
|
|
90
102
|
data: state.data,
|
|
91
103
|
onChange: setState,
|
|
92
|
-
customizer: jsonForms
|
|
104
|
+
customizer: jsonForms,
|
|
105
|
+
translations: mergedTranslations,
|
|
106
|
+
hideWarnings,
|
|
107
|
+
...jsonFormsProps
|
|
93
108
|
}
|
|
94
109
|
)
|
|
95
110
|
}
|
|
@@ -19,7 +19,15 @@ import { normalProps } from "../Modals/normalProps.mjs";
|
|
|
19
19
|
import { overlayProps } from "../Modals/overlayProps.mjs";
|
|
20
20
|
import { FormField } from "../Tables/DataGrid/FormField/FormField.mjs";
|
|
21
21
|
import { useTranslation } from "../../../.external/esm/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.mjs";
|
|
22
|
-
function EditDialog({
|
|
22
|
+
function EditDialog({
|
|
23
|
+
jsonForms: __jsonForms,
|
|
24
|
+
onSuccess,
|
|
25
|
+
onError,
|
|
26
|
+
translations,
|
|
27
|
+
hideWarnings,
|
|
28
|
+
jsonFormsProps,
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
23
31
|
var _a;
|
|
24
32
|
const { info, refetch, refetchInfo, updateEntry } = useApi();
|
|
25
33
|
const { t } = useTranslation();
|
|
@@ -30,6 +38,10 @@ function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
30
38
|
() => deepMerge({ __: { setNull: true } }, _jsonForms, __jsonForms),
|
|
31
39
|
[_jsonForms, __jsonForms]
|
|
32
40
|
);
|
|
41
|
+
const mergedTranslations = useMemo(
|
|
42
|
+
() => (info == null ? void 0 : info.edit_translations) ?? translations ? deepMerge(info.edit_translations, translations) : void 0,
|
|
43
|
+
[info == null ? void 0 : info.edit_translations, translations]
|
|
44
|
+
);
|
|
33
45
|
const { fab } = useInfo();
|
|
34
46
|
const initialState$1 = useMemo(
|
|
35
47
|
() => ({
|
|
@@ -114,7 +126,10 @@ function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }) {
|
|
|
114
126
|
uischema: info.edit_uischema,
|
|
115
127
|
data: state.data,
|
|
116
128
|
onChange: setState,
|
|
117
|
-
customizer: jsonForms
|
|
129
|
+
customizer: jsonForms,
|
|
130
|
+
translations: mergedTranslations,
|
|
131
|
+
hideWarnings,
|
|
132
|
+
...jsonFormsProps
|
|
118
133
|
}
|
|
119
134
|
)
|
|
120
135
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useProps, useStyles, Table, Box, Skeleton, Text } from "@mantine/core";
|
|
3
|
-
import purify from "../../../../../../../.external/esm/dompurify@3.2.
|
|
3
|
+
import purify from "../../../../../../../.external/esm/dompurify@3.2.7/dompurify/dist/purify.es.mjs";
|
|
4
4
|
import React__default, { isValidElement } from "react";
|
|
5
5
|
import { FallbackWrapper } from "../../../../NextGenDataGrid/FallbackWrapper.mjs";
|
|
6
6
|
import classes from "./Field.module.css.mjs";
|
|
@@ -37,6 +37,9 @@
|
|
|
37
37
|
* @property {Record<string, any>} [jsonForms] - Additional JSON Forms customization options.
|
|
38
38
|
* @property {(result: Record<string, any> | null) => void} [onSuccess] - Callback function triggered on successful form submission.
|
|
39
39
|
* @property {(error: any) => void} [onError] - Callback function triggered on form submission error.
|
|
40
|
+
* @property {Record<string, Record<string, string>>} [translations] - Optional translations for internationalization.
|
|
41
|
+
* @property {boolean | string | Record<string, boolean> | string[]} [hideWarnings] - Whether to hide missing translation warnings. Can be a boolean, a specific language code, an object mapping languages to booleans, or an array of language codes.
|
|
42
|
+
* @property {Record<string, any>} [jsonFormsProps] - Additional props to be passed to the JsonFormsWithCustomizer component.
|
|
40
43
|
*/
|
|
41
44
|
/**
|
|
42
45
|
* AddDialog is a component that renders a modal dialog for adding a new entry.
|
|
@@ -48,7 +51,7 @@
|
|
|
48
51
|
* @param {AddDialogProps & CommonModalProps} props - The properties for the AddDialog component.
|
|
49
52
|
* @returns {JSX.Element} The rendered modal dialog component for adding an entry.
|
|
50
53
|
*/
|
|
51
|
-
export function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }: AddDialogProps & CommonModalProps): JSX.Element;
|
|
54
|
+
export function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, translations, hideWarnings, jsonFormsProps, ...props }: AddDialogProps & CommonModalProps): JSX.Element;
|
|
52
55
|
export type CommonModalTitleOptionsProps = {
|
|
53
56
|
/**
|
|
54
57
|
* - Content or function to render on the left side of the title.
|
|
@@ -180,4 +183,16 @@ export type AddDialogProps = {
|
|
|
180
183
|
* - Callback function triggered on form submission error.
|
|
181
184
|
*/
|
|
182
185
|
onError?: (error: any) => void;
|
|
186
|
+
/**
|
|
187
|
+
* - Optional translations for internationalization.
|
|
188
|
+
*/
|
|
189
|
+
translations?: Record<string, Record<string, string>>;
|
|
190
|
+
/**
|
|
191
|
+
* - Whether to hide missing translation warnings. Can be a boolean, a specific language code, an object mapping languages to booleans, or an array of language codes.
|
|
192
|
+
*/
|
|
193
|
+
hideWarnings?: boolean | string | Record<string, boolean> | string[];
|
|
194
|
+
/**
|
|
195
|
+
* - Additional props to be passed to the JsonFormsWithCustomizer component.
|
|
196
|
+
*/
|
|
197
|
+
jsonFormsProps?: Record<string, any>;
|
|
183
198
|
};
|
|
@@ -37,6 +37,9 @@
|
|
|
37
37
|
* @property {Record<string, any>} [jsonForms] - Additional JSON Forms customization options.
|
|
38
38
|
* @property {(result: Record<string, any> | null) => void} [onSuccess] - Callback function triggered on successful form submission.
|
|
39
39
|
* @property {(error: any) => void} [onError] - Callback function triggered on form submission error.
|
|
40
|
+
* @property {Record<string, Record<string, string>>} [translations] - Optional translations for internationalization.
|
|
41
|
+
* @property {boolean | string | Record<string, boolean> | string[]} [hideWarnings] - Whether to hide missing translation warnings. Can be a boolean, a specific language code, an object mapping languages to booleans, or an array of language codes.
|
|
42
|
+
* @property {Record<string, any>} [jsonFormsProps] - Additional props to be passed to the JsonFormsWithCustomizer component.
|
|
40
43
|
*/
|
|
41
44
|
/**
|
|
42
45
|
* EditDialog is a component that renders a modal dialog for editing an existing entry.
|
|
@@ -48,7 +51,7 @@
|
|
|
48
51
|
* @param {EditDialogProps & CommonModalProps} props - The properties for the EditDialog component.
|
|
49
52
|
* @returns {JSX.Element} The rendered modal dialog component for editing an entry.
|
|
50
53
|
*/
|
|
51
|
-
export function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }: EditDialogProps & CommonModalProps): JSX.Element;
|
|
54
|
+
export function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, translations, hideWarnings, jsonFormsProps, ...props }: EditDialogProps & CommonModalProps): JSX.Element;
|
|
52
55
|
export type CommonModalTitleOptionsProps = {
|
|
53
56
|
/**
|
|
54
57
|
* - Content or function to render on the left side of the title.
|
|
@@ -180,4 +183,16 @@ export type EditDialogProps = {
|
|
|
180
183
|
* - Callback function triggered on form submission error.
|
|
181
184
|
*/
|
|
182
185
|
onError?: (error: any) => void;
|
|
186
|
+
/**
|
|
187
|
+
* - Optional translations for internationalization.
|
|
188
|
+
*/
|
|
189
|
+
translations?: Record<string, Record<string, string>>;
|
|
190
|
+
/**
|
|
191
|
+
* - Whether to hide missing translation warnings. Can be a boolean, a specific language code, an object mapping languages to booleans, or an array of language codes.
|
|
192
|
+
*/
|
|
193
|
+
hideWarnings?: boolean | string | Record<string, boolean> | string[];
|
|
194
|
+
/**
|
|
195
|
+
* - Additional props to be passed to the JsonFormsWithCustomizer component.
|
|
196
|
+
*/
|
|
197
|
+
jsonFormsProps?: Record<string, any>;
|
|
183
198
|
};
|
|
@@ -169,6 +169,10 @@ export type APIInfo = {
|
|
|
169
169
|
* - JSONForms UI schema for adding items.
|
|
170
170
|
*/
|
|
171
171
|
add_uischema?: APIJSONFormsUISchema;
|
|
172
|
+
/**
|
|
173
|
+
* - Translations for the add form.
|
|
174
|
+
*/
|
|
175
|
+
add_translations?: Record<string, Record<string, string>>;
|
|
172
176
|
/**
|
|
173
177
|
* - The title for the edit modal or section.
|
|
174
178
|
*/
|
|
@@ -185,6 +189,10 @@ export type APIInfo = {
|
|
|
185
189
|
* - JSONForms UI schema for editing items.
|
|
186
190
|
*/
|
|
187
191
|
edit_uischema?: APIJSONFormsUISchema;
|
|
192
|
+
/**
|
|
193
|
+
* - Translations for the edit form.
|
|
194
|
+
*/
|
|
195
|
+
edit_translations?: Record<string, Record<string, string>>;
|
|
188
196
|
/**
|
|
189
197
|
* - A mapping of filter names to filter definitions.
|
|
190
198
|
*/
|
|
@@ -8,6 +8,12 @@ const React = require("react");
|
|
|
8
8
|
const useThemeCustomizer = require("../hooks/useThemeCustomizer.cjs");
|
|
9
9
|
const mantineCells = require("../renderers/mantineCells.cjs");
|
|
10
10
|
const mantineRenderers = require("../renderers/mantineRenderers.cjs");
|
|
11
|
+
const defaultCreateTranslator = (locale, translations = {}, hideWarning = false) => (key, defaultMessage) => {
|
|
12
|
+
if (!(key in translations) && !hideWarning) {
|
|
13
|
+
core.FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
14
|
+
}
|
|
15
|
+
return (translations == null ? void 0 : translations[key]) ?? defaultMessage;
|
|
16
|
+
};
|
|
11
17
|
const JsonFormsWithCustomizer = React.memo(function JsonFormsWithCustomizer2({
|
|
12
18
|
schema,
|
|
13
19
|
uischema,
|
|
@@ -16,19 +22,22 @@ const JsonFormsWithCustomizer = React.memo(function JsonFormsWithCustomizer2({
|
|
|
16
22
|
customizer,
|
|
17
23
|
debounce = false,
|
|
18
24
|
translations,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
core.FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
22
|
-
}
|
|
23
|
-
return (translations2 == null ? void 0 : translations2[key]) ?? defaultMessage;
|
|
24
|
-
},
|
|
25
|
+
hideWarnings,
|
|
26
|
+
createTranslator = defaultCreateTranslator,
|
|
25
27
|
...props
|
|
26
28
|
}) {
|
|
27
29
|
const theme = useThemeCustomizer.useThemeCustomizer({ ...customizer, __: { debounce } });
|
|
28
30
|
const { currentLanguage } = core.useLang({ throwOnError: false });
|
|
29
31
|
const i18n = React.useMemo(
|
|
30
|
-
() => currentLanguage && translations ? {
|
|
31
|
-
|
|
32
|
+
() => currentLanguage && translations ? {
|
|
33
|
+
locale: currentLanguage,
|
|
34
|
+
translate: createTranslator(
|
|
35
|
+
currentLanguage,
|
|
36
|
+
translations == null ? void 0 : translations[currentLanguage],
|
|
37
|
+
hideWarnings === true || hideWarnings === currentLanguage
|
|
38
|
+
) || typeof hideWarnings === "object" && !Array.isArray(hideWarnings) && (hideWarnings == null ? void 0 : hideWarnings[currentLanguage]) || Array.isArray(hideWarnings) && hideWarnings.includes(currentLanguage)
|
|
39
|
+
} : void 0,
|
|
40
|
+
[createTranslator, currentLanguage, hideWarnings, translations]
|
|
32
41
|
);
|
|
33
42
|
return /* @__PURE__ */ jsxRuntime.jsx(core$1.MantineThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
34
43
|
react.JsonForms,
|
|
@@ -9,7 +9,7 @@ const useMultiSelectProps = require("../hooks/useMultiSelectProps.cjs");
|
|
|
9
9
|
function MantineEnumArrayInput({ margin, ...props }) {
|
|
10
10
|
const { value, ...commonProps } = useCommonProps.useCommonProps(props);
|
|
11
11
|
const { path } = props;
|
|
12
|
-
const multiSelectProps = useMultiSelectProps.useMultiSelectProps(value, props.
|
|
12
|
+
const multiSelectProps = useMultiSelectProps.useMultiSelectProps(value, props.options, { onChange: commonProps.onChange });
|
|
13
13
|
const componentProps = React.useMemo(() => ({ ...commonProps, ...multiSelectProps }), [commonProps, multiSelectProps]);
|
|
14
14
|
const [Component, _props] = useContextProps.useContextProps("EnumArray", path, componentProps, props);
|
|
15
15
|
if (!props.visible) {
|
|
@@ -9,7 +9,7 @@ const useSelectProps = require("../hooks/useSelectProps.cjs");
|
|
|
9
9
|
function MantineEnumInput({ margin, ...props }) {
|
|
10
10
|
const { value, ...commonProps } = useCommonProps.useCommonProps(props);
|
|
11
11
|
const { path } = props;
|
|
12
|
-
const selectProps = useSelectProps.useSelectProps(value, props.
|
|
12
|
+
const selectProps = useSelectProps.useSelectProps(value, props.options);
|
|
13
13
|
const componentProps = React.useMemo(() => ({ ...commonProps, ...selectProps }), [commonProps, selectProps]);
|
|
14
14
|
const [Component, _props] = useContextProps.useContextProps("Enum", path, componentProps, props);
|
|
15
15
|
if (!props.visible) {
|
|
@@ -8,8 +8,8 @@ const useContextProps = require("../hooks/useContextProps.cjs");
|
|
|
8
8
|
const useSelectProps = require("../hooks/useSelectProps.cjs");
|
|
9
9
|
function MantineOneOfEnumInput({ margin, ...props }) {
|
|
10
10
|
const { value, ...commonProps } = useCommonProps.useCommonProps(props);
|
|
11
|
-
const { path
|
|
12
|
-
const selectProps = useSelectProps.useSelectProps(value,
|
|
11
|
+
const { path } = props;
|
|
12
|
+
const selectProps = useSelectProps.useSelectProps(value, props.options);
|
|
13
13
|
const errorProps = React.useMemo(() => {
|
|
14
14
|
var _a;
|
|
15
15
|
const isNull = value === null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const useSelectProps = require("./useSelectProps.cjs");
|
|
4
|
-
function useMultiSelectProps(value,
|
|
5
|
-
const props = useSelectProps.useSelectProps(value,
|
|
4
|
+
function useMultiSelectProps(value, options, { onChange }) {
|
|
5
|
+
const props = useSelectProps.useSelectProps(value, options);
|
|
6
6
|
return {
|
|
7
7
|
...props,
|
|
8
8
|
value: props.value || [],
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
function useSelectProps(value, schema) {
|
|
5
|
-
const options = React.useMemo(
|
|
6
|
-
() => schema.oneOf ? schema.oneOf.map((option) => ({ value: option.const, label: option.title })) : schema.enum,
|
|
7
|
-
[schema.enum, schema.oneOf]
|
|
8
|
-
);
|
|
3
|
+
function useSelectProps(value, options) {
|
|
9
4
|
return { data: options, value: value || null, searchable: true };
|
|
10
5
|
}
|
|
11
6
|
exports.useSelectProps = useSelectProps;
|
|
@@ -6,6 +6,12 @@ import { memo, useMemo } from "react";
|
|
|
6
6
|
import { useThemeCustomizer } from "../hooks/useThemeCustomizer.mjs";
|
|
7
7
|
import { mantineCells } from "../renderers/mantineCells.mjs";
|
|
8
8
|
import { mantineRenderers } from "../renderers/mantineRenderers.mjs";
|
|
9
|
+
const defaultCreateTranslator = (locale, translations = {}, hideWarning = false) => (key, defaultMessage) => {
|
|
10
|
+
if (!(key in translations) && !hideWarning) {
|
|
11
|
+
FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
12
|
+
}
|
|
13
|
+
return (translations == null ? void 0 : translations[key]) ?? defaultMessage;
|
|
14
|
+
};
|
|
9
15
|
const JsonFormsWithCustomizer = memo(function JsonFormsWithCustomizer2({
|
|
10
16
|
schema,
|
|
11
17
|
uischema,
|
|
@@ -14,19 +20,22 @@ const JsonFormsWithCustomizer = memo(function JsonFormsWithCustomizer2({
|
|
|
14
20
|
customizer,
|
|
15
21
|
debounce = false,
|
|
16
22
|
translations,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
FastAPIRTKLogger.warn(`${locale}: Missing translation for key: ${key}`);
|
|
20
|
-
}
|
|
21
|
-
return (translations2 == null ? void 0 : translations2[key]) ?? defaultMessage;
|
|
22
|
-
},
|
|
23
|
+
hideWarnings,
|
|
24
|
+
createTranslator = defaultCreateTranslator,
|
|
23
25
|
...props
|
|
24
26
|
}) {
|
|
25
27
|
const theme = useThemeCustomizer({ ...customizer, __: { debounce } });
|
|
26
28
|
const { currentLanguage } = useLang({ throwOnError: false });
|
|
27
29
|
const i18n = useMemo(
|
|
28
|
-
() => currentLanguage && translations ? {
|
|
29
|
-
|
|
30
|
+
() => currentLanguage && translations ? {
|
|
31
|
+
locale: currentLanguage,
|
|
32
|
+
translate: createTranslator(
|
|
33
|
+
currentLanguage,
|
|
34
|
+
translations == null ? void 0 : translations[currentLanguage],
|
|
35
|
+
hideWarnings === true || hideWarnings === currentLanguage
|
|
36
|
+
) || typeof hideWarnings === "object" && !Array.isArray(hideWarnings) && (hideWarnings == null ? void 0 : hideWarnings[currentLanguage]) || Array.isArray(hideWarnings) && hideWarnings.includes(currentLanguage)
|
|
37
|
+
} : void 0,
|
|
38
|
+
[createTranslator, currentLanguage, hideWarnings, translations]
|
|
30
39
|
);
|
|
31
40
|
return /* @__PURE__ */ jsx(MantineThemeProvider, { theme, children: /* @__PURE__ */ jsx(
|
|
32
41
|
JsonForms,
|
|
@@ -7,7 +7,7 @@ import { useMultiSelectProps } from "../hooks/useMultiSelectProps.mjs";
|
|
|
7
7
|
function MantineEnumArrayInput({ margin, ...props }) {
|
|
8
8
|
const { value, ...commonProps } = useCommonProps(props);
|
|
9
9
|
const { path } = props;
|
|
10
|
-
const multiSelectProps = useMultiSelectProps(value, props.
|
|
10
|
+
const multiSelectProps = useMultiSelectProps(value, props.options, { onChange: commonProps.onChange });
|
|
11
11
|
const componentProps = useMemo(() => ({ ...commonProps, ...multiSelectProps }), [commonProps, multiSelectProps]);
|
|
12
12
|
const [Component, _props] = useContextProps("EnumArray", path, componentProps, props);
|
|
13
13
|
if (!props.visible) {
|
|
@@ -7,7 +7,7 @@ import { useSelectProps } from "../hooks/useSelectProps.mjs";
|
|
|
7
7
|
function MantineEnumInput({ margin, ...props }) {
|
|
8
8
|
const { value, ...commonProps } = useCommonProps(props);
|
|
9
9
|
const { path } = props;
|
|
10
|
-
const selectProps = useSelectProps(value, props.
|
|
10
|
+
const selectProps = useSelectProps(value, props.options);
|
|
11
11
|
const componentProps = useMemo(() => ({ ...commonProps, ...selectProps }), [commonProps, selectProps]);
|
|
12
12
|
const [Component, _props] = useContextProps("Enum", path, componentProps, props);
|
|
13
13
|
if (!props.visible) {
|
|
@@ -6,8 +6,8 @@ import { useContextProps } from "../hooks/useContextProps.mjs";
|
|
|
6
6
|
import { useSelectProps } from "../hooks/useSelectProps.mjs";
|
|
7
7
|
function MantineOneOfEnumInput({ margin, ...props }) {
|
|
8
8
|
const { value, ...commonProps } = useCommonProps(props);
|
|
9
|
-
const { path
|
|
10
|
-
const selectProps = useSelectProps(value,
|
|
9
|
+
const { path } = props;
|
|
10
|
+
const selectProps = useSelectProps(value, props.options);
|
|
11
11
|
const errorProps = useMemo(() => {
|
|
12
12
|
var _a;
|
|
13
13
|
const isNull = value === null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSelectProps } from "./useSelectProps.mjs";
|
|
2
|
-
function useMultiSelectProps(value,
|
|
3
|
-
const props = useSelectProps(value,
|
|
2
|
+
function useMultiSelectProps(value, options, { onChange }) {
|
|
3
|
+
const props = useSelectProps(value, options);
|
|
4
4
|
return {
|
|
5
5
|
...props,
|
|
6
6
|
value: props.value || [],
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function useSelectProps(value, schema) {
|
|
3
|
-
const options = useMemo(
|
|
4
|
-
() => schema.oneOf ? schema.oneOf.map((option) => ({ value: option.const, label: option.title })) : schema.enum,
|
|
5
|
-
[schema.enum, schema.oneOf]
|
|
6
|
-
);
|
|
1
|
+
function useSelectProps(value, options) {
|
|
7
2
|
return { data: options, value: value || null, searchable: true };
|
|
8
3
|
}
|
|
9
4
|
export {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @param {Record<string, any>} props.customizer - Object to customize the form inputs.
|
|
10
10
|
* @param {boolean} [props.debounce=false] - Whether to debounce input changes. Defaults to false.
|
|
11
11
|
* @param {Record<string, Record<string, string>>} [props.translations] - Optional translations for internationalization.
|
|
12
|
+
* @param {boolean | string | Record<string, boolean> | string[]} [props.hideWarnings] - Whether to hide missing translation warnings. Can be a boolean, a specific language code, an object mapping languages to booleans, or an array of language codes.
|
|
12
13
|
* @param {(locale: string, translations?: Record<string, string>) => (key: string, defaultMessage: string) => string} [props.createTranslator] - Function to create a translator function from translations.
|
|
13
14
|
* @param {Record<string, any>} props.rest - Additional properties to be passed to the JsonForms component.
|
|
14
15
|
*
|
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
* Custom hook for handling multi-select functionality.
|
|
3
3
|
*
|
|
4
4
|
* @param {string[]} value - The value to be used in the multi-select component.
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {Object}
|
|
7
|
-
* @param {
|
|
5
|
+
* @param {{label: string, value: string}[]} options - List of options for the multi-select component.
|
|
6
|
+
* @param {Object} params - Additional params for the hook.
|
|
7
|
+
* @param {(value?: string[]) => void} params.onChange - Callback function to handle changes in the selected values.
|
|
8
8
|
* @returns The properties and methods for the multi-select component.
|
|
9
9
|
*/
|
|
10
|
-
export function useMultiSelectProps(value: string[],
|
|
11
|
-
|
|
10
|
+
export function useMultiSelectProps(value: string[], options: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[], { onChange }: {
|
|
14
|
+
onChange: (value?: string[]) => void;
|
|
12
15
|
}): {
|
|
13
16
|
value: string | any[];
|
|
14
|
-
onChange: (value: any) =>
|
|
15
|
-
data:
|
|
16
|
-
value: string;
|
|
17
|
+
onChange: (value: any) => void;
|
|
18
|
+
data: {
|
|
17
19
|
label: string;
|
|
20
|
+
value: string;
|
|
18
21
|
}[];
|
|
19
22
|
searchable: boolean;
|
|
20
23
|
};
|
|
@@ -2,21 +2,16 @@
|
|
|
2
2
|
* Custom hook to generate select options from a schema.
|
|
3
3
|
*
|
|
4
4
|
* @param {string | undefined | null} value - The value.
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {{const: string, title: string}[] | undefined} schema.oneOf - Array of option objects.
|
|
7
|
-
* @param {string[]} schema.enum - Array of option values.
|
|
5
|
+
* @param {{label: string, value: string}[]} options - List of options for the select component.
|
|
8
6
|
* @returns An object containing the value array with value and label for each option.
|
|
9
7
|
*/
|
|
10
|
-
export function useSelectProps(value: string | undefined | null,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enum: string[];
|
|
16
|
-
}): {
|
|
17
|
-
data: string[] | {
|
|
18
|
-
value: string;
|
|
8
|
+
export function useSelectProps(value: string | undefined | null, options: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[]): {
|
|
12
|
+
data: {
|
|
19
13
|
label: string;
|
|
14
|
+
value: string;
|
|
20
15
|
}[];
|
|
21
16
|
value: string;
|
|
22
17
|
searchable: boolean;
|
package/package.json
CHANGED