primereact 10.6.3 → 10.6.4
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/accordion/accordion.cjs.js +14 -16
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.d.ts +4 -0
- package/accordion/accordion.esm.js +14 -16
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +14 -16
- package/accordion/accordion.min.js +1 -1
- package/api/api.cjs.js +109 -38
- package/api/api.cjs.min.js +1 -1
- package/api/api.d.ts +5 -0
- package/api/api.esm.js +109 -38
- package/api/api.esm.min.js +1 -1
- package/api/api.js +109 -38
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +7 -7
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +7 -7
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +7 -7
- package/autocomplete/autocomplete.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +1 -1
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +1 -1
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +1 -1
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/buttongroup/buttongroup.d.ts +1 -6
- package/calendar/calendar.cjs.js +23 -6
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +23 -6
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +23 -6
- package/calendar/calendar.min.js +1 -1
- package/carousel/carousel.cjs.js +6 -2
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +7 -3
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +6 -2
- package/carousel/carousel.min.js +1 -1
- package/checkbox/checkbox.d.ts +6 -1
- package/chips/chips.cjs.js +12 -12
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.esm.js +12 -12
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +12 -12
- package/chips/chips.min.js +1 -1
- package/core/core.js +313 -174
- package/core/core.min.js +7 -7
- package/datatable/datatable.cjs.js +17 -6
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +27 -27
- package/datatable/datatable.esm.js +17 -6
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +17 -6
- package/datatable/datatable.min.js +1 -1
- package/dialog/dialog.cjs.js +143 -92
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +144 -93
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +144 -93
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +39 -40
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +17 -17
- package/dropdown/dropdown.esm.js +39 -40
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +39 -40
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.cjs.js +2 -2
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +2 -2
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +2 -2
- package/editor/editor.min.js +1 -1
- package/fileupload/fileupload.d.ts +4 -0
- package/floatlabel/floatlabel.d.ts +5 -0
- package/galleria/galleria.cjs.js +9 -3
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +10 -4
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +9 -3
- package/galleria/galleria.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +11 -1
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +11 -1
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +11 -1
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputotp/inputotp.cjs.js +9 -9
- package/inputotp/inputotp.cjs.min.js +1 -1
- package/inputotp/inputotp.esm.js +9 -9
- package/inputotp/inputotp.esm.min.js +1 -1
- package/inputotp/inputotp.js +9 -9
- package/inputotp/inputotp.min.js +1 -1
- package/inputotp/package.json +1 -1
- package/keyfilter/keyfilter.cjs.js +3 -1
- package/keyfilter/keyfilter.cjs.min.js +1 -1
- package/keyfilter/keyfilter.esm.js +3 -1
- package/keyfilter/keyfilter.esm.min.js +1 -1
- package/keyfilter/keyfilter.js +3 -1
- package/keyfilter/keyfilter.min.js +1 -1
- package/listbox/listbox.cjs.js +2 -6
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +2 -6
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +2 -6
- package/listbox/listbox.min.js +1 -1
- package/megamenu/megamenu.cjs.js +10 -6
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +10 -6
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +10 -6
- package/megamenu/megamenu.min.js +1 -1
- package/menu/menu.cjs.js +23 -5
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.d.ts +19 -0
- package/menu/menu.esm.js +23 -5
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +23 -5
- package/menu/menu.min.js +1 -1
- package/messages/messages.cjs.js +1 -1
- package/messages/messages.cjs.min.js +1 -1
- package/messages/messages.esm.js +1 -1
- package/messages/messages.esm.min.js +1 -1
- package/messages/messages.js +1 -1
- package/messages/messages.min.js +1 -1
- package/metergroup/metergroup.cjs.js +33 -12
- package/metergroup/metergroup.cjs.min.js +1 -1
- package/metergroup/metergroup.esm.js +6 -5
- package/metergroup/metergroup.esm.min.js +1 -1
- package/metergroup/metergroup.js +32 -11
- package/metergroup/metergroup.min.js +1 -1
- package/multiselect/multiselect.cjs.js +18 -3
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +17 -17
- package/multiselect/multiselect.esm.js +18 -3
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +18 -3
- package/multiselect/multiselect.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +3 -0
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.d.ts +5 -0
- package/overlaypanel/overlaypanel.esm.js +3 -0
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +3 -0
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +1 -1
- package/paginator/paginator.cjs.js +6 -0
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +6 -0
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +6 -0
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +1 -2
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +1 -2
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +1 -2
- package/panelmenu/panelmenu.min.js +1 -1
- package/passthrough/tailwind/index.cjs.js +14 -4
- package/passthrough/tailwind/index.cjs.min.js +1 -1
- package/passthrough/tailwind/index.esm.js +14 -4
- package/passthrough/tailwind/index.esm.min.js +1 -1
- package/passthrough/tailwind/index.js +14 -4
- package/passthrough/tailwind/index.min.js +1 -1
- package/password/password.cjs.js +104 -15
- package/password/password.cjs.min.js +1 -1
- package/password/password.d.ts +10 -10
- package/password/password.esm.js +104 -15
- package/password/password.esm.min.js +1 -1
- package/password/password.js +105 -16
- package/password/password.min.js +1 -1
- package/picklist/picklist.cjs.js +6 -0
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +6 -0
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +6 -0
- package/picklist/picklist.min.js +1 -1
- package/primereact.all.cjs.js +1121 -920
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +1121 -920
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +1121 -920
- package/primereact.all.min.js +1 -1
- package/ripple/ripple.d.ts +32 -0
- package/splitter/splitter.cjs.js +6 -1
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +6 -1
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +6 -1
- package/splitter/splitter.min.js +1 -1
- package/stepper/stepper.cjs.js +14 -4
- package/stepper/stepper.cjs.min.js +1 -1
- package/stepper/stepper.d.ts +13 -1
- package/stepper/stepper.esm.js +14 -4
- package/stepper/stepper.esm.min.js +1 -1
- package/stepper/stepper.js +14 -4
- package/stepper/stepper.min.js +1 -1
- package/stepperpanel/stepperpanel.cjs.js +0 -5
- package/stepperpanel/stepperpanel.cjs.min.js +1 -1
- package/stepperpanel/stepperpanel.d.ts +1 -1
- package/stepperpanel/stepperpanel.esm.js +0 -5
- package/stepperpanel/stepperpanel.esm.min.js +1 -1
- package/stepperpanel/stepperpanel.js +2 -6
- package/stepperpanel/stepperpanel.min.js +1 -1
- package/tabview/tabview.cjs.js +1 -1
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.d.ts +4 -0
- package/tabview/tabview.esm.js +1 -1
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +1 -1
- package/tabview/tabview.min.js +1 -1
- package/toast/toast.cjs.js +7 -1
- package/toast/toast.cjs.min.js +1 -1
- package/toast/toast.esm.js +7 -1
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +7 -1
- package/toast/toast.min.js +1 -1
- package/treeselect/treeselect.cjs.js +12 -2
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +12 -2
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +12 -2
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +8 -0
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +8 -0
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +8 -0
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +1 -1
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/virtualscroller/virtualscroller.d.ts +3 -3
- package/web-types.json +61 -5
package/dialog/dialog.esm.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
3
4
|
import PrimeReact, { PrimeReactContext, localeOption } from 'primereact/api';
|
|
4
5
|
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
5
6
|
import { CSSTransition } from 'primereact/csstransition';
|
|
6
|
-
import { useMergeProps, useDisplayOrder, useGlobalOnEscapeKey, ESC_KEY_HANDLING_PRIORITIES, useEventListener,
|
|
7
|
+
import { useStyle, useMountEffect, useMergeProps, useDisplayOrder, useGlobalOnEscapeKey, ESC_KEY_HANDLING_PRIORITIES, useEventListener, useUpdateEffect, useUnmountEffect } from 'primereact/hooks';
|
|
8
|
+
import { ObjectUtils, DomHandler, classNames, UniqueComponentId, ZIndexUtils, IconUtils } from 'primereact/utils';
|
|
7
9
|
import { TimesIcon } from 'primereact/icons/times';
|
|
8
10
|
import { WindowMaximizeIcon } from 'primereact/icons/windowmaximize';
|
|
9
11
|
import { WindowMinimizeIcon } from 'primereact/icons/windowminimize';
|
|
10
12
|
import { Portal } from 'primereact/portal';
|
|
11
13
|
import { Ripple } from 'primereact/ripple';
|
|
12
|
-
import { classNames, UniqueComponentId, DomHandler, ZIndexUtils, ObjectUtils, IconUtils } from 'primereact/utils';
|
|
13
14
|
|
|
14
15
|
function _extends() {
|
|
15
16
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -138,6 +139,117 @@ function _slicedToArray(arr, i) {
|
|
|
138
139
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
var styles$1 = '';
|
|
143
|
+
var FocusTrapBase = ComponentBase.extend({
|
|
144
|
+
defaultProps: {
|
|
145
|
+
__TYPE: 'FocusTrap',
|
|
146
|
+
children: undefined
|
|
147
|
+
},
|
|
148
|
+
css: {
|
|
149
|
+
styles: styles$1
|
|
150
|
+
},
|
|
151
|
+
getProps: function getProps(props) {
|
|
152
|
+
return ObjectUtils.getMergedProps(props, FocusTrapBase.defaultProps);
|
|
153
|
+
},
|
|
154
|
+
getOtherProps: function getOtherProps(props) {
|
|
155
|
+
return ObjectUtils.getDiffProps(props, FocusTrapBase.defaultProps);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
160
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
161
|
+
var FocusTrap = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__default.forwardRef(function (inProps, ref) {
|
|
162
|
+
var targetRef = React__default.useRef(null);
|
|
163
|
+
var firstFocusableElementRef = React__default.useRef(null);
|
|
164
|
+
var lastFocusableElementRef = React__default.useRef(null);
|
|
165
|
+
var context = React__default.useContext(PrimeReactContext);
|
|
166
|
+
var props = FocusTrapBase.getProps(inProps, context);
|
|
167
|
+
var metaData = {
|
|
168
|
+
props: props
|
|
169
|
+
};
|
|
170
|
+
useStyle(FocusTrapBase.css.styles, {
|
|
171
|
+
name: 'focustrap'
|
|
172
|
+
});
|
|
173
|
+
var _FocusTrapBase$setMet = FocusTrapBase.setMetaData(_objectSpread$2({}, metaData));
|
|
174
|
+
_FocusTrapBase$setMet.ptm;
|
|
175
|
+
React__default.useImperativeHandle(ref, function () {
|
|
176
|
+
return {
|
|
177
|
+
props: props,
|
|
178
|
+
getInk: function getInk() {
|
|
179
|
+
return firstFocusableElementRef.current;
|
|
180
|
+
},
|
|
181
|
+
getTarget: function getTarget() {
|
|
182
|
+
return targetRef.current;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
useMountEffect(function () {
|
|
187
|
+
if (!props.disabled) {
|
|
188
|
+
targetRef.current = getTarget();
|
|
189
|
+
setAutoFocus(targetRef.current);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
var getTarget = function getTarget() {
|
|
193
|
+
return firstFocusableElementRef.current && firstFocusableElementRef.current.parentElement;
|
|
194
|
+
};
|
|
195
|
+
var setAutoFocus = function setAutoFocus(target) {
|
|
196
|
+
var _ref = props || {},
|
|
197
|
+
_ref$autoFocusSelecto = _ref.autoFocusSelector,
|
|
198
|
+
autoFocusSelector = _ref$autoFocusSelecto === void 0 ? '' : _ref$autoFocusSelecto,
|
|
199
|
+
_ref$firstFocusableSe = _ref.firstFocusableSelector,
|
|
200
|
+
firstFocusableSelector = _ref$firstFocusableSe === void 0 ? '' : _ref$firstFocusableSe,
|
|
201
|
+
_ref$autoFocus = _ref.autoFocus,
|
|
202
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus;
|
|
203
|
+
var focusableElement = DomHandler.getFirstFocusableElement(target, "[autofocus]".concat(getComputedSelector(autoFocusSelector)));
|
|
204
|
+
autoFocus && !focusableElement && (focusableElement = DomHandler.getFirstFocusableElement(target, getComputedSelector(firstFocusableSelector)));
|
|
205
|
+
DomHandler.focus(focusableElement);
|
|
206
|
+
};
|
|
207
|
+
var getComputedSelector = function getComputedSelector(selector) {
|
|
208
|
+
return ":not(.p-hidden-focusable):not([data-p-hidden-focusable=\"true\"])".concat(selector !== null && selector !== void 0 ? selector : '');
|
|
209
|
+
};
|
|
210
|
+
var onFirstHiddenElementFocus = function onFirstHiddenElementFocus(event) {
|
|
211
|
+
var _targetRef$current;
|
|
212
|
+
var currentTarget = event.currentTarget,
|
|
213
|
+
relatedTarget = event.relatedTarget;
|
|
214
|
+
var focusableElement = relatedTarget === currentTarget.$_pfocustrap_lasthiddenfocusableelement || !((_targetRef$current = targetRef.current) !== null && _targetRef$current !== void 0 && _targetRef$current.contains(relatedTarget)) ? DomHandler.getFirstFocusableElement(currentTarget.parentElement, getComputedSelector(currentTarget.$_pfocustrap_focusableselector)) : currentTarget.$_pfocustrap_lasthiddenfocusableelement;
|
|
215
|
+
DomHandler.focus(focusableElement);
|
|
216
|
+
};
|
|
217
|
+
var onLastHiddenElementFocus = function onLastHiddenElementFocus(event) {
|
|
218
|
+
var _targetRef$current2;
|
|
219
|
+
var currentTarget = event.currentTarget,
|
|
220
|
+
relatedTarget = event.relatedTarget;
|
|
221
|
+
var focusableElement = relatedTarget === currentTarget.$_pfocustrap_firsthiddenfocusableelement || !((_targetRef$current2 = targetRef.current) !== null && _targetRef$current2 !== void 0 && _targetRef$current2.contains(relatedTarget)) ? DomHandler.getLastFocusableElement(currentTarget.parentElement, getComputedSelector(currentTarget.$_pfocustrap_focusableselector)) : currentTarget.$_pfocustrap_firsthiddenfocusableelement;
|
|
222
|
+
DomHandler.focus(focusableElement);
|
|
223
|
+
};
|
|
224
|
+
var createHiddenFocusableElements = function createHiddenFocusableElements() {
|
|
225
|
+
var _ref2 = props || {},
|
|
226
|
+
_ref2$tabIndex = _ref2.tabIndex,
|
|
227
|
+
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
228
|
+
var createFocusableElement = function createFocusableElement(onFocus, section) {
|
|
229
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
230
|
+
ref: section === 'firstfocusableelement' ? firstFocusableElementRef : lastFocusableElementRef,
|
|
231
|
+
className: 'p-hidden-accessible p-hidden-focusable',
|
|
232
|
+
tabIndex: tabIndex,
|
|
233
|
+
role: 'presentation',
|
|
234
|
+
"aria-hidden": true,
|
|
235
|
+
"data-p-hidden-accessible": true,
|
|
236
|
+
"data-p-hidden-focusable": true,
|
|
237
|
+
onFocus: onFocus,
|
|
238
|
+
"data-pc-section": section
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
var firstFocusableElement = createFocusableElement(onFirstHiddenElementFocus, 'firstfocusableelement');
|
|
242
|
+
var lastFocusableElement = createFocusableElement(onLastHiddenElementFocus, 'lastfocusableelement');
|
|
243
|
+
if (firstFocusableElement.ref.current && lastFocusableElement.ref.current) {
|
|
244
|
+
firstFocusableElement.ref.current.$_pfocustrap_lasthiddenfocusableelement = lastFocusableElement.ref.current;
|
|
245
|
+
lastFocusableElement.ref.current.$_pfocustrap_firsthiddenfocusableelement = firstFocusableElement.ref.current;
|
|
246
|
+
}
|
|
247
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, firstFocusableElement, props.children, lastFocusableElement);
|
|
248
|
+
};
|
|
249
|
+
return createHiddenFocusableElements();
|
|
250
|
+
}));
|
|
251
|
+
var FocusTrap$1 = FocusTrap;
|
|
252
|
+
|
|
141
253
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
142
254
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
143
255
|
var classes = {
|
|
@@ -332,15 +444,6 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
332
444
|
priority: [ESC_KEY_HANDLING_PRIORITIES.DIALOG, displayOrder]
|
|
333
445
|
});
|
|
334
446
|
var _useEventListener = useEventListener({
|
|
335
|
-
type: 'keydown',
|
|
336
|
-
listener: function listener(event) {
|
|
337
|
-
return onKeyDown(event);
|
|
338
|
-
}
|
|
339
|
-
}),
|
|
340
|
-
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
341
|
-
bindDocumentKeyDownListener = _useEventListener2[0],
|
|
342
|
-
unbindDocumentKeyDownListener = _useEventListener2[1];
|
|
343
|
-
var _useEventListener3 = useEventListener({
|
|
344
447
|
type: 'mousemove',
|
|
345
448
|
target: function target() {
|
|
346
449
|
return window.document;
|
|
@@ -349,10 +452,10 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
349
452
|
return onResize(event);
|
|
350
453
|
}
|
|
351
454
|
}),
|
|
352
|
-
|
|
353
|
-
bindDocumentResizeListener =
|
|
354
|
-
unbindDocumentResizeListener =
|
|
355
|
-
var
|
|
455
|
+
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
456
|
+
bindDocumentResizeListener = _useEventListener2[0],
|
|
457
|
+
unbindDocumentResizeListener = _useEventListener2[1];
|
|
458
|
+
var _useEventListener3 = useEventListener({
|
|
356
459
|
type: 'mouseup',
|
|
357
460
|
target: function target() {
|
|
358
461
|
return window.document;
|
|
@@ -361,10 +464,10 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
361
464
|
return onResizeEnd(event);
|
|
362
465
|
}
|
|
363
466
|
}),
|
|
364
|
-
|
|
365
|
-
bindDocumentResizeEndListener =
|
|
366
|
-
unbindDocumentResizEndListener =
|
|
367
|
-
var
|
|
467
|
+
_useEventListener4 = _slicedToArray(_useEventListener3, 2),
|
|
468
|
+
bindDocumentResizeEndListener = _useEventListener4[0],
|
|
469
|
+
unbindDocumentResizEndListener = _useEventListener4[1];
|
|
470
|
+
var _useEventListener5 = useEventListener({
|
|
368
471
|
type: 'mousemove',
|
|
369
472
|
target: function target() {
|
|
370
473
|
return window.document;
|
|
@@ -373,10 +476,10 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
373
476
|
return onDrag(event);
|
|
374
477
|
}
|
|
375
478
|
}),
|
|
376
|
-
|
|
377
|
-
bindDocumentDragListener =
|
|
378
|
-
unbindDocumentDragListener =
|
|
379
|
-
var
|
|
479
|
+
_useEventListener6 = _slicedToArray(_useEventListener5, 2),
|
|
480
|
+
bindDocumentDragListener = _useEventListener6[0],
|
|
481
|
+
unbindDocumentDragListener = _useEventListener6[1];
|
|
482
|
+
var _useEventListener7 = useEventListener({
|
|
380
483
|
type: 'mouseup',
|
|
381
484
|
target: function target() {
|
|
382
485
|
return window.document;
|
|
@@ -385,9 +488,9 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
385
488
|
return onDragEnd(event);
|
|
386
489
|
}
|
|
387
490
|
}),
|
|
388
|
-
|
|
389
|
-
bindDocumentDragEndListener =
|
|
390
|
-
unbindDocumentDragEndListener =
|
|
491
|
+
_useEventListener8 = _slicedToArray(_useEventListener7, 2),
|
|
492
|
+
bindDocumentDragEndListener = _useEventListener8[0],
|
|
493
|
+
unbindDocumentDragEndListener = _useEventListener8[1];
|
|
391
494
|
var onClose = function onClose(event) {
|
|
392
495
|
props.onHide();
|
|
393
496
|
event.preventDefault();
|
|
@@ -423,41 +526,6 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
423
526
|
}
|
|
424
527
|
event.preventDefault();
|
|
425
528
|
};
|
|
426
|
-
var onKeyDown = function onKeyDown(event) {
|
|
427
|
-
var currentTarget = event.currentTarget;
|
|
428
|
-
if (!currentTarget || !currentTarget.primeDialogParams) {
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
var params = currentTarget.primeDialogParams;
|
|
432
|
-
var paramLength = params.length;
|
|
433
|
-
var dialogId = params[paramLength - 1] ? params[paramLength - 1].id : undefined;
|
|
434
|
-
if (dialogId !== idState) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
var dialog = document.getElementById(dialogId);
|
|
438
|
-
if (event.key === 'Tab') {
|
|
439
|
-
event.preventDefault();
|
|
440
|
-
var focusableElements = DomHandler.getFocusableElements(dialog);
|
|
441
|
-
if (focusableElements && focusableElements.length > 0) {
|
|
442
|
-
if (!document.activeElement) {
|
|
443
|
-
focusableElements[0].focus();
|
|
444
|
-
} else {
|
|
445
|
-
var focusedIndex = focusableElements.indexOf(document.activeElement);
|
|
446
|
-
if (event.shiftKey) {
|
|
447
|
-
if (focusedIndex === -1 || focusedIndex === 0) {
|
|
448
|
-
focusableElements[focusableElements.length - 1].focus();
|
|
449
|
-
} else {
|
|
450
|
-
focusableElements[focusedIndex - 1].focus();
|
|
451
|
-
}
|
|
452
|
-
} else if (focusedIndex === -1 || focusedIndex === focusableElements.length - 1) {
|
|
453
|
-
focusableElements[0].focus();
|
|
454
|
-
} else {
|
|
455
|
-
focusableElements[focusedIndex + 1].focus();
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
529
|
var onDragStart = function onDragStart(event) {
|
|
462
530
|
if (DomHandler.hasClass(event.target, 'p-dialog-header-icon') || DomHandler.hasClass(event.target.parentElement, 'p-dialog-header-icon')) {
|
|
463
531
|
return;
|
|
@@ -584,6 +652,7 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
584
652
|
}
|
|
585
653
|
};
|
|
586
654
|
var onExited = function onExited() {
|
|
655
|
+
props.onHide && props.onHide();
|
|
587
656
|
dragging.current = false;
|
|
588
657
|
ZIndexUtils.clear(maskRef.current);
|
|
589
658
|
setMaskVisibleState(false);
|
|
@@ -651,14 +720,12 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
651
720
|
bindDocumentResizeListener();
|
|
652
721
|
bindDocumentResizeEndListener();
|
|
653
722
|
}
|
|
654
|
-
bindDocumentKeyDownListener();
|
|
655
723
|
};
|
|
656
724
|
var unbindGlobalListeners = function unbindGlobalListeners() {
|
|
657
725
|
unbindDocumentDragListener();
|
|
658
726
|
unbindDocumentDragEndListener();
|
|
659
727
|
unbindDocumentResizeListener();
|
|
660
728
|
unbindDocumentResizEndListener();
|
|
661
|
-
unbindDocumentKeyDownListener();
|
|
662
729
|
};
|
|
663
730
|
var createStyle = function createStyle() {
|
|
664
731
|
styleElement.current = DomHandler.createInlineStyle(context && context.nonce || PrimeReact.nonce, context && context.styleContainer);
|
|
@@ -837,11 +904,8 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
837
904
|
}
|
|
838
905
|
return null;
|
|
839
906
|
};
|
|
840
|
-
var createTemplateElement = function createTemplateElement(
|
|
907
|
+
var createTemplateElement = function createTemplateElement() {
|
|
841
908
|
var _props$children;
|
|
842
|
-
var maskProps = _ref.maskProps,
|
|
843
|
-
rootProps = _ref.rootProps,
|
|
844
|
-
transitionProps = _ref.transitionProps;
|
|
845
909
|
var messageProps = {
|
|
846
910
|
header: props.header,
|
|
847
911
|
content: props.message,
|
|
@@ -855,21 +919,14 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
855
919
|
hide: onClose,
|
|
856
920
|
message: messageProps
|
|
857
921
|
};
|
|
858
|
-
return
|
|
859
|
-
nodeRef: dialogRef
|
|
860
|
-
}, transitionProps), /*#__PURE__*/React.createElement("div", rootProps, ObjectUtils.getJSXElement(inProps.content, templateElementProps))));
|
|
922
|
+
return ObjectUtils.getJSXElement(inProps.content, templateElementProps);
|
|
861
923
|
};
|
|
862
|
-
var createElement = function createElement(
|
|
863
|
-
var maskProps = _ref2.maskProps,
|
|
864
|
-
rootProps = _ref2.rootProps,
|
|
865
|
-
transitionProps = _ref2.transitionProps;
|
|
924
|
+
var createElement = function createElement() {
|
|
866
925
|
var header = createHeader();
|
|
867
926
|
var content = createContent();
|
|
868
927
|
var footer = createFooter();
|
|
869
928
|
var resizer = createResizer();
|
|
870
|
-
return /*#__PURE__*/React.createElement(
|
|
871
|
-
nodeRef: dialogRef
|
|
872
|
-
}, transitionProps), /*#__PURE__*/React.createElement("div", rootProps, header, content, footer, resizer)));
|
|
929
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, header, content, footer, resizer);
|
|
873
930
|
};
|
|
874
931
|
var createDialog = function createDialog() {
|
|
875
932
|
var headerId = idState + '_header';
|
|
@@ -911,25 +968,19 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
911
968
|
onExiting: onExiting,
|
|
912
969
|
onExited: onExited
|
|
913
970
|
}, ptm('transition'));
|
|
971
|
+
var contentElement = null;
|
|
914
972
|
if (inProps !== null && inProps !== void 0 && inProps.content) {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
transitionProps: transitionProps
|
|
919
|
-
});
|
|
920
|
-
return /*#__PURE__*/React.createElement(Portal, {
|
|
921
|
-
element: templateElement,
|
|
922
|
-
appendTo: props.appendTo,
|
|
923
|
-
visible: true
|
|
924
|
-
});
|
|
973
|
+
contentElement = createTemplateElement();
|
|
974
|
+
} else {
|
|
975
|
+
contentElement = createElement();
|
|
925
976
|
}
|
|
926
|
-
var
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
});
|
|
977
|
+
var rootElement = /*#__PURE__*/React.createElement("div", maskProps, /*#__PURE__*/React.createElement(CSSTransition, _extends({
|
|
978
|
+
nodeRef: dialogRef
|
|
979
|
+
}, transitionProps), /*#__PURE__*/React.createElement("div", rootProps, /*#__PURE__*/React.createElement(FocusTrap$1, {
|
|
980
|
+
autoFocus: true
|
|
981
|
+
}, contentElement))));
|
|
931
982
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
932
|
-
element:
|
|
983
|
+
element: rootElement,
|
|
933
984
|
appendTo: props.appendTo,
|
|
934
985
|
visible: true
|
|
935
986
|
});
|
package/dialog/dialog.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t,{PrimeReactContext as n,localeOption as o}from"primereact/api";import{ComponentBase as r,useHandleStyle as i}from"primereact/componentbase";import{CSSTransition as a}from"primereact/csstransition";import{useMergeProps as l,useDisplayOrder as c,useGlobalOnEscapeKey as s,ESC_KEY_HANDLING_PRIORITIES as p,useEventListener as u,useMountEffect as d,useUpdateEffect as m,useUnmountEffect as g}from"primereact/hooks";import{TimesIcon as f}from"primereact/icons/times";import{WindowMaximizeIcon as b}from"primereact/icons/windowmaximize";import{WindowMinimizeIcon as h}from"primereact/icons/windowminimize";import{Portal as y}from"primereact/portal";import{Ripple as v}from"primereact/ripple";import{classNames as x,UniqueComponentId as w,DomHandler as S,ZIndexUtils as k,ObjectUtils as z,IconUtils as E}from"primereact/utils";function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},O.apply(this,arguments)}function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function D(e){if(Array.isArray(e))return I(e)}function j(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function C(e,t){if(e){if("string"==typeof e)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}function R(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function N(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function B(e){var t=N(e,"string");return"symbol"===P(t)?t:String(t)}function M(e,t,n){return(t=B(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e){if(Array.isArray(e))return e}function X(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}function A(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(e,t){return T(e)||X(e,t)||C(e,t)||A()}function Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(n),!0).forEach((function(t){M(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var V=r.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return x("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return x("p-dialog-content",e.props.contentClassName)},footer:function(e){return x("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,o=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===t.position||e.replace("-","")===t.position}));return x("p-dialog-mask",o?"p-dialog-".concat(o):"",{"p-component-overlay p-component-overlay-enter":t.modal,"p-dialog-visible":n,"p-dialog-draggable":t.draggable,"p-dialog-resizable":t.resizable},t.maskClassName)},root:function(e){var n=e.maximized,o=e.context;return x("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":n,"p-dialog-default":!n,"p-input-filled":o&&"filled"===o.inputStyle||"filled"===t.inputStyle,"p-ripple-disabled":o&&!1===o.ripple||!1===t.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n",inlineStyles:{mask:function(e){var t=e.props;return _({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){M(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=e.forwardRef((function(r,P){var I=l(),N=e.useContext(n),B=V.getProps(r,N),M=B.id?B.id:w(),T=H(e.useState(M),2),X=T[0],A=H(e.useState(!1),2),Y=A[0],_=A[1],J=H(e.useState(!1),2),F=J[0],Z=J[1],U=H(e.useState(B.maximized),2),W=U[0],$=U[1],G=e.useRef(null),K=e.useRef(null),q=e.useRef(null),Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null),ne=e.useRef(null),oe=e.useRef(!1),re=e.useRef(!1),ie=e.useRef(null),ae=e.useRef(null),le=e.useRef(null),ce=e.useRef(M),se=e.useRef(null),pe=B.onMaximize?B.maximized:W,ue=F&&(B.blockScroll||B.maximizable&&pe),de=B.closable&&B.closeOnEscape&&F,me=c("dialog",de),ge=V.setMetaData(L(L({props:B},B.__parentMetadata),{},{state:{id:X,maximized:pe,containerVisible:Y}})),fe=ge.ptm,be=ge.cx,he=ge.sx,ye=ge.isUnstyled;i(V.css.styles,ye,{name:"dialog"}),s({callback:function(e){Be(e)},when:de&&me,priority:[p.DIALOG,me]});var ve=H(u({type:"keydown",listener:function(e){return Ae(e)}}),2),xe=ve[0],we=ve[1],Se=H(u({type:"mousemove",target:function(){return window.document},listener:function(e){return Le(e)}}),2),ke=Se[0],ze=Se[1],Ee=H(u({type:"mouseup",target:function(){return window.document},listener:function(e){return Fe(e)}}),2),Oe=Ee[0],Pe=Ee[1],Ie=H(u({type:"mousemove",target:function(){return window.document},listener:function(e){return Ye(e)}}),2),De=Ie[0],je=Ie[1],Ce=H(u({type:"mouseup",target:function(){return window.document},listener:function(e){return _e(e)}}),2),Re=Ce[0],Ne=Ce[1],Be=function(e){B.onHide(),e.preventDefault()},Me=function(e){q.current=e.target,B.onPointerDown&&B.onPointerDown(e)},Te=function(e){B.dismissableMask&&B.modal&&K.current===e.target&&!q.current&&Be(e),B.onMaskClick&&B.onMaskClick(e),q.current=null},Xe=function(e){B.onMaximize?B.onMaximize({originalEvent:e,maximized:!pe}):$((function(e){return!e})),e.preventDefault()},Ae=function(e){var t=e.currentTarget;if(t&&t.primeDialogParams){var n=t.primeDialogParams,o=n.length,r=n[o-1]?n[o-1].id:void 0;if(r===X){var i=document.getElementById(r);if("Tab"===e.key){e.preventDefault();var a=S.getFocusableElements(i);if(a&&a.length>0)if(document.activeElement){var l=a.indexOf(document.activeElement);e.shiftKey?-1===l||0===l?a[a.length-1].focus():a[l-1].focus():-1===l||l===a.length-1?a[0].focus():a[l+1].focus()}else a[0].focus()}}}},He=function(e){S.hasClass(e.target,"p-dialog-header-icon")||S.hasClass(e.target.parentElement,"p-dialog-header-icon")||B.draggable&&(oe.current=!0,ie.current=e.pageX,ae.current=e.pageY,G.current.style.margin="0",S.addClass(document.body,"p-unselectable-text"),B.onDragStart&&B.onDragStart(e))},Ye=function(e){if(oe.current){var t=S.getOuterWidth(G.current),n=S.getOuterHeight(G.current),o=e.pageX-ie.current,r=e.pageY-ae.current,i=G.current.getBoundingClientRect(),a=i.left+o,l=i.top+r,c=S.getViewport(),s=getComputedStyle(G.current),p=parseFloat(s.marginLeft),u=parseFloat(s.marginTop);G.current.style.position="fixed",B.keepInViewport?(a>=B.minX&&a+t<c.width&&(ie.current=e.pageX,G.current.style.left=a-p+"px"),l>=B.minY&&l+n<c.height&&(ae.current=e.pageY,G.current.style.top=l-u+"px")):(ie.current=e.pageX,G.current.style.left=a-p+"px",ae.current=e.pageY,G.current.style.top=l-u+"px"),B.onDrag&&B.onDrag(e)}},_e=function(e){oe.current&&(oe.current=!1,S.removeClass(document.body,"p-unselectable-text"),B.onDragEnd&&B.onDragEnd(e))},Ve=function(e){B.resizable&&(re.current=!0,ie.current=e.pageX,ae.current=e.pageY,S.addClass(document.body,"p-unselectable-text"),B.onResizeStart&&B.onResizeStart(e))},Je=function(e,t,n){!n&&(n=S.getViewport());var o=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?o*(n[t]/100):o},Le=function(e){if(re.current){var t=e.pageX-ie.current,n=e.pageY-ae.current,o=S.getOuterWidth(G.current),r=S.getOuterHeight(G.current),i=G.current.getBoundingClientRect(),a=S.getViewport(),l=!parseInt(G.current.style.top)||!parseInt(G.current.style.left),c=Je(G.current.style.minWidth,"width",a),s=Je(G.current.style.minHeight,"height",a),p=o+t,u=r+n;l&&(p+=t,u+=n),(!c||p>c)&&i.left+p<a.width&&(G.current.style.width=p+"px"),(!s||u>s)&&i.top+u<a.height&&(G.current.style.height=u+"px"),ie.current=e.pageX,ae.current=e.pageY,B.onResize&&B.onResize(e)}},Fe=function(e){re.current&&(re.current=!1,S.removeClass(document.body,"p-unselectable-text"),B.onResizeEnd&&B.onResizeEnd(e))},Ze=function(){G.current.style.position="",G.current.style.left="",G.current.style.top="",G.current.style.margin=""},Ue=function(){G.current.setAttribute(ce.current,"")},We=function(){var e;B.onShow&&B.onShow(),B.focusOnShow&&!((e=document.activeElement)&&G.current&&G.current.contains(e))&&B.closable&&B.showHeader&&ne.current&&ne.current.focus(),Ke()},$e=function(){B.modal&&!ye()&&S.addClass(K.current,"p-component-overlay-leave")},Ge=function(){oe.current=!1,k.clear(K.current),_(!1),qe(),S.focus(se.current),se.current=null},Ke=function(){et()},qe=function(){tt()},Qe=function(e){if(e&&F){var t={id:X,hasBlockScroll:ue};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===X}));document.primeDialogParams=-1===n?[].concat(D(o=document.primeDialogParams)||j(o)||C(o)||R(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==X}));var o;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?S.blockBodyScroll():S.unblockBodyScroll()},et=function(){B.draggable&&(De(),Re()),B.resizable&&(ke(),Oe()),xe()},tt=function(){je(),Ne(),ze(),Pe(),we()},nt=function(){le.current=S.createInlineStyle(N&&N.nonce||t.nonce,N&&N.styleContainer);var e="";for(var n in B.breakpoints)e+="\n @media screen and (max-width: ".concat(n,') {\n [data-pc-name="dialog"][').concat(ce.current,"] {\n width: ").concat(B.breakpoints[n]," !important;\n }\n }\n ");le.current.innerHTML=e};d((function(){Qe(!0),B.visible&&_(!0)})),e.useEffect((function(){return B.breakpoints&&nt(),function(){le.current=S.removeInlineStyle(le.current)}}),[B.breakpoints]),m((function(){B.visible&&!Y&&_(!0),B.visible!==F&&Y&&Z(B.visible),B.visible&&(se.current=document.activeElement)}),[B.visible,Y]),m((function(){Y&&(k.set("modal",K.current,N&&N.autoZIndex||t.autoZIndex,B.baseZIndex||N&&N.zIndex.modal||t.zIndex.modal),Z(!0))}),[Y]),m((function(){Qe(!0)}),[ue,F]),g((function(){qe(),Qe(!1),S.removeInlineStyle(le.current),k.clear(K.current)})),e.useImperativeHandle(P,(function(){return{props:B,resetPosition:Ze,getElement:function(){return G.current},getMask:function(){return K.current},getContent:function(){return Q.current},getHeader:function(){return ee.current},getFooter:function(){return te.current},getCloseButton:function(){return ne.current}}}));var ot=function(){if(B.closable){var t=B.ariaCloseIconLabel||o("close"),n=I({className:be("closeButtonIcon"),"aria-hidden":!0},fe("closeButtonIcon")),r=E.getJSXIcon(B.closeIcon||e.createElement(f,n),L({},n),{props:B}),i=I({ref:ne,type:"button",className:be("closeButton"),"aria-label":t,onClick:Be},fe("closeButton"));return e.createElement("button",i,r,e.createElement(v,null))}return null},rt=function(){var t=I({className:be("maximizableIcon")},fe("maximizableIcon")),n=E.getJSXIcon(pe?B.minimizeIcon||e.createElement(h,t):B.maximizeIcon||e.createElement(b,t),t,{props:B});if(B.maximizable){var o=I({type:"button",className:be("maximizableButton"),onClick:Xe},fe("maximizableButton"));return e.createElement("button",o,n,e.createElement(v,null))}return null},it=function(){if(B.showHeader){var t=ot(),n=rt(),o=z.getJSXElement(B.icons,B),r=z.getJSXElement(B.header,B),i=X+"_header",a=I({ref:ee,style:B.headerStyle,className:be("header"),onMouseDown:He},fe("header")),l=I({id:i,className:be("headerTitle")},fe("headerTitle")),c=I({className:be("headerIcons")},fe("headerIcons"));return e.createElement("div",a,e.createElement("div",l,r),e.createElement("div",c,o,n,t))}return null},at=function(){var t=z.getJSXElement(B.footer,B),n=I({ref:te,className:be("footer")},fe("footer"));return t&&e.createElement("div",n,t)},lt=function(t){var n,o=t.rootProps,i={header:B.header,content:B.message,message:null==B||null===(n=B.children)||void 0===n||null===(n=n[1])||void 0===n||null===(n=n.props)||void 0===n?void 0:n.children},l={headerRef:ee,contentRef:Q,footerRef:te,closeRef:ne,hide:Be,message:i};return e.createElement("div",t.maskProps,e.createElement(a,O({nodeRef:G},t.transitionProps),e.createElement("div",o,z.getJSXElement(r.content,l))))},ct=function(t){var n,o=t.maskProps,r=t.rootProps,i=t.transitionProps,l=it(),c=(n=I({id:X+"_content",ref:Q,style:B.contentStyle,className:be("content")},fe("content")),e.createElement("div",n,B.children)),s=at(),p=B.resizable?e.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Ve}):null;return e.createElement("div",o,e.createElement(a,O({nodeRef:G},i),e.createElement("div",r,l,c,s,p)))};return Y&&function(){var t=X+"_header",n=X+"_content",o={enter:"center"===B.position?150:300,exit:"center"===B.position?150:300},i=I({ref:K,style:he("mask"),className:be("mask"),onPointerUp:Te},fe("mask")),a=I({ref:G,id:X,className:x(B.className,be("root",{props:B,maximized:pe,context:N})),style:B.style,onClick:B.onClick,role:"dialog","aria-labelledby":t,"aria-describedby":n,"aria-modal":B.modal,onPointerDown:Me},V.getOtherProps(B),fe("root")),l=I({classNames:be("transition"),timeout:o,in:F,options:B.transitionOptions,unmountOnExit:!0,onEnter:Ue,onEntered:We,onExiting:$e,onExited:Ge},fe("transition"));if(null!=r&&r.content){var c=lt({maskProps:i,rootProps:a,transitionProps:l});return e.createElement(y,{element:c,appendTo:B.appendTo,visible:!0})}var s=ct({maskProps:i,rootProps:a,transitionProps:l});return e.createElement(y,{element:s,appendTo:B.appendTo,visible:!0})}()}));F.displayName="Dialog";export{F as Dialog};
|
|
1
|
+
import*as e from"react";import t from"react";import n,{PrimeReactContext as r,localeOption as o}from"primereact/api";import{ComponentBase as i,useHandleStyle as a}from"primereact/componentbase";import{CSSTransition as l}from"primereact/csstransition";import{useStyle as c,useMountEffect as s,useMergeProps as u,useDisplayOrder as p,useGlobalOnEscapeKey as d,ESC_KEY_HANDLING_PRIORITIES as m,useEventListener as f,useUpdateEffect as g,useUnmountEffect as b}from"primereact/hooks";import{ObjectUtils as h,DomHandler as y,classNames as v,UniqueComponentId as x,ZIndexUtils as w,IconUtils as O}from"primereact/utils";import{TimesIcon as S}from"primereact/icons/times";import{WindowMaximizeIcon as E}from"primereact/icons/windowmaximize";import{WindowMinimizeIcon as z}from"primereact/icons/windowminimize";import{Portal as P}from"primereact/portal";import{Ripple as k}from"primereact/ripple";function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j.apply(this,arguments)}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R(e){if(Array.isArray(e))return D(e)}function C(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _(e,t){if(e){if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(e,t):void 0}}function N(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function M(e){var t=T(e,"string");return"symbol"===I(t)?t:String(t)}function F(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){if(Array.isArray(e))return e}function X(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}function H(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function A(e,t){return B(e)||X(e,t)||_(e,t)||H()}var Y=i.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return h.getMergedProps(e,Y.defaultProps)},getOtherProps:function(e){return h.getDiffProps(e,Y.defaultProps)}});function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var V=t.memo(t.forwardRef((function(e,n){var o=t.useRef(null),i=t.useRef(null),a=t.useRef(null),l=t.useContext(r),u=Y.getProps(e,l),p={props:u};c(Y.css.styles,{name:"focustrap"});Y.setMetaData(L({},p));t.useImperativeHandle(n,(function(){return{props:u,getInk:function(){return i.current},getTarget:function(){return o.current}}})),s((function(){u.disabled||(o.current=h(),v(o.current))}));var d,m,f,g,b,h=function(){return i.current&&i.current.parentElement},v=function(e){var t=u||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,i=t.autoFocus,a=void 0!==i&&i,l=y.getFirstFocusableElement(e,"[autofocus]".concat(x(void 0===n?"":n)));a&&!l&&(l=y.getFirstFocusableElement(e,x(o))),y.focus(l)},x=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},w=function(e){var t,n=e.currentTarget,r=e.relatedTarget,i=r!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=o.current)&&void 0!==t&&t.contains(r)?n.$_pfocustrap_firsthiddenfocusableelement:y.getLastFocusableElement(n.parentElement,x(n.$_pfocustrap_focusableselector));y.focus(i)};return m=void 0===(d=(u||{}).tabIndex)?0:d,g=(f=function(e,n){return t.createElement("span",{ref:"firstfocusableelement"===n?i:a,className:"p-hidden-accessible p-hidden-focusable",tabIndex:m,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:e,"data-pc-section":n})})((function(e){var t,n=e.currentTarget,r=e.relatedTarget,i=r!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=o.current)&&void 0!==t&&t.contains(r)?n.$_pfocustrap_lasthiddenfocusableelement:y.getFirstFocusableElement(n.parentElement,x(n.$_pfocustrap_focusableselector));y.focus(i)}),"firstfocusableelement"),b=f(w,"lastfocusableelement"),g.ref.current&&b.ref.current&&(g.ref.current.$_pfocustrap_lasthiddenfocusableelement=b.ref.current,b.ref.current.$_pfocustrap_firsthiddenfocusableelement=g.ref.current),t.createElement(t.Fragment,null,g,u.children,b)})));function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var U=i.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return v("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return v("p-dialog-content",e.props.contentClassName)},footer:function(e){return v("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,r=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===t.position||e.replace("-","")===t.position}));return v("p-dialog-mask",r?"p-dialog-".concat(r):"",{"p-component-overlay p-component-overlay-enter":t.modal,"p-dialog-visible":n,"p-dialog-draggable":t.draggable,"p-dialog-resizable":t.resizable},t.maskClassName)},root:function(e){var t=e.maximized,r=e.context;return v("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":r&&"filled"===r.inputStyle||"filled"===n.inputStyle,"p-ripple-disabled":r&&!1===r.ripple||!1===n.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n",inlineStyles:{mask:function(e){var t=e.props;return Z({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var q=e.forwardRef((function(t,i){var c=u(),I=e.useContext(r),D=U.getProps(t,I),T=D.id?D.id:x(),M=A(e.useState(T),2),F=M[0],B=A(e.useState(!1),2),X=B[0],H=B[1],Y=A(e.useState(!1),2),$=Y[0],L=Y[1],J=A(e.useState(D.maximized),2),Z=J[0],W=J[1],q=e.useRef(null),K=e.useRef(null),Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null),ne=e.useRef(null),re=e.useRef(null),oe=e.useRef(!1),ie=e.useRef(!1),ae=e.useRef(null),le=e.useRef(null),ce=e.useRef(null),se=e.useRef(T),ue=e.useRef(null),pe=D.onMaximize?D.maximized:Z,de=$&&(D.blockScroll||D.maximizable&&pe),me=D.closable&&D.closeOnEscape&&$,fe=p("dialog",me),ge=U.setMetaData(G(G({props:D},D.__parentMetadata),{},{state:{id:F,maximized:pe,containerVisible:X}})),be=ge.ptm,he=ge.cx,ye=ge.sx,ve=ge.isUnstyled;a(U.css.styles,ve,{name:"dialog"}),d({callback:function(e){Ce(e)},when:me&&fe,priority:[m.DIALOG,fe]});var xe=A(f({type:"mousemove",target:function(){return window.document},listener:function(e){return Ae(e)}}),2),we=xe[0],Oe=xe[1],Se=A(f({type:"mouseup",target:function(){return window.document},listener:function(e){return Ye(e)}}),2),Ee=Se[0],ze=Se[1],Pe=A(f({type:"mousemove",target:function(){return window.document},listener:function(e){return Fe(e)}}),2),ke=Pe[0],je=Pe[1],Ie=A(f({type:"mouseup",target:function(){return window.document},listener:function(e){return Be(e)}}),2),De=Ie[0],Re=Ie[1],Ce=function(e){D.onHide(),e.preventDefault()},_e=function(e){Q.current=e.target,D.onPointerDown&&D.onPointerDown(e)},Ne=function(e){D.dismissableMask&&D.modal&&K.current===e.target&&!Q.current&&Ce(e),D.onMaskClick&&D.onMaskClick(e),Q.current=null},Te=function(e){D.onMaximize?D.onMaximize({originalEvent:e,maximized:!pe}):W((function(e){return!e})),e.preventDefault()},Me=function(e){y.hasClass(e.target,"p-dialog-header-icon")||y.hasClass(e.target.parentElement,"p-dialog-header-icon")||D.draggable&&(oe.current=!0,ae.current=e.pageX,le.current=e.pageY,q.current.style.margin="0",y.addClass(document.body,"p-unselectable-text"),D.onDragStart&&D.onDragStart(e))},Fe=function(e){if(oe.current){var t=y.getOuterWidth(q.current),n=y.getOuterHeight(q.current),r=e.pageX-ae.current,o=e.pageY-le.current,i=q.current.getBoundingClientRect(),a=i.left+r,l=i.top+o,c=y.getViewport(),s=getComputedStyle(q.current),u=parseFloat(s.marginLeft),p=parseFloat(s.marginTop);q.current.style.position="fixed",D.keepInViewport?(a>=D.minX&&a+t<c.width&&(ae.current=e.pageX,q.current.style.left=a-u+"px"),l>=D.minY&&l+n<c.height&&(le.current=e.pageY,q.current.style.top=l-p+"px")):(ae.current=e.pageX,q.current.style.left=a-u+"px",le.current=e.pageY,q.current.style.top=l-p+"px"),D.onDrag&&D.onDrag(e)}},Be=function(e){oe.current&&(oe.current=!1,y.removeClass(document.body,"p-unselectable-text"),D.onDragEnd&&D.onDragEnd(e))},Xe=function(e){D.resizable&&(ie.current=!0,ae.current=e.pageX,le.current=e.pageY,y.addClass(document.body,"p-unselectable-text"),D.onResizeStart&&D.onResizeStart(e))},He=function(e,t,n){!n&&(n=y.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},Ae=function(e){if(ie.current){var t=e.pageX-ae.current,n=e.pageY-le.current,r=y.getOuterWidth(q.current),o=y.getOuterHeight(q.current),i=q.current.getBoundingClientRect(),a=y.getViewport(),l=!parseInt(q.current.style.top)||!parseInt(q.current.style.left),c=He(q.current.style.minWidth,"width",a),s=He(q.current.style.minHeight,"height",a),u=r+t,p=o+n;l&&(u+=t,p+=n),(!c||u>c)&&i.left+u<a.width&&(q.current.style.width=u+"px"),(!s||p>s)&&i.top+p<a.height&&(q.current.style.height=p+"px"),ae.current=e.pageX,le.current=e.pageY,D.onResize&&D.onResize(e)}},Ye=function(e){ie.current&&(ie.current=!1,y.removeClass(document.body,"p-unselectable-text"),D.onResizeEnd&&D.onResizeEnd(e))},$e=function(){q.current.style.position="",q.current.style.left="",q.current.style.top="",q.current.style.margin=""},Le=function(){q.current.setAttribute(se.current,"")},Ve=function(){var e;D.onShow&&D.onShow(),D.focusOnShow&&!((e=document.activeElement)&&q.current&&q.current.contains(e))&&D.closable&&D.showHeader&&re.current&&re.current.focus(),Ue()},Je=function(){D.modal&&!ve()&&y.addClass(K.current,"p-component-overlay-leave")},Ze=function(){D.onHide&&D.onHide(),oe.current=!1,w.clear(K.current),H(!1),We(),y.focus(ue.current),ue.current=null},Ue=function(){qe()},We=function(){Ke()},Ge=function(e){if(e&&$){var t={id:F,hasBlockScroll:de};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===F}));document.primeDialogParams=-1===n?[].concat(R(r=document.primeDialogParams)||C(r)||_(r)||N(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==F}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?y.blockBodyScroll():y.unblockBodyScroll()},qe=function(){D.draggable&&(ke(),De()),D.resizable&&(we(),Ee())},Ke=function(){je(),Re(),Oe(),ze()},Qe=function(){ce.current=y.createInlineStyle(I&&I.nonce||n.nonce,I&&I.styleContainer);var e="";for(var t in D.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(se.current,"] {\n width: ").concat(D.breakpoints[t]," !important;\n }\n }\n ");ce.current.innerHTML=e};s((function(){Ge(!0),D.visible&&H(!0)})),e.useEffect((function(){return D.breakpoints&&Qe(),function(){ce.current=y.removeInlineStyle(ce.current)}}),[D.breakpoints]),g((function(){D.visible&&!X&&H(!0),D.visible!==$&&X&&L(D.visible),D.visible&&(ue.current=document.activeElement)}),[D.visible,X]),g((function(){X&&(w.set("modal",K.current,I&&I.autoZIndex||n.autoZIndex,D.baseZIndex||I&&I.zIndex.modal||n.zIndex.modal),L(!0))}),[X]),g((function(){Ge(!0)}),[de,$]),b((function(){We(),Ge(!1),y.removeInlineStyle(ce.current),w.clear(K.current)})),e.useImperativeHandle(i,(function(){return{props:D,resetPosition:$e,getElement:function(){return q.current},getMask:function(){return K.current},getContent:function(){return ee.current},getHeader:function(){return te.current},getFooter:function(){return ne.current},getCloseButton:function(){return re.current}}}));var et=function(){if(D.closable){var t=D.ariaCloseIconLabel||o("close"),n=c({className:he("closeButtonIcon"),"aria-hidden":!0},be("closeButtonIcon")),r=O.getJSXIcon(D.closeIcon||e.createElement(S,n),G({},n),{props:D}),i=c({ref:re,type:"button",className:he("closeButton"),"aria-label":t,onClick:Ce},be("closeButton"));return e.createElement("button",i,r,e.createElement(k,null))}return null},tt=function(){var t=c({className:he("maximizableIcon")},be("maximizableIcon")),n=O.getJSXIcon(pe?D.minimizeIcon||e.createElement(z,t):D.maximizeIcon||e.createElement(E,t),t,{props:D});if(D.maximizable){var r=c({type:"button",className:he("maximizableButton"),onClick:Te},be("maximizableButton"));return e.createElement("button",r,n,e.createElement(k,null))}return null},nt=function(){if(D.showHeader){var t=et(),n=tt(),r=h.getJSXElement(D.icons,D),o=h.getJSXElement(D.header,D),i=F+"_header",a=c({ref:te,style:D.headerStyle,className:he("header"),onMouseDown:Me},be("header")),l=c({id:i,className:he("headerTitle")},be("headerTitle")),s=c({className:he("headerIcons")},be("headerIcons"));return e.createElement("div",a,e.createElement("div",l,o),e.createElement("div",s,r,n,t))}return null},rt=function(){var t=h.getJSXElement(D.footer,D),n=c({ref:ne,className:he("footer")},be("footer"));return t&&e.createElement("div",n,t)};return X&&function(){var n,r,o,i,a,s,u=F+"_header",p=F+"_content",d={enter:"center"===D.position?150:300,exit:"center"===D.position?150:300},m=c({ref:K,style:ye("mask"),className:he("mask"),onPointerUp:Ne},be("mask")),f=c({ref:q,id:F,className:v(D.className,he("root",{props:D,maximized:pe,context:I})),style:D.style,onClick:D.onClick,role:"dialog","aria-labelledby":u,"aria-describedby":p,"aria-modal":D.modal,onPointerDown:_e},U.getOtherProps(D),be("root")),g=c({classNames:he("transition"),timeout:d,in:$,options:D.transitionOptions,unmountOnExit:!0,onEnter:Le,onEntered:Ve,onExiting:Je,onExited:Ze},be("transition")),b=null;null!=t&&t.content?(s={header:D.header,content:D.message,message:null==D||null===(a=D.children)||void 0===a||null===(a=a[1])||void 0===a||null===(a=a.props)||void 0===a?void 0:a.children},b=h.getJSXElement(t.content,{headerRef:te,contentRef:ee,footerRef:ne,closeRef:re,hide:Ce,message:s})):(r=nt(),n=c({id:F+"_content",ref:ee,style:D.contentStyle,className:he("content")},be("content")),o=e.createElement("div",n,D.children),i=rt(),b=e.createElement(e.Fragment,null,r,o,i,D.resizable?e.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Xe}):null));var y=e.createElement("div",m,e.createElement(l,j({nodeRef:q},g),e.createElement("div",f,e.createElement(V,{autoFocus:!0},b))));return e.createElement(P,{element:y,appendTo:D.appendTo,visible:!0})}()}));q.displayName="Dialog";export{q as Dialog};
|