@gravity-ui/page-constructor 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.8.0](https://github.com/gravity-ui/page-constructor/compare/v3.7.0...v3.8.0) (2023-06-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add yfm transoform for editor demo ([#420](https://github.com/gravity-ui/page-constructor/issues/420)) ([1c1a2aa](https://github.com/gravity-ui/page-constructor/commit/1c1a2aa134a3c4d18e01537c1ca874720f23649d))
|
|
9
|
+
* update dynamic forms and fix form render performance ([#418](https://github.com/gravity-ui/page-constructor/issues/418)) ([eb9437d](https://github.com/gravity-ui/page-constructor/commit/eb9437df0d38a9a3433e85d111c45b3a49dbd9aa))
|
|
10
|
+
|
|
3
11
|
## [3.7.0](https://github.com/gravity-ui/page-constructor/compare/v3.6.2...v3.7.0) (2023-06-21)
|
|
4
12
|
|
|
5
13
|
|
|
@@ -10,24 +10,19 @@ const config_1 = require("../../dynamic-forms-custom/config");
|
|
|
10
10
|
const usePreviousValue_1 = tslib_1.__importDefault(require("../../hooks/usePreviousValue"));
|
|
11
11
|
exports.BlockForm = (0, react_1.memo)((_a) => {
|
|
12
12
|
var _b = _a.data, { type } = _b, content = tslib_1.__rest(_b, ["type"]), { onChange, onSelect, active, spec: specRaw } = _a;
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
|
-
const initialValues = (0, react_1.useMemo)(() => ({ content }), []);
|
|
13
|
+
const initialValues = (0, react_1.useMemo)(() => ({ content }), [content]);
|
|
16
14
|
const prevContent = (0, usePreviousValue_1.default)(content);
|
|
17
15
|
const spec = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, specRaw), { viewSpec: Object.assign(Object.assign({}, specRaw.viewSpec), { layoutOpen: active }) })), [specRaw, active]);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} },
|
|
16
|
+
if (!active) {
|
|
17
|
+
return (react_1.default.createElement(dynamic_forms_1.SimpleVerticalAccordeon, { open: false, name: type, title: spec.viewSpec.layoutTitle || type, onOpenChange: onSelect }, 1));
|
|
18
|
+
}
|
|
19
|
+
return (react_1.default.createElement(react_final_form_1.Form, { initialValues: initialValues, onSubmit: lodash_1.default.noop }, () => (react_1.default.createElement("div", null,
|
|
23
20
|
react_1.default.createElement(react_final_form_1.FormSpy, { onChange: ({ values }) => {
|
|
24
21
|
// fix for FormSpy onChange called twice without content changes
|
|
25
22
|
if (!lodash_1.default.isEqual(values.content, prevContent)) {
|
|
26
23
|
onChange(Object.assign({ type }, values.content));
|
|
27
24
|
}
|
|
28
25
|
}, subscription: { values: true } }),
|
|
29
|
-
react_1.default.createElement(dynamic_forms_1.DynamicField, { name: "content",
|
|
30
|
-
// there is no way other way to manage with form open/close state now
|
|
31
|
-
key: String(active), spec: spec, config: config_1.dynamicConfig })))));
|
|
26
|
+
react_1.default.createElement(dynamic_forms_1.DynamicField, { name: "content", spec: spec, config: config_1.dynamicConfig, withoutInsertFFDebounce: true })))));
|
|
32
27
|
});
|
|
33
28
|
exports.BlockForm.displayName = 'BlockForm';
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { memo, useMemo } from 'react';
|
|
3
|
-
import { DynamicField } from '@gravity-ui/dynamic-forms';
|
|
3
|
+
import { DynamicField, SimpleVerticalAccordeon } from '@gravity-ui/dynamic-forms';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import { Form as FinalForm, FormSpy } from 'react-final-form';
|
|
6
6
|
import { dynamicConfig } from '../../dynamic-forms-custom/config';
|
|
7
7
|
import usePreviousValue from '../../hooks/usePreviousValue';
|
|
8
8
|
export const BlockForm = memo((_a) => {
|
|
9
9
|
var _b = _a.data, { type } = _b, content = __rest(_b, ["type"]), { onChange, onSelect, active, spec: specRaw } = _a;
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
-
const initialValues = useMemo(() => ({ content }), []);
|
|
10
|
+
const initialValues = useMemo(() => ({ content }), [content]);
|
|
13
11
|
const prevContent = usePreviousValue(content);
|
|
14
12
|
const spec = useMemo(() => (Object.assign(Object.assign({}, specRaw), { viewSpec: Object.assign(Object.assign({}, specRaw.viewSpec), { layoutOpen: active }) })), [specRaw, active]);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} },
|
|
13
|
+
if (!active) {
|
|
14
|
+
return (React.createElement(SimpleVerticalAccordeon, { open: false, name: type, title: spec.viewSpec.layoutTitle || type, onOpenChange: onSelect }, 1));
|
|
15
|
+
}
|
|
16
|
+
return (React.createElement(FinalForm, { initialValues: initialValues, onSubmit: _.noop }, () => (React.createElement("div", null,
|
|
20
17
|
React.createElement(FormSpy, { onChange: ({ values }) => {
|
|
21
18
|
// fix for FormSpy onChange called twice without content changes
|
|
22
19
|
if (!_.isEqual(values.content, prevContent)) {
|
|
23
20
|
onChange(Object.assign({ type }, values.content));
|
|
24
21
|
}
|
|
25
22
|
}, subscription: { values: true } }),
|
|
26
|
-
React.createElement(DynamicField, { name: "content",
|
|
27
|
-
// there is no way other way to manage with form open/close state now
|
|
28
|
-
key: String(active), spec: spec, config: dynamicConfig })))));
|
|
23
|
+
React.createElement(DynamicField, { name: "content", spec: spec, config: dynamicConfig, withoutInsertFFDebounce: true })))));
|
|
29
24
|
});
|
|
30
25
|
BlockForm.displayName = 'BlockForm';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"test:watch": "jest --watchAll"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@gravity-ui/dynamic-forms": "1.
|
|
80
|
+
"@gravity-ui/dynamic-forms": "^1.9.2",
|
|
81
81
|
"@gravity-ui/i18n": "^1.0.0",
|
|
82
82
|
"bem-cn-lite": "^4.0.0",
|
|
83
83
|
"final-form": "^4.20.9",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"react-spring": "^9.3.0",
|
|
90
90
|
"react-transition-group": "^4.4.2",
|
|
91
91
|
"react-waypoint": "^10.1.0",
|
|
92
|
-
"sanitize-html": "
|
|
92
|
+
"sanitize-html": "2.6.1",
|
|
93
93
|
"snakecase-keys": "^5.1.0",
|
|
94
94
|
"typograf": "^6.14.0",
|
|
95
95
|
"uuid": "^9.0.0"
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"@types/react-dom": "^18.0.10",
|
|
126
126
|
"@types/react-slick": "^0.23.7",
|
|
127
127
|
"@types/react-transition-group": "^4.4.4",
|
|
128
|
-
"@types/sanitize-html": "
|
|
128
|
+
"@types/sanitize-html": "2.6.1",
|
|
129
129
|
"@types/uuid": "^9.0.0",
|
|
130
130
|
"es5-ext": "0.10.53",
|
|
131
131
|
"eslint": "^8.34.0",
|
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
"gulp-replace": "^1.1.3",
|
|
138
138
|
"gulp-typescript": "^6.0.0-alpha.1",
|
|
139
139
|
"html-loader": "^1.3.2",
|
|
140
|
+
"htmlparser2": "^6.1.0",
|
|
140
141
|
"husky": "^7.0.4",
|
|
141
142
|
"jest": "^29.3.1",
|
|
142
143
|
"jest-environment-jsdom": "^29.3.1",
|