devextreme-react 23.2.6 → 24.1.2-beta
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/cjs/accordion.d.ts +35 -48
- package/cjs/accordion.js +63 -118
- package/cjs/action-sheet.d.ts +27 -43
- package/cjs/action-sheet.js +54 -95
- package/cjs/autocomplete.d.ts +62 -192
- package/cjs/autocomplete.js +181 -352
- package/cjs/bar-gauge.d.ts +80 -292
- package/cjs/bar-gauge.js +210 -353
- package/cjs/box.d.ts +25 -42
- package/cjs/box.js +53 -113
- package/cjs/bullet.d.ts +35 -80
- package/cjs/bullet.js +82 -148
- package/cjs/button-group.d.ts +17 -43
- package/cjs/button-group.js +54 -112
- package/cjs/button.d.ts +14 -19
- package/cjs/button.js +36 -88
- package/cjs/calendar.d.ts +14 -24
- package/cjs/calendar.js +41 -180
- package/cjs/chart.d.ts +297 -1146
- package/cjs/chart.js +707 -1059
- package/cjs/check-box.d.ts +14 -16
- package/cjs/check-box.js +34 -101
- package/cjs/circular-gauge.d.ts +86 -287
- package/cjs/circular-gauge.js +226 -332
- package/cjs/color-box.d.ts +59 -175
- package/cjs/color-box.js +165 -312
- 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 +71 -148
- package/cjs/context-menu.js +151 -279
- package/cjs/core/component-base.d.ts +18 -47
- package/cjs/core/component-base.js +261 -185
- package/cjs/core/component.d.ts +26 -13
- package/cjs/core/component.js +73 -58
- package/cjs/core/config.d.ts +2 -2
- package/cjs/core/config.js +2 -2
- package/cjs/core/configuration/comparer.d.ts +2 -2
- package/cjs/core/configuration/comparer.js +10 -10
- package/cjs/core/configuration/config-node.d.ts +2 -3
- package/cjs/core/configuration/config-node.js +2 -2
- package/cjs/core/configuration/react/element.d.ts +12 -4
- package/cjs/core/configuration/react/element.js +4 -5
- package/cjs/core/configuration/react/templates.d.ts +2 -2
- package/cjs/core/configuration/react/templates.js +2 -8
- package/cjs/core/configuration/react/tree.d.ts +2 -2
- package/cjs/core/configuration/react/tree.js +13 -9
- package/cjs/core/configuration/tree.d.ts +2 -2
- package/cjs/core/configuration/tree.js +5 -6
- package/cjs/core/configuration/utils.d.ts +2 -2
- package/cjs/core/configuration/utils.js +2 -2
- package/cjs/core/extension-component.d.ts +14 -7
- package/cjs/core/extension-component.js +69 -29
- package/cjs/core/helpers.d.ts +4 -3
- package/cjs/core/helpers.js +8 -9
- package/cjs/core/nested-option.d.ts +3 -5
- package/cjs/core/nested-option.js +16 -34
- package/cjs/core/options-manager.d.ts +3 -2
- package/cjs/core/options-manager.js +30 -18
- package/cjs/core/template-manager.d.ts +2 -2
- package/cjs/core/template-manager.js +20 -16
- package/cjs/core/template-wrapper.d.ts +2 -2
- package/cjs/core/template-wrapper.js +18 -14
- package/cjs/core/template.d.ts +3 -7
- package/cjs/core/template.js +4 -61
- package/cjs/core/types.d.ts +8 -8
- package/cjs/core/types.js +2 -2
- package/cjs/core/widget-config.d.ts +2 -2
- package/cjs/core/widget-config.js +23 -6
- package/cjs/data-grid.d.ts +317 -1057
- package/cjs/data-grid.js +752 -1112
- package/cjs/date-box.d.ts +65 -202
- package/cjs/date-box.js +179 -386
- package/cjs/date-range-box.d.ts +65 -203
- package/cjs/date-range-box.js +181 -373
- package/cjs/defer-rendering.d.ts +41 -93
- package/cjs/defer-rendering.js +93 -151
- package/cjs/diagram.d.ts +92 -307
- package/cjs/diagram.js +263 -408
- package/cjs/draggable.d.ts +17 -30
- package/cjs/draggable.js +45 -89
- package/cjs/drawer.d.ts +14 -23
- package/cjs/drawer.js +40 -102
- package/cjs/drop-down-box.d.ts +59 -175
- package/cjs/drop-down-box.js +169 -319
- package/cjs/drop-down-button.d.ts +58 -160
- package/cjs/drop-down-button.js +157 -256
- package/cjs/file-manager.d.ts +50 -128
- package/cjs/file-manager.js +123 -220
- package/cjs/file-uploader.d.ts +14 -16
- package/cjs/file-uploader.js +34 -127
- package/cjs/filter-builder.d.ts +32 -86
- package/cjs/filter-builder.js +86 -147
- package/cjs/form.d.ts +94 -347
- package/cjs/form.js +273 -398
- package/cjs/funnel.d.ts +95 -358
- package/cjs/funnel.js +239 -412
- package/cjs/gallery.d.ts +29 -44
- package/cjs/gallery.js +55 -107
- package/cjs/gantt.d.ts +89 -294
- package/cjs/gantt.js +252 -420
- package/cjs/html-editor.d.ts +50 -164
- package/cjs/html-editor.js +143 -262
- package/cjs/index.d.ts +3 -2
- package/cjs/index.js +5 -3
- package/cjs/linear-gauge.d.ts +89 -288
- package/cjs/linear-gauge.js +226 -335
- package/cjs/list.d.ts +49 -118
- package/cjs/list.js +115 -277
- package/cjs/load-indicator.d.ts +14 -12
- package/cjs/load-indicator.js +30 -56
- package/cjs/load-panel.d.ts +47 -99
- package/cjs/load-panel.js +111 -221
- package/cjs/lookup.d.ts +62 -182
- package/cjs/lookup.js +174 -364
- package/cjs/map.d.ts +32 -80
- package/cjs/map.js +85 -164
- package/cjs/menu.d.ts +69 -171
- package/cjs/menu.js +153 -286
- package/cjs/multi-view.d.ts +29 -44
- package/cjs/multi-view.js +55 -101
- package/cjs/number-box.d.ts +23 -53
- package/cjs/number-box.js +62 -183
- package/cjs/pie-chart.d.ts +119 -481
- package/cjs/pie-chart.js +309 -520
- package/cjs/pivot-grid-field-chooser.d.ts +29 -61
- package/cjs/pivot-grid-field-chooser.js +67 -129
- package/cjs/pivot-grid.d.ts +53 -137
- package/cjs/pivot-grid.js +125 -225
- package/cjs/polar-chart.d.ts +228 -882
- package/cjs/polar-chart.js +544 -828
- package/cjs/popover.d.ts +56 -142
- package/cjs/popover.js +150 -270
- package/cjs/popup.d.ts +48 -124
- package/cjs/popup.js +136 -261
- package/cjs/progress-bar.d.ts +14 -16
- package/cjs/progress-bar.js +34 -98
- package/cjs/radio-group.d.ts +17 -42
- package/cjs/radio-group.js +53 -132
- package/cjs/range-selector.d.ts +194 -671
- package/cjs/range-selector.js +455 -646
- package/cjs/range-slider.d.ts +23 -51
- package/cjs/range-slider.js +60 -145
- package/cjs/recurrence-editor.d.ts +14 -16
- package/cjs/recurrence-editor.js +34 -95
- package/cjs/resizable.d.ts +14 -17
- package/cjs/resizable.js +35 -75
- package/cjs/responsive-box.d.ts +34 -71
- package/cjs/responsive-box.js +78 -122
- package/cjs/sankey.d.ts +71 -240
- package/cjs/sankey.js +180 -321
- package/cjs/scheduler.d.ts +29 -96
- package/cjs/scheduler.js +127 -290
- package/cjs/scroll-view.d.ts +14 -12
- package/cjs/scroll-view.js +30 -82
- package/cjs/select-box.d.ts +62 -193
- package/cjs/select-box.js +186 -366
- package/cjs/slider.d.ts +23 -51
- package/cjs/slider.js +60 -142
- package/cjs/sortable.d.ts +17 -30
- package/cjs/sortable.js +45 -110
- package/cjs/sparkline.d.ts +35 -80
- package/cjs/sparkline.js +82 -183
- package/cjs/speed-dial-action.d.ts +14 -12
- package/cjs/speed-dial-action.js +30 -54
- package/cjs/splitter.d.ts +79 -0
- package/cjs/splitter.js +99 -0
- package/cjs/switch.d.ts +14 -16
- package/cjs/switch.js +34 -98
- package/cjs/tab-panel.d.ts +31 -46
- package/cjs/tab-panel.js +61 -140
- package/cjs/tabs.d.ts +33 -46
- package/cjs/tabs.js +57 -138
- package/cjs/tag-box.d.ts +62 -194
- package/cjs/tag-box.js +191 -390
- package/cjs/text-area.d.ts +14 -16
- package/cjs/text-area.js +34 -141
- package/cjs/text-box.d.ts +20 -45
- package/cjs/text-box.js +55 -182
- package/cjs/tile-view.d.ts +25 -42
- package/cjs/tile-view.js +53 -112
- package/cjs/toast.d.ts +47 -106
- package/cjs/toast.js +117 -223
- package/cjs/toolbar.d.ts +27 -44
- package/cjs/toolbar.js +59 -92
- package/cjs/tooltip.d.ts +53 -124
- package/cjs/tooltip.js +133 -243
- package/cjs/tree-list.d.ts +274 -909
- package/cjs/tree-list.js +644 -996
- package/cjs/tree-map.d.ts +77 -257
- package/cjs/tree-map.js +191 -326
- package/cjs/tree-view.d.ts +34 -81
- package/cjs/tree-view.js +82 -229
- package/cjs/validation-group.d.ts +14 -12
- package/cjs/validation-group.js +30 -51
- package/cjs/validation-summary.d.ts +25 -42
- package/cjs/validation-summary.js +53 -71
- package/cjs/validator.d.ts +48 -142
- package/cjs/validator.js +142 -187
- package/cjs/vector-map.d.ts +92 -347
- package/cjs/vector-map.js +244 -384
- package/esm/accordion.js +58 -117
- package/esm/action-sheet.js +49 -94
- package/esm/autocomplete.js +176 -351
- package/esm/bar-gauge.js +205 -352
- package/esm/box.js +48 -112
- package/esm/bullet.js +77 -147
- package/esm/button-group.js +49 -111
- package/esm/button.js +31 -87
- package/esm/calendar.js +36 -179
- package/esm/chart.js +702 -1058
- package/esm/check-box.js +29 -100
- package/esm/circular-gauge.js +221 -331
- package/esm/color-box.js +160 -311
- 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 +146 -278
- package/esm/core/component-base.js +256 -184
- package/esm/core/component.js +69 -58
- package/esm/core/config.js +2 -2
- package/esm/core/configuration/comparer.js +2 -2
- package/esm/core/configuration/config-node.js +2 -2
- package/esm/core/configuration/react/element.js +5 -5
- package/esm/core/configuration/react/templates.js +2 -8
- package/esm/core/configuration/react/tree.js +3 -3
- package/esm/core/configuration/tree.js +2 -2
- package/esm/core/configuration/utils.js +2 -2
- package/esm/core/extension-component.js +45 -29
- package/esm/core/helpers.js +7 -8
- package/esm/core/nested-option.js +11 -33
- package/esm/core/options-manager.js +22 -10
- package/esm/core/template-manager.js +3 -3
- package/esm/core/template-wrapper.js +2 -2
- package/esm/core/template.js +4 -42
- package/esm/core/types.js +2 -2
- package/esm/core/widget-config.js +23 -6
- package/esm/data-grid.js +748 -1112
- package/esm/date-box.js +174 -385
- package/esm/date-range-box.js +176 -372
- package/esm/defer-rendering.js +88 -150
- package/esm/diagram.js +258 -407
- package/esm/draggable.js +40 -88
- package/esm/drawer.js +35 -101
- package/esm/drop-down-box.js +164 -318
- package/esm/drop-down-button.js +152 -255
- package/esm/file-manager.js +118 -219
- package/esm/file-uploader.js +29 -126
- package/esm/filter-builder.js +81 -146
- package/esm/form.js +268 -397
- package/esm/funnel.js +234 -411
- package/esm/gallery.js +50 -106
- package/esm/gantt.js +247 -419
- package/esm/html-editor.js +138 -261
- package/esm/index.js +3 -2
- package/esm/linear-gauge.js +221 -334
- package/esm/list.js +110 -276
- package/esm/load-indicator.js +25 -55
- package/esm/load-panel.js +106 -220
- package/esm/lookup.js +169 -363
- package/esm/map.js +80 -163
- package/esm/menu.js +148 -285
- package/esm/multi-view.js +50 -100
- package/esm/number-box.js +57 -182
- package/esm/pie-chart.js +304 -519
- package/esm/pivot-grid-field-chooser.js +62 -128
- package/esm/pivot-grid.js +120 -224
- package/esm/polar-chart.js +539 -827
- package/esm/popover.js +145 -269
- package/esm/popup.js +131 -260
- package/esm/progress-bar.js +29 -97
- package/esm/radio-group.js +48 -131
- package/esm/range-selector.js +450 -645
- package/esm/range-slider.js +55 -144
- package/esm/recurrence-editor.js +29 -94
- package/esm/resizable.js +30 -74
- package/esm/responsive-box.js +73 -121
- package/esm/sankey.js +175 -320
- package/esm/scheduler.js +122 -289
- package/esm/scroll-view.js +25 -81
- package/esm/select-box.js +181 -365
- package/esm/slider.js +55 -141
- package/esm/sortable.js +40 -109
- package/esm/sparkline.js +77 -182
- package/esm/speed-dial-action.js +25 -53
- package/esm/splitter.js +69 -0
- package/esm/switch.js +29 -97
- package/esm/tab-panel.js +56 -139
- package/esm/tabs.js +52 -137
- package/esm/tag-box.js +186 -389
- package/esm/text-area.js +29 -140
- package/esm/text-box.js +50 -181
- package/esm/tile-view.js +48 -111
- package/esm/toast.js +112 -222
- package/esm/toolbar.js +54 -91
- package/esm/tooltip.js +128 -242
- package/esm/tree-list.js +639 -995
- package/esm/tree-map.js +186 -325
- package/esm/tree-view.js +77 -228
- package/esm/validation-group.js +25 -50
- package/esm/validation-summary.js +48 -70
- package/esm/validator.js +137 -186
- package/esm/vector-map.js +239 -383
- package/package.json +4 -4
- package/splitter/package.json +6 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* devextreme-react
|
|
3
|
-
* Version:
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 24.1.2-beta
|
|
4
|
+
* Build date: Mon May 13 2024
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
*
|
|
@@ -11,21 +11,6 @@
|
|
|
11
11
|
* https://github.com/DevExpress/devextreme-react
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __extends = (this && this.__extends) || (function () {
|
|
15
|
-
var extendStatics = function (d, b) {
|
|
16
|
-
extendStatics = Object.setPrototypeOf ||
|
|
17
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
19
|
-
return extendStatics(d, b);
|
|
20
|
-
};
|
|
21
|
-
return function (d, b) {
|
|
22
|
-
if (typeof b !== "function" && b !== null)
|
|
23
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
24
|
-
extendStatics(d, b);
|
|
25
|
-
function __() { this.constructor = d; }
|
|
26
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
27
|
-
};
|
|
28
|
-
})();
|
|
29
14
|
var __assign = (this && this.__assign) || function () {
|
|
30
15
|
__assign = Object.assign || function(t) {
|
|
31
16
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -53,210 +38,297 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
53
38
|
}
|
|
54
39
|
return ar;
|
|
55
40
|
};
|
|
56
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
57
|
-
for (var i = 0,
|
|
58
|
-
|
|
59
|
-
|
|
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));
|
|
60
49
|
};
|
|
61
|
-
import * as events from 'devextreme/events';
|
|
62
50
|
import * as React from 'react';
|
|
63
|
-
import
|
|
51
|
+
import * as events from 'devextreme/events';
|
|
52
|
+
import { useContext, useImperativeHandle, forwardRef, useRef, useLayoutEffect, useCallback, useState, } from 'react';
|
|
64
53
|
import { requestAnimationFrame } from 'devextreme/animation/frame';
|
|
65
54
|
import { deferUpdate } from 'devextreme/core/utils/common';
|
|
66
|
-
import {
|
|
55
|
+
import { createPortal } from 'react-dom';
|
|
56
|
+
import { RemovalLockerContext, RestoreTreeContext } from './helpers';
|
|
67
57
|
import { OptionsManager, scheduleGuards, unscheduleGuards } from './options-manager';
|
|
68
58
|
import { elementPropNames, getClassName } from './widget-config';
|
|
69
59
|
import { buildConfigTree } from './configuration/react/tree';
|
|
70
|
-
import {
|
|
71
|
-
import { RemovalLockerContext } from './helpers';
|
|
60
|
+
import { TemplateManager } from './template-manager';
|
|
72
61
|
var DX_REMOVE_EVENT = 'dxremove';
|
|
73
|
-
var ComponentBase =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
width: '100%',
|
|
92
|
-
height: '100%',
|
|
93
|
-
padding: 0,
|
|
94
|
-
margin: 0,
|
|
95
|
-
}
|
|
96
|
-
: { display: 'contents' };
|
|
97
|
-
};
|
|
98
|
-
ComponentBase.prototype.componentDidMount = function () {
|
|
62
|
+
var ComponentBase = forwardRef(function (props, ref) {
|
|
63
|
+
var _a = props.templateProps, templateProps = _a === void 0 ? [] : _a, _b = props.defaults, defaults = _b === void 0 ? {} : _b, _c = props.expectedChildren, expectedChildren = _c === void 0 ? {} : _c, _d = props.isPortalComponent, isPortalComponent = _d === void 0 ? false : _d, _e = props.useRequestAnimationFrameFlag, useRequestAnimationFrameFlag = _e === void 0 ? false : _e, _f = props.subscribableOptions, subscribableOptions = _f === void 0 ? [] : _f, WidgetClass = props.WidgetClass, _g = props.independentEvents, independentEvents = _g === void 0 ? [] : _g, renderChildren = props.renderChildren, _h = props.beforeCreateWidget, beforeCreateWidget = _h === void 0 ? function () { return undefined; } : _h, _j = props.afterCreateWidget, afterCreateWidget = _j === void 0 ? function () { return undefined; } : _j;
|
|
64
|
+
var _k = __read(useState(0), 2), setForceUpdateToken = _k[1];
|
|
65
|
+
var removalLocker = useContext(RemovalLockerContext);
|
|
66
|
+
var restoreParentLink = useContext(RestoreTreeContext);
|
|
67
|
+
var instance = useRef();
|
|
68
|
+
var element = useRef();
|
|
69
|
+
var portalContainer = useRef();
|
|
70
|
+
var useDeferUpdateForTemplates = useRef(false);
|
|
71
|
+
var guardsUpdateScheduled = useRef(false);
|
|
72
|
+
var childElementsDetached = useRef(false);
|
|
73
|
+
var optionsManager = useRef(new OptionsManager());
|
|
74
|
+
var childNodes = useRef();
|
|
75
|
+
var createDXTemplates = useRef();
|
|
76
|
+
var clearInstantiationModels = useRef();
|
|
77
|
+
var updateTemplates = useRef();
|
|
78
|
+
var prevPropsRef = useRef();
|
|
79
|
+
var restoreTree = useCallback(function () {
|
|
99
80
|
var _a;
|
|
100
81
|
var _b;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
else if (this._element.childNodes.length) {
|
|
106
|
-
this._childNodes = Array.from(this._element.childNodes);
|
|
82
|
+
if (((_b = childNodes.current) === null || _b === void 0 ? void 0 : _b.length) && element.current) {
|
|
83
|
+
(_a = element.current).append.apply(_a, __spreadArray([], __read(childNodes.current), false));
|
|
84
|
+
childElementsDetached.current = false;
|
|
107
85
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this._setInlineStyles(style);
|
|
86
|
+
if (restoreParentLink && element.current && !element.current.isConnected) {
|
|
87
|
+
restoreParentLink();
|
|
111
88
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this._optionsManager.update(config, dxTemplates);
|
|
120
|
-
this._scheduleTemplatesUpdate();
|
|
121
|
-
};
|
|
122
|
-
ComponentBase.prototype.componentWillUnmount = function () {
|
|
123
|
-
var _a;
|
|
124
|
-
this._lockParentOnRemoved();
|
|
125
|
-
if (this._instance) {
|
|
126
|
-
var dxRemoveArgs = { isUnmounting: true };
|
|
127
|
-
(_a = this._childNodes) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(child); });
|
|
128
|
-
events.triggerHandler(this._element, DX_REMOVE_EVENT, dxRemoveArgs);
|
|
129
|
-
this._instance.dispose();
|
|
130
|
-
}
|
|
131
|
-
this._optionsManager.dispose();
|
|
132
|
-
this._unlockParentOnRemoved();
|
|
133
|
-
};
|
|
134
|
-
ComponentBase.prototype._createWidget = function (element) {
|
|
89
|
+
}, [
|
|
90
|
+
childNodes.current,
|
|
91
|
+
element.current,
|
|
92
|
+
childElementsDetached.current,
|
|
93
|
+
restoreParentLink,
|
|
94
|
+
]);
|
|
95
|
+
var updateCssClasses = useCallback(function (prevProps, newProps) {
|
|
135
96
|
var _a, _b;
|
|
136
|
-
|
|
137
|
-
var
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (dxTemplates && Object.keys(dxTemplates).length) {
|
|
142
|
-
options = __assign(__assign({}, options), { integrationOptions: {
|
|
143
|
-
templates: dxTemplates,
|
|
144
|
-
} });
|
|
97
|
+
var _c, _d;
|
|
98
|
+
var prevClassName = prevProps ? getClassName(prevProps) : undefined;
|
|
99
|
+
var newClassName = getClassName(newProps);
|
|
100
|
+
if (prevClassName === newClassName) {
|
|
101
|
+
return;
|
|
145
102
|
}
|
|
146
|
-
(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
103
|
+
if (prevClassName) {
|
|
104
|
+
var classNames = prevClassName.split(' ').filter(function (c) { return c; });
|
|
105
|
+
if (classNames.length) {
|
|
106
|
+
(_c = element.current) === null || _c === void 0 ? void 0 : (_a = _c.classList).remove.apply(_a, __spreadArray([], __read(classNames), false));
|
|
107
|
+
}
|
|
150
108
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (this.guardsUpdateScheduled) {
|
|
157
|
-
return;
|
|
109
|
+
if (newClassName) {
|
|
110
|
+
var classNames = newClassName.split(' ').filter(function (c) { return c; });
|
|
111
|
+
if (classNames.length) {
|
|
112
|
+
(_d = element.current) === null || _d === void 0 ? void 0 : (_b = _d.classList).add.apply(_b, __spreadArray([], __read(classNames), false));
|
|
113
|
+
}
|
|
158
114
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
115
|
+
}, [element.current]);
|
|
116
|
+
var setInlineStyles = useCallback(function (styles) {
|
|
117
|
+
if (element.current) {
|
|
118
|
+
var el_1 = element.current;
|
|
119
|
+
Object.entries(styles).forEach(function (_a) {
|
|
120
|
+
var _b = __read(_a, 2), name = _b[0], value = _b[1];
|
|
121
|
+
el_1.style[name] = value;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}, [element.current]);
|
|
125
|
+
var getConfig = useCallback(function () { return buildConfigTree({
|
|
126
|
+
templates: templateProps,
|
|
127
|
+
initialValuesProps: defaults,
|
|
128
|
+
predefinedValuesProps: {},
|
|
129
|
+
expectedChildren: expectedChildren,
|
|
130
|
+
}, props); }, [
|
|
131
|
+
templateProps,
|
|
132
|
+
defaults,
|
|
133
|
+
expectedChildren,
|
|
134
|
+
props,
|
|
135
|
+
]);
|
|
136
|
+
var setTemplateManagerHooks = useCallback(function (_a) {
|
|
137
|
+
var createDXTemplatesFn = _a.createDXTemplates, clearInstantiationModelsFn = _a.clearInstantiationModels, updateTemplatesFn = _a.updateTemplates;
|
|
138
|
+
createDXTemplates.current = createDXTemplatesFn;
|
|
139
|
+
clearInstantiationModels.current = clearInstantiationModelsFn;
|
|
140
|
+
updateTemplates.current = updateTemplatesFn;
|
|
141
|
+
}, [
|
|
142
|
+
createDXTemplates.current,
|
|
143
|
+
clearInstantiationModels.current,
|
|
144
|
+
updateTemplates.current,
|
|
145
|
+
]);
|
|
146
|
+
var getElementProps = useCallback(function () {
|
|
178
147
|
var elementProps = {
|
|
179
|
-
ref: function (
|
|
148
|
+
ref: function (el) {
|
|
149
|
+
if (el) {
|
|
150
|
+
element.current = el;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
180
153
|
};
|
|
181
154
|
elementPropNames.forEach(function (name) {
|
|
182
|
-
var props = _this.props;
|
|
183
155
|
if (name in props) {
|
|
184
156
|
elementProps[name] = props[name];
|
|
185
157
|
}
|
|
186
158
|
});
|
|
187
159
|
return elementProps;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
160
|
+
}, [element.current]);
|
|
161
|
+
var scheduleTemplatesUpdate = useCallback(function () {
|
|
162
|
+
if (guardsUpdateScheduled.current) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
guardsUpdateScheduled.current = true;
|
|
166
|
+
var updateFunc = useDeferUpdateForTemplates.current ? deferUpdate : requestAnimationFrame;
|
|
167
|
+
updateFunc(function () {
|
|
168
|
+
var _a;
|
|
169
|
+
guardsUpdateScheduled.current = false;
|
|
170
|
+
(_a = updateTemplates.current) === null || _a === void 0 ? void 0 : _a.call(updateTemplates, function () { return scheduleGuards(); });
|
|
194
171
|
});
|
|
195
|
-
|
|
196
|
-
|
|
172
|
+
unscheduleGuards();
|
|
173
|
+
}, [
|
|
174
|
+
guardsUpdateScheduled.current,
|
|
175
|
+
useDeferUpdateForTemplates.current,
|
|
176
|
+
updateTemplates.current,
|
|
177
|
+
]);
|
|
178
|
+
var createWidget = useCallback(function (el) {
|
|
197
179
|
var _a, _b;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
180
|
+
beforeCreateWidget();
|
|
181
|
+
el = el || element.current;
|
|
182
|
+
var config = getConfig();
|
|
183
|
+
var options = __assign({ templatesRenderAsynchronously: true }, optionsManager.current.getInitialOptions(config));
|
|
184
|
+
var templateOptions = optionsManager.current.getTemplateOptions(config);
|
|
185
|
+
var dxTemplates = (_a = createDXTemplates.current) === null || _a === void 0 ? void 0 : _a.call(createDXTemplates, templateOptions);
|
|
186
|
+
if (dxTemplates && Object.keys(dxTemplates).length) {
|
|
187
|
+
options = __assign(__assign({}, options), { integrationOptions: {
|
|
188
|
+
templates: dxTemplates,
|
|
189
|
+
} });
|
|
190
|
+
}
|
|
191
|
+
(_b = clearInstantiationModels.current) === null || _b === void 0 ? void 0 : _b.call(clearInstantiationModels);
|
|
192
|
+
instance.current = new WidgetClass(el, options);
|
|
193
|
+
if (!useRequestAnimationFrameFlag) {
|
|
194
|
+
useDeferUpdateForTemplates.current = instance.current.option('integrationOptions.useDeferUpdateForTemplates');
|
|
195
|
+
}
|
|
196
|
+
optionsManager.current.setInstance(instance.current, config, subscribableOptions, independentEvents);
|
|
197
|
+
instance.current.on('optionChanged', optionsManager.current.onOptionChanged);
|
|
198
|
+
afterCreateWidget();
|
|
199
|
+
}, [
|
|
200
|
+
beforeCreateWidget,
|
|
201
|
+
afterCreateWidget,
|
|
202
|
+
element.current,
|
|
203
|
+
optionsManager.current,
|
|
204
|
+
createDXTemplates.current,
|
|
205
|
+
clearInstantiationModels.current,
|
|
206
|
+
WidgetClass,
|
|
207
|
+
useRequestAnimationFrameFlag,
|
|
208
|
+
useDeferUpdateForTemplates.current,
|
|
209
|
+
instance.current,
|
|
210
|
+
subscribableOptions,
|
|
211
|
+
independentEvents,
|
|
212
|
+
getConfig,
|
|
213
|
+
]);
|
|
214
|
+
var onComponentUpdated = useCallback(function () {
|
|
215
|
+
var _a, _b;
|
|
216
|
+
if (!((_a = optionsManager.current) === null || _a === void 0 ? void 0 : _a.isInstanceSet)) {
|
|
201
217
|
return;
|
|
202
218
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
updateCssClasses(prevPropsRef.current, props);
|
|
220
|
+
var config = getConfig();
|
|
221
|
+
var templateOptions = optionsManager.current.getTemplateOptions(config);
|
|
222
|
+
var dxTemplates = ((_b = createDXTemplates.current) === null || _b === void 0 ? void 0 : _b.call(createDXTemplates, templateOptions)) || {};
|
|
223
|
+
optionsManager.current.update(config, dxTemplates);
|
|
224
|
+
scheduleTemplatesUpdate();
|
|
225
|
+
prevPropsRef.current = props;
|
|
226
|
+
}, [
|
|
227
|
+
optionsManager.current,
|
|
228
|
+
prevPropsRef.current,
|
|
229
|
+
createDXTemplates.current,
|
|
230
|
+
scheduleTemplatesUpdate,
|
|
231
|
+
updateCssClasses,
|
|
232
|
+
getConfig,
|
|
233
|
+
props,
|
|
234
|
+
]);
|
|
235
|
+
var onComponentMounted = useCallback(function () {
|
|
236
|
+
var _a, _b;
|
|
237
|
+
var style = props.style;
|
|
238
|
+
if (childElementsDetached.current) {
|
|
239
|
+
restoreTree();
|
|
208
240
|
}
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
if (classNames.length) {
|
|
212
|
-
(_b = this._element.classList).add.apply(_b, __spreadArray([], __read(classNames)));
|
|
213
|
-
}
|
|
241
|
+
else if ((_a = element.current) === null || _a === void 0 ? void 0 : _a.childNodes.length) {
|
|
242
|
+
childNodes.current = Array.from((_b = element.current) === null || _b === void 0 ? void 0 : _b.childNodes);
|
|
214
243
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
244
|
+
updateCssClasses(undefined, props);
|
|
245
|
+
if (style) {
|
|
246
|
+
setInlineStyles(style);
|
|
247
|
+
}
|
|
248
|
+
prevPropsRef.current = props;
|
|
249
|
+
}, [
|
|
250
|
+
childNodes.current,
|
|
251
|
+
element.current,
|
|
252
|
+
childElementsDetached.current,
|
|
253
|
+
updateCssClasses,
|
|
254
|
+
setInlineStyles,
|
|
255
|
+
props,
|
|
256
|
+
]);
|
|
257
|
+
var onComponentUnmounted = useCallback(function () {
|
|
221
258
|
var _a;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
259
|
+
removalLocker === null || removalLocker === void 0 ? void 0 : removalLocker.lock();
|
|
260
|
+
if (instance.current) {
|
|
261
|
+
var dxRemoveArgs = { isUnmounting: true };
|
|
262
|
+
(_a = childNodes.current) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(child); });
|
|
263
|
+
childElementsDetached.current = true;
|
|
264
|
+
if (element.current) {
|
|
265
|
+
events.triggerHandler(element.current, DX_REMOVE_EVENT, dxRemoveArgs);
|
|
266
|
+
}
|
|
267
|
+
instance.current.dispose();
|
|
268
|
+
}
|
|
269
|
+
optionsManager.current.dispose();
|
|
270
|
+
removalLocker === null || removalLocker === void 0 ? void 0 : removalLocker.unlock();
|
|
271
|
+
}, [
|
|
272
|
+
removalLocker,
|
|
273
|
+
instance.current,
|
|
274
|
+
childNodes.current,
|
|
275
|
+
element.current,
|
|
276
|
+
optionsManager.current,
|
|
277
|
+
childElementsDetached.current,
|
|
278
|
+
]);
|
|
279
|
+
useLayoutEffect(function () {
|
|
280
|
+
onComponentMounted();
|
|
281
|
+
return function () {
|
|
282
|
+
onComponentUnmounted();
|
|
283
|
+
};
|
|
284
|
+
}, []);
|
|
285
|
+
useLayoutEffect(function () {
|
|
286
|
+
onComponentUpdated();
|
|
287
|
+
});
|
|
288
|
+
useImperativeHandle(ref, function () { return ({
|
|
289
|
+
getInstance: function () {
|
|
290
|
+
return instance.current;
|
|
291
|
+
},
|
|
292
|
+
getElement: function () {
|
|
293
|
+
return element.current;
|
|
294
|
+
},
|
|
295
|
+
createWidget: function (el) {
|
|
296
|
+
createWidget(el);
|
|
297
|
+
},
|
|
298
|
+
}); }, [instance.current, element.current, createWidget]);
|
|
299
|
+
var _renderChildren = useCallback(function () {
|
|
300
|
+
if (renderChildren) {
|
|
301
|
+
return renderChildren();
|
|
302
|
+
}
|
|
231
303
|
// @ts-expect-error TS2339
|
|
232
|
-
var children =
|
|
304
|
+
var children = props.children;
|
|
233
305
|
return children;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
|
|
306
|
+
}, [props, renderChildren]);
|
|
307
|
+
var renderPortal = useCallback(function () { return portalContainer.current && createPortal(_renderChildren(), portalContainer.current); }, [portalContainer.current, _renderChildren]);
|
|
308
|
+
var renderContent = useCallback(function () {
|
|
237
309
|
// @ts-expect-error TS2339
|
|
238
|
-
var children =
|
|
239
|
-
return
|
|
310
|
+
var children = props.children;
|
|
311
|
+
return isPortalComponent && children
|
|
240
312
|
? React.createElement('div', {
|
|
241
313
|
ref: function (node) {
|
|
242
|
-
if (node &&
|
|
243
|
-
|
|
244
|
-
|
|
314
|
+
if (node && portalContainer.current !== node) {
|
|
315
|
+
portalContainer.current = node;
|
|
316
|
+
setForceUpdateToken(Math.random());
|
|
245
317
|
}
|
|
246
318
|
},
|
|
247
|
-
style:
|
|
319
|
+
style: { display: 'contents' },
|
|
248
320
|
})
|
|
249
|
-
:
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
321
|
+
: _renderChildren();
|
|
322
|
+
}, [
|
|
323
|
+
props,
|
|
324
|
+
isPortalComponent,
|
|
325
|
+
portalContainer.current,
|
|
326
|
+
_renderChildren,
|
|
327
|
+
]);
|
|
328
|
+
return React.createElement(RestoreTreeContext.Provider, {
|
|
329
|
+
value: restoreTree,
|
|
330
|
+
}, React.createElement('div', getElementProps(), renderContent(), React.createElement(TemplateManager, {
|
|
331
|
+
init: setTemplateManagerHooks,
|
|
332
|
+
})), isPortalComponent && renderPortal());
|
|
333
|
+
});
|
|
262
334
|
export { ComponentBase, DX_REMOVE_EVENT, };
|
package/esm/core/component.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* devextreme-react
|
|
3
|
-
* Version:
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 24.1.2-beta
|
|
4
|
+
* Build date: Mon May 13 2024
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
*
|
|
@@ -11,63 +11,74 @@
|
|
|
11
11
|
* https://github.com/DevExpress/devextreme-react
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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;
|
|
20
22
|
};
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
24
|
-
extendStatics(d, b);
|
|
25
|
-
function __() { this.constructor = d; }
|
|
26
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
27
|
-
};
|
|
28
|
-
})();
|
|
23
|
+
return __assign.apply(this, arguments);
|
|
24
|
+
};
|
|
29
25
|
import * as React from 'react';
|
|
26
|
+
import { useImperativeHandle, forwardRef, useRef, useLayoutEffect, useCallback, } from 'react';
|
|
30
27
|
import { ComponentBase } from './component-base';
|
|
31
|
-
import {
|
|
32
|
-
var Component =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
28
|
+
import { elementIsExtension } from './extension-component';
|
|
29
|
+
var Component = forwardRef(function (props, ref) {
|
|
30
|
+
var componentBaseRef = useRef(null);
|
|
31
|
+
var extensionCreators = useRef([]);
|
|
32
|
+
var registerExtension = useCallback(function (creator) {
|
|
33
|
+
extensionCreators.current.push(creator);
|
|
34
|
+
}, [extensionCreators.current]);
|
|
35
|
+
var createExtensions = useCallback(function () {
|
|
36
|
+
extensionCreators.current.forEach(function (creator) { var _a; return creator((_a = componentBaseRef.current) === null || _a === void 0 ? void 0 : _a.getElement()); });
|
|
37
|
+
}, [extensionCreators.current, componentBaseRef.current]);
|
|
38
|
+
var renderChildren = useCallback(function () { return React.Children.map(
|
|
39
|
+
// @ts-expect-error TS2339
|
|
40
|
+
props.children, function (child) {
|
|
41
|
+
if (child && elementIsExtension(child)) {
|
|
42
|
+
return React.cloneElement(child, { onMounted: registerExtension });
|
|
43
|
+
}
|
|
44
|
+
return child;
|
|
45
|
+
}); }, [props, registerExtension]);
|
|
46
|
+
var createWidget = useCallback(function (el) {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = componentBaseRef.current) === null || _a === void 0 ? void 0 : _a.createWidget(el);
|
|
49
|
+
}, [componentBaseRef.current]);
|
|
50
|
+
var clearExtensions = useCallback(function () {
|
|
51
|
+
if (props.clearExtensions) {
|
|
52
|
+
props.clearExtensions();
|
|
53
|
+
}
|
|
54
|
+
extensionCreators.current = [];
|
|
55
|
+
}, [
|
|
56
|
+
extensionCreators.current,
|
|
57
|
+
props.clearExtensions,
|
|
58
|
+
]);
|
|
59
|
+
useLayoutEffect(function () {
|
|
60
|
+
createWidget();
|
|
61
|
+
createExtensions();
|
|
62
|
+
return function () {
|
|
63
|
+
clearExtensions();
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
useImperativeHandle(ref, function () { return ({
|
|
67
|
+
getInstance: function () {
|
|
68
|
+
var _a;
|
|
69
|
+
return (_a = componentBaseRef.current) === null || _a === void 0 ? void 0 : _a.getInstance();
|
|
70
|
+
},
|
|
71
|
+
getElement: function () {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = componentBaseRef.current) === null || _a === void 0 ? void 0 : _a.getElement();
|
|
74
|
+
},
|
|
75
|
+
createWidget: function (el) {
|
|
76
|
+
createWidget(el);
|
|
77
|
+
},
|
|
78
|
+
clearExtensions: function () {
|
|
79
|
+
clearExtensions();
|
|
80
|
+
},
|
|
81
|
+
}); }, [componentBaseRef.current, createWidget, clearExtensions]);
|
|
82
|
+
return (React.createElement(ComponentBase, __assign({ ref: componentBaseRef, renderChildren: renderChildren }, props)));
|
|
83
|
+
});
|
|
73
84
|
export { Component, };
|