@gravity-ui/dynamic-forms 5.30.0 → 5.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/lib/unstable/core/constants.d.ts +1 -0
- package/build/cjs/lib/unstable/core/constants.js +1 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/types/state.d.ts +1 -0
- package/build/cjs/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +17 -0
- package/build/cjs/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.d.ts +2 -0
- package/build/cjs/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +6 -7
- package/build/cjs/lib/unstable/kit/components/CopyButton/CopyButton.css +1 -0
- package/build/cjs/lib/unstable/kit/components/CopyButton/CopyButton.d.ts +3 -1
- package/build/cjs/lib/unstable/kit/components/CopyButton/CopyButton.js +6 -2
- package/build/cjs/lib/unstable/kit/components/DropButton/DropButton.css +3 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/DropButton.d.ts +10 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/DropButton.js +32 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/DropButton/index.js +5 -0
- package/build/cjs/lib/unstable/kit/components/EntityContainer/EntityContainer.css +1 -0
- package/build/cjs/lib/unstable/kit/components/EntityContainer/EntityContainer.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/EntityContainer/EntityContainer.js +2 -2
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/LayoutButtons.d.ts +10 -0
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/LayoutButtons.js +15 -0
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/components/LayoutButtons/index.js +5 -0
- package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +30 -1
- package/build/cjs/lib/unstable/kit/components/index.d.ts +2 -0
- package/build/cjs/lib/unstable/kit/components/index.js +5 -1
- package/build/cjs/lib/unstable/kit/constants/config.d.ts +4 -2
- package/build/cjs/lib/unstable/kit/constants/config.js +4 -4
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.css +1 -1
- package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +33 -4
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.css +13 -3
- package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +47 -15
- package/build/cjs/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.css +3 -0
- package/build/cjs/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.js +40 -5
- package/build/cjs/lib/unstable/kit/entities/ObjectInline/ObjectInline.js +1 -1
- package/build/cjs/lib/unstable/kit/entities/OneOfNested/OneOfNested.js +1 -1
- package/build/cjs/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +1 -1
- package/build/cjs/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.css +3 -5
- package/build/cjs/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +1 -1
- package/build/cjs/lib/unstable/kit/form-entities/RangeInput/RangeInput.js +2 -2
- package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +1 -0
- package/build/cjs/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +1 -1
- package/build/cjs/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +1 -1
- package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.css +3 -3
- package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +6 -5
- package/build/cjs/lib/unstable/kit/form-layouts/FormRow/FormRow.js +2 -2
- package/build/cjs/lib/unstable/kit/hooks/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/hooks/index.js +5 -0
- package/build/cjs/lib/unstable/kit/hooks/useExpanded.d.ts +11 -0
- package/build/cjs/lib/unstable/kit/hooks/useExpanded.js +25 -0
- package/build/cjs/lib/unstable/kit/index.d.ts +1 -0
- package/build/cjs/lib/unstable/kit/index.js +1 -0
- package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.css +2 -6
- package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.js +6 -17
- package/build/cjs/lib/unstable/kit/layouts/Card/Card.css +0 -6
- package/build/cjs/lib/unstable/kit/layouts/Card/Card.js +12 -11
- package/build/cjs/lib/unstable/kit/layouts/Section/Section.css +0 -6
- package/build/cjs/lib/unstable/kit/layouts/Section/Section.js +2 -3
- package/build/cjs/lib/unstable/kit/layouts/Transparent/Transparent.css +0 -6
- package/build/cjs/lib/unstable/kit/layouts/Transparent/Transparent.js +2 -3
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +3 -3
- package/build/cjs/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +3 -3
- package/build/cjs/lib/unstable/kit/utils/transformer.js +18 -3
- package/build/esm/lib/unstable/core/constants.d.ts +1 -0
- package/build/esm/lib/unstable/core/constants.js +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/types/state.d.ts +1 -0
- package/build/esm/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +17 -0
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.d.ts +2 -0
- package/build/esm/lib/unstable/kit/components/ArrayRemoveButton/ArrayRemoveButton.js +7 -8
- package/build/esm/lib/unstable/kit/components/CopyButton/CopyButton.css +1 -0
- package/build/esm/lib/unstable/kit/components/CopyButton/CopyButton.d.ts +3 -1
- package/build/esm/lib/unstable/kit/components/CopyButton/CopyButton.js +6 -2
- package/build/esm/lib/unstable/kit/components/DropButton/DropButton.css +3 -0
- package/build/esm/lib/unstable/kit/components/DropButton/DropButton.d.ts +11 -0
- package/build/esm/lib/unstable/kit/components/DropButton/DropButton.js +28 -0
- package/build/esm/lib/unstable/kit/components/DropButton/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/DropButton/index.js +1 -0
- package/build/esm/lib/unstable/kit/components/EntityContainer/EntityContainer.css +1 -0
- package/build/esm/lib/unstable/kit/components/EntityContainer/EntityContainer.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/EntityContainer/EntityContainer.js +2 -2
- package/build/esm/lib/unstable/kit/components/LayoutButtons/LayoutButtons.d.ts +10 -0
- package/build/esm/lib/unstable/kit/components/LayoutButtons/LayoutButtons.js +10 -0
- package/build/esm/lib/unstable/kit/components/LayoutButtons/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/components/LayoutButtons/index.js +1 -0
- package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +30 -1
- package/build/esm/lib/unstable/kit/components/index.d.ts +2 -0
- package/build/esm/lib/unstable/kit/components/index.js +2 -0
- package/build/esm/lib/unstable/kit/constants/config.d.ts +4 -2
- package/build/esm/lib/unstable/kit/constants/config.js +4 -4
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.css +1 -1
- package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +33 -4
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.css +13 -3
- package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +48 -16
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.css +3 -0
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +1 -0
- package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.js +42 -6
- package/build/esm/lib/unstable/kit/entities/ObjectInline/ObjectInline.js +1 -1
- package/build/esm/lib/unstable/kit/entities/OneOfNested/OneOfNested.js +1 -1
- package/build/esm/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +1 -1
- package/build/esm/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.css +3 -5
- package/build/esm/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +1 -1
- package/build/esm/lib/unstable/kit/form-entities/RangeInput/RangeInput.js +2 -2
- package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +1 -0
- package/build/esm/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +1 -1
- package/build/esm/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +1 -1
- package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.css +3 -3
- package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +7 -6
- package/build/esm/lib/unstable/kit/form-layouts/FormRow/FormRow.js +3 -3
- package/build/esm/lib/unstable/kit/hooks/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/hooks/index.js +1 -0
- package/build/esm/lib/unstable/kit/hooks/useExpanded.d.ts +11 -0
- package/build/esm/lib/unstable/kit/hooks/useExpanded.js +20 -0
- package/build/esm/lib/unstable/kit/index.d.ts +1 -0
- package/build/esm/lib/unstable/kit/index.js +1 -0
- package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.css +2 -6
- package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.js +7 -18
- package/build/esm/lib/unstable/kit/layouts/Card/Card.css +0 -6
- package/build/esm/lib/unstable/kit/layouts/Card/Card.js +13 -12
- package/build/esm/lib/unstable/kit/layouts/Section/Section.css +0 -6
- package/build/esm/lib/unstable/kit/layouts/Section/Section.js +3 -4
- package/build/esm/lib/unstable/kit/layouts/Transparent/Transparent.css +0 -6
- package/build/esm/lib/unstable/kit/layouts/Transparent/Transparent.js +3 -4
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +4 -4
- package/build/esm/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +4 -4
- package/build/esm/lib/unstable/kit/utils/transformer.js +18 -3
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ var SchemaRendererEventType;
|
|
|
16
16
|
SchemaRendererEventType["Patch"] = "patch";
|
|
17
17
|
SchemaRendererEventType["Settings"] = "settings";
|
|
18
18
|
SchemaRendererEventType["Schema"] = "schema";
|
|
19
|
+
SchemaRendererEventType["Submit"] = "submit";
|
|
19
20
|
SchemaRendererEventType["UserContext"] = "userContext";
|
|
20
21
|
})(SchemaRendererEventType || (exports.SchemaRendererEventType = SchemaRendererEventType = {}));
|
|
21
22
|
var JsonSchemaType;
|
|
@@ -21,6 +21,7 @@ export interface SchemaRendererState<UserContext extends Record<string, unknown>
|
|
|
21
21
|
coerceInitialValues: boolean;
|
|
22
22
|
jsonDefaultValues: boolean;
|
|
23
23
|
};
|
|
24
|
+
submitCount: number;
|
|
24
25
|
subscribe: (subscriber: SchemaRendererSubscriber) => string;
|
|
25
26
|
subscribers: {
|
|
26
27
|
byId: Record<string, SchemaRendererSubscriber>;
|
|
@@ -49,6 +49,7 @@ const useSchemaRenderer = ({ coerceInitialValues = true, config, connectValidate
|
|
|
49
49
|
runValidate,
|
|
50
50
|
settings: { coerceInitialValues, jsonDefaultValues },
|
|
51
51
|
schema: nameUpdated || schemaUpdated ? (0, cloneDeep_1.default)(originalSchema) : (prevState === null || prevState === void 0 ? void 0 : prevState.schema) || {},
|
|
52
|
+
submitCount: nameUpdated || schemaUpdated || !prevState ? 0 : prevState.submitCount,
|
|
52
53
|
subscribe,
|
|
53
54
|
subscribers: (prevState === null || prevState === void 0 ? void 0 : prevState.subscribers) || { byId: {}, byName: new Map(), byPath: new Map() },
|
|
54
55
|
unsubscribe,
|
|
@@ -118,6 +119,22 @@ const useSchemaRenderer = ({ coerceInitialValues = true, config, connectValidate
|
|
|
118
119
|
initialState.dispatchEvent(initialEvents);
|
|
119
120
|
}
|
|
120
121
|
}, [initialEvents, initialState]);
|
|
122
|
+
react_1.default.useEffect(() => {
|
|
123
|
+
const originalSubmit = form.submit;
|
|
124
|
+
form.submit = () => {
|
|
125
|
+
var _a;
|
|
126
|
+
const srField = form.getFieldState((0, utils_1.getServiceFieldName)(constants_2.SCHEMA_RENDERER_SERVICE_FIELD, headName));
|
|
127
|
+
const srState = (_a = srField === null || srField === void 0 ? void 0 : srField.data) === null || _a === void 0 ? void 0 : _a.state;
|
|
128
|
+
if (srState) {
|
|
129
|
+
srState.submitCount += 1;
|
|
130
|
+
srState.dispatchEvent([{ type: constants_1.SchemaRendererEventType.Submit, all: true }]);
|
|
131
|
+
}
|
|
132
|
+
return originalSubmit.call(form);
|
|
133
|
+
};
|
|
134
|
+
return () => {
|
|
135
|
+
form.submit = originalSubmit;
|
|
136
|
+
};
|
|
137
|
+
}, [form]);
|
|
121
138
|
react_1.default.useEffect(() => {
|
|
122
139
|
const strictChecker = strictCheckerRef.current;
|
|
123
140
|
return () => {
|
|
@@ -6,12 +6,14 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
8
|
const react_final_form_1 = require("react-final-form");
|
|
9
|
+
const core_1 = require("../../../core");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
|
-
const
|
|
11
|
+
const b = (0, utils_1.block)('array-remove-button');
|
|
12
|
+
const ArrayRemoveButton = ({ mode, name, headName, onClick, }) => {
|
|
11
13
|
const form = (0, react_final_form_1.useForm)();
|
|
12
|
-
const [ready, setReady] = react_1.default.useState(false);
|
|
13
14
|
const arrayItem = (0, utils_1.isArrayItem)(name);
|
|
14
15
|
const tupleItem = (0, utils_1.isTupleItem)(name, headName, form);
|
|
16
|
+
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
15
17
|
const removeItem = react_1.default.useCallback((event) => {
|
|
16
18
|
var _a;
|
|
17
19
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
@@ -24,11 +26,8 @@ const ArrayRemoveButton = ({ name, headName, onClick }) => {
|
|
|
24
26
|
form.blur(parentName);
|
|
25
27
|
}
|
|
26
28
|
}, [form, name, onClick]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, []);
|
|
30
|
-
if (ready && arrayItem && !tupleItem) {
|
|
31
|
-
return (react_1.default.createElement(uikit_1.Button, { view: "flat-secondary", onClick: removeItem, qa: `${name}-remove-button` },
|
|
29
|
+
if (arrayItem && !tupleItem && !overviewFlag) {
|
|
30
|
+
return (react_1.default.createElement(uikit_1.Button, { className: b(), view: "flat-secondary", onClick: removeItem, qa: `${name}-remove-button` },
|
|
32
31
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.TrashBin, size: 16 })));
|
|
33
32
|
}
|
|
34
33
|
return null;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type JsonSchema, SchemaRendererMode } from '../../../core';
|
|
2
3
|
export interface CopyButtonProps {
|
|
3
4
|
className?: string;
|
|
4
|
-
|
|
5
|
+
mode: SchemaRendererMode;
|
|
6
|
+
schema: JsonSchema;
|
|
5
7
|
value: unknown;
|
|
6
8
|
}
|
|
7
9
|
export declare const CopyButton: React.FC<CopyButtonProps>;
|
|
@@ -6,10 +6,14 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
7
|
const isNumber_1 = tslib_1.__importDefault(require("lodash/isNumber"));
|
|
8
8
|
const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
|
|
9
|
+
const core_1 = require("../../../core");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
const b = (0, utils_1.block)('copy-button');
|
|
11
|
-
const CopyButton = ({ className,
|
|
12
|
-
|
|
12
|
+
const CopyButton = ({ className, mode, schema, value }) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const { copy } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
|
+
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
16
|
+
if (copy && ((0, isString_1.default)(value) || (0, isNumber_1.default)(value)) && overviewFlag) {
|
|
13
17
|
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
14
18
|
react_1.default.createElement(uikit_1.ClipboardButton, { text: String(value), view: "flat", size: "s" })));
|
|
15
19
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type FieldValue, type JsonSchema, SchemaRendererMode } from '../../../core';
|
|
3
|
+
export interface DropButtonProps {
|
|
4
|
+
mode: SchemaRendererMode;
|
|
5
|
+
name: string;
|
|
6
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
7
|
+
schema?: JsonSchema;
|
|
8
|
+
value: FieldValue;
|
|
9
|
+
}
|
|
10
|
+
export declare const DropButton: React.FC<DropButtonProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropButton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const unstable_1 = require("@gravity-ui/uikit/unstable");
|
|
7
|
+
const react_final_form_1 = require("react-final-form");
|
|
8
|
+
const i18n_1 = tslib_1.__importDefault(require("../../../../kit/i18n"));
|
|
9
|
+
const core_1 = require("../../../core");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const b = (0, utils_1.block)('drop-button');
|
|
12
|
+
const DropButton = ({ mode, name, onClick, schema, value }) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const form = (0, react_final_form_1.useForm)();
|
|
15
|
+
const [open, setOpen] = react_1.default.useState(false);
|
|
16
|
+
const { required } = ((_a = schema === null || schema === void 0 ? void 0 : schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
17
|
+
const arrayItem = (0, utils_1.isArrayItem)(name);
|
|
18
|
+
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
19
|
+
const removeItem = react_1.default.useCallback((event) => {
|
|
20
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
21
|
+
form.focus(name);
|
|
22
|
+
form.change(name, undefined);
|
|
23
|
+
form.blur(name);
|
|
24
|
+
}, [form, name, onClick]);
|
|
25
|
+
if (!required && value !== undefined && !arrayItem && !overviewFlag) {
|
|
26
|
+
return (react_1.default.createElement("div", { className: b({ open }) },
|
|
27
|
+
react_1.default.createElement(unstable_1.unstable_Menu, { trigger: react_1.default.createElement(unstable_1.unstable_MenuTrigger, { view: "flat-secondary" }), onOpenChange: setOpen, placement: "right" },
|
|
28
|
+
react_1.default.createElement(unstable_1.unstable_MenuItem, { theme: "danger", onClick: removeItem }, (0, i18n_1.default)('label_delete')))));
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
};
|
|
32
|
+
exports.DropButton = DropButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropButton, type DropButtonProps } from './DropButton';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropButton = void 0;
|
|
4
|
+
var DropButton_1 = require("./DropButton");
|
|
5
|
+
Object.defineProperty(exports, "DropButton", { enumerable: true, get: function () { return DropButton_1.DropButton; } });
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { type FlexProps } from '@gravity-ui/uikit';
|
|
3
3
|
export interface EntityContainerProps extends FlexProps {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
+
droppable?: boolean;
|
|
5
6
|
fill?: 'populated' | 'empty' | 'by-child';
|
|
6
7
|
ref?: React.ComponentPropsWithRef<'div'>['ref'];
|
|
7
8
|
stretch: 'max' | 'fit' | 'by-child';
|
|
@@ -7,8 +7,8 @@ const uikit_1 = require("@gravity-ui/uikit");
|
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('entity-container');
|
|
9
9
|
const EntityContainer = (_a) => {
|
|
10
|
-
var { children, fill, stretch } = _a, restFlexProps = tslib_1.__rest(_a, ["children", "fill", "stretch"]);
|
|
11
|
-
return (react_1.default.createElement("div", { className: b({ stretch }), "data-
|
|
10
|
+
var { children, droppable, fill, stretch } = _a, restFlexProps = tslib_1.__rest(_a, ["children", "droppable", "fill", "stretch"]);
|
|
11
|
+
return (react_1.default.createElement("div", { className: b({ stretch }), "data-fill": fill, "data-droppable": droppable, "data-stretch": stretch },
|
|
12
12
|
react_1.default.createElement(uikit_1.Flex, Object.assign({ direction: "column", minWidth: 0 }, restFlexProps, { grow: 1 }), children)));
|
|
13
13
|
};
|
|
14
14
|
exports.EntityContainer = EntityContainer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FieldValue, JsonSchema, SchemaRendererMode } from '../../../core';
|
|
3
|
+
export interface LayoutButtonsProps {
|
|
4
|
+
name: string;
|
|
5
|
+
headName: string;
|
|
6
|
+
mode: SchemaRendererMode;
|
|
7
|
+
schema: JsonSchema;
|
|
8
|
+
value: FieldValue;
|
|
9
|
+
}
|
|
10
|
+
export declare const LayoutButtons: React.FC<LayoutButtonsProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LayoutButtons = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const ArrayRemoveButton_1 = require("../ArrayRemoveButton");
|
|
7
|
+
const CopyButton_1 = require("../CopyButton");
|
|
8
|
+
const DropButton_1 = require("../DropButton");
|
|
9
|
+
const LayoutButtons = ({ mode, name, headName, schema, value, }) => {
|
|
10
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
11
|
+
react_1.default.createElement(ArrayRemoveButton_1.ArrayRemoveButton, { mode: mode, name: name, headName: headName }),
|
|
12
|
+
react_1.default.createElement(CopyButton_1.CopyButton, { mode: mode, schema: schema, value: value }),
|
|
13
|
+
react_1.default.createElement(DropButton_1.DropButton, { mode: mode, name: name, schema: schema, value: value })));
|
|
14
|
+
};
|
|
15
|
+
exports.LayoutButtons = LayoutButtons;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LayoutButtons, type LayoutButtonsProps } from './LayoutButtons';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LayoutButtons = void 0;
|
|
4
|
+
var LayoutButtons_1 = require("./LayoutButtons");
|
|
5
|
+
Object.defineProperty(exports, "LayoutButtons", { enumerable: true, get: function () { return LayoutButtons_1.LayoutButtons; } });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
.sr-layout-container {
|
|
2
|
+
max-width: 100%;
|
|
3
|
+
min-width: 0;
|
|
2
4
|
width: fit-content;
|
|
3
|
-
flex: 0
|
|
5
|
+
flex: 0 1 auto;
|
|
4
6
|
}
|
|
5
7
|
.sr-layout-container:has([data-stretch=max]) {
|
|
6
8
|
width: 100%;
|
|
@@ -11,4 +13,31 @@
|
|
|
11
13
|
}
|
|
12
14
|
.sr-layout-container_hidden {
|
|
13
15
|
display: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@scope (.sr-layout-container) to (.sr-layout-container) {
|
|
19
|
+
:scope:has([data-droppable=true]:not(:scope .sr-layout-container *)) .sr-drop-button {
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
:scope:has(.sr-drop-button:not(:scope .sr-layout-container *):hover),
|
|
23
|
+
:scope:has(.sr-drop-button_open:not(:scope .sr-layout-container *)),
|
|
24
|
+
:scope:has(.sr-array-remove-button:not(:scope .sr-layout-container *):hover) {
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
27
|
+
:scope:has(.sr-drop-button:not(:scope .sr-layout-container *):hover):before,
|
|
28
|
+
:scope:has(.sr-drop-button_open:not(:scope .sr-layout-container *)):before,
|
|
29
|
+
:scope:has(.sr-array-remove-button:not(:scope .sr-layout-container *):hover):before {
|
|
30
|
+
content: "";
|
|
31
|
+
z-index: -1;
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: -8px;
|
|
34
|
+
left: -8px;
|
|
35
|
+
width: calc(100% + 16px);
|
|
36
|
+
height: calc(100% + 16px);
|
|
37
|
+
background-color: var(--g-color-base-simple-hover);
|
|
38
|
+
border-radius: 6px;
|
|
39
|
+
}
|
|
40
|
+
:scope:hover .sr-copy-button {
|
|
41
|
+
display: block;
|
|
42
|
+
}
|
|
14
43
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { ArrayRemoveButton, type ArrayRemoveButtonProps } from './ArrayRemoveButton';
|
|
2
2
|
export { CopyButton, type CopyButtonProps } from './CopyButton';
|
|
3
|
+
export { DropButton, type DropButtonProps } from './DropButton';
|
|
3
4
|
export { EmptyEntityValue } from './EmptyEntityValue';
|
|
4
5
|
export { EntityContainer, type EntityContainerProps } from './EntityContainer';
|
|
5
6
|
export { EntityError, type EntityErrorProps } from './EntityError';
|
|
6
7
|
export { HTMLContent, type HTMLContentProps } from './HTMLContent';
|
|
7
8
|
export { LayoutContainer, type LayoutContainerProps } from './LayoutContainer';
|
|
9
|
+
export { LayoutButtons, type LayoutButtonsProps } from './LayoutButtons';
|
|
8
10
|
export { LongValue, type LongValueProps } from './LongValue';
|
|
9
11
|
export { MonacoContainer, type MonacoContainerProps } from './MonacoContainer';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MonacoContainer = exports.LongValue = exports.LayoutContainer = exports.HTMLContent = exports.EntityError = exports.EntityContainer = exports.EmptyEntityValue = exports.CopyButton = exports.ArrayRemoveButton = void 0;
|
|
3
|
+
exports.MonacoContainer = exports.LongValue = exports.LayoutButtons = exports.LayoutContainer = exports.HTMLContent = exports.EntityError = exports.EntityContainer = exports.EmptyEntityValue = exports.DropButton = exports.CopyButton = exports.ArrayRemoveButton = void 0;
|
|
4
4
|
var ArrayRemoveButton_1 = require("./ArrayRemoveButton");
|
|
5
5
|
Object.defineProperty(exports, "ArrayRemoveButton", { enumerable: true, get: function () { return ArrayRemoveButton_1.ArrayRemoveButton; } });
|
|
6
6
|
var CopyButton_1 = require("./CopyButton");
|
|
7
7
|
Object.defineProperty(exports, "CopyButton", { enumerable: true, get: function () { return CopyButton_1.CopyButton; } });
|
|
8
|
+
var DropButton_1 = require("./DropButton");
|
|
9
|
+
Object.defineProperty(exports, "DropButton", { enumerable: true, get: function () { return DropButton_1.DropButton; } });
|
|
8
10
|
var EmptyEntityValue_1 = require("./EmptyEntityValue");
|
|
9
11
|
Object.defineProperty(exports, "EmptyEntityValue", { enumerable: true, get: function () { return EmptyEntityValue_1.EmptyEntityValue; } });
|
|
10
12
|
var EntityContainer_1 = require("./EntityContainer");
|
|
@@ -15,6 +17,8 @@ var HTMLContent_1 = require("./HTMLContent");
|
|
|
15
17
|
Object.defineProperty(exports, "HTMLContent", { enumerable: true, get: function () { return HTMLContent_1.HTMLContent; } });
|
|
16
18
|
var LayoutContainer_1 = require("./LayoutContainer");
|
|
17
19
|
Object.defineProperty(exports, "LayoutContainer", { enumerable: true, get: function () { return LayoutContainer_1.LayoutContainer; } });
|
|
20
|
+
var LayoutButtons_1 = require("./LayoutButtons");
|
|
21
|
+
Object.defineProperty(exports, "LayoutButtons", { enumerable: true, get: function () { return LayoutButtons_1.LayoutButtons; } });
|
|
18
22
|
var LongValue_1 = require("./LongValue");
|
|
19
23
|
Object.defineProperty(exports, "LongValue", { enumerable: true, get: function () { return LongValue_1.LongValue; } });
|
|
20
24
|
var MonacoContainer_1 = require("./MonacoContainer");
|
|
@@ -288,6 +288,7 @@ export declare const untypedConfig: {
|
|
|
288
288
|
readonly formEntities: {
|
|
289
289
|
readonly base: {
|
|
290
290
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaObject, import("../entities").ObjectEntityProps>;
|
|
291
|
+
readonly independent: true;
|
|
291
292
|
};
|
|
292
293
|
readonly dot_value: {
|
|
293
294
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaObject, import("../entities").DotValueProps>;
|
|
@@ -336,6 +337,7 @@ export declare const untypedConfig: {
|
|
|
336
337
|
readonly overviewEntities: {
|
|
337
338
|
readonly base: {
|
|
338
339
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaObject, import("../entities").ObjectEntityProps>;
|
|
340
|
+
readonly independent: true;
|
|
339
341
|
};
|
|
340
342
|
readonly dot_value: {
|
|
341
343
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaObject, import("../entities").DotValueProps>;
|
|
@@ -397,7 +399,7 @@ export declare const untypedConfig: {
|
|
|
397
399
|
readonly color_picker: {
|
|
398
400
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaString, import("../form-entities").ColorPickerInputProps>;
|
|
399
401
|
};
|
|
400
|
-
readonly
|
|
402
|
+
readonly file_input: {
|
|
401
403
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaString, import("../form-entities").FileInputProps>;
|
|
402
404
|
};
|
|
403
405
|
readonly label: {
|
|
@@ -461,7 +463,7 @@ export declare const untypedConfig: {
|
|
|
461
463
|
readonly color_picker: {
|
|
462
464
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaString, import("../overview-entities").ColorPickerValueProps>;
|
|
463
465
|
};
|
|
464
|
-
readonly
|
|
466
|
+
readonly file_input: {
|
|
465
467
|
readonly Component: import("../../core").NodeEntity<import("../../core").JsonSchemaString, import("../overview-entities").StringValueProps>;
|
|
466
468
|
};
|
|
467
469
|
readonly label: {
|
|
@@ -131,7 +131,7 @@ exports.untypedConfig = {
|
|
|
131
131
|
},
|
|
132
132
|
[core_1.NodeType.Object]: {
|
|
133
133
|
formEntities: {
|
|
134
|
-
base: { Component: entities_1.ObjectEntity },
|
|
134
|
+
base: { Component: entities_1.ObjectEntity, independent: true },
|
|
135
135
|
dot_value: { Component: entities_1.DotValue },
|
|
136
136
|
few_of_nested: { Component: entities_1.FewOfNested, independent: true },
|
|
137
137
|
inline: { Component: entities_1.ObjectInline },
|
|
@@ -149,7 +149,7 @@ exports.untypedConfig = {
|
|
|
149
149
|
transparent: { Component: layouts_1.Transparent },
|
|
150
150
|
},
|
|
151
151
|
overviewEntities: {
|
|
152
|
-
base: { Component: entities_1.ObjectEntity },
|
|
152
|
+
base: { Component: entities_1.ObjectEntity, independent: true },
|
|
153
153
|
dot_value: { Component: entities_1.DotValue },
|
|
154
154
|
few_of_nested: { Component: entities_1.FewOfNested, independent: true },
|
|
155
155
|
inline: { Component: entities_1.ObjectInline },
|
|
@@ -173,7 +173,7 @@ exports.untypedConfig = {
|
|
|
173
173
|
alert: { Component: entities_1.Alert },
|
|
174
174
|
base: { Component: form_entities_1.StringInput },
|
|
175
175
|
color_picker: { Component: form_entities_1.ColorPickerInput },
|
|
176
|
-
|
|
176
|
+
file_input: { Component: form_entities_1.FileInput },
|
|
177
177
|
label: { Component: entities_1.Label },
|
|
178
178
|
monaco_input: { Component: entities_1.Monaco },
|
|
179
179
|
password: { Component: form_entities_1.PasswordInput },
|
|
@@ -197,7 +197,7 @@ exports.untypedConfig = {
|
|
|
197
197
|
alert: { Component: entities_1.Alert },
|
|
198
198
|
base: { Component: overview_entities_1.StringValue },
|
|
199
199
|
color_picker: { Component: overview_entities_1.ColorPickerValue },
|
|
200
|
-
|
|
200
|
+
file_input: { Component: overview_entities_1.StringValue },
|
|
201
201
|
label: { Component: entities_1.Label },
|
|
202
202
|
monaco_input: { Component: entities_1.Monaco },
|
|
203
203
|
password: { Component: overview_entities_1.StringValue },
|
|
@@ -12,8 +12,37 @@ const b = (0, utils_1.block)('array-entity');
|
|
|
12
12
|
const ArrayEntity = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
13
13
|
var _a;
|
|
14
14
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
15
|
-
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
|
+
const { disabled, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
16
16
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
17
|
+
const initButton = react_1.default.useMemo(() => {
|
|
18
|
+
if (required || value !== undefined || overviewFlag) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const itemsSchema = schema.items;
|
|
22
|
+
const initValue = Array.isArray(itemsSchema)
|
|
23
|
+
? itemsSchema.map(() => undefined)
|
|
24
|
+
: [undefined];
|
|
25
|
+
const onClick = () => {
|
|
26
|
+
onFocus();
|
|
27
|
+
onChange(initValue);
|
|
28
|
+
onBlur();
|
|
29
|
+
};
|
|
30
|
+
return (react_1.default.createElement(uikit_1.Button, { className: b('init-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-init-button` },
|
|
31
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Plus, size: 14 }),
|
|
32
|
+
props.addButtonText || null));
|
|
33
|
+
}, [
|
|
34
|
+
props.addButtonText,
|
|
35
|
+
disabled,
|
|
36
|
+
name,
|
|
37
|
+
onBlur,
|
|
38
|
+
onChange,
|
|
39
|
+
onFocus,
|
|
40
|
+
overviewFlag,
|
|
41
|
+
required,
|
|
42
|
+
schema.items,
|
|
43
|
+
schema.readOnly,
|
|
44
|
+
value,
|
|
45
|
+
]);
|
|
17
46
|
const addButton = react_1.default.useMemo(() => {
|
|
18
47
|
const itemsSchema = schema.items;
|
|
19
48
|
if (Array.isArray(itemsSchema) || overviewFlag) {
|
|
@@ -21,7 +50,7 @@ const ArrayEntity = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
|
21
50
|
}
|
|
22
51
|
const onClick = () => {
|
|
23
52
|
onFocus();
|
|
24
|
-
onChange([...(value || []),
|
|
53
|
+
onChange([...(value || []), undefined]);
|
|
25
54
|
onBlur();
|
|
26
55
|
};
|
|
27
56
|
return (react_1.default.createElement(uikit_1.Button, { className: b('add-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-add-button` },
|
|
@@ -52,8 +81,8 @@ const ArrayEntity = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
|
52
81
|
if (overviewFlag && !(value === null || value === void 0 ? void 0 : value.length)) {
|
|
53
82
|
return react_1.default.createElement(components_1.EmptyEntityValue, null);
|
|
54
83
|
}
|
|
55
|
-
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "by-child", gap: 4, fill: "by-child" },
|
|
84
|
+
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "by-child", gap: 4, fill: "by-child", droppable: true }, initButton ? (initButton) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
56
85
|
(items === null || items === void 0 ? void 0 : items.length) ? react_1.default.createElement(uikit_1.Flex, { direction: "column" }, items) : null,
|
|
57
|
-
addButton));
|
|
86
|
+
addButton))));
|
|
58
87
|
};
|
|
59
88
|
exports.ArrayEntity = ArrayEntity;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
.sr-array-table__row-divider {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: calc(var(--g-spacing-base) * 5 + 1px);
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
}
|
|
7
|
+
.sr-array-table__row-divider::before {
|
|
8
|
+
content: "";
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 1px;
|
|
11
|
+
background-color: var(--g-color-line-generic);
|
|
12
|
+
}
|
|
1
13
|
.sr-array-table__row {
|
|
2
14
|
width: 100%;
|
|
3
15
|
display: grid;
|
|
4
16
|
align-items: start;
|
|
5
17
|
grid-template-columns: 28px repeat(var(--columns-count), 1fr);
|
|
6
18
|
gap: calc(var(--g-spacing-base) * 3);
|
|
7
|
-
padding: calc(var(--g-spacing-base) * 2) 0;
|
|
8
|
-
border-bottom: 1px solid var(--g-color-line-generic);
|
|
9
19
|
}
|
|
10
20
|
.sr-array-table__row_head {
|
|
11
21
|
align-items: center;
|
|
@@ -40,6 +50,6 @@
|
|
|
40
50
|
gap: 0 calc(var(--g-spacing-base) * 1);
|
|
41
51
|
flex-wrap: wrap;
|
|
42
52
|
}
|
|
43
|
-
.sr-array-table__add-button {
|
|
53
|
+
.sr-array-table__add-button, .sr-array-table__init-button {
|
|
44
54
|
align-self: flex-start;
|
|
45
55
|
}
|
|
@@ -12,8 +12,37 @@ const b = (0, utils_1.block)('array-table');
|
|
|
12
12
|
const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
13
13
|
var _a;
|
|
14
14
|
const { name, onBlur, onChange, onFocus, value } = input;
|
|
15
|
-
const { disabled } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
15
|
+
const { disabled, required } = ((_a = schema.nodeParameters) === null || _a === void 0 ? void 0 : _a.flags) || {};
|
|
16
16
|
const overviewFlag = mode === core_1.SchemaRendererMode.Overview;
|
|
17
|
+
const initButton = react_1.default.useMemo(() => {
|
|
18
|
+
if (required || value !== undefined || overviewFlag) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const itemsSchema = schema.items;
|
|
22
|
+
const initValue = Array.isArray(itemsSchema)
|
|
23
|
+
? itemsSchema.map(() => undefined)
|
|
24
|
+
: [undefined];
|
|
25
|
+
const onClick = () => {
|
|
26
|
+
onFocus();
|
|
27
|
+
onChange(initValue);
|
|
28
|
+
onBlur();
|
|
29
|
+
};
|
|
30
|
+
return (react_1.default.createElement(uikit_1.Button, { className: b('init-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-init-button` },
|
|
31
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Plus, size: 14 }),
|
|
32
|
+
props.addButtonText || null));
|
|
33
|
+
}, [
|
|
34
|
+
props.addButtonText,
|
|
35
|
+
disabled,
|
|
36
|
+
name,
|
|
37
|
+
onBlur,
|
|
38
|
+
onChange,
|
|
39
|
+
onFocus,
|
|
40
|
+
overviewFlag,
|
|
41
|
+
required,
|
|
42
|
+
schema.items,
|
|
43
|
+
schema.readOnly,
|
|
44
|
+
value,
|
|
45
|
+
]);
|
|
17
46
|
const addButton = react_1.default.useMemo(() => {
|
|
18
47
|
const itemsSchema = schema.items;
|
|
19
48
|
if (Array.isArray(itemsSchema) || overviewFlag) {
|
|
@@ -21,7 +50,7 @@ const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
|
21
50
|
}
|
|
22
51
|
const onClick = () => {
|
|
23
52
|
onFocus();
|
|
24
|
-
onChange([...(value || []),
|
|
53
|
+
onChange([...(value || []), undefined]);
|
|
25
54
|
onBlur();
|
|
26
55
|
};
|
|
27
56
|
return (react_1.default.createElement(uikit_1.Button, { className: b('add-button'), onClick: onClick, disabled: disabled || schema.readOnly, qa: `${name}-add-button` },
|
|
@@ -83,22 +112,25 @@ const ArrayTable = ({ headName, input, mode, props, schema, schemaPath, }) => {
|
|
|
83
112
|
wIndex + 1 === array.length && column.schema.description ? (react_1.default.createElement(uikit_1.HelpMark, null,
|
|
84
113
|
react_1.default.createElement(components_1.HTMLContent, { content: column.schema.description, headName: headName }))) : null))))));
|
|
85
114
|
})));
|
|
86
|
-
const rows = new Array(rowsCount).fill(null).map((_, rIndex) => (react_1.default.createElement(
|
|
87
|
-
react_1.default.createElement("div", { className: b('
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
115
|
+
const rows = new Array(rowsCount).fill(null).map((_, rIndex) => (react_1.default.createElement(react_1.default.Fragment, { key: rIndex },
|
|
116
|
+
react_1.default.createElement("div", { className: b('row-divider') }),
|
|
117
|
+
react_1.default.createElement(components_1.LayoutContainer, null,
|
|
118
|
+
react_1.default.createElement("div", { className: b('row', { 'with-remove-button': withRemoveButton }), style: { '--columns-count': columns.length } },
|
|
119
|
+
react_1.default.createElement("div", { className: b('cell') },
|
|
120
|
+
react_1.default.createElement(uikit_1.Text, { className: b('index'), variant: "subheader-1" }, rIndex + 1)),
|
|
121
|
+
columns.map((column, cIndex) => (react_1.default.createElement("div", { className: b('cell'), key: cIndex },
|
|
122
|
+
react_1.default.createElement(core_1.SchemaRendererNode, { headName: headName, name: getItemName(rIndex, column.name), schemaPath: getItemSchemaPath(rIndex, column.name) })))),
|
|
123
|
+
withRemoveButton ? (react_1.default.createElement("div", { className: b('cell') },
|
|
124
|
+
react_1.default.createElement(components_1.ArrayRemoveButton, { name: `${name}[${rIndex}]`, headName: headName, mode: mode }))) : null)))));
|
|
93
125
|
return { head, rows };
|
|
94
|
-
}, [columns, headName, name, overviewFlag, schema.items, schemaPath, value === null || value === void 0 ? void 0 : value.length]);
|
|
126
|
+
}, [columns, headName, mode, name, overviewFlag, schema.items, schemaPath, value === null || value === void 0 ? void 0 : value.length]);
|
|
95
127
|
if (overviewFlag && !(value === null || value === void 0 ? void 0 : value.length)) {
|
|
96
128
|
return react_1.default.createElement(components_1.EmptyEntityValue, null);
|
|
97
129
|
}
|
|
98
|
-
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "by-child", gap:
|
|
99
|
-
react_1.default.createElement("div", null,
|
|
100
|
-
|
|
101
|
-
rows),
|
|
102
|
-
addButton));
|
|
130
|
+
return (react_1.default.createElement(components_1.EntityContainer, { stretch: "by-child", gap: 4, fill: "by-child", droppable: true }, initButton ? (initButton) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
131
|
+
rows.length ? (react_1.default.createElement("div", null,
|
|
132
|
+
head,
|
|
133
|
+
rows)) : null,
|
|
134
|
+
addButton))));
|
|
103
135
|
};
|
|
104
136
|
exports.ArrayTable = ArrayTable;
|