gd-bs 6.5.5 → 6.5.6
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.
- package/build/components/card/index.js +5 -0
- package/build/components/cardGroup/index.js +6 -0
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +8 -4
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/index.html +4 -0
- package/package.json +1 -1
- package/src/components/card/index.ts +6 -0
- package/src/components/card/types.d.ts +5 -4
- package/src/components/cardGroup/index.ts +9 -0
- package/src/components/cardGroup/types.d.ts +3 -0
package/index.html
CHANGED
|
@@ -153,9 +153,11 @@
|
|
|
153
153
|
|
|
154
154
|
window["card"] = GD.Components.Card({
|
|
155
155
|
el: document.getElementById("card"),
|
|
156
|
+
onRender: (el) => { console.log("Card Render: ", el); },
|
|
156
157
|
body: [{
|
|
157
158
|
title: "Card Title",
|
|
158
159
|
text: "This is the card contents.",
|
|
160
|
+
onRender: (el) => { console.log("Card Body Render: ", el); },
|
|
159
161
|
actions: [{
|
|
160
162
|
text: "Card Action",
|
|
161
163
|
buttonType: GD.Components.ButtonTypes.OutlinePrimary,
|
|
@@ -170,11 +172,13 @@
|
|
|
170
172
|
el: document.getElementById("card-group"),
|
|
171
173
|
className: "g-4",
|
|
172
174
|
col: 4,
|
|
175
|
+
onRender: (el) => { console.log("Card Group Render: ", el); },
|
|
173
176
|
cards: [
|
|
174
177
|
{
|
|
175
178
|
body: [{
|
|
176
179
|
title: "Card Title 1",
|
|
177
180
|
text: "This is the card contents.",
|
|
181
|
+
onRender: (el) => { console.log("Card Group Body Render: ", el); },
|
|
178
182
|
actions: [{
|
|
179
183
|
text: "Card Action",
|
|
180
184
|
buttonType: GD.Components.ButtonTypes.OutlinePrimary,
|
package/package.json
CHANGED
|
@@ -62,6 +62,12 @@ class _Card extends Base<ICardProps> implements ICard {
|
|
|
62
62
|
this.props.onClick(body.props);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
// See if there is a render event
|
|
67
|
+
if (this.props.onRender) {
|
|
68
|
+
// Call the event
|
|
69
|
+
this.props.onRender(this.el, body.props);
|
|
70
|
+
}
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
// Configure the header
|
|
@@ -84,7 +84,7 @@ export interface ICardAction {
|
|
|
84
84
|
/**
|
|
85
85
|
* Card Body
|
|
86
86
|
*/
|
|
87
|
-
export interface ICardBody<T=Element> {
|
|
87
|
+
export interface ICardBody<T = Element> {
|
|
88
88
|
actions?: Array<ICardAction>;
|
|
89
89
|
className?: string;
|
|
90
90
|
content?: string | T;
|
|
@@ -100,7 +100,7 @@ export interface ICardBody<T=Element> {
|
|
|
100
100
|
/**
|
|
101
101
|
* Card Footer
|
|
102
102
|
*/
|
|
103
|
-
export interface ICardFooter<T=Element> {
|
|
103
|
+
export interface ICardFooter<T = Element> {
|
|
104
104
|
className?: string;
|
|
105
105
|
content?: string | T;
|
|
106
106
|
onRender?: (el?: HTMLElement, card?: ICardFooter) => void;
|
|
@@ -109,7 +109,7 @@ export interface ICardFooter<T=Element> {
|
|
|
109
109
|
/**
|
|
110
110
|
* Card Header
|
|
111
111
|
*/
|
|
112
|
-
export interface ICardHeader<T=Element> {
|
|
112
|
+
export interface ICardHeader<T = Element> {
|
|
113
113
|
className?: string;
|
|
114
114
|
content?: string | T;
|
|
115
115
|
onRender?: (el?: HTMLElement, card?: ICardHeader) => void;
|
|
@@ -119,7 +119,7 @@ export interface ICardHeader<T=Element> {
|
|
|
119
119
|
/**
|
|
120
120
|
* Card Properties
|
|
121
121
|
*/
|
|
122
|
-
export interface ICardProps<T=Element> extends IBaseProps<ICard> {
|
|
122
|
+
export interface ICardProps<T = Element> extends IBaseProps<ICard> {
|
|
123
123
|
body?: Array<ICardBody<T>>;
|
|
124
124
|
footer?: ICardFooter<T>;
|
|
125
125
|
header?: ICardHeader<T>;
|
|
@@ -132,4 +132,5 @@ export interface ICardProps<T=Element> extends IBaseProps<ICard> {
|
|
|
132
132
|
src?: string;
|
|
133
133
|
};
|
|
134
134
|
onClick?: (card?: ICardBody, ev?: Event) => void;
|
|
135
|
+
onRender?: (el?: HTMLElement, card?: ICardProps) => void;
|
|
135
136
|
}
|
|
@@ -52,11 +52,20 @@ class _CardGroup extends Base<ICardGroupProps> implements ICardGroup {
|
|
|
52
52
|
|
|
53
53
|
// Add the card
|
|
54
54
|
this.el.appendChild(elCol);
|
|
55
|
+
|
|
56
|
+
// Call the event
|
|
57
|
+
this.props.onColRender ? this.props.onColRender(elCol, cards[i]) : null;
|
|
55
58
|
} else {
|
|
56
59
|
// Add the card
|
|
57
60
|
this.el.appendChild(card.el);
|
|
61
|
+
|
|
62
|
+
// Call the event
|
|
63
|
+
this.props.onCardRender ? this.props.onCardRender(card.el, cards[i]) : null;
|
|
58
64
|
}
|
|
59
65
|
}
|
|
66
|
+
|
|
67
|
+
// Call the event
|
|
68
|
+
this.props.onRender ? this.props.onRender(this.el, this.props) : null;
|
|
60
69
|
}
|
|
61
70
|
}
|
|
62
71
|
export const CardGroup = (props: ICardGroupProps, template?: string, cardTemplate?: string): ICardGroup => { return new _CardGroup(props, template, cardTemplate); }
|
|
@@ -108,4 +108,7 @@ export interface ICardGroup {
|
|
|
108
108
|
export interface ICardGroupProps extends IBaseProps<ICardGroup> {
|
|
109
109
|
cards?: Array<ICardProps>;
|
|
110
110
|
colSize?: number;
|
|
111
|
+
onCardRender?: (el?: HTMLElement, props?: ICardProps) => void;
|
|
112
|
+
onColRender?: (el?: HTMLElement, props?: ICardProps) => void;
|
|
113
|
+
onRender?: (el?: HTMLElement, props?: ICardGroupProps) => void;
|
|
111
114
|
}
|