gd-bs 6.5.3 → 6.5.5

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.
@@ -32,7 +32,7 @@ var CardBody = /** @class */ (function () {
32
32
  // Update the title
33
33
  var elTitle = this._el.querySelector(".card-title");
34
34
  if (this._props.title || this._props.onRenderTitle) {
35
- // Append the content
35
+ // Append the title
36
36
  (0, common_1.appendContent)(elTitle, this._props.title);
37
37
  // Call the render event
38
38
  this._props.onRenderTitle ? this._props.onRenderTitle(elTitle, this._props) : null;
@@ -44,25 +44,33 @@ var CardBody = /** @class */ (function () {
44
44
  // Update the sub-title
45
45
  var subTitle = this._el.querySelector(".card-subtitle");
46
46
  if (this._props.subTitle) {
47
- // Set the title
47
+ // Set the sub-title
48
48
  subTitle.innerHTML = this._props.subTitle;
49
49
  }
50
50
  else {
51
- // Remove the title
51
+ // Remove the sub-title
52
52
  this._el.removeChild(subTitle);
53
53
  }
54
54
  // Update the text
55
55
  var text = this._el.querySelector(".card-text");
56
56
  if (this._props.text) {
57
- // Set the title
57
+ // Set the text
58
58
  text.innerHTML = this._props.text;
59
59
  }
60
+ // Else, see if there is content
61
+ else if (this._props.content && typeof (this._props.content) === "string") {
62
+ // Set the text
63
+ text.innerHTML = this._props.content;
64
+ }
60
65
  else {
61
- // Remove the title
66
+ // Remove the text
62
67
  this._el.removeChild(text);
63
68
  }
64
- // Append the content
65
- (0, common_1.appendContent)(this._el, this._props.content);
69
+ // See if the content is an element
70
+ if (this._props.content && typeof (this._props.content) !== "string") {
71
+ // Append the content
72
+ (0, common_1.appendContent)(this._el, this._props.content);
73
+ }
66
74
  // Render the actions
67
75
  this.renderActions();
68
76
  };
@@ -37,11 +37,36 @@ var _CardGroup = /** @class */ (function (_super) {
37
37
  }
38
38
  // Configure the card group
39
39
  _CardGroup.prototype.configure = function (cardTemplate) {
40
- // Parse the cards
41
40
  var cards = this.props.cards || [];
41
+ var isGrid = false;
42
+ // See if we are rendering columns
43
+ if (typeof (this.props.colSize) === "number") {
44
+ // Update the flag
45
+ isGrid = true;
46
+ // Update the class name
47
+ this.el.classList.remove("card-group");
48
+ this.el.classList.add("row");
49
+ // Determine the column class to use
50
+ var colSize = this.props.colSize > 0 && this.props.colSize <= 12 ? this.props.colSize : 4;
51
+ this.el.classList.add("row-cols-" + colSize);
52
+ }
53
+ // Parse the cards
42
54
  for (var i = 0; i < cards.length; i++) {
43
- // Add the card
44
- this.el.appendChild((0, card_1.Card)(cards[i], cardTemplate).el);
55
+ // Create the card
56
+ var card = (0, card_1.Card)(cards[i], cardTemplate);
57
+ // See if we are using a grid
58
+ if (isGrid) {
59
+ // Create a column element
60
+ var elCol = document.createElement("div");
61
+ elCol.classList.add("col");
62
+ elCol.appendChild(card.el);
63
+ // Add the card
64
+ this.el.appendChild(elCol);
65
+ }
66
+ else {
67
+ // Add the card
68
+ this.el.appendChild(card.el);
69
+ }
45
70
  }
46
71
  };
47
72
  return _CardGroup;