1 | "use strict";
|
2 | var __importStar = (this && this.__importStar) || function (mod) {
|
3 | if (mod && mod.__esModule) return mod;
|
4 | var result = {};
|
5 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
6 | result["default"] = mod;
|
7 | return result;
|
8 | };
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | const react_1 = __importStar(require("react"));
|
11 | const context_1 = require("./context");
|
12 | class DialogConsumer extends react_1.Component {
|
13 | render() {
|
14 | return (react_1.default.createElement(context_1.DialogContext.Consumer, null, context => {
|
15 | const props = Object.assign({}, context);
|
16 | const { children } = this.props;
|
17 | const elements = [];
|
18 | react_1.default.Children.forEach(children, child => {
|
19 | if (react_1.default.isValidElement(child)) {
|
20 | elements.push(react_1.default.cloneElement(child, props));
|
21 | }
|
22 | });
|
23 | return elements || null;
|
24 | }));
|
25 | }
|
26 | }
|
27 | exports.default = DialogConsumer;
|
28 |
|
\ | No newline at end of file |