source: imaps-frontend/node_modules/html2canvas/dist/lib/dom/replaced-elements/input-element-container.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 4.3 KB
Line 
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 if (typeof b !== "function" && b !== null)
11 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12 extendStatics(d, b);
13 function __() { this.constructor = d; }
14 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 };
16})();
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.InputElementContainer = exports.INPUT_COLOR = exports.PASSWORD = exports.RADIO = exports.CHECKBOX = void 0;
19var element_container_1 = require("../element-container");
20var bounds_1 = require("../../css/layout/bounds");
21var CHECKBOX_BORDER_RADIUS = [
22 {
23 type: 15 /* DIMENSION_TOKEN */,
24 flags: 0,
25 unit: 'px',
26 number: 3
27 }
28];
29var RADIO_BORDER_RADIUS = [
30 {
31 type: 16 /* PERCENTAGE_TOKEN */,
32 flags: 0,
33 number: 50
34 }
35];
36var reformatInputBounds = function (bounds) {
37 if (bounds.width > bounds.height) {
38 return new bounds_1.Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height);
39 }
40 else if (bounds.width < bounds.height) {
41 return new bounds_1.Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width);
42 }
43 return bounds;
44};
45var getInputValue = function (node) {
46 var value = node.type === exports.PASSWORD ? new Array(node.value.length + 1).join('\u2022') : node.value;
47 return value.length === 0 ? node.placeholder || '' : value;
48};
49exports.CHECKBOX = 'checkbox';
50exports.RADIO = 'radio';
51exports.PASSWORD = 'password';
52exports.INPUT_COLOR = 0x2a2a2aff;
53var InputElementContainer = /** @class */ (function (_super) {
54 __extends(InputElementContainer, _super);
55 function InputElementContainer(context, input) {
56 var _this = _super.call(this, context, input) || this;
57 _this.type = input.type.toLowerCase();
58 _this.checked = input.checked;
59 _this.value = getInputValue(input);
60 if (_this.type === exports.CHECKBOX || _this.type === exports.RADIO) {
61 _this.styles.backgroundColor = 0xdededeff;
62 _this.styles.borderTopColor =
63 _this.styles.borderRightColor =
64 _this.styles.borderBottomColor =
65 _this.styles.borderLeftColor =
66 0xa5a5a5ff;
67 _this.styles.borderTopWidth =
68 _this.styles.borderRightWidth =
69 _this.styles.borderBottomWidth =
70 _this.styles.borderLeftWidth =
71 1;
72 _this.styles.borderTopStyle =
73 _this.styles.borderRightStyle =
74 _this.styles.borderBottomStyle =
75 _this.styles.borderLeftStyle =
76 1 /* SOLID */;
77 _this.styles.backgroundClip = [0 /* BORDER_BOX */];
78 _this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
79 _this.bounds = reformatInputBounds(_this.bounds);
80 }
81 switch (_this.type) {
82 case exports.CHECKBOX:
83 _this.styles.borderTopRightRadius =
84 _this.styles.borderTopLeftRadius =
85 _this.styles.borderBottomRightRadius =
86 _this.styles.borderBottomLeftRadius =
87 CHECKBOX_BORDER_RADIUS;
88 break;
89 case exports.RADIO:
90 _this.styles.borderTopRightRadius =
91 _this.styles.borderTopLeftRadius =
92 _this.styles.borderBottomRightRadius =
93 _this.styles.borderBottomLeftRadius =
94 RADIO_BORDER_RADIUS;
95 break;
96 }
97 return _this;
98 }
99 return InputElementContainer;
100}(element_container_1.ElementContainer));
101exports.InputElementContainer = InputElementContainer;
102//# sourceMappingURL=input-element-container.js.map
Note: See TracBrowser for help on using the repository browser.