fastapi-rtk 1.0.41 → 1.0.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/_virtual/index10.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index11.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index12.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index6.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index7.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index8.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index9.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineBooleanInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineDateInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineEnumArrayInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineEnumInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineFileInput.cjs +4 -4
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineImageInput.cjs +1 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineIntegerInput.cjs +1 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineJsonInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineNumberInput.cjs +4 -3
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineOneOfEnumInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineTextInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineTimeInput.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/cells/MantineEnumArrayCell.cjs +5 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/cells/MantineEnumCell.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/cells/MantineOneOfEnumCell.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/complex/MantineEnumArrayControl.cjs +3 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/controls/MantineEnumControl.cjs +5 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/controls/MantineOneOfEnumControl.cjs +5 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useBooleanProps.cjs +7 -3
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useCommonProps.cjs +25 -16
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useDateProps.cjs +23 -16
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useFileProps.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useJsonProps.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useMultiSelectProps.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useNumberProps.cjs +5 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useSelectProps.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useTextProps.cjs +2 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useTimeProps.cjs +10 -6
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/utils/withLabelMappingProps.cjs +14 -0
- package/dist/.bundled/jsonforms/esm/_virtual/index10.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index11.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index12.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index6.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index7.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index8.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index9.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineBooleanInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineDateInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineEnumArrayInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineEnumInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineFileInput.mjs +5 -5
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineImageInput.mjs +1 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineIntegerInput.mjs +1 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineJsonInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineNumberInput.mjs +4 -3
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineOneOfEnumInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineTextInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineTimeInput.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/cells/MantineEnumArrayCell.mjs +5 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/cells/MantineEnumCell.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/cells/MantineOneOfEnumCell.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/complex/MantineEnumArrayControl.mjs +3 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/controls/MantineEnumControl.mjs +5 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/controls/MantineOneOfEnumControl.mjs +5 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useBooleanProps.mjs +7 -3
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useCommonProps.mjs +26 -17
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useDateProps.mjs +23 -16
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useFileProps.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useJsonProps.mjs +3 -3
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useMultiSelectProps.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useNumberProps.mjs +5 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useSelectProps.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useTextProps.mjs +2 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useTimeProps.mjs +10 -6
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/utils/withLabelMappingProps.mjs +14 -0
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/compile/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/vocabularies/applicator/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/vocabularies/core/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/vocabularies/format/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/vocabularies/validation/index.cjs +1 -1
- package/dist/.external/cjs/fast-uri@3.1.0/fast-uri/index.cjs +1 -1
- package/dist/.external/cjs/json-schema-traverse@1.0.0/json-schema-traverse/index.cjs +1 -1
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/compile/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/vocabularies/applicator/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/vocabularies/core/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/vocabularies/format/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/vocabularies/validation/index.mjs +1 -1
- package/dist/.external/esm/fast-uri@3.1.0/fast-uri/index.mjs +1 -1
- package/dist/.external/esm/json-schema-traverse@1.0.0/json-schema-traverse/index.mjs +1 -1
- package/dist/constants/cjs/index.cjs +6 -0
- package/dist/constants/esm/index.mjs +7 -1
- package/dist/constants/lib/index.d.ts +3 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +23 -24
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.cjs +15 -6
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +3 -3
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useEvent.cjs +10 -9
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/useToolbarAlertBanner.cjs +7 -3
- package/dist/core/cjs/Wrappers/Provider/Provider.cjs +4 -0
- package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +24 -25
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.mjs +16 -7
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +4 -4
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useEvent.mjs +10 -9
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/useToolbarAlertBanner.mjs +7 -3
- package/dist/core/esm/Wrappers/Provider/Provider.mjs +5 -1
- package/dist/core/lib/Tables/NextGenDataGrid/NextGenDataGrid.d.ts +4 -4
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useData.d.ts +1 -1
- package/dist/core/lib/Wrappers/Provider/Provider.d.ts +8 -4
- package/dist/core/lib/hooks/api/useApi.d.ts +4 -0
- package/dist/jsonforms/cjs/MantineInputs/MantineBooleanInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineDateInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineDateTimeInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineEnumArrayInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineEnumInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineFileInput.cjs +4 -4
- package/dist/jsonforms/cjs/MantineInputs/MantineImageInput.cjs +1 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineIntegerInput.cjs +1 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineJsonInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineNumberInput.cjs +4 -3
- package/dist/jsonforms/cjs/MantineInputs/MantineOneOfEnumInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineTextInput.cjs +2 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineTimeInput.cjs +2 -1
- package/dist/jsonforms/cjs/cells/MantineEnumArrayCell.cjs +5 -2
- package/dist/jsonforms/cjs/cells/MantineEnumCell.cjs +2 -1
- package/dist/jsonforms/cjs/cells/MantineOneOfEnumCell.cjs +2 -1
- package/dist/jsonforms/cjs/complex/MantineEnumArrayControl.cjs +3 -2
- package/dist/jsonforms/cjs/controls/MantineEnumControl.cjs +5 -1
- package/dist/jsonforms/cjs/controls/MantineOneOfEnumControl.cjs +5 -1
- package/dist/jsonforms/cjs/hooks/useBooleanProps.cjs +7 -3
- package/dist/jsonforms/cjs/hooks/useCommonProps.cjs +25 -16
- package/dist/jsonforms/cjs/hooks/useDateProps.cjs +23 -16
- package/dist/jsonforms/cjs/hooks/useFileProps.cjs +2 -1
- package/dist/jsonforms/cjs/hooks/useJsonProps.cjs +2 -2
- package/dist/jsonforms/cjs/hooks/useMultiSelectProps.cjs +2 -1
- package/dist/jsonforms/cjs/hooks/useNumberProps.cjs +5 -1
- package/dist/jsonforms/cjs/hooks/useSelectProps.cjs +2 -1
- package/dist/jsonforms/cjs/hooks/useTextProps.cjs +2 -1
- package/dist/jsonforms/cjs/hooks/useTimeProps.cjs +10 -6
- package/dist/jsonforms/cjs/utils/withLabelMappingProps.cjs +14 -0
- package/dist/jsonforms/esm/MantineInputs/MantineBooleanInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineDateInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineDateTimeInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineEnumArrayInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineEnumInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineFileInput.mjs +5 -5
- package/dist/jsonforms/esm/MantineInputs/MantineImageInput.mjs +1 -1
- package/dist/jsonforms/esm/MantineInputs/MantineIntegerInput.mjs +1 -1
- package/dist/jsonforms/esm/MantineInputs/MantineJsonInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineNumberInput.mjs +4 -3
- package/dist/jsonforms/esm/MantineInputs/MantineOneOfEnumInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineTextInput.mjs +2 -1
- package/dist/jsonforms/esm/MantineInputs/MantineTimeInput.mjs +2 -1
- package/dist/jsonforms/esm/cells/MantineEnumArrayCell.mjs +5 -2
- package/dist/jsonforms/esm/cells/MantineEnumCell.mjs +2 -1
- package/dist/jsonforms/esm/cells/MantineOneOfEnumCell.mjs +2 -1
- package/dist/jsonforms/esm/complex/MantineEnumArrayControl.mjs +3 -2
- package/dist/jsonforms/esm/controls/MantineEnumControl.mjs +5 -1
- package/dist/jsonforms/esm/controls/MantineOneOfEnumControl.mjs +5 -1
- package/dist/jsonforms/esm/hooks/useBooleanProps.mjs +7 -3
- package/dist/jsonforms/esm/hooks/useCommonProps.mjs +26 -17
- package/dist/jsonforms/esm/hooks/useDateProps.mjs +23 -16
- package/dist/jsonforms/esm/hooks/useFileProps.mjs +2 -1
- package/dist/jsonforms/esm/hooks/useJsonProps.mjs +3 -3
- package/dist/jsonforms/esm/hooks/useMultiSelectProps.mjs +2 -1
- package/dist/jsonforms/esm/hooks/useNumberProps.mjs +5 -1
- package/dist/jsonforms/esm/hooks/useSelectProps.mjs +2 -1
- package/dist/jsonforms/esm/hooks/useTextProps.mjs +2 -1
- package/dist/jsonforms/esm/hooks/useTimeProps.mjs +10 -6
- package/dist/jsonforms/esm/utils/withLabelMappingProps.mjs +14 -0
- package/dist/jsonforms/lib/MantineInputs/MantineFileInput.d.ts +2 -1
- package/dist/jsonforms/lib/MantineInputs/MantineNumberInput.d.ts +2 -1
- package/dist/jsonforms/lib/utils/withLabelMappingProps.d.ts +1 -0
- package/dist/utils/cjs/FastAPIRTKLogger/FastAPIRTKLogger.cjs +3 -1
- package/dist/utils/cjs/MemoWrapper/MemoWrapper.cjs +37 -0
- package/dist/utils/cjs/_virtual/_commonjsHelpers.cjs +4 -0
- package/dist/utils/cjs/_virtual/lodash.cjs +5 -0
- package/dist/utils/cjs/_virtual/lodash2.cjs +4 -0
- package/dist/utils/cjs/index.cjs +2 -0
- package/dist/utils/esm/FastAPIRTKLogger/FastAPIRTKLogger.mjs +3 -1
- package/dist/utils/esm/MemoWrapper/MemoWrapper.mjs +37 -0
- package/dist/utils/esm/_virtual/_commonjsHelpers.mjs +4 -0
- package/dist/utils/esm/_virtual/lodash.mjs +5 -0
- package/dist/utils/esm/_virtual/lodash2.mjs +4 -0
- package/dist/utils/esm/index.mjs +2 -0
- package/dist/utils/lib/FastAPIRTKLogger/FastAPIRTKLogger.d.ts +1 -0
- package/dist/utils/lib/MemoWrapper/MemoWrapper.d.ts +9 -0
- package/dist/utils/lib/MemoWrapper/index.d.ts +1 -0
- package/dist/utils/lib/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
3
4
|
const useSelectProps = require("./useSelectProps.cjs");
|
|
4
5
|
function useMultiSelectProps(value, options, { onChange }) {
|
|
5
6
|
const props = useSelectProps.useSelectProps(value, options);
|
|
6
7
|
return {
|
|
7
8
|
...props,
|
|
8
9
|
value: props.value || [],
|
|
9
|
-
onChange: (value2) => value2.length ? onChange(value2) : onChange(void 0)
|
|
10
|
+
onChange: React.useCallback((value2) => value2.length ? onChange(value2) : onChange(void 0), [onChange])
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
exports.useMultiSelectProps = useMultiSelectProps;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
3
4
|
function useNumberProps(type, { value, onChange }) {
|
|
4
5
|
return {
|
|
5
6
|
value: value ?? "",
|
|
6
7
|
allowDecimal: type === "number" ? true : false,
|
|
7
8
|
hideControls: true,
|
|
8
|
-
onChange: (
|
|
9
|
+
onChange: React.useCallback(
|
|
10
|
+
(value2) => onChange(typeof value2 === "string" ? value2 || void 0 : value2 ?? void 0),
|
|
11
|
+
[onChange]
|
|
12
|
+
)
|
|
9
13
|
};
|
|
10
14
|
}
|
|
11
15
|
exports.useNumberProps = useNumberProps;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
3
4
|
function useSelectProps(value, options, isNative = false, { onChange } = {}) {
|
|
4
5
|
if (isNative) {
|
|
5
6
|
return {
|
|
6
7
|
data: [{ value: "", label: "" }, ...options],
|
|
7
8
|
value: value || "",
|
|
8
|
-
onChange: (event) => onChange(event.currentTarget.value || void 0)
|
|
9
|
+
onChange: React.useCallback((event) => onChange(event.currentTarget.value || void 0), [onChange])
|
|
9
10
|
};
|
|
10
11
|
} else {
|
|
11
12
|
return { data: options, value: value || null, searchable: true };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
3
4
|
function useTextProps({ value, onChange }) {
|
|
4
5
|
return {
|
|
5
6
|
value: value || "",
|
|
6
|
-
onChange: (event) => onChange(event.target.value || void 0)
|
|
7
|
+
onChange: React.useCallback((event) => onChange(event.target.value || void 0), [onChange])
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
10
|
exports.useTextProps = useTextProps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
3
4
|
function useTimeProps({ value, onChange, withSeconds }) {
|
|
4
5
|
if (withSeconds) {
|
|
5
6
|
value = (value == null ? void 0 : value.length) === 5 ? `${value}:00` : value;
|
|
@@ -8,12 +9,15 @@ function useTimeProps({ value, onChange, withSeconds }) {
|
|
|
8
9
|
}
|
|
9
10
|
return {
|
|
10
11
|
value: value || "",
|
|
11
|
-
onChange: (
|
|
12
|
-
|
|
13
|
-
value2
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
onChange: React.useCallback(
|
|
13
|
+
(value2) => {
|
|
14
|
+
if (value2.length === 5) {
|
|
15
|
+
value2 = `${value2}:00`;
|
|
16
|
+
}
|
|
17
|
+
onChange == null ? void 0 : onChange(value2 || void 0);
|
|
18
|
+
},
|
|
19
|
+
[onChange]
|
|
20
|
+
)
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
23
|
exports.useTimeProps = useTimeProps;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const withLabelMappingProps = (Component) => function WithLabelMappingProps(props) {
|
|
5
|
+
var _a;
|
|
6
|
+
const options = props.options;
|
|
7
|
+
const labelMapping = props.schema["x-label-mapping"] ?? ((_a = props.schema.items) == null ? void 0 : _a["x-label-mapping"]) ?? {};
|
|
8
|
+
const newOptions = options.map((option) => ({
|
|
9
|
+
value: option.value,
|
|
10
|
+
label: labelMapping[option.value] ?? option.label
|
|
11
|
+
}));
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props, options: newOptions });
|
|
13
|
+
};
|
|
14
|
+
exports.withLabelMappingProps = withLabelMappingProps;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { Checkbox, NativeSelect, Select } from "@mantine/core";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useBooleanProps } from "../hooks/useBooleanProps.mjs";
|
|
@@ -18,7 +19,7 @@ function MantineBooleanInput(props) {
|
|
|
18
19
|
const { inputWrapperOrder, ...__props } = _props;
|
|
19
20
|
const InnerComponent = format === "checkbox" ? Checkbox : format === "native" ? NativeSelect : Select;
|
|
20
21
|
const innerProps = format === "checkbox" ? {} : { inputWrapperOrder };
|
|
21
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(InnerComponent, { ...innerProps, ...__props }) : Component;
|
|
22
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineBooleanInput-${path}`, ...innerProps, ...__props, children: /* @__PURE__ */ jsx(InnerComponent, { ...innerProps, ...__props }) }) : Component;
|
|
22
23
|
}
|
|
23
24
|
export {
|
|
24
25
|
MantineBooleanInput
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { DateInput } from "@mantine/dates";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
@@ -13,7 +14,7 @@ function MantineDateInput(props) {
|
|
|
13
14
|
if (!props.visible) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(DateInput, { ..._props }) : Component;
|
|
17
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineDateInput-${path}`, ..._props, children: /* @__PURE__ */ jsx(DateInput, { ..._props }) }) : Component;
|
|
17
18
|
}
|
|
18
19
|
export {
|
|
19
20
|
MantineDateInput
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { DateTimePicker } from "fastapi-rtk/core";
|
|
3
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
3
4
|
import { useDisclosure } from "@mantine/hooks";
|
|
4
5
|
import { useEffect, useMemo } from "react";
|
|
5
6
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
@@ -27,7 +28,7 @@ function MantineDateTimeInput(props) {
|
|
|
27
28
|
if (!props.visible) {
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(DateTimePicker, { ..._props }) : Component;
|
|
31
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineDateTimeInput-${path}`, ..._props, children: /* @__PURE__ */ jsx(DateTimePicker, { ..._props }) }) : Component;
|
|
31
32
|
}
|
|
32
33
|
export {
|
|
33
34
|
MantineDateTimeInput
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { MultiSelect } from "@mantine/core";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
@@ -13,7 +14,7 @@ function MantineEnumArrayInput(props) {
|
|
|
13
14
|
if (!props.visible) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(MultiSelect, { ..._props }) : Component;
|
|
17
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineEnumArrayInput-${path}`, ..._props, children: /* @__PURE__ */ jsx(MultiSelect, { ..._props }) }) : Component;
|
|
17
18
|
}
|
|
18
19
|
export {
|
|
19
20
|
MantineEnumArrayInput
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { NativeSelect, Select } from "@mantine/core";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
@@ -16,7 +17,7 @@ function MantineEnumInput(props) {
|
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
19
|
const InnerComponent = isNative ? NativeSelect : Select;
|
|
19
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(InnerComponent, { ..._props }) : Component;
|
|
20
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineEnumInput-${path}`, ..._props, children: /* @__PURE__ */ jsx(InnerComponent, { ..._props }) }) : Component;
|
|
20
21
|
}
|
|
21
22
|
export {
|
|
22
23
|
MantineEnumInput
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
2
|
+
import { MemoWrapper, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
3
3
|
import { Box, FileInput } from "@mantine/core";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
6
6
|
import { useContextProps } from "../hooks/useContextProps.mjs";
|
|
7
7
|
import { useFileProps } from "../hooks/useFileProps.mjs";
|
|
8
|
-
const InnerMantineFileInput = ({ contextName, children, ...props }) => {
|
|
8
|
+
const InnerMantineFileInput = ({ contextName, componentName, children, ...props }) => {
|
|
9
9
|
const { value, ...commonProps } = useCommonProps(props);
|
|
10
10
|
const { path, schema, errors } = props;
|
|
11
11
|
const accept = useMemo(
|
|
@@ -18,13 +18,13 @@ const InnerMantineFileInput = ({ contextName, children, ...props }) => {
|
|
|
18
18
|
if (!props.visible) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
return Component === void 0 ? /* @__PURE__ */ jsxs(Box, { children: [
|
|
21
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `${componentName}-${path}`, ..._props, children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
22
22
|
/* @__PURE__ */ jsx(FileInput, { ..._props }),
|
|
23
23
|
parseFromValuesOrFunc(children, { componentProps, jsonFormsProps: props })
|
|
24
|
-
] }) : Component;
|
|
24
|
+
] }) }) : Component;
|
|
25
25
|
};
|
|
26
26
|
function MantineFileInput(props) {
|
|
27
|
-
return /* @__PURE__ */ jsx(InnerMantineFileInput, { ...props, contextName: "File" });
|
|
27
|
+
return /* @__PURE__ */ jsx(InnerMantineFileInput, { ...props, contextName: "File", componentName: "MantineFileInput" });
|
|
28
28
|
}
|
|
29
29
|
export {
|
|
30
30
|
InnerMantineFileInput,
|
|
@@ -10,7 +10,7 @@ function MantineImageInput(props) {
|
|
|
10
10
|
getImageURL: (item) => typeof item === "string" ? item : URL.createObjectURL(item)
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
return /* @__PURE__ */ jsx(InnerMantineFileInput, { ...props, contextName: "Image", children: ({ jsonFormsProps }) => jsonFormsProps.data ? /* @__PURE__ */ jsx(
|
|
13
|
+
return /* @__PURE__ */ jsx(InnerMantineFileInput, { ...props, contextName: "Image", componentName: "MantineImageInput", children: ({ jsonFormsProps }) => jsonFormsProps.data ? /* @__PURE__ */ jsx(
|
|
14
14
|
Image,
|
|
15
15
|
{
|
|
16
16
|
src: getImageURL(jsonFormsProps.data),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { InnerMantineNumberInput } from "./MantineNumberInput.mjs";
|
|
3
3
|
function MantineIntegerInput(props) {
|
|
4
|
-
return /* @__PURE__ */ jsx(InnerMantineNumberInput, { ...props, contextName: "Integer" });
|
|
4
|
+
return /* @__PURE__ */ jsx(InnerMantineNumberInput, { ...props, contextName: "Integer", componentName: "MantineIntegerInput" });
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
7
|
MantineIntegerInput
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { JsonInput } from "@mantine/core";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
@@ -13,7 +14,7 @@ function MantineJsonInput(props) {
|
|
|
13
14
|
if (!props.visible) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(JsonInput, { ..._props }) : Component;
|
|
17
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineJsonInput-${path}`, ..._props, children: /* @__PURE__ */ jsx(JsonInput, { ..._props }) }) : Component;
|
|
17
18
|
}
|
|
18
19
|
export {
|
|
19
20
|
MantineJsonInput
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { NumberInput } from "@mantine/core";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
5
6
|
import { useContextProps } from "../hooks/useContextProps.mjs";
|
|
6
7
|
import { useNumberProps } from "../hooks/useNumberProps.mjs";
|
|
7
|
-
const InnerMantineNumberInput = ({ contextName, ...props }) => {
|
|
8
|
+
const InnerMantineNumberInput = ({ contextName, componentName, ...props }) => {
|
|
8
9
|
const { value, ...commonProps } = useCommonProps(props);
|
|
9
10
|
const { path } = props;
|
|
10
11
|
const numberProps = useNumberProps(contextName.toLowerCase(), { value, onChange: commonProps.onChange });
|
|
@@ -13,10 +14,10 @@ const InnerMantineNumberInput = ({ contextName, ...props }) => {
|
|
|
13
14
|
if (!props.visible) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(NumberInput, { ..._props }) : Component;
|
|
17
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `${componentName}-${path}`, ..._props, children: /* @__PURE__ */ jsx(NumberInput, { ..._props }) }) : Component;
|
|
17
18
|
};
|
|
18
19
|
function MantineNumberInput(props) {
|
|
19
|
-
return /* @__PURE__ */ jsx(InnerMantineNumberInput, { ...props, contextName: "Number" });
|
|
20
|
+
return /* @__PURE__ */ jsx(InnerMantineNumberInput, { ...props, contextName: "Number", componentName: "MantineNumberInput" });
|
|
20
21
|
}
|
|
21
22
|
export {
|
|
22
23
|
InnerMantineNumberInput,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { NativeSelect, Select } from "@mantine/core";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
@@ -27,7 +28,7 @@ function MantineOneOfEnumInput(props) {
|
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
29
30
|
const InnerComponent = isNative ? NativeSelect : Select;
|
|
30
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(InnerComponent, { ..._props }) : Component;
|
|
31
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineOneOfEnumInput-${path}`, ..._props, children: /* @__PURE__ */ jsx(InnerComponent, { ..._props }) }) : Component;
|
|
31
32
|
}
|
|
32
33
|
export {
|
|
33
34
|
MantineOneOfEnumInput
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
2
3
|
import { PasswordInput, TextInput } from "@mantine/core";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
@@ -13,7 +14,7 @@ function MantineTextInput(props) {
|
|
|
13
14
|
if (!props.visible) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
|
-
return Component === void 0 ? schema.format === "password" ? /* @__PURE__ */ jsx(PasswordInput, { ..._props }) : /* @__PURE__ */ jsx(TextInput, { ..._props }) : Component;
|
|
17
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineTextInput-${path}`, ..._props, children: schema.format === "password" ? /* @__PURE__ */ jsx(PasswordInput, { ..._props }) : /* @__PURE__ */ jsx(TextInput, { ..._props }) }) : Component;
|
|
17
18
|
}
|
|
18
19
|
export {
|
|
19
20
|
MantineTextInput
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { TimePicker } from "fastapi-rtk/core";
|
|
3
|
+
import { MemoWrapper } from "fastapi-rtk/utils";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useCommonProps } from "../hooks/useCommonProps.mjs";
|
|
5
6
|
import { useContextProps } from "../hooks/useContextProps.mjs";
|
|
@@ -20,7 +21,7 @@ function MantineTimeInput(props) {
|
|
|
20
21
|
if (!props.visible) {
|
|
21
22
|
return null;
|
|
22
23
|
}
|
|
23
|
-
return Component === void 0 ? /* @__PURE__ */ jsx(TimePicker, { ..._props }) : Component;
|
|
24
|
+
return Component === void 0 ? /* @__PURE__ */ jsx(MemoWrapper, { componentName: `MantineTimeInput-${path}`, ..._props, children: /* @__PURE__ */ jsx(TimePicker, { ..._props }) }) : Component;
|
|
24
25
|
}
|
|
25
26
|
export {
|
|
26
27
|
MantineTimeInput
|
|
@@ -3,8 +3,11 @@ import { rankWith } from "@jsonforms/core";
|
|
|
3
3
|
import { withJsonFormsMultiEnumProps } from "@jsonforms/react";
|
|
4
4
|
import { MantineEnumArrayInput } from "../MantineInputs/MantineEnumArrayInput.mjs";
|
|
5
5
|
import { isEnumArrayControl } from "../testers/isEnumArrayControl.mjs";
|
|
6
|
-
|
|
7
|
-
const
|
|
6
|
+
import { withLabelMappingProps } from "../utils/withLabelMappingProps.mjs";
|
|
7
|
+
const mantineEnumArrayCellTester = rankWith(2, isEnumArrayControl);
|
|
8
|
+
const MantineEnumArrayCell = withJsonFormsMultiEnumProps(
|
|
9
|
+
withLabelMappingProps((props) => /* @__PURE__ */ jsx(MantineEnumArrayInput, { ...props }))
|
|
10
|
+
);
|
|
8
11
|
export {
|
|
9
12
|
MantineEnumArrayCell,
|
|
10
13
|
mantineEnumArrayCellTester
|
|
@@ -2,9 +2,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { rankWith, isEnumControl } from "@jsonforms/core";
|
|
3
3
|
import { withJsonFormsEnumCellProps, withTranslateProps } from "@jsonforms/react";
|
|
4
4
|
import { MantineEnumInput } from "../MantineInputs/MantineEnumInput.mjs";
|
|
5
|
+
import { withLabelMappingProps } from "../utils/withLabelMappingProps.mjs";
|
|
5
6
|
const mantineEnumCellTester = rankWith(2, isEnumControl);
|
|
6
7
|
const MantineEnumCell = withJsonFormsEnumCellProps(
|
|
7
|
-
withTranslateProps((props) => /* @__PURE__ */ jsx(MantineEnumInput, { ...props })),
|
|
8
|
+
withTranslateProps(withLabelMappingProps((props) => /* @__PURE__ */ jsx(MantineEnumInput, { ...props }))),
|
|
8
9
|
false
|
|
9
10
|
);
|
|
10
11
|
export {
|
|
@@ -2,9 +2,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { rankWith, isOneOfControl } from "@jsonforms/core";
|
|
3
3
|
import { withJsonFormsOneOfEnumCellProps, withTranslateProps } from "@jsonforms/react";
|
|
4
4
|
import { MantineOneOfEnumInput } from "../MantineInputs/MantineOneOfEnumInput.mjs";
|
|
5
|
+
import { withLabelMappingProps } from "../utils/withLabelMappingProps.mjs";
|
|
5
6
|
const mantineOneOfEnumCellTester = rankWith(2, isOneOfControl);
|
|
6
7
|
const MantineOneOfEnumCell = withJsonFormsOneOfEnumCellProps(
|
|
7
|
-
withTranslateProps((props) => /* @__PURE__ */ jsx(MantineOneOfEnumInput, { ...props })),
|
|
8
|
+
withTranslateProps(withLabelMappingProps((props) => /* @__PURE__ */ jsx(MantineOneOfEnumInput, { ...props }))),
|
|
8
9
|
false
|
|
9
10
|
);
|
|
10
11
|
export {
|
|
@@ -2,8 +2,9 @@ import { rankWith } from "@jsonforms/core";
|
|
|
2
2
|
import { withJsonFormsMultiEnumProps } from "@jsonforms/react";
|
|
3
3
|
import { MantineEnumArrayInput } from "../MantineInputs/MantineEnumArrayInput.mjs";
|
|
4
4
|
import { isEnumArrayControl } from "../testers/isEnumArrayControl.mjs";
|
|
5
|
-
|
|
6
|
-
const
|
|
5
|
+
import { withLabelMappingProps } from "../utils/withLabelMappingProps.mjs";
|
|
6
|
+
const mantineEnumArrayRendererTester = rankWith(2, isEnumArrayControl);
|
|
7
|
+
const MantineEnumArrayRenderer = withJsonFormsMultiEnumProps(withLabelMappingProps(MantineEnumArrayInput));
|
|
7
8
|
export {
|
|
8
9
|
MantineEnumArrayRenderer,
|
|
9
10
|
mantineEnumArrayRendererTester
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { rankWith, isEnumControl } from "@jsonforms/core";
|
|
2
2
|
import { withJsonFormsEnumProps, withTranslateProps } from "@jsonforms/react";
|
|
3
3
|
import { MantineEnumInput } from "../MantineInputs/MantineEnumInput.mjs";
|
|
4
|
+
import { withLabelMappingProps } from "../utils/withLabelMappingProps.mjs";
|
|
4
5
|
const mantineEnumControlTester = rankWith(2, isEnumControl);
|
|
5
|
-
const MantineEnumControl = withJsonFormsEnumProps(
|
|
6
|
+
const MantineEnumControl = withJsonFormsEnumProps(
|
|
7
|
+
withTranslateProps(withLabelMappingProps(MantineEnumInput)),
|
|
8
|
+
false
|
|
9
|
+
);
|
|
6
10
|
export {
|
|
7
11
|
MantineEnumControl,
|
|
8
12
|
mantineEnumControlTester
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { rankWith, isOneOfControl } from "@jsonforms/core";
|
|
2
2
|
import { withJsonFormsOneOfEnumProps, withTranslateProps } from "@jsonforms/react";
|
|
3
3
|
import { MantineOneOfEnumInput } from "../MantineInputs/MantineOneOfEnumInput.mjs";
|
|
4
|
+
import { withLabelMappingProps } from "../utils/withLabelMappingProps.mjs";
|
|
4
5
|
const mantineOneOfEnumControlTester = rankWith(2, isOneOfControl);
|
|
5
|
-
const MantineOneOfEnumControl = withJsonFormsOneOfEnumProps(
|
|
6
|
+
const MantineOneOfEnumControl = withJsonFormsOneOfEnumProps(
|
|
7
|
+
withTranslateProps(withLabelMappingProps(MantineOneOfEnumInput)),
|
|
8
|
+
false
|
|
9
|
+
);
|
|
6
10
|
export {
|
|
7
11
|
MantineOneOfEnumControl,
|
|
8
12
|
mantineOneOfEnumControlTester
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { isTruthy } from "fastapi-rtk/utils";
|
|
2
|
+
import { useCallback } from "react";
|
|
2
3
|
function useBooleanProps(type, { value, onChange }) {
|
|
3
4
|
switch (type) {
|
|
4
5
|
case "checkbox":
|
|
5
6
|
return {
|
|
6
7
|
checked: value || false,
|
|
7
|
-
onChange: (event) => onChange(event.target.checked)
|
|
8
|
+
onChange: useCallback((event) => onChange(event.target.checked), [onChange])
|
|
8
9
|
};
|
|
9
10
|
case "native":
|
|
10
11
|
return {
|
|
@@ -19,7 +20,10 @@ function useBooleanProps(type, { value, onChange }) {
|
|
|
19
20
|
}
|
|
20
21
|
],
|
|
21
22
|
value: isTruthy(value) ? String(value) : "",
|
|
22
|
-
onChange: (
|
|
23
|
+
onChange: useCallback(
|
|
24
|
+
(event) => onChange(isTruthy(event.currentTarget.value) ? event.currentTarget.value === String(true) : void 0),
|
|
25
|
+
[onChange]
|
|
26
|
+
)
|
|
23
27
|
};
|
|
24
28
|
case "select":
|
|
25
29
|
return {
|
|
@@ -34,7 +38,7 @@ function useBooleanProps(type, { value, onChange }) {
|
|
|
34
38
|
}
|
|
35
39
|
],
|
|
36
40
|
value: isTruthy(value) ? String(value) : null,
|
|
37
|
-
onChange: (value2) => onChange(isTruthy(value2) ? value2 === String(true) : void 0)
|
|
41
|
+
onChange: useCallback((value2) => onChange(isTruthy(value2) ? value2 === String(true) : void 0), [onChange])
|
|
38
42
|
};
|
|
39
43
|
default:
|
|
40
44
|
throw new Error(`Unknown boolean type: ${type}`);
|
|
@@ -3,33 +3,39 @@ import { DEBOUNCE_JSONFORMS_DELAY } from "fastapi-rtk/core";
|
|
|
3
3
|
import { useJsonForms } from "@jsonforms/react";
|
|
4
4
|
import { useProps } from "@mantine/core";
|
|
5
5
|
import { useDebouncedCallback } from "@mantine/hooks";
|
|
6
|
-
import { useState, useEffect } from "react";
|
|
6
|
+
import { useState, useMemo, useCallback, useEffect } from "react";
|
|
7
7
|
import { isSchemaTypeInclude } from "../utils/isSchemaTypeInclude.mjs";
|
|
8
8
|
import { useIfProps } from "./useIfProps.mjs";
|
|
9
9
|
function useCommonProps(props = {}) {
|
|
10
10
|
var _a, _b, _c, _d;
|
|
11
11
|
const __ = useProps("__", {}, {});
|
|
12
12
|
const [value, setValue] = useState(props.data);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (isSchemaTypeInclude(props.schema.type, "
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const valueIfNull = useMemo(() => {
|
|
14
|
+
let valueIfNull2 = null;
|
|
15
|
+
if (!isSchemaTypeInclude(props.schema.type, "null")) {
|
|
16
|
+
if (isSchemaTypeInclude(props.schema.type, "array")) {
|
|
17
|
+
valueIfNull2 = [];
|
|
18
|
+
} else if (isSchemaTypeInclude(props.schema.type, "object")) {
|
|
19
|
+
valueIfNull2 = {};
|
|
20
|
+
} else if (isSchemaTypeInclude(props.schema.type, "string")) {
|
|
21
|
+
valueIfNull2 = "";
|
|
22
|
+
}
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
return valueIfNull2;
|
|
25
|
+
}, [props.schema.type]);
|
|
23
26
|
const debouncedCallback = useDebouncedCallback((value2) => props.handleChange(props.path, value2), {
|
|
24
27
|
delay: DEBOUNCE_JSONFORMS_DELAY,
|
|
25
28
|
flushOnUnmount: true,
|
|
26
29
|
...__.debounceOptions
|
|
27
30
|
});
|
|
28
|
-
const onChange = (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const onChange = useCallback(
|
|
32
|
+
(value2) => {
|
|
33
|
+
const newValue = value2 ?? (__.setNull ? valueIfNull : void 0);
|
|
34
|
+
setValue(newValue);
|
|
35
|
+
__.debounce ? debouncedCallback(newValue) : props.handleChange(props.path, newValue);
|
|
36
|
+
},
|
|
37
|
+
[props.handleChange, props.path, __.debounce, __.setNull, valueIfNull, debouncedCallback]
|
|
38
|
+
);
|
|
33
39
|
useEffect(() => {
|
|
34
40
|
setValue(props.data);
|
|
35
41
|
}, [props.data]);
|
|
@@ -48,8 +54,11 @@ function useCommonProps(props = {}) {
|
|
|
48
54
|
disabled: !props.enabled,
|
|
49
55
|
value,
|
|
50
56
|
onChange,
|
|
51
|
-
onBlur: () => debouncedCallback.flush(),
|
|
52
|
-
error:
|
|
57
|
+
onBlur: useCallback(() => debouncedCallback.flush(), [debouncedCallback]),
|
|
58
|
+
error: useMemo(
|
|
59
|
+
() => props.errors ? props.errors.split("\n").map((error) => /* @__PURE__ */ jsx("span", { style: { display: "block" }, children: error }, error)) : void 0,
|
|
60
|
+
[props.errors]
|
|
61
|
+
),
|
|
53
62
|
...(_d = (_c = props.uischema) == null ? void 0 : _c.options) == null ? void 0 : _d.props,
|
|
54
63
|
...ifProps
|
|
55
64
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Icon } from "../../../.external/esm/@iconify_react@6.0.2_react@19.2.4/@iconify/react/dist/iconify.mjs";
|
|
3
3
|
import { useMantineTheme, CloseButton } from "@mantine/core";
|
|
4
|
+
import { useCallback, useMemo } from "react";
|
|
4
5
|
import { convertUTCStringToLocalString, convertLocalStringToUTCString } from "../utils/utcConverter.mjs";
|
|
5
6
|
function useDateProps(type, isUTC, { value, toggle, onChange }) {
|
|
6
7
|
const theme = useMantineTheme();
|
|
@@ -8,26 +9,32 @@ function useDateProps(type, isUTC, { value, toggle, onChange }) {
|
|
|
8
9
|
if (type === "date") {
|
|
9
10
|
props.valueFormat = "DD.MM.YYYY";
|
|
10
11
|
props.value = value || null;
|
|
11
|
-
props.onChange = (value2) => onChange(value2 || void 0);
|
|
12
|
+
props.onChange = useCallback((value2) => onChange(value2 || void 0), [onChange]);
|
|
12
13
|
} else {
|
|
13
14
|
props.valueFormat = isUTC ? "DD.MM.YYYY HH:mm (UTC)" : "DD.MM.YYYY HH:mm";
|
|
14
15
|
props.value = value ? isUTC ? convertUTCStringToLocalString(value) : value : null;
|
|
15
|
-
props.onChange = (
|
|
16
|
+
props.onChange = useCallback(
|
|
17
|
+
(value2) => onChange(value2 ? isUTC ? convertLocalStringToUTCString(value2) : value2 : void 0),
|
|
18
|
+
[onChange]
|
|
19
|
+
);
|
|
16
20
|
props.placeholder = isUTC ? "DD.MM.YYYY HH:mm (UTC)" : "DD.MM.YYYY HH:mm";
|
|
17
|
-
props.rightSection =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
props.rightSection = useMemo(
|
|
22
|
+
() => /* @__PURE__ */ jsx(
|
|
23
|
+
CloseButton,
|
|
24
|
+
{
|
|
25
|
+
title: isUTC ? "UTC" : "Local",
|
|
26
|
+
variant: "transparent",
|
|
27
|
+
size: "sm",
|
|
28
|
+
onClick: () => {
|
|
29
|
+
toggle();
|
|
30
|
+
if (props.value) {
|
|
31
|
+
onChange(isUTC ? convertUTCStringToLocalString(props.value) : convertLocalStringToUTCString(props.value));
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: "tabler:timezone", color: isUTC ? theme.primaryColor : "gray" })
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
[isUTC, toggle, onChange, props.value, theme.primaryColor]
|
|
31
38
|
);
|
|
32
39
|
}
|
|
33
40
|
return props;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
2
3
|
function useFileProps({ value, onChange, accept, errors }) {
|
|
3
4
|
var _a;
|
|
4
5
|
const filteredErrors = (_a = errors == null ? void 0 : errors.split("\n").filter((error) => !error.startsWith("must be string"))) == null ? void 0 : _a.join("\n");
|
|
@@ -8,7 +9,7 @@ function useFileProps({ value, onChange, accept, errors }) {
|
|
|
8
9
|
}
|
|
9
10
|
return {
|
|
10
11
|
value,
|
|
11
|
-
onChange: (value2) => onChange(value2 || void 0),
|
|
12
|
+
onChange: useCallback((value2) => onChange(value2 || void 0), [onChange]),
|
|
12
13
|
accept: accept || void 0,
|
|
13
14
|
error: filteredErrors ? filteredErrors.split("\n").map((error) => /* @__PURE__ */ jsx("span", { style: { display: "block" }, children: error }, error)) : void 0,
|
|
14
15
|
clearable: true
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useMemo, useEffect } from "react";
|
|
1
|
+
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
2
2
|
function useJsonProps({ value, onChange }) {
|
|
3
3
|
const [inputValue, setInputValue] = useState("");
|
|
4
4
|
const stringifiedData = useMemo(
|
|
@@ -15,7 +15,7 @@ function useJsonProps({ value, onChange }) {
|
|
|
15
15
|
validationError: "Invalid JSON",
|
|
16
16
|
formatOnBlur: true,
|
|
17
17
|
value: inputValue,
|
|
18
|
-
onBlur: () => {
|
|
18
|
+
onBlur: useCallback(() => {
|
|
19
19
|
if (!inputValue) {
|
|
20
20
|
onChange(void 0);
|
|
21
21
|
return;
|
|
@@ -25,7 +25,7 @@ function useJsonProps({ value, onChange }) {
|
|
|
25
25
|
onChange(parsedValue);
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, [inputValue, onChange]),
|
|
29
29
|
onChange: setInputValue
|
|
30
30
|
};
|
|
31
31
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
1
2
|
import { useSelectProps } from "./useSelectProps.mjs";
|
|
2
3
|
function useMultiSelectProps(value, options, { onChange }) {
|
|
3
4
|
const props = useSelectProps(value, options);
|
|
4
5
|
return {
|
|
5
6
|
...props,
|
|
6
7
|
value: props.value || [],
|
|
7
|
-
onChange: (value2) => value2.length ? onChange(value2) : onChange(void 0)
|
|
8
|
+
onChange: useCallback((value2) => value2.length ? onChange(value2) : onChange(void 0), [onChange])
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
11
|
export {
|