tabler-react-2 0.1.34 → 0.1.36
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/dist/modal/modal.js +11 -9
- package/package.json +1 -1
package/dist/modal/modal.js
CHANGED
|
@@ -115,14 +115,6 @@ var useModal = exports.useModal = function useModal(options) {
|
|
|
115
115
|
_useState2 = _slicedToArray(_useState, 2),
|
|
116
116
|
modalState = _useState2[0],
|
|
117
117
|
setModalState = _useState2[1];
|
|
118
|
-
(0, _react.useEffect)(function () {
|
|
119
|
-
setModalState({
|
|
120
|
-
open: options.open,
|
|
121
|
-
title: options.title,
|
|
122
|
-
text: options.text,
|
|
123
|
-
buttons: options.buttons
|
|
124
|
-
});
|
|
125
|
-
}, [options]);
|
|
126
118
|
var modal = (0, _react.useCallback)(function () {
|
|
127
119
|
var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
128
120
|
return new Promise(function (resolve) {
|
|
@@ -149,6 +141,11 @@ var useModal = exports.useModal = function useModal(options) {
|
|
|
149
141
|
});
|
|
150
142
|
}
|
|
151
143
|
};
|
|
144
|
+
var update = function update() {
|
|
145
|
+
setModalState(_objectSpread(_objectSpread({}, modalState), {}, {
|
|
146
|
+
text: options.text
|
|
147
|
+
}));
|
|
148
|
+
};
|
|
152
149
|
var ModalElement = /*#__PURE__*/_react["default"].createElement(Modal, {
|
|
153
150
|
open: modalState.open,
|
|
154
151
|
onClose: function onClose() {
|
|
@@ -168,6 +165,11 @@ var useModal = exports.useModal = function useModal(options) {
|
|
|
168
165
|
}, modalState.text);
|
|
169
166
|
return {
|
|
170
167
|
modal: modal,
|
|
171
|
-
ModalElement: ModalElement
|
|
168
|
+
ModalElement: ModalElement,
|
|
169
|
+
update: update,
|
|
170
|
+
close: function close() {
|
|
171
|
+
var v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
172
|
+
return handleDecision(v);
|
|
173
|
+
}
|
|
172
174
|
};
|
|
173
175
|
};
|