1 | ;
|
2 | var _a;
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | exports.ConcreteWidget = exports.GRID_WIDTH = void 0;
|
5 | const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
|
6 | const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
7 | /**
|
8 | * The width of the grid we're filling
|
9 | */
|
10 | exports.GRID_WIDTH = 24;
|
11 | /**
|
12 | * A real CloudWatch widget that has its own fixed size and remembers its position
|
13 | *
|
14 | * This is in contrast to other widgets which exist for layout purposes.
|
15 | */
|
16 | class ConcreteWidget {
|
17 | constructor(width, height) {
|
18 | this.warnings = [];
|
19 | this.width = width;
|
20 | this.height = height;
|
21 | if (this.width > exports.GRID_WIDTH) {
|
22 | throw new Error(`Widget is too wide, max ${exports.GRID_WIDTH} units allowed`);
|
23 | }
|
24 | }
|
25 | position(x, y) {
|
26 | this.x = x;
|
27 | this.y = y;
|
28 | }
|
29 | /**
|
30 | * Copy the warnings from the given metric
|
31 | */
|
32 | copyMetricWarnings(...ms) {
|
33 | try {
|
34 | jsiiDeprecationWarnings._aws_cdk_aws_cloudwatch_IMetric(ms);
|
35 | }
|
36 | catch (error) {
|
37 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
38 | Error.captureStackTrace(error, this.copyMetricWarnings);
|
39 | }
|
40 | throw error;
|
41 | }
|
42 | this.warnings?.push(...ms.flatMap(m => m.warnings ?? []));
|
43 | }
|
44 | }
|
45 | exports.ConcreteWidget = ConcreteWidget;
|
46 | _a = JSII_RTTI_SYMBOL_1;
|
47 | ConcreteWidget[_a] = { fqn: "@aws-cdk/aws-cloudwatch.ConcreteWidget", version: "1.198.0" };
|
48 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2lkZ2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsid2lkZ2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7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