devextreme-react 24.1.2-beta → 24.1.3
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/LICENSE +21 -21
- package/README.md +23 -23
- package/cjs/accordion.d.ts +3 -3
- package/cjs/accordion.js +34 -37
- package/cjs/action-sheet.d.ts +3 -3
- package/cjs/action-sheet.js +34 -37
- package/cjs/autocomplete.d.ts +2 -2
- package/cjs/autocomplete.js +79 -82
- package/cjs/bar-gauge.d.ts +2 -2
- package/cjs/bar-gauge.js +97 -100
- package/cjs/box.d.ts +3 -3
- package/cjs/box.js +34 -37
- package/cjs/bullet.d.ts +2 -2
- package/cjs/bullet.js +44 -50
- package/cjs/button-group.d.ts +2 -2
- package/cjs/button-group.js +34 -37
- package/cjs/button.d.ts +2 -2
- package/cjs/button.js +22 -28
- package/cjs/calendar.d.ts +2 -2
- package/cjs/calendar.js +27 -31
- package/cjs/chart.d.ts +2 -2
- package/cjs/chart.js +305 -308
- package/cjs/check-box.d.ts +2 -2
- package/cjs/check-box.js +24 -29
- package/cjs/circular-gauge.d.ts +2 -2
- package/cjs/circular-gauge.js +103 -106
- package/cjs/color-box.d.ts +2 -2
- package/cjs/color-box.js +76 -79
- package/cjs/common/charts.d.ts +2 -2
- package/cjs/common/charts.js +2 -2
- package/cjs/common/data/custom-store.d.ts +2 -2
- package/cjs/common/data/custom-store.js +2 -2
- package/cjs/common/grids.d.ts +2 -2
- package/cjs/common/grids.js +2 -2
- package/cjs/common/index.d.ts +2 -2
- package/cjs/common/index.js +2 -2
- package/cjs/context-menu.d.ts +3 -3
- package/cjs/context-menu.js +76 -79
- package/cjs/core/component-base.d.ts +2 -2
- package/cjs/core/component-base.js +107 -141
- package/cjs/core/component.d.ts +2 -2
- package/cjs/core/component.js +29 -43
- package/cjs/core/config.d.ts +2 -2
- package/cjs/core/config.js +4 -15
- package/cjs/core/configuration/comparer.d.ts +2 -2
- package/cjs/core/configuration/comparer.js +27 -27
- package/cjs/core/configuration/config-node.d.ts +2 -2
- package/cjs/core/configuration/config-node.js +2 -2
- package/cjs/core/configuration/react/element.d.ts +2 -3
- package/cjs/core/configuration/react/element.js +10 -10
- package/cjs/core/configuration/react/templates.d.ts +2 -2
- package/cjs/core/configuration/react/templates.js +2 -2
- package/cjs/core/configuration/react/tree.d.ts +2 -2
- package/cjs/core/configuration/react/tree.js +33 -40
- package/cjs/core/configuration/tree.d.ts +2 -2
- package/cjs/core/configuration/tree.js +24 -24
- package/cjs/core/configuration/utils.d.ts +2 -2
- package/cjs/core/configuration/utils.js +12 -17
- package/cjs/core/extension-component.d.ts +2 -2
- package/cjs/core/extension-component.js +20 -35
- package/cjs/core/helpers.d.ts +2 -3
- package/cjs/core/helpers.js +30 -161
- package/cjs/core/nested-option.d.ts +2 -2
- package/cjs/core/nested-option.js +8 -8
- package/cjs/core/options-manager.d.ts +2 -2
- package/cjs/core/options-manager.js +85 -128
- package/cjs/core/template-manager.d.ts +2 -2
- package/cjs/core/template-manager.js +51 -82
- package/cjs/core/template-wrapper.d.ts +2 -2
- package/cjs/core/template-wrapper.js +32 -49
- package/cjs/core/template.d.ts +2 -2
- package/cjs/core/template.js +4 -4
- package/cjs/core/types.d.ts +2 -2
- package/cjs/core/types.js +2 -2
- package/cjs/core/widget-config.d.ts +2 -2
- package/cjs/core/widget-config.js +21 -22
- package/cjs/data-grid.d.ts +3 -3
- package/cjs/data-grid.js +290 -292
- package/cjs/date-box.d.ts +2 -2
- package/cjs/date-box.js +83 -85
- package/cjs/date-range-box.d.ts +2 -2
- package/cjs/date-range-box.js +82 -85
- package/cjs/defer-rendering.d.ts +2 -2
- package/cjs/defer-rendering.js +50 -56
- package/cjs/diagram.d.ts +16 -16
- package/cjs/diagram.js +109 -112
- package/cjs/draggable.d.ts +2 -2
- package/cjs/draggable.js +29 -34
- package/cjs/drawer.d.ts +2 -2
- package/cjs/drawer.js +27 -31
- package/cjs/drop-down-box.d.ts +2 -2
- package/cjs/drop-down-box.js +76 -79
- package/cjs/drop-down-button.d.ts +2 -2
- package/cjs/drop-down-button.js +68 -73
- package/cjs/file-manager.d.ts +2 -2
- package/cjs/file-manager.js +59 -65
- package/cjs/file-uploader.d.ts +2 -2
- package/cjs/file-uploader.js +24 -29
- package/cjs/filter-builder.d.ts +2 -2
- package/cjs/filter-builder.js +47 -50
- package/cjs/form.d.ts +2 -2
- package/cjs/form.js +94 -98
- package/cjs/funnel.d.ts +2 -2
- package/cjs/funnel.js +109 -113
- package/cjs/gallery.d.ts +3 -3
- package/cjs/gallery.js +34 -37
- package/cjs/gantt.d.ts +2 -2
- package/cjs/gantt.js +101 -106
- package/cjs/html-editor.d.ts +2 -2
- package/cjs/html-editor.js +64 -68
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +2 -2
- package/cjs/linear-gauge.d.ts +2 -2
- package/cjs/linear-gauge.js +103 -107
- package/cjs/list.d.ts +3 -3
- package/cjs/list.js +52 -55
- package/cjs/load-indicator.d.ts +2 -2
- package/cjs/load-indicator.js +19 -26
- package/cjs/load-panel.d.ts +2 -2
- package/cjs/load-panel.js +62 -65
- package/cjs/lookup.d.ts +2 -2
- package/cjs/lookup.js +79 -82
- package/cjs/map.d.ts +2 -2
- package/cjs/map.js +46 -50
- package/cjs/menu.d.ts +3 -3
- package/cjs/menu.js +76 -79
- package/cjs/multi-view.d.ts +3 -3
- package/cjs/multi-view.js +34 -37
- package/cjs/number-box.d.ts +2 -2
- package/cjs/number-box.js +37 -41
- package/cjs/pie-chart.d.ts +2 -2
- package/cjs/pie-chart.js +136 -139
- package/cjs/pivot-grid-field-chooser.d.ts +2 -2
- package/cjs/pivot-grid-field-chooser.js +38 -44
- package/cjs/pivot-grid.d.ts +2 -2
- package/cjs/pivot-grid.js +62 -68
- package/cjs/polar-chart.d.ts +2 -2
- package/cjs/polar-chart.js +238 -242
- package/cjs/popover.d.ts +2 -2
- package/cjs/popover.js +74 -76
- package/cjs/popup.d.ts +2 -2
- package/cjs/popup.js +68 -70
- package/cjs/progress-bar.d.ts +2 -2
- package/cjs/progress-bar.js +24 -29
- package/cjs/radio-group.d.ts +2 -2
- package/cjs/radio-group.js +34 -37
- package/cjs/range-selector.d.ts +2 -2
- package/cjs/range-selector.js +208 -212
- package/cjs/range-slider.d.ts +2 -2
- package/cjs/range-slider.js +37 -41
- package/cjs/recurrence-editor.d.ts +2 -2
- package/cjs/recurrence-editor.js +24 -29
- package/cjs/resizable.d.ts +2 -2
- package/cjs/resizable.js +24 -29
- package/cjs/responsive-box.d.ts +3 -3
- package/cjs/responsive-box.js +43 -46
- package/cjs/sankey.d.ts +2 -2
- package/cjs/sankey.js +85 -89
- package/cjs/scheduler.d.ts +2 -2
- package/cjs/scheduler.js +46 -49
- package/cjs/scroll-view.d.ts +2 -2
- package/cjs/scroll-view.js +19 -26
- package/cjs/select-box.d.ts +2 -2
- package/cjs/select-box.js +79 -82
- package/cjs/slider.d.ts +2 -2
- package/cjs/slider.js +37 -41
- package/cjs/sortable.d.ts +2 -2
- package/cjs/sortable.js +29 -34
- package/cjs/sparkline.d.ts +2 -2
- package/cjs/sparkline.js +44 -50
- package/cjs/speed-dial-action.d.ts +2 -2
- package/cjs/speed-dial-action.js +19 -26
- package/cjs/splitter.d.ts +6 -6
- package/cjs/splitter.js +34 -37
- package/cjs/switch.d.ts +2 -2
- package/cjs/switch.js +24 -29
- package/cjs/tab-panel.d.ts +3 -3
- package/cjs/tab-panel.js +34 -37
- package/cjs/tabs.d.ts +3 -3
- package/cjs/tabs.js +34 -37
- package/cjs/tag-box.d.ts +2 -2
- package/cjs/tag-box.js +79 -82
- package/cjs/text-area.d.ts +2 -2
- package/cjs/text-area.js +24 -29
- package/cjs/text-box.d.ts +2 -2
- package/cjs/text-box.js +34 -38
- package/cjs/tile-view.d.ts +3 -3
- package/cjs/tile-view.js +34 -37
- package/cjs/toast.d.ts +2 -2
- package/cjs/toast.js +65 -67
- package/cjs/toolbar.d.ts +3 -3
- package/cjs/toolbar.js +34 -37
- package/cjs/tooltip.d.ts +2 -2
- package/cjs/tooltip.js +71 -73
- package/cjs/tree-list.d.ts +3 -3
- package/cjs/tree-list.js +250 -254
- package/cjs/tree-map.d.ts +2 -2
- package/cjs/tree-map.js +91 -95
- package/cjs/tree-view.d.ts +3 -3
- package/cjs/tree-view.js +43 -46
- package/cjs/validation-group.d.ts +2 -2
- package/cjs/validation-group.js +19 -26
- package/cjs/validation-summary.d.ts +3 -3
- package/cjs/validation-summary.js +34 -37
- package/cjs/validator.d.ts +2 -2
- package/cjs/validator.js +57 -63
- package/cjs/vector-map.d.ts +2 -2
- package/cjs/vector-map.js +106 -110
- package/esm/accordion.js +29 -32
- package/esm/action-sheet.js +29 -32
- package/esm/autocomplete.js +74 -77
- package/esm/bar-gauge.js +92 -95
- package/esm/box.js +29 -32
- package/esm/bullet.js +39 -45
- package/esm/button-group.js +29 -32
- package/esm/button.js +18 -24
- package/esm/calendar.js +23 -27
- package/esm/chart.js +300 -303
- package/esm/check-box.js +20 -25
- package/esm/circular-gauge.js +98 -101
- package/esm/color-box.js +71 -74
- package/esm/common/charts.js +2 -2
- package/esm/common/data/custom-store.js +2 -2
- package/esm/common/grids.js +2 -2
- package/esm/common/index.js +2 -2
- package/esm/context-menu.js +71 -74
- package/esm/core/component-base.js +94 -131
- package/esm/core/component.js +25 -39
- package/esm/core/config.js +4 -15
- package/esm/core/configuration/comparer.js +25 -25
- package/esm/core/configuration/config-node.js +2 -2
- package/esm/core/configuration/react/element.js +9 -9
- package/esm/core/configuration/react/templates.js +2 -2
- package/esm/core/configuration/react/tree.js +28 -35
- package/esm/core/configuration/tree.js +23 -23
- package/esm/core/configuration/utils.js +12 -17
- package/esm/core/extension-component.js +17 -32
- package/esm/core/helpers.js +30 -163
- package/esm/core/nested-option.js +6 -6
- package/esm/core/options-manager.js +81 -124
- package/esm/core/template-manager.js +44 -75
- package/esm/core/template-wrapper.js +27 -44
- package/esm/core/template.js +3 -3
- package/esm/core/types.js +2 -2
- package/esm/core/widget-config.js +21 -22
- package/esm/data-grid.js +285 -287
- package/esm/date-box.js +78 -80
- package/esm/date-range-box.js +77 -80
- package/esm/defer-rendering.js +45 -51
- package/esm/diagram.js +104 -107
- package/esm/draggable.js +24 -29
- package/esm/drawer.js +23 -27
- package/esm/drop-down-box.js +71 -74
- package/esm/drop-down-button.js +63 -68
- package/esm/file-manager.js +54 -60
- package/esm/file-uploader.js +20 -25
- package/esm/filter-builder.js +42 -45
- package/esm/form.js +89 -93
- package/esm/funnel.js +104 -108
- package/esm/gallery.js +29 -32
- package/esm/gantt.js +96 -101
- package/esm/html-editor.js +59 -63
- package/esm/index.js +2 -2
- package/esm/linear-gauge.js +98 -102
- package/esm/list.js +47 -50
- package/esm/load-indicator.js +15 -22
- package/esm/load-panel.js +57 -60
- package/esm/lookup.js +74 -77
- package/esm/map.js +41 -45
- package/esm/menu.js +71 -74
- package/esm/multi-view.js +29 -32
- package/esm/number-box.js +32 -36
- package/esm/pie-chart.js +131 -134
- package/esm/pivot-grid-field-chooser.js +33 -39
- package/esm/pivot-grid.js +57 -63
- package/esm/polar-chart.js +233 -237
- package/esm/popover.js +69 -71
- package/esm/popup.js +63 -65
- package/esm/progress-bar.js +20 -25
- package/esm/radio-group.js +29 -32
- package/esm/range-selector.js +203 -207
- package/esm/range-slider.js +32 -36
- package/esm/recurrence-editor.js +20 -25
- package/esm/resizable.js +20 -25
- package/esm/responsive-box.js +38 -41
- package/esm/sankey.js +80 -84
- package/esm/scheduler.js +41 -44
- package/esm/scroll-view.js +15 -22
- package/esm/select-box.js +74 -77
- package/esm/slider.js +32 -36
- package/esm/sortable.js +24 -29
- package/esm/sparkline.js +39 -45
- package/esm/speed-dial-action.js +15 -22
- package/esm/splitter.js +29 -32
- package/esm/switch.js +20 -25
- package/esm/tab-panel.js +29 -32
- package/esm/tabs.js +29 -32
- package/esm/tag-box.js +74 -77
- package/esm/text-area.js +20 -25
- package/esm/text-box.js +29 -33
- package/esm/tile-view.js +29 -32
- package/esm/toast.js +60 -62
- package/esm/toolbar.js +29 -32
- package/esm/tooltip.js +66 -68
- package/esm/tree-list.js +245 -249
- package/esm/tree-map.js +86 -90
- package/esm/tree-view.js +38 -41
- package/esm/validation-group.js +15 -22
- package/esm/validation-summary.js +29 -32
- package/esm/validator.js +52 -58
- package/esm/vector-map.js +101 -105
- package/package.json +50 -51
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* devextreme-react
|
|
3
|
-
* Version: 24.1.
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 24.1.3
|
|
4
|
+
* Build date: Tue Jun 11 2024
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
*
|
|
@@ -11,76 +11,42 @@
|
|
|
11
11
|
* https://github.com/DevExpress/devextreme-react
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
26
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27
|
-
if (!m) return o;
|
|
28
|
-
var i = m.call(o), r, ar = [], e;
|
|
29
|
-
try {
|
|
30
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
31
|
-
}
|
|
32
|
-
catch (error) { e = { error: error }; }
|
|
33
|
-
finally {
|
|
34
|
-
try {
|
|
35
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
-
}
|
|
37
|
-
finally { if (e) throw e.error; }
|
|
38
|
-
}
|
|
39
|
-
return ar;
|
|
40
|
-
};
|
|
41
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
42
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
43
|
-
if (ar || !(i in from)) {
|
|
44
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
45
|
-
ar[i] = from[i];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
49
|
-
};
|
|
50
14
|
import * as React from 'react';
|
|
51
15
|
import * as events from 'devextreme/events';
|
|
52
16
|
import { useContext, useImperativeHandle, forwardRef, useRef, useLayoutEffect, useCallback, useState, } from 'react';
|
|
53
17
|
import { requestAnimationFrame } from 'devextreme/animation/frame';
|
|
54
18
|
import { deferUpdate } from 'devextreme/core/utils/common';
|
|
19
|
+
import config from 'devextreme/core/config';
|
|
55
20
|
import { createPortal } from 'react-dom';
|
|
56
21
|
import { RemovalLockerContext, RestoreTreeContext } from './helpers';
|
|
57
22
|
import { OptionsManager, scheduleGuards, unscheduleGuards } from './options-manager';
|
|
58
23
|
import { elementPropNames, getClassName } from './widget-config';
|
|
59
24
|
import { buildConfigTree } from './configuration/react/tree';
|
|
60
25
|
import { TemplateManager } from './template-manager';
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
26
|
+
const DX_REMOVE_EVENT = 'dxremove';
|
|
27
|
+
config({
|
|
28
|
+
buyNowLink: 'https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeReact.aspx',
|
|
29
|
+
});
|
|
30
|
+
const ComponentBase = forwardRef((props, ref) => {
|
|
31
|
+
const { templateProps = [], defaults = {}, expectedChildren = {}, isPortalComponent = false, useRequestAnimationFrameFlag = false, subscribableOptions = [], WidgetClass, independentEvents = [], renderChildren, beforeCreateWidget = () => undefined, afterCreateWidget = () => undefined, } = props;
|
|
32
|
+
const [, setForceUpdateToken] = useState(0);
|
|
33
|
+
const removalLocker = useContext(RemovalLockerContext);
|
|
34
|
+
const restoreParentLink = useContext(RestoreTreeContext);
|
|
35
|
+
const instance = useRef();
|
|
36
|
+
const element = useRef();
|
|
37
|
+
const portalContainer = useRef();
|
|
38
|
+
const useDeferUpdateForTemplates = useRef(false);
|
|
39
|
+
const guardsUpdateScheduled = useRef(false);
|
|
40
|
+
const childElementsDetached = useRef(false);
|
|
41
|
+
const optionsManager = useRef(new OptionsManager());
|
|
42
|
+
const childNodes = useRef();
|
|
43
|
+
const createDXTemplates = useRef();
|
|
44
|
+
const clearInstantiationModels = useRef();
|
|
45
|
+
const updateTemplates = useRef();
|
|
46
|
+
const prevPropsRef = useRef();
|
|
47
|
+
const restoreTree = useCallback(() => {
|
|
48
|
+
if (childNodes.current?.length && element.current) {
|
|
49
|
+
element.current.append(...childNodes.current);
|
|
84
50
|
childElementsDetached.current = false;
|
|
85
51
|
}
|
|
86
52
|
if (restoreParentLink && element.current && !element.current.isConnected) {
|
|
@@ -92,49 +58,45 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
92
58
|
childElementsDetached.current,
|
|
93
59
|
restoreParentLink,
|
|
94
60
|
]);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var prevClassName = prevProps ? getClassName(prevProps) : undefined;
|
|
99
|
-
var newClassName = getClassName(newProps);
|
|
61
|
+
const updateCssClasses = useCallback((prevProps, newProps) => {
|
|
62
|
+
const prevClassName = prevProps ? getClassName(prevProps) : undefined;
|
|
63
|
+
const newClassName = getClassName(newProps);
|
|
100
64
|
if (prevClassName === newClassName) {
|
|
101
65
|
return;
|
|
102
66
|
}
|
|
103
67
|
if (prevClassName) {
|
|
104
|
-
|
|
68
|
+
const classNames = prevClassName.split(' ').filter((c) => c);
|
|
105
69
|
if (classNames.length) {
|
|
106
|
-
|
|
70
|
+
element.current?.classList.remove(...classNames);
|
|
107
71
|
}
|
|
108
72
|
}
|
|
109
73
|
if (newClassName) {
|
|
110
|
-
|
|
74
|
+
const classNames = newClassName.split(' ').filter((c) => c);
|
|
111
75
|
if (classNames.length) {
|
|
112
|
-
|
|
76
|
+
element.current?.classList.add(...classNames);
|
|
113
77
|
}
|
|
114
78
|
}
|
|
115
79
|
}, [element.current]);
|
|
116
|
-
|
|
80
|
+
const setInlineStyles = useCallback((styles) => {
|
|
117
81
|
if (element.current) {
|
|
118
|
-
|
|
119
|
-
Object.entries(styles).forEach(
|
|
120
|
-
|
|
121
|
-
el_1.style[name] = value;
|
|
82
|
+
const el = element.current;
|
|
83
|
+
Object.entries(styles).forEach(([name, value]) => {
|
|
84
|
+
el.style[name] = value;
|
|
122
85
|
});
|
|
123
86
|
}
|
|
124
87
|
}, [element.current]);
|
|
125
|
-
|
|
88
|
+
const getConfig = useCallback(() => buildConfigTree({
|
|
126
89
|
templates: templateProps,
|
|
127
90
|
initialValuesProps: defaults,
|
|
128
91
|
predefinedValuesProps: {},
|
|
129
|
-
expectedChildren
|
|
130
|
-
}, props)
|
|
92
|
+
expectedChildren,
|
|
93
|
+
}, props), [
|
|
131
94
|
templateProps,
|
|
132
95
|
defaults,
|
|
133
96
|
expectedChildren,
|
|
134
97
|
props,
|
|
135
98
|
]);
|
|
136
|
-
|
|
137
|
-
var createDXTemplatesFn = _a.createDXTemplates, clearInstantiationModelsFn = _a.clearInstantiationModels, updateTemplatesFn = _a.updateTemplates;
|
|
99
|
+
const setTemplateManagerHooks = useCallback(({ createDXTemplates: createDXTemplatesFn, clearInstantiationModels: clearInstantiationModelsFn, updateTemplates: updateTemplatesFn, }) => {
|
|
138
100
|
createDXTemplates.current = createDXTemplatesFn;
|
|
139
101
|
clearInstantiationModels.current = clearInstantiationModelsFn;
|
|
140
102
|
updateTemplates.current = updateTemplatesFn;
|
|
@@ -143,31 +105,30 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
143
105
|
clearInstantiationModels.current,
|
|
144
106
|
updateTemplates.current,
|
|
145
107
|
]);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
ref:
|
|
108
|
+
const getElementProps = useCallback(() => {
|
|
109
|
+
const elementProps = {
|
|
110
|
+
ref: (el) => {
|
|
149
111
|
if (el) {
|
|
150
112
|
element.current = el;
|
|
151
113
|
}
|
|
152
114
|
},
|
|
153
115
|
};
|
|
154
|
-
elementPropNames.forEach(
|
|
116
|
+
elementPropNames.forEach((name) => {
|
|
155
117
|
if (name in props) {
|
|
156
118
|
elementProps[name] = props[name];
|
|
157
119
|
}
|
|
158
120
|
});
|
|
159
121
|
return elementProps;
|
|
160
122
|
}, [element.current]);
|
|
161
|
-
|
|
123
|
+
const scheduleTemplatesUpdate = useCallback(() => {
|
|
162
124
|
if (guardsUpdateScheduled.current) {
|
|
163
125
|
return;
|
|
164
126
|
}
|
|
165
127
|
guardsUpdateScheduled.current = true;
|
|
166
|
-
|
|
167
|
-
updateFunc(
|
|
168
|
-
var _a;
|
|
128
|
+
const updateFunc = useDeferUpdateForTemplates.current ? deferUpdate : requestAnimationFrame;
|
|
129
|
+
updateFunc(() => {
|
|
169
130
|
guardsUpdateScheduled.current = false;
|
|
170
|
-
|
|
131
|
+
updateTemplates.current?.(() => scheduleGuards());
|
|
171
132
|
});
|
|
172
133
|
unscheduleGuards();
|
|
173
134
|
}, [
|
|
@@ -175,25 +136,30 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
175
136
|
useDeferUpdateForTemplates.current,
|
|
176
137
|
updateTemplates.current,
|
|
177
138
|
]);
|
|
178
|
-
|
|
179
|
-
var _a, _b;
|
|
139
|
+
const createWidget = useCallback((el) => {
|
|
180
140
|
beforeCreateWidget();
|
|
181
141
|
el = el || element.current;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
142
|
+
const widgetConfig = getConfig();
|
|
143
|
+
let options = {
|
|
144
|
+
templatesRenderAsynchronously: true,
|
|
145
|
+
...optionsManager.current.getInitialOptions(widgetConfig),
|
|
146
|
+
};
|
|
147
|
+
const templateOptions = optionsManager.current.getTemplateOptions(widgetConfig);
|
|
148
|
+
const dxTemplates = createDXTemplates.current?.(templateOptions);
|
|
186
149
|
if (dxTemplates && Object.keys(dxTemplates).length) {
|
|
187
|
-
options =
|
|
150
|
+
options = {
|
|
151
|
+
...options,
|
|
152
|
+
integrationOptions: {
|
|
188
153
|
templates: dxTemplates,
|
|
189
|
-
}
|
|
154
|
+
},
|
|
155
|
+
};
|
|
190
156
|
}
|
|
191
|
-
|
|
157
|
+
clearInstantiationModels.current?.();
|
|
192
158
|
instance.current = new WidgetClass(el, options);
|
|
193
159
|
if (!useRequestAnimationFrameFlag) {
|
|
194
160
|
useDeferUpdateForTemplates.current = instance.current.option('integrationOptions.useDeferUpdateForTemplates');
|
|
195
161
|
}
|
|
196
|
-
optionsManager.current.setInstance(instance.current,
|
|
162
|
+
optionsManager.current.setInstance(instance.current, widgetConfig, subscribableOptions, independentEvents);
|
|
197
163
|
instance.current.on('optionChanged', optionsManager.current.onOptionChanged);
|
|
198
164
|
afterCreateWidget();
|
|
199
165
|
}, [
|
|
@@ -211,16 +177,15 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
211
177
|
independentEvents,
|
|
212
178
|
getConfig,
|
|
213
179
|
]);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (!((_a = optionsManager.current) === null || _a === void 0 ? void 0 : _a.isInstanceSet)) {
|
|
180
|
+
const onComponentUpdated = useCallback(() => {
|
|
181
|
+
if (!optionsManager.current?.isInstanceSet) {
|
|
217
182
|
return;
|
|
218
183
|
}
|
|
219
184
|
updateCssClasses(prevPropsRef.current, props);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
optionsManager.current.update(
|
|
185
|
+
const widgetConfig = getConfig();
|
|
186
|
+
const templateOptions = optionsManager.current.getTemplateOptions(widgetConfig);
|
|
187
|
+
const dxTemplates = createDXTemplates.current?.(templateOptions) || {};
|
|
188
|
+
optionsManager.current.update(widgetConfig, dxTemplates);
|
|
224
189
|
scheduleTemplatesUpdate();
|
|
225
190
|
prevPropsRef.current = props;
|
|
226
191
|
}, [
|
|
@@ -232,14 +197,13 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
232
197
|
getConfig,
|
|
233
198
|
props,
|
|
234
199
|
]);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
var style = props.style;
|
|
200
|
+
const onComponentMounted = useCallback(() => {
|
|
201
|
+
const { style } = props;
|
|
238
202
|
if (childElementsDetached.current) {
|
|
239
203
|
restoreTree();
|
|
240
204
|
}
|
|
241
|
-
else if (
|
|
242
|
-
childNodes.current = Array.from(
|
|
205
|
+
else if (element.current?.childNodes.length) {
|
|
206
|
+
childNodes.current = Array.from(element.current?.childNodes);
|
|
243
207
|
}
|
|
244
208
|
updateCssClasses(undefined, props);
|
|
245
209
|
if (style) {
|
|
@@ -254,12 +218,11 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
254
218
|
setInlineStyles,
|
|
255
219
|
props,
|
|
256
220
|
]);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
removalLocker === null || removalLocker === void 0 ? void 0 : removalLocker.lock();
|
|
221
|
+
const onComponentUnmounted = useCallback(() => {
|
|
222
|
+
removalLocker?.lock();
|
|
260
223
|
if (instance.current) {
|
|
261
|
-
|
|
262
|
-
|
|
224
|
+
const dxRemoveArgs = { isUnmounting: true };
|
|
225
|
+
childNodes.current?.forEach((child) => child.parentNode?.removeChild(child));
|
|
263
226
|
childElementsDetached.current = true;
|
|
264
227
|
if (element.current) {
|
|
265
228
|
events.triggerHandler(element.current, DX_REMOVE_EVENT, dxRemoveArgs);
|
|
@@ -267,7 +230,7 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
267
230
|
instance.current.dispose();
|
|
268
231
|
}
|
|
269
232
|
optionsManager.current.dispose();
|
|
270
|
-
removalLocker
|
|
233
|
+
removalLocker?.unlock();
|
|
271
234
|
}, [
|
|
272
235
|
removalLocker,
|
|
273
236
|
instance.current,
|
|
@@ -276,41 +239,41 @@ var ComponentBase = forwardRef(function (props, ref) {
|
|
|
276
239
|
optionsManager.current,
|
|
277
240
|
childElementsDetached.current,
|
|
278
241
|
]);
|
|
279
|
-
useLayoutEffect(
|
|
242
|
+
useLayoutEffect(() => {
|
|
280
243
|
onComponentMounted();
|
|
281
|
-
return
|
|
244
|
+
return () => {
|
|
282
245
|
onComponentUnmounted();
|
|
283
246
|
};
|
|
284
247
|
}, []);
|
|
285
|
-
useLayoutEffect(
|
|
248
|
+
useLayoutEffect(() => {
|
|
286
249
|
onComponentUpdated();
|
|
287
250
|
});
|
|
288
|
-
useImperativeHandle(ref,
|
|
289
|
-
getInstance
|
|
251
|
+
useImperativeHandle(ref, () => ({
|
|
252
|
+
getInstance() {
|
|
290
253
|
return instance.current;
|
|
291
254
|
},
|
|
292
|
-
getElement
|
|
255
|
+
getElement() {
|
|
293
256
|
return element.current;
|
|
294
257
|
},
|
|
295
|
-
createWidget
|
|
258
|
+
createWidget(el) {
|
|
296
259
|
createWidget(el);
|
|
297
260
|
},
|
|
298
|
-
})
|
|
299
|
-
|
|
261
|
+
}), [instance.current, element.current, createWidget]);
|
|
262
|
+
const _renderChildren = useCallback(() => {
|
|
300
263
|
if (renderChildren) {
|
|
301
264
|
return renderChildren();
|
|
302
265
|
}
|
|
303
266
|
// @ts-expect-error TS2339
|
|
304
|
-
|
|
267
|
+
const { children } = props;
|
|
305
268
|
return children;
|
|
306
269
|
}, [props, renderChildren]);
|
|
307
|
-
|
|
308
|
-
|
|
270
|
+
const renderPortal = useCallback(() => portalContainer.current && createPortal(_renderChildren(), portalContainer.current), [portalContainer.current, _renderChildren]);
|
|
271
|
+
const renderContent = useCallback(() => {
|
|
309
272
|
// @ts-expect-error TS2339
|
|
310
|
-
|
|
273
|
+
const { children } = props;
|
|
311
274
|
return isPortalComponent && children
|
|
312
275
|
? React.createElement('div', {
|
|
313
|
-
ref:
|
|
276
|
+
ref: (node) => {
|
|
314
277
|
if (node && portalContainer.current !== node) {
|
|
315
278
|
portalContainer.current = node;
|
|
316
279
|
setForceUpdateToken(Math.random());
|
package/esm/core/component.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* devextreme-react
|
|
3
|
-
* Version: 24.1.
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 24.1.3
|
|
4
|
+
* Build date: Tue Jun 11 2024
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
*
|
|
@@ -11,43 +11,31 @@
|
|
|
11
11
|
* https://github.com/DevExpress/devextreme-react
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
14
|
import * as React from 'react';
|
|
26
15
|
import { useImperativeHandle, forwardRef, useRef, useLayoutEffect, useCallback, } from 'react';
|
|
27
16
|
import { ComponentBase } from './component-base';
|
|
28
17
|
import { elementIsExtension } from './extension-component';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
const Component = forwardRef((props, ref) => {
|
|
19
|
+
const componentBaseRef = useRef(null);
|
|
20
|
+
const extensionCreators = useRef([]);
|
|
21
|
+
const registerExtension = useCallback((creator) => {
|
|
33
22
|
extensionCreators.current.push(creator);
|
|
34
23
|
}, [extensionCreators.current]);
|
|
35
|
-
|
|
36
|
-
extensionCreators.current.forEach(
|
|
24
|
+
const createExtensions = useCallback(() => {
|
|
25
|
+
extensionCreators.current.forEach((creator) => creator(componentBaseRef.current?.getElement()));
|
|
37
26
|
}, [extensionCreators.current, componentBaseRef.current]);
|
|
38
|
-
|
|
27
|
+
const renderChildren = useCallback(() => React.Children.map(
|
|
39
28
|
// @ts-expect-error TS2339
|
|
40
|
-
props.children,
|
|
29
|
+
props.children, (child) => {
|
|
41
30
|
if (child && elementIsExtension(child)) {
|
|
42
31
|
return React.cloneElement(child, { onMounted: registerExtension });
|
|
43
32
|
}
|
|
44
33
|
return child;
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(_a = componentBaseRef.current) === null || _a === void 0 ? void 0 : _a.createWidget(el);
|
|
34
|
+
}), [props, registerExtension]);
|
|
35
|
+
const createWidget = useCallback((el) => {
|
|
36
|
+
componentBaseRef.current?.createWidget(el);
|
|
49
37
|
}, [componentBaseRef.current]);
|
|
50
|
-
|
|
38
|
+
const clearExtensions = useCallback(() => {
|
|
51
39
|
if (props.clearExtensions) {
|
|
52
40
|
props.clearExtensions();
|
|
53
41
|
}
|
|
@@ -56,29 +44,27 @@ var Component = forwardRef(function (props, ref) {
|
|
|
56
44
|
extensionCreators.current,
|
|
57
45
|
props.clearExtensions,
|
|
58
46
|
]);
|
|
59
|
-
useLayoutEffect(
|
|
47
|
+
useLayoutEffect(() => {
|
|
60
48
|
createWidget();
|
|
61
49
|
createExtensions();
|
|
62
|
-
return
|
|
50
|
+
return () => {
|
|
63
51
|
clearExtensions();
|
|
64
52
|
};
|
|
65
53
|
}, []);
|
|
66
|
-
useImperativeHandle(ref,
|
|
67
|
-
getInstance
|
|
68
|
-
|
|
69
|
-
return (_a = componentBaseRef.current) === null || _a === void 0 ? void 0 : _a.getInstance();
|
|
54
|
+
useImperativeHandle(ref, () => ({
|
|
55
|
+
getInstance() {
|
|
56
|
+
return componentBaseRef.current?.getInstance();
|
|
70
57
|
},
|
|
71
|
-
getElement
|
|
72
|
-
|
|
73
|
-
return (_a = componentBaseRef.current) === null || _a === void 0 ? void 0 : _a.getElement();
|
|
58
|
+
getElement() {
|
|
59
|
+
return componentBaseRef.current?.getElement();
|
|
74
60
|
},
|
|
75
|
-
createWidget
|
|
61
|
+
createWidget(el) {
|
|
76
62
|
createWidget(el);
|
|
77
63
|
},
|
|
78
|
-
clearExtensions
|
|
64
|
+
clearExtensions() {
|
|
79
65
|
clearExtensions();
|
|
80
66
|
},
|
|
81
|
-
})
|
|
82
|
-
return (React.createElement(ComponentBase,
|
|
67
|
+
}), [componentBaseRef.current, createWidget, clearExtensions]);
|
|
68
|
+
return (React.createElement(ComponentBase, { ref: componentBaseRef, renderChildren: renderChildren, ...props }));
|
|
83
69
|
});
|
|
84
70
|
export { Component, };
|
package/esm/core/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* devextreme-react
|
|
3
|
-
* Version: 24.1.
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 24.1.3
|
|
4
|
+
* Build date: Tue Jun 11 2024
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
*
|
|
@@ -11,22 +11,11 @@
|
|
|
11
11
|
* https://github.com/DevExpress/devextreme-react
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
var config = {
|
|
14
|
+
let config = {
|
|
26
15
|
useLegacyTemplateEngine: false,
|
|
27
16
|
};
|
|
28
17
|
function setOptions(options) {
|
|
29
|
-
config =
|
|
18
|
+
config = { ...config, ...options };
|
|
30
19
|
}
|
|
31
20
|
function getOption(optionName) {
|
|
32
21
|
return config[optionName];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* devextreme-react
|
|
3
|
-
* Version: 24.1.
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 24.1.3
|
|
4
|
+
* Build date: Tue Jun 11 2024
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
*
|
|
@@ -14,24 +14,24 @@
|
|
|
14
14
|
import { buildNode, buildTemplates } from './tree';
|
|
15
15
|
import { mergeNameParts } from './utils';
|
|
16
16
|
function compareTemplates(current, prev, changesAccum) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const currentTemplatesOptions = {};
|
|
18
|
+
const currentTemplates = {};
|
|
19
|
+
const prevTemplatesOptions = {};
|
|
20
|
+
const prevTemplates = {};
|
|
21
21
|
buildTemplates(current, currentTemplatesOptions, currentTemplates);
|
|
22
22
|
buildTemplates(prev, prevTemplatesOptions, prevTemplates);
|
|
23
23
|
changesAccum.addRemovedValues(currentTemplatesOptions, prevTemplatesOptions, current.fullName);
|
|
24
24
|
// TODO: support switching to default templates
|
|
25
25
|
// appendRemovedValues(currentTemplates, prevTemplates, "", changesAccum.templates);
|
|
26
|
-
Object.keys(currentTemplatesOptions).forEach(
|
|
26
|
+
Object.keys(currentTemplatesOptions).forEach((key) => {
|
|
27
27
|
if (currentTemplatesOptions[key] === prevTemplatesOptions[key]) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
changesAccum.options[mergeNameParts(current.fullName, key)] = currentTemplatesOptions[key];
|
|
31
31
|
});
|
|
32
|
-
Object.keys(currentTemplates).forEach(
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
Object.keys(currentTemplates).forEach((key) => {
|
|
33
|
+
const currentTemplate = currentTemplates[key];
|
|
34
|
+
const prevTemplate = prevTemplates[key];
|
|
35
35
|
if (prevTemplate && currentTemplate.content === prevTemplate.content) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -48,10 +48,10 @@ function compare(current, prev, changesAccum) {
|
|
|
48
48
|
changesAccum.addRemovedValues(current.configs, prev.configs, current.fullName);
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
50
50
|
compareCollections(current, prev, changesAccum);
|
|
51
|
-
Object.keys(current.configs).forEach(
|
|
51
|
+
Object.keys(current.configs).forEach((key) => {
|
|
52
52
|
compare(current.configs[key], prev.configs[key], changesAccum);
|
|
53
53
|
});
|
|
54
|
-
Object.keys(current.options).forEach(
|
|
54
|
+
Object.keys(current.options).forEach((key) => {
|
|
55
55
|
if (current.options[key] === prev.options[key]) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
@@ -60,17 +60,17 @@ function compare(current, prev, changesAccum) {
|
|
|
60
60
|
compareTemplates(current, prev, changesAccum);
|
|
61
61
|
}
|
|
62
62
|
function appendRemovedValues(current, prev, path, changesAccum) {
|
|
63
|
-
|
|
64
|
-
removedKeys.forEach(
|
|
63
|
+
const removedKeys = Object.keys(prev).filter((key) => !Object.keys(current).includes(key));
|
|
64
|
+
removedKeys.forEach((key) => {
|
|
65
65
|
changesAccum.push(mergeNameParts(path, key));
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
function getChanges(current, prev) {
|
|
69
|
-
|
|
69
|
+
const changesAccum = {
|
|
70
70
|
options: {},
|
|
71
71
|
removedOptions: [],
|
|
72
72
|
templates: {},
|
|
73
|
-
addRemovedValues
|
|
73
|
+
addRemovedValues(currentOptions, prevOptions, path) {
|
|
74
74
|
appendRemovedValues(currentOptions, prevOptions, path, this.removedOptions);
|
|
75
75
|
},
|
|
76
76
|
};
|
|
@@ -78,19 +78,19 @@ function getChanges(current, prev) {
|
|
|
78
78
|
return changesAccum;
|
|
79
79
|
}
|
|
80
80
|
function compareCollections(current, prev, changesAccum) {
|
|
81
|
-
Object.keys(current.configCollections).forEach(
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
Object.keys(current.configCollections).forEach((key) => {
|
|
82
|
+
const currentCollection = current.configCollections[key];
|
|
83
|
+
const prevCollection = prev.configCollections[key] || [];
|
|
84
84
|
if (!currentCollection || currentCollection.length !== prevCollection.length) {
|
|
85
|
-
|
|
86
|
-
currentCollection.forEach(
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
const updatedCollection = [];
|
|
86
|
+
currentCollection.forEach((item) => {
|
|
87
|
+
const config = buildNode(item, changesAccum.templates, true);
|
|
88
|
+
updatedCollection.push(config);
|
|
89
89
|
});
|
|
90
|
-
changesAccum.options[mergeNameParts(current.fullName, key)] =
|
|
90
|
+
changesAccum.options[mergeNameParts(current.fullName, key)] = updatedCollection;
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
for (
|
|
93
|
+
for (let i = 0; i < currentCollection.length; i += 1) {
|
|
94
94
|
compare(currentCollection[i], prevCollection[i], changesAccum);
|
|
95
95
|
}
|
|
96
96
|
});
|