gd-sprest-bs 10.11.13 → 10.11.15

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.
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasePropertyPane = void 0;
4
+ var core_1 = require("../components/core");
5
+ /**
6
+ * Base Property Pane
7
+ */
8
+ var BasePropertyPane = /** @class */ (function () {
9
+ // Constructor
10
+ function BasePropertyPane(targetProperty, config, context) {
11
+ var _this = this;
12
+ this.config = null;
13
+ // Set the type (Custom = 1)
14
+ this.type = 1;
15
+ // Save the configuration
16
+ this.config = config;
17
+ // Save the key
18
+ this.targetProperty = targetProperty;
19
+ // Set the properties
20
+ this.properties = {
21
+ key: this.targetProperty,
22
+ context: context,
23
+ onDispose: function (el, context) {
24
+ // Call the events
25
+ _this.dispose(el, context);
26
+ _this.onDispose ? _this.onDispose(el, context) : null;
27
+ },
28
+ onRender: function (el, context, onChange) {
29
+ _this.render(el, context, onChange);
30
+ _this.onRender ? _this.onRender(el, context, onChange) : null;
31
+ }
32
+ };
33
+ }
34
+ // Applies the tooltip to an element
35
+ BasePropertyPane.prototype.applyTooltip = function (el) {
36
+ // Apply the tooltip
37
+ core_1.Components.Tooltip({
38
+ target: el,
39
+ content: this.config["tooltip"]
40
+ });
41
+ };
42
+ Object.defineProperty(BasePropertyPane.prototype, "currentValue", {
43
+ // Returns the current value as a string
44
+ get: function () { return this.config["properties"][this.targetProperty]; },
45
+ enumerable: false,
46
+ configurable: true
47
+ });
48
+ // Returns the current value as an object
49
+ BasePropertyPane.prototype.currentValueAsObject = function () {
50
+ // Ensure a value exists
51
+ if (this.currentValue) {
52
+ try {
53
+ return JSON.parse(this.currentValue);
54
+ }
55
+ catch (_a) { }
56
+ }
57
+ // Return nothing
58
+ return null;
59
+ };
60
+ // Dispose of the component
61
+ BasePropertyPane.prototype.onDispose = function (el, context) { };
62
+ BasePropertyPane.prototype.dispose = function (el, context) {
63
+ // Clear the element
64
+ while (el.firstChild) {
65
+ el.removeChild(el.firstChild);
66
+ }
67
+ };
68
+ // Renders the component
69
+ BasePropertyPane.prototype.onRender = function (el, context, onChange) { };
70
+ BasePropertyPane.prototype.render = function (el, context, onChange) {
71
+ // Clear the component
72
+ this.dispose(el, context);
73
+ };
74
+ return BasePropertyPane;
75
+ }());
76
+ exports.BasePropertyPane = BasePropertyPane;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __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
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.MultiDropdownCheckbox = void 0;
19
+ var core_1 = require("../components/core");
20
+ var base_1 = require("./base");
21
+ /**
22
+ * Multi-Dropdown Checkbox
23
+ */
24
+ var MultiDropdownCheckbox = /** @class */ (function (_super) {
25
+ __extends(MultiDropdownCheckbox, _super);
26
+ function MultiDropdownCheckbox() {
27
+ return _super !== null && _super.apply(this, arguments) || this;
28
+ }
29
+ // Override the render event
30
+ MultiDropdownCheckbox.prototype.onRender = function (el, context, onChange) {
31
+ var _this = this;
32
+ // Set the properties
33
+ var props = {
34
+ description: this.config.description,
35
+ items: this.config.items,
36
+ label: this.config.label,
37
+ name: this.targetProperty,
38
+ placeholder: this.config.placeholder,
39
+ placement: this.config.placement,
40
+ type: core_1.Components.FormControlTypes.MultiDropdownCheckbox,
41
+ value: this.currentValueAsObject(),
42
+ onChange: function (items) {
43
+ // Save the value as a string
44
+ onChange(_this.targetProperty, JSON.stringify(items));
45
+ }
46
+ };
47
+ // Call the rendering event
48
+ props = this.config.onRendering ? this.config.onRendering(props) : props;
49
+ // Render the dropdown
50
+ core_1.Components.Form({
51
+ el: el,
52
+ controls: [],
53
+ onControlRendered: function (ctrl) {
54
+ // Call the event
55
+ _this.config.onRendered ? _this.config.onRendered(ctrl.dropdown, ctrl.props) : null;
56
+ }
57
+ });
58
+ };
59
+ return MultiDropdownCheckbox;
60
+ }(base_1.BasePropertyPane));
61
+ exports.MultiDropdownCheckbox = MultiDropdownCheckbox;