@elliemae/ds-modal 1.58.0-rc.2 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/v1/DSModalWrapper.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
3
4
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
4
5
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
5
|
-
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
6
6
|
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
7
7
|
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
8
8
|
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
9
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
10
9
|
var React = require('react');
|
|
11
10
|
var constants = require('../constants.js');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
13
|
|
|
14
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
15
15
|
var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
|
|
16
16
|
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
17
|
-
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
18
17
|
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
19
18
|
var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn);
|
|
20
19
|
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
|
|
21
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
20
|
|
|
23
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
24
22
|
|
|
@@ -43,26 +41,25 @@ var DSModalWrapper = (function (WrappedComponent) {
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
46
|
-
|
|
47
|
-
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "state", {
|
|
44
|
+
_this.state = {
|
|
48
45
|
childready: false,
|
|
49
46
|
additionalFooterCssClass: 'loading',
|
|
50
47
|
container: null,
|
|
51
48
|
actions: null,
|
|
52
49
|
height: '100%'
|
|
53
|
-
}
|
|
50
|
+
};
|
|
54
51
|
|
|
55
|
-
|
|
52
|
+
_this.onHeaderHeight = function (e) {
|
|
56
53
|
_this.heightHeaderFlag = true;
|
|
57
54
|
_this.heightHeader = e.height || 0;
|
|
58
|
-
}
|
|
55
|
+
};
|
|
59
56
|
|
|
60
|
-
|
|
57
|
+
_this.onFooterHeight = function (e) {
|
|
61
58
|
_this.heightFooterFlag = true;
|
|
62
59
|
_this.heightFooter = e.height || 0;
|
|
63
|
-
}
|
|
60
|
+
};
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
_this.onResize = function (_ref) {
|
|
66
63
|
var bounds = _ref.bounds;
|
|
67
64
|
|
|
68
65
|
if (_this.heightFooterFlag && _this.heightHeaderFlag) {
|
|
@@ -74,23 +71,23 @@ var DSModalWrapper = (function (WrappedComponent) {
|
|
|
74
71
|
return setTimeout(_this.onResize({
|
|
75
72
|
bounds: bounds
|
|
76
73
|
}), 0);
|
|
77
|
-
}
|
|
74
|
+
};
|
|
78
75
|
|
|
79
|
-
|
|
76
|
+
_this.handleContainer = function (node) {
|
|
80
77
|
if (node) _this.setState({
|
|
81
78
|
container: node
|
|
82
79
|
});
|
|
83
80
|
|
|
84
81
|
_this.handleResize();
|
|
85
|
-
}
|
|
82
|
+
};
|
|
86
83
|
|
|
87
|
-
|
|
84
|
+
_this.handleActions = function (node) {
|
|
88
85
|
if (node) _this.setState({
|
|
89
86
|
actions: node
|
|
90
87
|
});
|
|
91
88
|
|
|
92
89
|
_this.handleResize();
|
|
93
|
-
}
|
|
90
|
+
};
|
|
94
91
|
|
|
95
92
|
return _this;
|
|
96
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DSModalWrapper.js","sources":["../../../src/v1/DSModalWrapper.tsx"],"sourcesContent":["import { Component, createElement } from 'react';\nimport { MODAL_TYPE } from '../constants';\n\nexport default (WrappedComponent) => {\n class DSModalWrapper extends Component {\n state = {\n childready: false,\n additionalFooterCssClass: 'loading',\n container: null,\n actions: null,\n height: '100%',\n };\n\n componentDidMount() {\n window.addEventListener('resize', this.handleResize);\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResize);\n }\n\n onHeaderHeight = (e) => {\n this.heightHeaderFlag = true;\n this.heightHeader = e.height || 0;\n };\n\n onFooterHeight = (e) => {\n this.heightFooterFlag = true;\n this.heightFooter = e.height || 0;\n };\n\n onResize = ({ bounds }) => {\n if (this.heightFooterFlag && this.heightHeaderFlag) {\n return this.setState({\n height: bounds.height - this.heightFooter - this.heightHeader,\n });\n }\n return setTimeout(this.onResize({ bounds }), 0);\n };\n\n handleContainer = (node) => {\n if (node) this.setState({ container: node });\n this.handleResize();\n };\n\n handleActions = (node) => {\n if (node) this.setState({ actions: node });\n this.handleResize();\n };\n\n /**\n * Change button width to 100% if the\n * combined width of the button (or button group) exceed 50% of the container width.\n */\n handleResize() {\n if (!this.state) return null;\n const { container, actions, childready } = this.state;\n if (!childready) return null;\n this.setState({ additionalFooterCssClass: null }); // !important reset to default state to recalculate\n const { clientWidth: containerWidth } = container;\n const { clientWidth: actionsWidth } = actions;\n // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.\n if (\n containerWidth &&\n actionsWidth &&\n (actionsWidth / containerWidth) * 100 > 50\n ) {\n return this.setState({ additionalFooterCssClass: 'fluid-actions' });\n }\n return this.setState({ additionalFooterCssClass: null });\n }\n\n verifyNodes() {\n const { modalType } = this.props;\n if (modalType !== MODAL_TYPE.DEFAULT) {\n const nodesInterval = setInterval(() => {\n // !important it checks when nodes are availables\n const { container, actions } = this.state;\n if (!container || !actions) return null;\n clearInterval(nodesInterval);\n this.setState({ childready: true });\n return this.handleResize();\n }, 100);\n }\n }\n\n render() {\n const { props, state } = this;\n const { additionalFooterCssClass, height } = state;\n return createElement(WrappedComponent, {\n ...props,\n height,\n onResize: this.onResize,\n onFooterHeight: this.onFooterHeight,\n onHeaderHeight: this.onHeaderHeight,\n containerRef: this.handleContainer,\n actionsRef: this.handleActions,\n additionalFooterCssClass,\n onAfterOpen: () => {\n if (props.onAfterOpen) props.onAfterOpen();\n this.verifyNodes();\n },\n });\n }\n }\n\n return DSModalWrapper;\n};\n"],"names":["WrappedComponent","DSModalWrapper","childready","additionalFooterCssClass","container","actions","height","e","heightHeaderFlag","heightHeader","heightFooterFlag","heightFooter","bounds","setState","setTimeout","
|
|
1
|
+
{"version":3,"file":"DSModalWrapper.js","sources":["../../../src/v1/DSModalWrapper.tsx"],"sourcesContent":["import { Component, createElement } from 'react';\nimport { MODAL_TYPE } from '../constants';\n\nexport default (WrappedComponent) => {\n class DSModalWrapper extends Component {\n state = {\n childready: false,\n additionalFooterCssClass: 'loading',\n container: null,\n actions: null,\n height: '100%',\n };\n\n componentDidMount() {\n window.addEventListener('resize', this.handleResize);\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResize);\n }\n\n onHeaderHeight = (e) => {\n this.heightHeaderFlag = true;\n this.heightHeader = e.height || 0;\n };\n\n onFooterHeight = (e) => {\n this.heightFooterFlag = true;\n this.heightFooter = e.height || 0;\n };\n\n onResize = ({ bounds }) => {\n if (this.heightFooterFlag && this.heightHeaderFlag) {\n return this.setState({\n height: bounds.height - this.heightFooter - this.heightHeader,\n });\n }\n return setTimeout(this.onResize({ bounds }), 0);\n };\n\n handleContainer = (node) => {\n if (node) this.setState({ container: node });\n this.handleResize();\n };\n\n handleActions = (node) => {\n if (node) this.setState({ actions: node });\n this.handleResize();\n };\n\n /**\n * Change button width to 100% if the\n * combined width of the button (or button group) exceed 50% of the container width.\n */\n handleResize() {\n if (!this.state) return null;\n const { container, actions, childready } = this.state;\n if (!childready) return null;\n this.setState({ additionalFooterCssClass: null }); // !important reset to default state to recalculate\n const { clientWidth: containerWidth } = container;\n const { clientWidth: actionsWidth } = actions;\n // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.\n if (\n containerWidth &&\n actionsWidth &&\n (actionsWidth / containerWidth) * 100 > 50\n ) {\n return this.setState({ additionalFooterCssClass: 'fluid-actions' });\n }\n return this.setState({ additionalFooterCssClass: null });\n }\n\n verifyNodes() {\n const { modalType } = this.props;\n if (modalType !== MODAL_TYPE.DEFAULT) {\n const nodesInterval = setInterval(() => {\n // !important it checks when nodes are availables\n const { container, actions } = this.state;\n if (!container || !actions) return null;\n clearInterval(nodesInterval);\n this.setState({ childready: true });\n return this.handleResize();\n }, 100);\n }\n }\n\n render() {\n const { props, state } = this;\n const { additionalFooterCssClass, height } = state;\n return createElement(WrappedComponent, {\n ...props,\n height,\n onResize: this.onResize,\n onFooterHeight: this.onFooterHeight,\n onHeaderHeight: this.onHeaderHeight,\n containerRef: this.handleContainer,\n actionsRef: this.handleActions,\n additionalFooterCssClass,\n onAfterOpen: () => {\n if (props.onAfterOpen) props.onAfterOpen();\n this.verifyNodes();\n },\n });\n }\n }\n\n return DSModalWrapper;\n};\n"],"names":["WrappedComponent","DSModalWrapper","state","childready","additionalFooterCssClass","container","actions","height","onHeaderHeight","e","heightHeaderFlag","heightHeader","onFooterHeight","heightFooterFlag","heightFooter","onResize","bounds","setState","setTimeout","handleContainer","node","handleResize","handleActions","window","addEventListener","removeEventListener","containerWidth","clientWidth","actionsWidth","modalType","props","MODAL_TYPE","DEFAULT","nodesInterval","setInterval","clearInterval","createElement","containerRef","actionsRef","onAfterOpen","verifyNodes","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sBAAe,UAACA,gBAAD,EAAsB;AAAA,MAC7BC,cAD6B;AAAA;;AAAA;;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,YAEjCC,KAFiC,GAEzB;AACNC,QAAAA,UAAU,EAAE,KADN;AAENC,QAAAA,wBAAwB,EAAE,SAFpB;AAGNC,QAAAA,SAAS,EAAE,IAHL;AAINC,QAAAA,OAAO,EAAE,IAJH;AAKNC,QAAAA,MAAM,EAAE;AALF,OAFyB;;AAAA,YAkBjCC,cAlBiC,GAkBhB,UAACC,CAAD,EAAO;AACtB,cAAKC,gBAAL,GAAwB,IAAxB;AACA,cAAKC,YAAL,GAAoBF,CAAC,CAACF,MAAF,IAAY,CAAhC;AACD,OArBgC;;AAAA,YAuBjCK,cAvBiC,GAuBhB,UAACH,CAAD,EAAO;AACtB,cAAKI,gBAAL,GAAwB,IAAxB;AACA,cAAKC,YAAL,GAAoBL,CAAC,CAACF,MAAF,IAAY,CAAhC;AACD,OA1BgC;;AAAA,YA4BjCQ,QA5BiC,GA4BtB,gBAAgB;AAAA,YAAbC,MAAa,QAAbA,MAAa;;AACzB,YAAI,MAAKH,gBAAL,IAAyB,MAAKH,gBAAlC,EAAoD;AAClD,iBAAO,MAAKO,QAAL,CAAc;AACnBV,YAAAA,MAAM,EAAES,MAAM,CAACT,MAAP,GAAgB,MAAKO,YAArB,GAAoC,MAAKH;AAD9B,WAAd,CAAP;AAGD;;AACD,eAAOO,UAAU,CAAC,MAAKH,QAAL,CAAc;AAAEC,UAAAA,MAAM,EAANA;AAAF,SAAd,CAAD,EAA4B,CAA5B,CAAjB;AACD,OAnCgC;;AAAA,YAqCjCG,eArCiC,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gBAAIT,KAAK,CAACS,WAAV,EAAuBT,KAAK,CAACS,WAAN;;AACvB,YAAA,MAAI,CAACC,WAAL;AACD;AAZiB,WAApB;AAcD;AApGgC;;AAAA;AAAA,IACNC,eADM;;AAuGnC,SAAOxC,cAAP;AACD,CAxGD;;;;"}
|
package/esm/v1/DSModalWrapper.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
1
2
|
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
|
|
2
3
|
import _createClass from '@babel/runtime/helpers/esm/createClass';
|
|
3
|
-
import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
4
4
|
import _inherits from '@babel/runtime/helpers/esm/inherits';
|
|
5
5
|
import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
6
6
|
import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
7
|
import { createElement, Component } from 'react';
|
|
9
8
|
import { MODAL_TYPE } from '../constants.js';
|
|
10
9
|
|
|
@@ -31,26 +30,25 @@ var DSModalWrapper = (function (WrappedComponent) {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
34
|
-
|
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
33
|
+
_this.state = {
|
|
36
34
|
childready: false,
|
|
37
35
|
additionalFooterCssClass: 'loading',
|
|
38
36
|
container: null,
|
|
39
37
|
actions: null,
|
|
40
38
|
height: '100%'
|
|
41
|
-
}
|
|
39
|
+
};
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
_this.onHeaderHeight = function (e) {
|
|
44
42
|
_this.heightHeaderFlag = true;
|
|
45
43
|
_this.heightHeader = e.height || 0;
|
|
46
|
-
}
|
|
44
|
+
};
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
_this.onFooterHeight = function (e) {
|
|
49
47
|
_this.heightFooterFlag = true;
|
|
50
48
|
_this.heightFooter = e.height || 0;
|
|
51
|
-
}
|
|
49
|
+
};
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
_this.onResize = function (_ref) {
|
|
54
52
|
var bounds = _ref.bounds;
|
|
55
53
|
|
|
56
54
|
if (_this.heightFooterFlag && _this.heightHeaderFlag) {
|
|
@@ -62,23 +60,23 @@ var DSModalWrapper = (function (WrappedComponent) {
|
|
|
62
60
|
return setTimeout(_this.onResize({
|
|
63
61
|
bounds: bounds
|
|
64
62
|
}), 0);
|
|
65
|
-
}
|
|
63
|
+
};
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
_this.handleContainer = function (node) {
|
|
68
66
|
if (node) _this.setState({
|
|
69
67
|
container: node
|
|
70
68
|
});
|
|
71
69
|
|
|
72
70
|
_this.handleResize();
|
|
73
|
-
}
|
|
71
|
+
};
|
|
74
72
|
|
|
75
|
-
|
|
73
|
+
_this.handleActions = function (node) {
|
|
76
74
|
if (node) _this.setState({
|
|
77
75
|
actions: node
|
|
78
76
|
});
|
|
79
77
|
|
|
80
78
|
_this.handleResize();
|
|
81
|
-
}
|
|
79
|
+
};
|
|
82
80
|
|
|
83
81
|
return _this;
|
|
84
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DSModalWrapper.js","sources":["../../../src/v1/DSModalWrapper.tsx"],"sourcesContent":["import { Component, createElement } from 'react';\nimport { MODAL_TYPE } from '../constants';\n\nexport default (WrappedComponent) => {\n class DSModalWrapper extends Component {\n state = {\n childready: false,\n additionalFooterCssClass: 'loading',\n container: null,\n actions: null,\n height: '100%',\n };\n\n componentDidMount() {\n window.addEventListener('resize', this.handleResize);\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResize);\n }\n\n onHeaderHeight = (e) => {\n this.heightHeaderFlag = true;\n this.heightHeader = e.height || 0;\n };\n\n onFooterHeight = (e) => {\n this.heightFooterFlag = true;\n this.heightFooter = e.height || 0;\n };\n\n onResize = ({ bounds }) => {\n if (this.heightFooterFlag && this.heightHeaderFlag) {\n return this.setState({\n height: bounds.height - this.heightFooter - this.heightHeader,\n });\n }\n return setTimeout(this.onResize({ bounds }), 0);\n };\n\n handleContainer = (node) => {\n if (node) this.setState({ container: node });\n this.handleResize();\n };\n\n handleActions = (node) => {\n if (node) this.setState({ actions: node });\n this.handleResize();\n };\n\n /**\n * Change button width to 100% if the\n * combined width of the button (or button group) exceed 50% of the container width.\n */\n handleResize() {\n if (!this.state) return null;\n const { container, actions, childready } = this.state;\n if (!childready) return null;\n this.setState({ additionalFooterCssClass: null }); // !important reset to default state to recalculate\n const { clientWidth: containerWidth } = container;\n const { clientWidth: actionsWidth } = actions;\n // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.\n if (\n containerWidth &&\n actionsWidth &&\n (actionsWidth / containerWidth) * 100 > 50\n ) {\n return this.setState({ additionalFooterCssClass: 'fluid-actions' });\n }\n return this.setState({ additionalFooterCssClass: null });\n }\n\n verifyNodes() {\n const { modalType } = this.props;\n if (modalType !== MODAL_TYPE.DEFAULT) {\n const nodesInterval = setInterval(() => {\n // !important it checks when nodes are availables\n const { container, actions } = this.state;\n if (!container || !actions) return null;\n clearInterval(nodesInterval);\n this.setState({ childready: true });\n return this.handleResize();\n }, 100);\n }\n }\n\n render() {\n const { props, state } = this;\n const { additionalFooterCssClass, height } = state;\n return createElement(WrappedComponent, {\n ...props,\n height,\n onResize: this.onResize,\n onFooterHeight: this.onFooterHeight,\n onHeaderHeight: this.onHeaderHeight,\n containerRef: this.handleContainer,\n actionsRef: this.handleActions,\n additionalFooterCssClass,\n onAfterOpen: () => {\n if (props.onAfterOpen) props.onAfterOpen();\n this.verifyNodes();\n },\n });\n }\n }\n\n return DSModalWrapper;\n};\n"],"names":["WrappedComponent","DSModalWrapper","childready","additionalFooterCssClass","container","actions","height","e","heightHeaderFlag","heightHeader","heightFooterFlag","heightFooter","bounds","setState","setTimeout","
|
|
1
|
+
{"version":3,"file":"DSModalWrapper.js","sources":["../../../src/v1/DSModalWrapper.tsx"],"sourcesContent":["import { Component, createElement } from 'react';\nimport { MODAL_TYPE } from '../constants';\n\nexport default (WrappedComponent) => {\n class DSModalWrapper extends Component {\n state = {\n childready: false,\n additionalFooterCssClass: 'loading',\n container: null,\n actions: null,\n height: '100%',\n };\n\n componentDidMount() {\n window.addEventListener('resize', this.handleResize);\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResize);\n }\n\n onHeaderHeight = (e) => {\n this.heightHeaderFlag = true;\n this.heightHeader = e.height || 0;\n };\n\n onFooterHeight = (e) => {\n this.heightFooterFlag = true;\n this.heightFooter = e.height || 0;\n };\n\n onResize = ({ bounds }) => {\n if (this.heightFooterFlag && this.heightHeaderFlag) {\n return this.setState({\n height: bounds.height - this.heightFooter - this.heightHeader,\n });\n }\n return setTimeout(this.onResize({ bounds }), 0);\n };\n\n handleContainer = (node) => {\n if (node) this.setState({ container: node });\n this.handleResize();\n };\n\n handleActions = (node) => {\n if (node) this.setState({ actions: node });\n this.handleResize();\n };\n\n /**\n * Change button width to 100% if the\n * combined width of the button (or button group) exceed 50% of the container width.\n */\n handleResize() {\n if (!this.state) return null;\n const { container, actions, childready } = this.state;\n if (!childready) return null;\n this.setState({ additionalFooterCssClass: null }); // !important reset to default state to recalculate\n const { clientWidth: containerWidth } = container;\n const { clientWidth: actionsWidth } = actions;\n // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.\n if (\n containerWidth &&\n actionsWidth &&\n (actionsWidth / containerWidth) * 100 > 50\n ) {\n return this.setState({ additionalFooterCssClass: 'fluid-actions' });\n }\n return this.setState({ additionalFooterCssClass: null });\n }\n\n verifyNodes() {\n const { modalType } = this.props;\n if (modalType !== MODAL_TYPE.DEFAULT) {\n const nodesInterval = setInterval(() => {\n // !important it checks when nodes are availables\n const { container, actions } = this.state;\n if (!container || !actions) return null;\n clearInterval(nodesInterval);\n this.setState({ childready: true });\n return this.handleResize();\n }, 100);\n }\n }\n\n render() {\n const { props, state } = this;\n const { additionalFooterCssClass, height } = state;\n return createElement(WrappedComponent, {\n ...props,\n height,\n onResize: this.onResize,\n onFooterHeight: this.onFooterHeight,\n onHeaderHeight: this.onHeaderHeight,\n containerRef: this.handleContainer,\n actionsRef: this.handleActions,\n additionalFooterCssClass,\n onAfterOpen: () => {\n if (props.onAfterOpen) props.onAfterOpen();\n this.verifyNodes();\n },\n });\n }\n }\n\n return DSModalWrapper;\n};\n"],"names":["WrappedComponent","DSModalWrapper","state","childready","additionalFooterCssClass","container","actions","height","onHeaderHeight","e","heightHeaderFlag","heightHeader","onFooterHeight","heightFooterFlag","heightFooter","onResize","bounds","setState","setTimeout","handleContainer","node","handleResize","handleActions","window","addEventListener","removeEventListener","containerWidth","clientWidth","actionsWidth","modalType","props","MODAL_TYPE","DEFAULT","nodesInterval","setInterval","clearInterval","createElement","containerRef","actionsRef","onAfterOpen","verifyNodes","Component"],"mappings":";;;;;;;;;;;;;;;;AAGA,sBAAe,UAACA,gBAAD,EAAsB;AAAA,MAC7BC,cAD6B;AAAA;;AAAA;;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,YAEjCC,KAFiC,GAEzB;AACNC,QAAAA,UAAU,EAAE,KADN;AAENC,QAAAA,wBAAwB,EAAE,SAFpB;AAGNC,QAAAA,SAAS,EAAE,IAHL;AAINC,QAAAA,OAAO,EAAE,IAJH;AAKNC,QAAAA,MAAM,EAAE;AALF,OAFyB;;AAAA,YAkBjCC,cAlBiC,GAkBhB,UAACC,CAAD,EAAO;AACtB,cAAKC,gBAAL,GAAwB,IAAxB;AACA,cAAKC,YAAL,GAAoBF,CAAC,CAACF,MAAF,IAAY,CAAhC;AACD,OArBgC;;AAAA,YAuBjCK,cAvBiC,GAuBhB,UAACH,CAAD,EAAO;AACtB,cAAKI,gBAAL,GAAwB,IAAxB;AACA,cAAKC,YA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YAAQE,wBAAR,GAA6CF,KAA7C,CAAQE,wBAAR;AAAA,YAAkCG,MAAlC,GAA6CL,KAA7C,CAAkCK,MAAlC;AACA,4BAAO6B,aAAa,CAACpC,gBAAD,kCACf8B,KADe;AAElBvB,UAAAA,MAAM,EAANA,MAFkB;AAGlBQ,UAAAA,QAAQ,EAAE,KAAKA,QAHG;AAIlBH,UAAAA,cAAc,EAAE,KAAKA,cAJH;AAKlBJ,UAAAA,cAAc,EAAE,KAAKA,cALH;AAMlB6B,UAAAA,YAAY,EAAE,KAAKlB,eAND;AAOlBmB,UAAAA,UAAU,EAAE,KAAKhB,aAPC;AAQlBlB,UAAAA,wBAAwB,EAAxBA,wBARkB;AASlBmC,UAAAA,WAAW,EAAE,uBAAM;AACjB,gBAAIT,KAAK,CAACS,WAAV,EAAuBT,KAAK,CAACS,WAAN;;AACvB,YAAA,MAAI,CAACC,WAAL;AACD;AAZiB,WAApB;AAcD;AApGgC;;AAAA;AAAA,IACNC,SADM;;AAuGnC,SAAOxC,cAAP;AACD,CAxGD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-modal",
|
|
3
|
-
"version": "1.58.0
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Ellie Mae - Dim Sum - Modal",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"build": "node ../../scripts/build/build.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-basic": "1.58.0
|
|
20
|
-
"@elliemae/ds-classnames": "1.58.0
|
|
21
|
-
"@elliemae/ds-icons": "1.58.0
|
|
22
|
-
"@elliemae/ds-modal": "1.58.0
|
|
23
|
-
"@elliemae/ds-system": "1.58.0
|
|
19
|
+
"@elliemae/ds-basic": "1.58.0",
|
|
20
|
+
"@elliemae/ds-classnames": "1.58.0",
|
|
21
|
+
"@elliemae/ds-icons": "1.58.0",
|
|
22
|
+
"@elliemae/ds-modal": "1.58.0",
|
|
23
|
+
"@elliemae/ds-system": "1.58.0",
|
|
24
24
|
"prop-types": "~15.7.2",
|
|
25
25
|
"react-desc": "^4.1.2",
|
|
26
26
|
"react-modal": "~3.12.1"
|