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.cjs.js
CHANGED
|
@@ -8,12 +8,12 @@ var PrimeReact = require('primereact/api');
|
|
|
8
8
|
var componentbase = require('primereact/componentbase');
|
|
9
9
|
var csstransition = require('primereact/csstransition');
|
|
10
10
|
var hooks = require('primereact/hooks');
|
|
11
|
+
var utils = require('primereact/utils');
|
|
11
12
|
var times = require('primereact/icons/times');
|
|
12
13
|
var windowmaximize = require('primereact/icons/windowmaximize');
|
|
13
14
|
var windowminimize = require('primereact/icons/windowminimize');
|
|
14
15
|
var portal = require('primereact/portal');
|
|
15
16
|
var ripple = require('primereact/ripple');
|
|
16
|
-
var utils = require('primereact/utils');
|
|
17
17
|
|
|
18
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
19
|
|
|
@@ -35,6 +35,7 @@ function _interopNamespace(e) {
|
|
|
35
35
|
return Object.freeze(n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
38
39
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
39
40
|
var PrimeReact__default = /*#__PURE__*/_interopDefaultLegacy(PrimeReact);
|
|
40
41
|
|
|
@@ -165,6 +166,117 @@ function _slicedToArray(arr, i) {
|
|
|
165
166
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
166
167
|
}
|
|
167
168
|
|
|
169
|
+
var styles$1 = '';
|
|
170
|
+
var FocusTrapBase = componentbase.ComponentBase.extend({
|
|
171
|
+
defaultProps: {
|
|
172
|
+
__TYPE: 'FocusTrap',
|
|
173
|
+
children: undefined
|
|
174
|
+
},
|
|
175
|
+
css: {
|
|
176
|
+
styles: styles$1
|
|
177
|
+
},
|
|
178
|
+
getProps: function getProps(props) {
|
|
179
|
+
return utils.ObjectUtils.getMergedProps(props, FocusTrapBase.defaultProps);
|
|
180
|
+
},
|
|
181
|
+
getOtherProps: function getOtherProps(props) {
|
|
182
|
+
return utils.ObjectUtils.getDiffProps(props, FocusTrapBase.defaultProps);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
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; }
|
|
187
|
+
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; }
|
|
188
|
+
var FocusTrap = /*#__PURE__*/React__default["default"].memo( /*#__PURE__*/React__default["default"].forwardRef(function (inProps, ref) {
|
|
189
|
+
var targetRef = React__default["default"].useRef(null);
|
|
190
|
+
var firstFocusableElementRef = React__default["default"].useRef(null);
|
|
191
|
+
var lastFocusableElementRef = React__default["default"].useRef(null);
|
|
192
|
+
var context = React__default["default"].useContext(PrimeReact.PrimeReactContext);
|
|
193
|
+
var props = FocusTrapBase.getProps(inProps, context);
|
|
194
|
+
var metaData = {
|
|
195
|
+
props: props
|
|
196
|
+
};
|
|
197
|
+
hooks.useStyle(FocusTrapBase.css.styles, {
|
|
198
|
+
name: 'focustrap'
|
|
199
|
+
});
|
|
200
|
+
var _FocusTrapBase$setMet = FocusTrapBase.setMetaData(_objectSpread$2({}, metaData));
|
|
201
|
+
_FocusTrapBase$setMet.ptm;
|
|
202
|
+
React__default["default"].useImperativeHandle(ref, function () {
|
|
203
|
+
return {
|
|
204
|
+
props: props,
|
|
205
|
+
getInk: function getInk() {
|
|
206
|
+
return firstFocusableElementRef.current;
|
|
207
|
+
},
|
|
208
|
+
getTarget: function getTarget() {
|
|
209
|
+
return targetRef.current;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
hooks.useMountEffect(function () {
|
|
214
|
+
if (!props.disabled) {
|
|
215
|
+
targetRef.current = getTarget();
|
|
216
|
+
setAutoFocus(targetRef.current);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
var getTarget = function getTarget() {
|
|
220
|
+
return firstFocusableElementRef.current && firstFocusableElementRef.current.parentElement;
|
|
221
|
+
};
|
|
222
|
+
var setAutoFocus = function setAutoFocus(target) {
|
|
223
|
+
var _ref = props || {},
|
|
224
|
+
_ref$autoFocusSelecto = _ref.autoFocusSelector,
|
|
225
|
+
autoFocusSelector = _ref$autoFocusSelecto === void 0 ? '' : _ref$autoFocusSelecto,
|
|
226
|
+
_ref$firstFocusableSe = _ref.firstFocusableSelector,
|
|
227
|
+
firstFocusableSelector = _ref$firstFocusableSe === void 0 ? '' : _ref$firstFocusableSe,
|
|
228
|
+
_ref$autoFocus = _ref.autoFocus,
|
|
229
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus;
|
|
230
|
+
var focusableElement = utils.DomHandler.getFirstFocusableElement(target, "[autofocus]".concat(getComputedSelector(autoFocusSelector)));
|
|
231
|
+
autoFocus && !focusableElement && (focusableElement = utils.DomHandler.getFirstFocusableElement(target, getComputedSelector(firstFocusableSelector)));
|
|
232
|
+
utils.DomHandler.focus(focusableElement);
|
|
233
|
+
};
|
|
234
|
+
var getComputedSelector = function getComputedSelector(selector) {
|
|
235
|
+
return ":not(.p-hidden-focusable):not([data-p-hidden-focusable=\"true\"])".concat(selector !== null && selector !== void 0 ? selector : '');
|
|
236
|
+
};
|
|
237
|
+
var onFirstHiddenElementFocus = function onFirstHiddenElementFocus(event) {
|
|
238
|
+
var _targetRef$current;
|
|
239
|
+
var currentTarget = event.currentTarget,
|
|
240
|
+
relatedTarget = event.relatedTarget;
|
|
241
|
+
var focusableElement = relatedTarget === currentTarget.$_pfocustrap_lasthiddenfocusableelement || !((_targetRef$current = targetRef.current) !== null && _targetRef$current !== void 0 && _targetRef$current.contains(relatedTarget)) ? utils.DomHandler.getFirstFocusableElement(currentTarget.parentElement, getComputedSelector(currentTarget.$_pfocustrap_focusableselector)) : currentTarget.$_pfocustrap_lasthiddenfocusableelement;
|
|
242
|
+
utils.DomHandler.focus(focusableElement);
|
|
243
|
+
};
|
|
244
|
+
var onLastHiddenElementFocus = function onLastHiddenElementFocus(event) {
|
|
245
|
+
var _targetRef$current2;
|
|
246
|
+
var currentTarget = event.currentTarget,
|
|
247
|
+
relatedTarget = event.relatedTarget;
|
|
248
|
+
var focusableElement = relatedTarget === currentTarget.$_pfocustrap_firsthiddenfocusableelement || !((_targetRef$current2 = targetRef.current) !== null && _targetRef$current2 !== void 0 && _targetRef$current2.contains(relatedTarget)) ? utils.DomHandler.getLastFocusableElement(currentTarget.parentElement, getComputedSelector(currentTarget.$_pfocustrap_focusableselector)) : currentTarget.$_pfocustrap_firsthiddenfocusableelement;
|
|
249
|
+
utils.DomHandler.focus(focusableElement);
|
|
250
|
+
};
|
|
251
|
+
var createHiddenFocusableElements = function createHiddenFocusableElements() {
|
|
252
|
+
var _ref2 = props || {},
|
|
253
|
+
_ref2$tabIndex = _ref2.tabIndex,
|
|
254
|
+
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
255
|
+
var createFocusableElement = function createFocusableElement(onFocus, section) {
|
|
256
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
257
|
+
ref: section === 'firstfocusableelement' ? firstFocusableElementRef : lastFocusableElementRef,
|
|
258
|
+
className: 'p-hidden-accessible p-hidden-focusable',
|
|
259
|
+
tabIndex: tabIndex,
|
|
260
|
+
role: 'presentation',
|
|
261
|
+
"aria-hidden": true,
|
|
262
|
+
"data-p-hidden-accessible": true,
|
|
263
|
+
"data-p-hidden-focusable": true,
|
|
264
|
+
onFocus: onFocus,
|
|
265
|
+
"data-pc-section": section
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
var firstFocusableElement = createFocusableElement(onFirstHiddenElementFocus, 'firstfocusableelement');
|
|
269
|
+
var lastFocusableElement = createFocusableElement(onLastHiddenElementFocus, 'lastfocusableelement');
|
|
270
|
+
if (firstFocusableElement.ref.current && lastFocusableElement.ref.current) {
|
|
271
|
+
firstFocusableElement.ref.current.$_pfocustrap_lasthiddenfocusableelement = lastFocusableElement.ref.current;
|
|
272
|
+
lastFocusableElement.ref.current.$_pfocustrap_firsthiddenfocusableelement = firstFocusableElement.ref.current;
|
|
273
|
+
}
|
|
274
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, firstFocusableElement, props.children, lastFocusableElement);
|
|
275
|
+
};
|
|
276
|
+
return createHiddenFocusableElements();
|
|
277
|
+
}));
|
|
278
|
+
var FocusTrap$1 = FocusTrap;
|
|
279
|
+
|
|
168
280
|
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; }
|
|
169
281
|
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; }
|
|
170
282
|
var classes = {
|
|
@@ -359,15 +471,6 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
359
471
|
priority: [hooks.ESC_KEY_HANDLING_PRIORITIES.DIALOG, displayOrder]
|
|
360
472
|
});
|
|
361
473
|
var _useEventListener = hooks.useEventListener({
|
|
362
|
-
type: 'keydown',
|
|
363
|
-
listener: function listener(event) {
|
|
364
|
-
return onKeyDown(event);
|
|
365
|
-
}
|
|
366
|
-
}),
|
|
367
|
-
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
368
|
-
bindDocumentKeyDownListener = _useEventListener2[0],
|
|
369
|
-
unbindDocumentKeyDownListener = _useEventListener2[1];
|
|
370
|
-
var _useEventListener3 = hooks.useEventListener({
|
|
371
474
|
type: 'mousemove',
|
|
372
475
|
target: function target() {
|
|
373
476
|
return window.document;
|
|
@@ -376,10 +479,10 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
376
479
|
return onResize(event);
|
|
377
480
|
}
|
|
378
481
|
}),
|
|
379
|
-
|
|
380
|
-
bindDocumentResizeListener =
|
|
381
|
-
unbindDocumentResizeListener =
|
|
382
|
-
var
|
|
482
|
+
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
483
|
+
bindDocumentResizeListener = _useEventListener2[0],
|
|
484
|
+
unbindDocumentResizeListener = _useEventListener2[1];
|
|
485
|
+
var _useEventListener3 = hooks.useEventListener({
|
|
383
486
|
type: 'mouseup',
|
|
384
487
|
target: function target() {
|
|
385
488
|
return window.document;
|
|
@@ -388,10 +491,10 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
388
491
|
return onResizeEnd(event);
|
|
389
492
|
}
|
|
390
493
|
}),
|
|
391
|
-
|
|
392
|
-
bindDocumentResizeEndListener =
|
|
393
|
-
unbindDocumentResizEndListener =
|
|
394
|
-
var
|
|
494
|
+
_useEventListener4 = _slicedToArray(_useEventListener3, 2),
|
|
495
|
+
bindDocumentResizeEndListener = _useEventListener4[0],
|
|
496
|
+
unbindDocumentResizEndListener = _useEventListener4[1];
|
|
497
|
+
var _useEventListener5 = hooks.useEventListener({
|
|
395
498
|
type: 'mousemove',
|
|
396
499
|
target: function target() {
|
|
397
500
|
return window.document;
|
|
@@ -400,10 +503,10 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
400
503
|
return onDrag(event);
|
|
401
504
|
}
|
|
402
505
|
}),
|
|
403
|
-
|
|
404
|
-
bindDocumentDragListener =
|
|
405
|
-
unbindDocumentDragListener =
|
|
406
|
-
var
|
|
506
|
+
_useEventListener6 = _slicedToArray(_useEventListener5, 2),
|
|
507
|
+
bindDocumentDragListener = _useEventListener6[0],
|
|
508
|
+
unbindDocumentDragListener = _useEventListener6[1];
|
|
509
|
+
var _useEventListener7 = hooks.useEventListener({
|
|
407
510
|
type: 'mouseup',
|
|
408
511
|
target: function target() {
|
|
409
512
|
return window.document;
|
|
@@ -412,9 +515,9 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
412
515
|
return onDragEnd(event);
|
|
413
516
|
}
|
|
414
517
|
}),
|
|
415
|
-
|
|
416
|
-
bindDocumentDragEndListener =
|
|
417
|
-
unbindDocumentDragEndListener =
|
|
518
|
+
_useEventListener8 = _slicedToArray(_useEventListener7, 2),
|
|
519
|
+
bindDocumentDragEndListener = _useEventListener8[0],
|
|
520
|
+
unbindDocumentDragEndListener = _useEventListener8[1];
|
|
418
521
|
var onClose = function onClose(event) {
|
|
419
522
|
props.onHide();
|
|
420
523
|
event.preventDefault();
|
|
@@ -450,41 +553,6 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
450
553
|
}
|
|
451
554
|
event.preventDefault();
|
|
452
555
|
};
|
|
453
|
-
var onKeyDown = function onKeyDown(event) {
|
|
454
|
-
var currentTarget = event.currentTarget;
|
|
455
|
-
if (!currentTarget || !currentTarget.primeDialogParams) {
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
var params = currentTarget.primeDialogParams;
|
|
459
|
-
var paramLength = params.length;
|
|
460
|
-
var dialogId = params[paramLength - 1] ? params[paramLength - 1].id : undefined;
|
|
461
|
-
if (dialogId !== idState) {
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
var dialog = document.getElementById(dialogId);
|
|
465
|
-
if (event.key === 'Tab') {
|
|
466
|
-
event.preventDefault();
|
|
467
|
-
var focusableElements = utils.DomHandler.getFocusableElements(dialog);
|
|
468
|
-
if (focusableElements && focusableElements.length > 0) {
|
|
469
|
-
if (!document.activeElement) {
|
|
470
|
-
focusableElements[0].focus();
|
|
471
|
-
} else {
|
|
472
|
-
var focusedIndex = focusableElements.indexOf(document.activeElement);
|
|
473
|
-
if (event.shiftKey) {
|
|
474
|
-
if (focusedIndex === -1 || focusedIndex === 0) {
|
|
475
|
-
focusableElements[focusableElements.length - 1].focus();
|
|
476
|
-
} else {
|
|
477
|
-
focusableElements[focusedIndex - 1].focus();
|
|
478
|
-
}
|
|
479
|
-
} else if (focusedIndex === -1 || focusedIndex === focusableElements.length - 1) {
|
|
480
|
-
focusableElements[0].focus();
|
|
481
|
-
} else {
|
|
482
|
-
focusableElements[focusedIndex + 1].focus();
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
556
|
var onDragStart = function onDragStart(event) {
|
|
489
557
|
if (utils.DomHandler.hasClass(event.target, 'p-dialog-header-icon') || utils.DomHandler.hasClass(event.target.parentElement, 'p-dialog-header-icon')) {
|
|
490
558
|
return;
|
|
@@ -611,6 +679,7 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
611
679
|
}
|
|
612
680
|
};
|
|
613
681
|
var onExited = function onExited() {
|
|
682
|
+
props.onHide && props.onHide();
|
|
614
683
|
dragging.current = false;
|
|
615
684
|
utils.ZIndexUtils.clear(maskRef.current);
|
|
616
685
|
setMaskVisibleState(false);
|
|
@@ -678,14 +747,12 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
678
747
|
bindDocumentResizeListener();
|
|
679
748
|
bindDocumentResizeEndListener();
|
|
680
749
|
}
|
|
681
|
-
bindDocumentKeyDownListener();
|
|
682
750
|
};
|
|
683
751
|
var unbindGlobalListeners = function unbindGlobalListeners() {
|
|
684
752
|
unbindDocumentDragListener();
|
|
685
753
|
unbindDocumentDragEndListener();
|
|
686
754
|
unbindDocumentResizeListener();
|
|
687
755
|
unbindDocumentResizEndListener();
|
|
688
|
-
unbindDocumentKeyDownListener();
|
|
689
756
|
};
|
|
690
757
|
var createStyle = function createStyle() {
|
|
691
758
|
styleElement.current = utils.DomHandler.createInlineStyle(context && context.nonce || PrimeReact__default["default"].nonce, context && context.styleContainer);
|
|
@@ -864,11 +931,8 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
864
931
|
}
|
|
865
932
|
return null;
|
|
866
933
|
};
|
|
867
|
-
var createTemplateElement = function createTemplateElement(
|
|
934
|
+
var createTemplateElement = function createTemplateElement() {
|
|
868
935
|
var _props$children;
|
|
869
|
-
var maskProps = _ref.maskProps,
|
|
870
|
-
rootProps = _ref.rootProps,
|
|
871
|
-
transitionProps = _ref.transitionProps;
|
|
872
936
|
var messageProps = {
|
|
873
937
|
header: props.header,
|
|
874
938
|
content: props.message,
|
|
@@ -882,21 +946,14 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
882
946
|
hide: onClose,
|
|
883
947
|
message: messageProps
|
|
884
948
|
};
|
|
885
|
-
return
|
|
886
|
-
nodeRef: dialogRef
|
|
887
|
-
}, transitionProps), /*#__PURE__*/React__namespace.createElement("div", rootProps, utils.ObjectUtils.getJSXElement(inProps.content, templateElementProps))));
|
|
949
|
+
return utils.ObjectUtils.getJSXElement(inProps.content, templateElementProps);
|
|
888
950
|
};
|
|
889
|
-
var createElement = function createElement(
|
|
890
|
-
var maskProps = _ref2.maskProps,
|
|
891
|
-
rootProps = _ref2.rootProps,
|
|
892
|
-
transitionProps = _ref2.transitionProps;
|
|
951
|
+
var createElement = function createElement() {
|
|
893
952
|
var header = createHeader();
|
|
894
953
|
var content = createContent();
|
|
895
954
|
var footer = createFooter();
|
|
896
955
|
var resizer = createResizer();
|
|
897
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
898
|
-
nodeRef: dialogRef
|
|
899
|
-
}, transitionProps), /*#__PURE__*/React__namespace.createElement("div", rootProps, header, content, footer, resizer)));
|
|
956
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, header, content, footer, resizer);
|
|
900
957
|
};
|
|
901
958
|
var createDialog = function createDialog() {
|
|
902
959
|
var headerId = idState + '_header';
|
|
@@ -938,25 +995,19 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
938
995
|
onExiting: onExiting,
|
|
939
996
|
onExited: onExited
|
|
940
997
|
}, ptm('transition'));
|
|
998
|
+
var contentElement = null;
|
|
941
999
|
if (inProps !== null && inProps !== void 0 && inProps.content) {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
transitionProps: transitionProps
|
|
946
|
-
});
|
|
947
|
-
return /*#__PURE__*/React__namespace.createElement(portal.Portal, {
|
|
948
|
-
element: templateElement,
|
|
949
|
-
appendTo: props.appendTo,
|
|
950
|
-
visible: true
|
|
951
|
-
});
|
|
1000
|
+
contentElement = createTemplateElement();
|
|
1001
|
+
} else {
|
|
1002
|
+
contentElement = createElement();
|
|
952
1003
|
}
|
|
953
|
-
var
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
});
|
|
1004
|
+
var rootElement = /*#__PURE__*/React__namespace.createElement("div", maskProps, /*#__PURE__*/React__namespace.createElement(csstransition.CSSTransition, _extends({
|
|
1005
|
+
nodeRef: dialogRef
|
|
1006
|
+
}, transitionProps), /*#__PURE__*/React__namespace.createElement("div", rootProps, /*#__PURE__*/React__namespace.createElement(FocusTrap$1, {
|
|
1007
|
+
autoFocus: true
|
|
1008
|
+
}, contentElement))));
|
|
958
1009
|
return /*#__PURE__*/React__namespace.createElement(portal.Portal, {
|
|
959
|
-
element:
|
|
1010
|
+
element: rootElement,
|
|
960
1011
|
appendTo: props.appendTo,
|
|
961
1012
|
visible: true
|
|
962
1013
|
});
|
package/dialog/dialog.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),r=require("primereact/csstransition"),o=require("primereact/hooks"),i=require("primereact/icons/times"),a=require("primereact/icons/windowmaximize"),l=require("primereact/icons/windowminimize"),c=require("primereact/portal"),s=require("primereact/ripple"),u=require("primereact/utils");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=d(e),f=p(t);function g(){return g=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},g.apply(this,arguments)}function b(e){return b="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},b(e)}function y(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 v(e){if(Array.isArray(e))return y(e)}function h(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function x(e,t){if(e){if("string"==typeof e)return y(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)?y(e,t):void 0}}function w(){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 E(e,t){if("object"!==b(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function O(e){var t=E(e,"string");return"symbol"===b(t)?t:String(t)}function S(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e){if(Array.isArray(e))return e}function P(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 z(){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 k(e,t){return D(e)||P(e,t)||x(e,t)||z()}function I(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 j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var C=n.ComponentBase.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 u.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return u.classNames("p-dialog-content",e.props.contentClassName)},footer:function(e){return u.classNames("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 u.classNames("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,n=e.context;return u.classNames("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===f.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===f.default.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 j({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 R(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 H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var N=m.forwardRef((function(e,p){var d=o.useMergeProps(),b=m.useContext(t.PrimeReactContext),y=C.getProps(e,b),E=y.id?y.id:u.UniqueComponentId(),O=k(m.useState(E),2),S=O[0],D=k(m.useState(!1),2),P=D[0],z=D[1],I=k(m.useState(!1),2),j=I[0],R=I[1],N=k(m.useState(y.maximized),2),M=N[0],T=N[1],B=m.useRef(null),U=m.useRef(null),_=m.useRef(null),X=m.useRef(null),A=m.useRef(null),q=m.useRef(null),L=m.useRef(null),Y=m.useRef(!1),V=m.useRef(!1),Z=m.useRef(null),J=m.useRef(null),F=m.useRef(null),W=m.useRef(E),G=m.useRef(null),K=y.onMaximize?y.maximized:M,$=j&&(y.blockScroll||y.maximizable&&K),Q=y.closable&&y.closeOnEscape&&j,ee=o.useDisplayOrder("dialog",Q),te=C.setMetaData(H(H({props:y},y.__parentMetadata),{},{state:{id:S,maximized:K,containerVisible:P}})),ne=te.ptm,re=te.cx,oe=te.sx,ie=te.isUnstyled;n.useHandleStyle(C.css.styles,ie,{name:"dialog"}),o.useGlobalOnEscapeKey({callback:function(e){we(e)},when:Q&&ee,priority:[o.ESC_KEY_HANDLING_PRIORITIES.DIALOG,ee]});var ae=k(o.useEventListener({type:"keydown",listener:function(e){return De(e)}}),2),le=ae[0],ce=ae[1],se=k(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return Ce(e)}}),2),ue=se[0],pe=se[1],de=k(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Re(e)}}),2),me=de[0],fe=de[1],ge=k(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return ze(e)}}),2),be=ge[0],ye=ge[1],ve=k(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return ke(e)}}),2),he=ve[0],xe=ve[1],we=function(e){y.onHide(),e.preventDefault()},Ee=function(e){_.current=e.target,y.onPointerDown&&y.onPointerDown(e)},Oe=function(e){y.dismissableMask&&y.modal&&U.current===e.target&&!_.current&&we(e),y.onMaskClick&&y.onMaskClick(e),_.current=null},Se=function(e){y.onMaximize?y.onMaximize({originalEvent:e,maximized:!K}):T((function(e){return!e})),e.preventDefault()},De=function(e){var t=e.currentTarget;if(t&&t.primeDialogParams){var n=t.primeDialogParams,r=n.length,o=n[r-1]?n[r-1].id:void 0;if(o===S){var i=document.getElementById(o);if("Tab"===e.key){e.preventDefault();var a=u.DomHandler.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()}}}},Pe=function(e){u.DomHandler.hasClass(e.target,"p-dialog-header-icon")||u.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||y.draggable&&(Y.current=!0,Z.current=e.pageX,J.current=e.pageY,B.current.style.margin="0",u.DomHandler.addClass(document.body,"p-unselectable-text"),y.onDragStart&&y.onDragStart(e))},ze=function(e){if(Y.current){var t=u.DomHandler.getOuterWidth(B.current),n=u.DomHandler.getOuterHeight(B.current),r=e.pageX-Z.current,o=e.pageY-J.current,i=B.current.getBoundingClientRect(),a=i.left+r,l=i.top+o,c=u.DomHandler.getViewport(),s=getComputedStyle(B.current),p=parseFloat(s.marginLeft),d=parseFloat(s.marginTop);B.current.style.position="fixed",y.keepInViewport?(a>=y.minX&&a+t<c.width&&(Z.current=e.pageX,B.current.style.left=a-p+"px"),l>=y.minY&&l+n<c.height&&(J.current=e.pageY,B.current.style.top=l-d+"px")):(Z.current=e.pageX,B.current.style.left=a-p+"px",J.current=e.pageY,B.current.style.top=l-d+"px"),y.onDrag&&y.onDrag(e)}},ke=function(e){Y.current&&(Y.current=!1,u.DomHandler.removeClass(document.body,"p-unselectable-text"),y.onDragEnd&&y.onDragEnd(e))},Ie=function(e){y.resizable&&(V.current=!0,Z.current=e.pageX,J.current=e.pageY,u.DomHandler.addClass(document.body,"p-unselectable-text"),y.onResizeStart&&y.onResizeStart(e))},je=function(e,t,n){!n&&(n=u.DomHandler.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},Ce=function(e){if(V.current){var t=e.pageX-Z.current,n=e.pageY-J.current,r=u.DomHandler.getOuterWidth(B.current),o=u.DomHandler.getOuterHeight(B.current),i=B.current.getBoundingClientRect(),a=u.DomHandler.getViewport(),l=!parseInt(B.current.style.top)||!parseInt(B.current.style.left),c=je(B.current.style.minWidth,"width",a),s=je(B.current.style.minHeight,"height",a),p=r+t,d=o+n;l&&(p+=t,d+=n),(!c||p>c)&&i.left+p<a.width&&(B.current.style.width=p+"px"),(!s||d>s)&&i.top+d<a.height&&(B.current.style.height=d+"px"),Z.current=e.pageX,J.current=e.pageY,y.onResize&&y.onResize(e)}},Re=function(e){V.current&&(V.current=!1,u.DomHandler.removeClass(document.body,"p-unselectable-text"),y.onResizeEnd&&y.onResizeEnd(e))},He=function(){B.current.style.position="",B.current.style.left="",B.current.style.top="",B.current.style.margin=""},Ne=function(){B.current.setAttribute(W.current,"")},Me=function(){var e;y.onShow&&y.onShow(),y.focusOnShow&&!((e=document.activeElement)&&B.current&&B.current.contains(e))&&y.closable&&y.showHeader&&L.current&&L.current.focus(),Ue()},Te=function(){y.modal&&!ie()&&u.DomHandler.addClass(U.current,"p-component-overlay-leave")},Be=function(){Y.current=!1,u.ZIndexUtils.clear(U.current),z(!1),_e(),u.DomHandler.focus(G.current),G.current=null},Ue=function(){Ae()},_e=function(){qe()},Xe=function(e){if(e&&j){var t={id:S,hasBlockScroll:$};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===S}));document.primeDialogParams=-1===n?[].concat(v(r=document.primeDialogParams)||h(r)||x(r)||w(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==S}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?u.DomHandler.blockBodyScroll():u.DomHandler.unblockBodyScroll()},Ae=function(){y.draggable&&(be(),he()),y.resizable&&(ue(),me()),le()},qe=function(){ye(),xe(),pe(),fe(),ce()},Le=function(){F.current=u.DomHandler.createInlineStyle(b&&b.nonce||f.default.nonce,b&&b.styleContainer);var e="";for(var t in y.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(W.current,"] {\n width: ").concat(y.breakpoints[t]," !important;\n }\n }\n ");F.current.innerHTML=e};o.useMountEffect((function(){Xe(!0),y.visible&&z(!0)})),m.useEffect((function(){return y.breakpoints&&Le(),function(){F.current=u.DomHandler.removeInlineStyle(F.current)}}),[y.breakpoints]),o.useUpdateEffect((function(){y.visible&&!P&&z(!0),y.visible!==j&&P&&R(y.visible),y.visible&&(G.current=document.activeElement)}),[y.visible,P]),o.useUpdateEffect((function(){P&&(u.ZIndexUtils.set("modal",U.current,b&&b.autoZIndex||f.default.autoZIndex,y.baseZIndex||b&&b.zIndex.modal||f.default.zIndex.modal),R(!0))}),[P]),o.useUpdateEffect((function(){Xe(!0)}),[$,j]),o.useUnmountEffect((function(){_e(),Xe(!1),u.DomHandler.removeInlineStyle(F.current),u.ZIndexUtils.clear(U.current)})),m.useImperativeHandle(p,(function(){return{props:y,resetPosition:He,getElement:function(){return B.current},getMask:function(){return U.current},getContent:function(){return X.current},getHeader:function(){return A.current},getFooter:function(){return q.current},getCloseButton:function(){return L.current}}}));var Ye=function(){if(y.closable){var e=y.ariaCloseIconLabel||t.localeOption("close"),n=d({className:re("closeButtonIcon"),"aria-hidden":!0},ne("closeButtonIcon")),r=u.IconUtils.getJSXIcon(y.closeIcon||m.createElement(i.TimesIcon,n),H({},n),{props:y}),o=d({ref:L,type:"button",className:re("closeButton"),"aria-label":e,onClick:we},ne("closeButton"));return m.createElement("button",o,r,m.createElement(s.Ripple,null))}return null},Ve=function(){var e=d({className:re("maximizableIcon")},ne("maximizableIcon")),t=u.IconUtils.getJSXIcon(K?y.minimizeIcon||m.createElement(l.WindowMinimizeIcon,e):y.maximizeIcon||m.createElement(a.WindowMaximizeIcon,e),e,{props:y});if(y.maximizable){var n=d({type:"button",className:re("maximizableButton"),onClick:Se},ne("maximizableButton"));return m.createElement("button",n,t,m.createElement(s.Ripple,null))}return null},Ze=function(){if(y.showHeader){var e=Ye(),t=Ve(),n=u.ObjectUtils.getJSXElement(y.icons,y),r=u.ObjectUtils.getJSXElement(y.header,y),o=S+"_header",i=d({ref:A,style:y.headerStyle,className:re("header"),onMouseDown:Pe},ne("header")),a=d({id:o,className:re("headerTitle")},ne("headerTitle")),l=d({className:re("headerIcons")},ne("headerIcons"));return m.createElement("div",i,m.createElement("div",a,r),m.createElement("div",l,n,t,e))}return null},Je=function(){var e=u.ObjectUtils.getJSXElement(y.footer,y),t=d({ref:q,className:re("footer")},ne("footer"));return e&&m.createElement("div",t,e)},Fe=function(t){var n,o=t.rootProps,i={header:y.header,content:y.message,message:null==y||null===(n=y.children)||void 0===n||null===(n=n[1])||void 0===n||null===(n=n.props)||void 0===n?void 0:n.children},a={headerRef:A,contentRef:X,footerRef:q,closeRef:L,hide:we,message:i};return m.createElement("div",t.maskProps,m.createElement(r.CSSTransition,g({nodeRef:B},t.transitionProps),m.createElement("div",o,u.ObjectUtils.getJSXElement(e.content,a))))},We=function(e){var t,n=e.maskProps,o=e.rootProps,i=e.transitionProps,a=Ze(),l=(t=d({id:S+"_content",ref:X,style:y.contentStyle,className:re("content")},ne("content")),m.createElement("div",t,y.children)),c=Je(),s=y.resizable?m.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Ie}):null;return m.createElement("div",n,m.createElement(r.CSSTransition,g({nodeRef:B},i),m.createElement("div",o,a,l,c,s)))};return P&&function(){var t=S+"_header",n=S+"_content",r={enter:"center"===y.position?150:300,exit:"center"===y.position?150:300},o=d({ref:U,style:oe("mask"),className:re("mask"),onPointerUp:Oe},ne("mask")),i=d({ref:B,id:S,className:u.classNames(y.className,re("root",{props:y,maximized:K,context:b})),style:y.style,onClick:y.onClick,role:"dialog","aria-labelledby":t,"aria-describedby":n,"aria-modal":y.modal,onPointerDown:Ee},C.getOtherProps(y),ne("root")),a=d({classNames:re("transition"),timeout:r,in:j,options:y.transitionOptions,unmountOnExit:!0,onEnter:Ne,onEntered:Me,onExiting:Te,onExited:Be},ne("transition"));if(null!=e&&e.content){var l=Fe({maskProps:o,rootProps:i,transitionProps:a});return m.createElement(c.Portal,{element:l,appendTo:y.appendTo,visible:!0})}var s=We({maskProps:o,rootProps:i,transitionProps:a});return m.createElement(c.Portal,{element:s,appendTo:y.appendTo,visible:!0})}()}));N.displayName="Dialog",exports.Dialog=N;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),r=require("primereact/csstransition"),o=require("primereact/hooks"),i=require("primereact/utils"),a=require("primereact/icons/times"),l=require("primereact/icons/windowmaximize"),c=require("primereact/icons/windowminimize"),s=require("primereact/portal"),u=require("primereact/ripple");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=p(e),f=d(e),g=p(t);function b(){return b=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},b.apply(this,arguments)}function h(e){return h="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},h(e)}function y(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 v(e){if(Array.isArray(e))return y(e)}function x(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function O(e,t){if(e){if("string"==typeof e)return y(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)?y(e,t):void 0}}function w(){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 E(e,t){if("object"!==h(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function D(e){var t=E(e,"string");return"symbol"===h(t)?t:String(t)}function S(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){if(Array.isArray(e))return e}function j(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 z(){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 I(e,t){return P(e)||j(e,t)||O(e,t)||z()}var k=n.ComponentBase.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return i.ObjectUtils.getMergedProps(e,k.defaultProps)},getOtherProps:function(e){return i.ObjectUtils.getDiffProps(e,k.defaultProps)}});function C(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 H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var R=m.default.memo(m.default.forwardRef((function(e,n){var r=m.default.useRef(null),a=m.default.useRef(null),l=m.default.useRef(null),c=m.default.useContext(t.PrimeReactContext),s=k.getProps(e,c),u={props:s};o.useStyle(k.css.styles,{name:"focustrap"});k.setMetaData(H({},u));m.default.useImperativeHandle(n,(function(){return{props:s,getInk:function(){return a.current},getTarget:function(){return r.current}}})),o.useMountEffect((function(){s.disabled||(r.current=h(),y(r.current))}));var p,d,f,g,b,h=function(){return a.current&&a.current.parentElement},y=function(e){var t=s||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,a=t.autoFocus,l=void 0!==a&&a,c=i.DomHandler.getFirstFocusableElement(e,"[autofocus]".concat(v(void 0===n?"":n)));l&&!c&&(c=i.DomHandler.getFirstFocusableElement(e,v(o))),i.DomHandler.focus(c)},v=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},x=function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_firsthiddenfocusableelement:i.DomHandler.getLastFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)};return d=void 0===(p=(s||{}).tabIndex)?0:p,g=(f=function(e,t){return m.default.createElement("span",{ref:"firstfocusableelement"===t?a:l,className:"p-hidden-accessible p-hidden-focusable",tabIndex:d,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:e,"data-pc-section":t})})((function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_lasthiddenfocusableelement:i.DomHandler.getFirstFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)}),"firstfocusableelement"),b=f(x,"lastfocusableelement"),g.ref.current&&b.ref.current&&(g.ref.current.$_pfocustrap_lasthiddenfocusableelement=b.ref.current,b.ref.current.$_pfocustrap_firsthiddenfocusableelement=g.ref.current),m.default.createElement(m.default.Fragment,null,g,s.children,b)})));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 N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){S(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 M=n.ComponentBase.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 i.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return i.classNames("p-dialog-content",e.props.contentClassName)},footer:function(e){return i.classNames("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 i.classNames("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,n=e.context;return i.classNames("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===g.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===g.default.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 N({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 T(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 B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=f.forwardRef((function(e,p){var d=o.useMergeProps(),m=f.useContext(t.PrimeReactContext),h=M.getProps(e,m),y=h.id?h.id:i.UniqueComponentId(),E=I(f.useState(y),2),D=E[0],S=I(f.useState(!1),2),P=S[0],j=S[1],z=I(f.useState(!1),2),k=z[0],C=z[1],H=I(f.useState(h.maximized),2),_=H[0],N=H[1],T=f.useRef(null),F=f.useRef(null),U=f.useRef(null),X=f.useRef(null),A=f.useRef(null),q=f.useRef(null),L=f.useRef(null),Y=f.useRef(!1),$=f.useRef(!1),V=f.useRef(null),Z=f.useRef(null),J=f.useRef(null),W=f.useRef(y),G=f.useRef(null),K=h.onMaximize?h.maximized:_,Q=k&&(h.blockScroll||h.maximizable&&K),ee=h.closable&&h.closeOnEscape&&k,te=o.useDisplayOrder("dialog",ee),ne=M.setMetaData(B(B({props:h},h.__parentMetadata),{},{state:{id:D,maximized:K,containerVisible:P}})),re=ne.ptm,oe=ne.cx,ie=ne.sx,ae=ne.isUnstyled;n.useHandleStyle(M.css.styles,ae,{name:"dialog"}),o.useGlobalOnEscapeKey({callback:function(e){ve(e)},when:ee&&te,priority:[o.ESC_KEY_HANDLING_PRIORITIES.DIALOG,te]});var le=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return ze(e)}}),2),ce=le[0],se=le[1],ue=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Ie(e)}}),2),pe=ue[0],de=ue[1],me=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return De(e)}}),2),fe=me[0],ge=me[1],be=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Se(e)}}),2),he=be[0],ye=be[1],ve=function(e){h.onHide(),e.preventDefault()},xe=function(e){U.current=e.target,h.onPointerDown&&h.onPointerDown(e)},Oe=function(e){h.dismissableMask&&h.modal&&F.current===e.target&&!U.current&&ve(e),h.onMaskClick&&h.onMaskClick(e),U.current=null},we=function(e){h.onMaximize?h.onMaximize({originalEvent:e,maximized:!K}):N((function(e){return!e})),e.preventDefault()},Ee=function(e){i.DomHandler.hasClass(e.target,"p-dialog-header-icon")||i.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||h.draggable&&(Y.current=!0,V.current=e.pageX,Z.current=e.pageY,T.current.style.margin="0",i.DomHandler.addClass(document.body,"p-unselectable-text"),h.onDragStart&&h.onDragStart(e))},De=function(e){if(Y.current){var t=i.DomHandler.getOuterWidth(T.current),n=i.DomHandler.getOuterHeight(T.current),r=e.pageX-V.current,o=e.pageY-Z.current,a=T.current.getBoundingClientRect(),l=a.left+r,c=a.top+o,s=i.DomHandler.getViewport(),u=getComputedStyle(T.current),p=parseFloat(u.marginLeft),d=parseFloat(u.marginTop);T.current.style.position="fixed",h.keepInViewport?(l>=h.minX&&l+t<s.width&&(V.current=e.pageX,T.current.style.left=l-p+"px"),c>=h.minY&&c+n<s.height&&(Z.current=e.pageY,T.current.style.top=c-d+"px")):(V.current=e.pageX,T.current.style.left=l-p+"px",Z.current=e.pageY,T.current.style.top=c-d+"px"),h.onDrag&&h.onDrag(e)}},Se=function(e){Y.current&&(Y.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),h.onDragEnd&&h.onDragEnd(e))},Pe=function(e){h.resizable&&($.current=!0,V.current=e.pageX,Z.current=e.pageY,i.DomHandler.addClass(document.body,"p-unselectable-text"),h.onResizeStart&&h.onResizeStart(e))},je=function(e,t,n){!n&&(n=i.DomHandler.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},ze=function(e){if($.current){var t=e.pageX-V.current,n=e.pageY-Z.current,r=i.DomHandler.getOuterWidth(T.current),o=i.DomHandler.getOuterHeight(T.current),a=T.current.getBoundingClientRect(),l=i.DomHandler.getViewport(),c=!parseInt(T.current.style.top)||!parseInt(T.current.style.left),s=je(T.current.style.minWidth,"width",l),u=je(T.current.style.minHeight,"height",l),p=r+t,d=o+n;c&&(p+=t,d+=n),(!s||p>s)&&a.left+p<l.width&&(T.current.style.width=p+"px"),(!u||d>u)&&a.top+d<l.height&&(T.current.style.height=d+"px"),V.current=e.pageX,Z.current=e.pageY,h.onResize&&h.onResize(e)}},Ie=function(e){$.current&&($.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),h.onResizeEnd&&h.onResizeEnd(e))},ke=function(){T.current.style.position="",T.current.style.left="",T.current.style.top="",T.current.style.margin=""},Ce=function(){T.current.setAttribute(W.current,"")},He=function(){var e;h.onShow&&h.onShow(),h.focusOnShow&&!((e=document.activeElement)&&T.current&&T.current.contains(e))&&h.closable&&h.showHeader&&L.current&&L.current.focus(),Ne()},Re=function(){h.modal&&!ae()&&i.DomHandler.addClass(F.current,"p-component-overlay-leave")},_e=function(){h.onHide&&h.onHide(),Y.current=!1,i.ZIndexUtils.clear(F.current),j(!1),Me(),i.DomHandler.focus(G.current),G.current=null},Ne=function(){Be()},Me=function(){Fe()},Te=function(e){if(e&&k){var t={id:D,hasBlockScroll:Q};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===D}));document.primeDialogParams=-1===n?[].concat(v(r=document.primeDialogParams)||x(r)||O(r)||w(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==D}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?i.DomHandler.blockBodyScroll():i.DomHandler.unblockBodyScroll()},Be=function(){h.draggable&&(fe(),he()),h.resizable&&(ce(),pe())},Fe=function(){ge(),ye(),se(),de()},Ue=function(){J.current=i.DomHandler.createInlineStyle(m&&m.nonce||g.default.nonce,m&&m.styleContainer);var e="";for(var t in h.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(W.current,"] {\n width: ").concat(h.breakpoints[t]," !important;\n }\n }\n ");J.current.innerHTML=e};o.useMountEffect((function(){Te(!0),h.visible&&j(!0)})),f.useEffect((function(){return h.breakpoints&&Ue(),function(){J.current=i.DomHandler.removeInlineStyle(J.current)}}),[h.breakpoints]),o.useUpdateEffect((function(){h.visible&&!P&&j(!0),h.visible!==k&&P&&C(h.visible),h.visible&&(G.current=document.activeElement)}),[h.visible,P]),o.useUpdateEffect((function(){P&&(i.ZIndexUtils.set("modal",F.current,m&&m.autoZIndex||g.default.autoZIndex,h.baseZIndex||m&&m.zIndex.modal||g.default.zIndex.modal),C(!0))}),[P]),o.useUpdateEffect((function(){Te(!0)}),[Q,k]),o.useUnmountEffect((function(){Me(),Te(!1),i.DomHandler.removeInlineStyle(J.current),i.ZIndexUtils.clear(F.current)})),f.useImperativeHandle(p,(function(){return{props:h,resetPosition:ke,getElement:function(){return T.current},getMask:function(){return F.current},getContent:function(){return X.current},getHeader:function(){return A.current},getFooter:function(){return q.current},getCloseButton:function(){return L.current}}}));var Xe=function(){if(h.closable){var e=h.ariaCloseIconLabel||t.localeOption("close"),n=d({className:oe("closeButtonIcon"),"aria-hidden":!0},re("closeButtonIcon")),r=i.IconUtils.getJSXIcon(h.closeIcon||f.createElement(a.TimesIcon,n),B({},n),{props:h}),o=d({ref:L,type:"button",className:oe("closeButton"),"aria-label":e,onClick:ve},re("closeButton"));return f.createElement("button",o,r,f.createElement(u.Ripple,null))}return null},Ae=function(){var e=d({className:oe("maximizableIcon")},re("maximizableIcon")),t=i.IconUtils.getJSXIcon(K?h.minimizeIcon||f.createElement(c.WindowMinimizeIcon,e):h.maximizeIcon||f.createElement(l.WindowMaximizeIcon,e),e,{props:h});if(h.maximizable){var n=d({type:"button",className:oe("maximizableButton"),onClick:we},re("maximizableButton"));return f.createElement("button",n,t,f.createElement(u.Ripple,null))}return null},qe=function(){if(h.showHeader){var e=Xe(),t=Ae(),n=i.ObjectUtils.getJSXElement(h.icons,h),r=i.ObjectUtils.getJSXElement(h.header,h),o=D+"_header",a=d({ref:A,style:h.headerStyle,className:oe("header"),onMouseDown:Ee},re("header")),l=d({id:o,className:oe("headerTitle")},re("headerTitle")),c=d({className:oe("headerIcons")},re("headerIcons"));return f.createElement("div",a,f.createElement("div",l,r),f.createElement("div",c,n,t,e))}return null},Le=function(){var e=i.ObjectUtils.getJSXElement(h.footer,h),t=d({ref:q,className:oe("footer")},re("footer"));return e&&f.createElement("div",t,e)};return P&&function(){var t,n,o,a,l,c,u=D+"_header",p=D+"_content",g={enter:"center"===h.position?150:300,exit:"center"===h.position?150:300},y=d({ref:F,style:ie("mask"),className:oe("mask"),onPointerUp:Oe},re("mask")),v=d({ref:T,id:D,className:i.classNames(h.className,oe("root",{props:h,maximized:K,context:m})),style:h.style,onClick:h.onClick,role:"dialog","aria-labelledby":u,"aria-describedby":p,"aria-modal":h.modal,onPointerDown:xe},M.getOtherProps(h),re("root")),x=d({classNames:oe("transition"),timeout:g,in:k,options:h.transitionOptions,unmountOnExit:!0,onEnter:Ce,onEntered:He,onExiting:Re,onExited:_e},re("transition")),O=null;null!=e&&e.content?(c={header:h.header,content:h.message,message:null==h||null===(l=h.children)||void 0===l||null===(l=l[1])||void 0===l||null===(l=l.props)||void 0===l?void 0:l.children},O=i.ObjectUtils.getJSXElement(e.content,{headerRef:A,contentRef:X,footerRef:q,closeRef:L,hide:ve,message:c})):(n=qe(),t=d({id:D+"_content",ref:X,style:h.contentStyle,className:oe("content")},re("content")),o=f.createElement("div",t,h.children),a=Le(),O=f.createElement(f.Fragment,null,n,o,a,h.resizable?f.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Pe}):null));var w=f.createElement("div",y,f.createElement(r.CSSTransition,b({nodeRef:T},x),f.createElement("div",v,f.createElement(R,{autoFocus:!0},O))));return f.createElement(s.Portal,{element:w,appendTo:h.appendTo,visible:!0})}()}));F.displayName="Dialog",exports.Dialog=F;
|