gd-bs 6.6.92 → 6.6.93
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/custom-element.js +19 -16
- package/build/components/floating-ui/index.js +7 -7
- package/build/index-icons.js +4 -5
- package/build/index.js +4 -5
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.js.LICENSE.txt +0 -4
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +3 -4
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.js.LICENSE.txt +0 -4
- package/dist/gd-bs.min.js +1 -1
- package/indexv2.html +1 -1
- package/package.json +1 -1
- package/src/components/custom-element.ts +13 -11
- package/src/components/floating-ui/index.ts +7 -7
- package/src/components/form/formTypes.d.ts +2 -2
- package/src/index-icons.ts +5 -6
- package/src/index.d.ts +1 -2
- package/src/index.ts +5 -6
- package/build/render.js +0 -581
- package/src/render.ts +0 -583
package/build/render.js
DELETED
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.render = void 0;
|
|
15
|
-
var Components = require("./components");
|
|
16
|
-
require("./custom-elements");
|
|
17
|
-
/**
|
|
18
|
-
* Render
|
|
19
|
-
* Looks through the html code to find components and render them.
|
|
20
|
-
*/
|
|
21
|
-
var RenderComponents = /** @class */ (function () {
|
|
22
|
-
// Constructor
|
|
23
|
-
function RenderComponents(el, propsOnly, targetSelf) {
|
|
24
|
-
if (propsOnly === void 0) { propsOnly = false; }
|
|
25
|
-
if (targetSelf === void 0) { targetSelf = false; }
|
|
26
|
-
this._component = null;
|
|
27
|
-
this._el = null;
|
|
28
|
-
// The properties for the component
|
|
29
|
-
this._props = [];
|
|
30
|
-
this._el = el;
|
|
31
|
-
// Render the components
|
|
32
|
-
this.render(propsOnly, targetSelf);
|
|
33
|
-
}
|
|
34
|
-
Object.defineProperty(RenderComponents.prototype, "Props", {
|
|
35
|
-
get: function () { return this._props; },
|
|
36
|
-
enumerable: false,
|
|
37
|
-
configurable: true
|
|
38
|
-
});
|
|
39
|
-
// Creates an element and appends the children to it
|
|
40
|
-
RenderComponents.prototype.createElement = function (elSource, removeFl) {
|
|
41
|
-
if (removeFl === void 0) { removeFl = true; }
|
|
42
|
-
var elTarget = document.createElement("div");
|
|
43
|
-
// See if the target exists
|
|
44
|
-
while (elSource.firstChild) {
|
|
45
|
-
elTarget.appendChild(elSource.firstChild);
|
|
46
|
-
}
|
|
47
|
-
// Render any custom elements
|
|
48
|
-
new RenderComponents(elTarget);
|
|
49
|
-
// Remove the element
|
|
50
|
-
removeFl ? elSource.remove() : null;
|
|
51
|
-
// Return the target element
|
|
52
|
-
return elTarget.childNodes.length > 0 ? elTarget : null;
|
|
53
|
-
};
|
|
54
|
-
// Gets the custom elements
|
|
55
|
-
RenderComponents.prototype.getElements = function (targetSelf) {
|
|
56
|
-
var bsElements = [];
|
|
57
|
-
if (targetSelf) {
|
|
58
|
-
return [this._el];
|
|
59
|
-
}
|
|
60
|
-
// Get all the elements and find the custom components
|
|
61
|
-
this._el.childNodes.forEach(function (el) {
|
|
62
|
-
if (el.nodeName.indexOf("BS-") == 0) {
|
|
63
|
-
// Add the element
|
|
64
|
-
bsElements.push(el);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return bsElements;
|
|
68
|
-
};
|
|
69
|
-
// Converts the custom childelements
|
|
70
|
-
RenderComponents.prototype.getChildItems = function (el, propName, componentName) {
|
|
71
|
-
var _this = this;
|
|
72
|
-
var items = [];
|
|
73
|
-
// Get the item elements
|
|
74
|
-
el.querySelectorAll(propName).forEach(function (elItem) {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
// Ensure this is an item
|
|
77
|
-
if (elItem.nodeName == propName.toUpperCase()) {
|
|
78
|
-
var item = _this.getProps(elItem, componentName);
|
|
79
|
-
// See if there is content
|
|
80
|
-
if (elItem.innerHTML) {
|
|
81
|
-
// Set custom child elements
|
|
82
|
-
switch (elItem.nodeName) {
|
|
83
|
-
case "APPENDED-BUTTON":
|
|
84
|
-
case "BTN-PROPS":
|
|
85
|
-
case "PREPENDED-BUTTON":
|
|
86
|
-
item.text = (_a = (item.text || elItem.innerHTML)) === null || _a === void 0 ? void 0 : _a.trim();
|
|
87
|
-
break;
|
|
88
|
-
case "BS-COL":
|
|
89
|
-
item.title = (_b = (item.title || elItem.innerHTML)) === null || _b === void 0 ? void 0 : _b.trim();
|
|
90
|
-
break;
|
|
91
|
-
case "CARD-BODY":
|
|
92
|
-
item.actions = _this.getChildItems(elItem, "card-action", elItem.nodeName);
|
|
93
|
-
break;
|
|
94
|
-
case "CARD-BODY":
|
|
95
|
-
item.actions = _this.getChildItems(elItem, "card-action", elItem.nodeName);
|
|
96
|
-
break;
|
|
97
|
-
case "NAVBAR-ITEM":
|
|
98
|
-
item.items = _this.getChildItems(elItem, "navbar-item", componentName);
|
|
99
|
-
break;
|
|
100
|
-
case "NAVBAR-ITEM-END":
|
|
101
|
-
item.items = _this.getChildItems(elItem, "navbar-item-end", componentName);
|
|
102
|
-
break;
|
|
103
|
-
case "TOOLBAR-ITEM":
|
|
104
|
-
item.buttons = _this.getChildItems(elItem, "bs-button", "BUTTON");
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
// See if there is a sub-component
|
|
108
|
-
switch (componentName) {
|
|
109
|
-
case "LIST-GROUP":
|
|
110
|
-
// Set the badge
|
|
111
|
-
var badge = _this.getChildItems(elItem, "bs-badge", componentName);
|
|
112
|
-
if ((badge === null || badge === void 0 ? void 0 : badge.length) > 0) {
|
|
113
|
-
item.badge = badge[0];
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
// Set the custom property
|
|
118
|
-
switch (componentName) {
|
|
119
|
-
// content
|
|
120
|
-
case "ACCORDION":
|
|
121
|
-
case "CARD":
|
|
122
|
-
case "CAROUSEL":
|
|
123
|
-
case "LIST-GROUP":
|
|
124
|
-
item.content = item.content || _this.createElement(elItem);
|
|
125
|
-
break;
|
|
126
|
-
// label
|
|
127
|
-
case "CHECKBOX-GROUP":
|
|
128
|
-
item.label = item.label || elItem.innerHTML;
|
|
129
|
-
break;
|
|
130
|
-
// text
|
|
131
|
-
case "CARD-BODY":
|
|
132
|
-
item.text = item.text || _this.createElement(elItem);
|
|
133
|
-
break;
|
|
134
|
-
case "BREADCRUMB":
|
|
135
|
-
case "DROPDOWN":
|
|
136
|
-
case "FORM-CONTROL":
|
|
137
|
-
case "LIST-BOX":
|
|
138
|
-
item.text = item.text || elItem.innerHTML;
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// Add the item
|
|
143
|
-
items.push(item);
|
|
144
|
-
// Remove the item
|
|
145
|
-
elItem.remove();
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
// See if items exist
|
|
149
|
-
if (items.length > 0) {
|
|
150
|
-
switch (propName) {
|
|
151
|
-
case "btn-props":
|
|
152
|
-
return items[0];
|
|
153
|
-
default:
|
|
154
|
-
return items;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
// Return nothing
|
|
158
|
-
return undefined;
|
|
159
|
-
};
|
|
160
|
-
// Converts the target component name to an element
|
|
161
|
-
RenderComponents.prototype.getElement = function (elSource, componentName) {
|
|
162
|
-
var elTarget = null;
|
|
163
|
-
// See if the target exists
|
|
164
|
-
elSource.childNodes.forEach(function (el) {
|
|
165
|
-
if (el.nodeName == componentName.toUpperCase()) {
|
|
166
|
-
// Create the element
|
|
167
|
-
elTarget = document.createElement("div");
|
|
168
|
-
// Set the element
|
|
169
|
-
while (el.firstChild) {
|
|
170
|
-
elTarget.appendChild(el.firstChild);
|
|
171
|
-
}
|
|
172
|
-
// Render any custom elements
|
|
173
|
-
new RenderComponents(elTarget);
|
|
174
|
-
// Remove the element
|
|
175
|
-
el.remove();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
// Return the target element
|
|
179
|
-
return elTarget;
|
|
180
|
-
};
|
|
181
|
-
// Gets the properties of an element and returns an object
|
|
182
|
-
RenderComponents.prototype.getProps = function (el, componentName) {
|
|
183
|
-
var _a, _b;
|
|
184
|
-
var props = {};
|
|
185
|
-
// Parse the attributes
|
|
186
|
-
for (var i = 0; i < el.attributes.length; i++) {
|
|
187
|
-
var attribute = el.attributes[i];
|
|
188
|
-
// Set the value
|
|
189
|
-
var value = attribute.value;
|
|
190
|
-
// Convert the value
|
|
191
|
-
if (typeof (value) === "string") {
|
|
192
|
-
// See if it's a boolean value
|
|
193
|
-
if ((value === null || value === void 0 ? void 0 : value.toLowerCase()) == "true") {
|
|
194
|
-
value = true;
|
|
195
|
-
}
|
|
196
|
-
else if ((value === null || value === void 0 ? void 0 : value.toLowerCase()) == "false") {
|
|
197
|
-
value = false;
|
|
198
|
-
}
|
|
199
|
-
// Else, see if it's linked to a global library
|
|
200
|
-
else if (value.indexOf('.') > 0) {
|
|
201
|
-
// Split the value
|
|
202
|
-
var objInfo = value.split('.');
|
|
203
|
-
// See if this is linked to a global library
|
|
204
|
-
var objProp = null;
|
|
205
|
-
for (var i_1 = 0; i_1 < objInfo.length; i_1++) {
|
|
206
|
-
if (i_1 == 0) {
|
|
207
|
-
objProp = window[objInfo[0]];
|
|
208
|
-
if (objProp) {
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
;
|
|
215
|
-
}
|
|
216
|
-
// Update the object
|
|
217
|
-
objProp = objProp[objInfo[i_1]];
|
|
218
|
-
if (objProp == null) {
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
// See if the object exists
|
|
223
|
-
if (objProp) {
|
|
224
|
-
// Update the value
|
|
225
|
-
value = objProp;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
try {
|
|
230
|
-
// See if it's JSON
|
|
231
|
-
var jsonObj = JSON.parse(value);
|
|
232
|
-
value = jsonObj;
|
|
233
|
-
}
|
|
234
|
-
catch (_c) {
|
|
235
|
-
try {
|
|
236
|
-
// See if it's a reference
|
|
237
|
-
var elTarget = document.querySelector(value);
|
|
238
|
-
if (elTarget) {
|
|
239
|
-
value = elTarget;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
catch (_d) { }
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
// Add the property
|
|
247
|
-
props[this.getPropName(attribute.name)] = value;
|
|
248
|
-
}
|
|
249
|
-
// See if there is a sub-component
|
|
250
|
-
switch (componentName) {
|
|
251
|
-
case "BUTTON":
|
|
252
|
-
// Set the spinner
|
|
253
|
-
var spinner = this.getChildItems(el, "bs-spinner", componentName);
|
|
254
|
-
if ((spinner === null || spinner === void 0 ? void 0 : spinner.length) > 0) {
|
|
255
|
-
props.spinner = spinner[0];
|
|
256
|
-
}
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
// Set common properties
|
|
260
|
-
switch (componentName) {
|
|
261
|
-
// content
|
|
262
|
-
case "ALERT":
|
|
263
|
-
case "BADGE":
|
|
264
|
-
case "COLLAPSE":
|
|
265
|
-
case "ICON-LINK":
|
|
266
|
-
props.content = this.createElement(el, false);
|
|
267
|
-
break;
|
|
268
|
-
// data
|
|
269
|
-
case "DATA":
|
|
270
|
-
// Try to parse the value
|
|
271
|
-
try {
|
|
272
|
-
var data = JSON.parse(el.innerHTML.trim());
|
|
273
|
-
props.data = data;
|
|
274
|
-
}
|
|
275
|
-
catch (_e) { }
|
|
276
|
-
break;
|
|
277
|
-
// label
|
|
278
|
-
case "PROGRESS":
|
|
279
|
-
case "PROGRESS-GROUP":
|
|
280
|
-
props.label = (_a = (props.label || el.innerHTML)) === null || _a === void 0 ? void 0 : _a.trim();
|
|
281
|
-
break;
|
|
282
|
-
// text
|
|
283
|
-
case "BUTTON":
|
|
284
|
-
case "BUTTON-GROUP":
|
|
285
|
-
case "NAVBAR":
|
|
286
|
-
props.text = (_b = (props.text || el.innerHTML)) === null || _b === void 0 ? void 0 : _b.trim();
|
|
287
|
-
break;
|
|
288
|
-
// value
|
|
289
|
-
case "INPUT-GROUP":
|
|
290
|
-
case "NAVBAR-SEARCH-BOX":
|
|
291
|
-
// Ensure the value exists
|
|
292
|
-
if (typeof (props.value) != "undefined") {
|
|
293
|
-
props.value = typeof (props.value) === "string" ? props.value : props.value;
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
props.value = el.innerHTML.trim();
|
|
297
|
-
}
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
// Return the properties
|
|
301
|
-
return props;
|
|
302
|
-
};
|
|
303
|
-
// Gets the property name
|
|
304
|
-
RenderComponents.prototype.getPropName = function (propName) {
|
|
305
|
-
var idx = propName.indexOf('-');
|
|
306
|
-
while (idx > 0) {
|
|
307
|
-
// Update the key and index
|
|
308
|
-
propName = propName.substring(0, idx) + propName[idx + 1].toUpperCase() + propName.substring(idx + 2);
|
|
309
|
-
idx = propName.indexOf('-');
|
|
310
|
-
}
|
|
311
|
-
// Return the property name
|
|
312
|
-
return propName;
|
|
313
|
-
};
|
|
314
|
-
// Renders the custom components
|
|
315
|
-
RenderComponents.prototype.render = function (propsOnly, targetSelf) {
|
|
316
|
-
var _this = this;
|
|
317
|
-
// Parse the elements
|
|
318
|
-
this.getElements(targetSelf).forEach(function (el) {
|
|
319
|
-
var componentName = el.nodeName.substring(3);
|
|
320
|
-
switch (componentName) {
|
|
321
|
-
case "ACCORDION":
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
// Get the component props
|
|
325
|
-
var props = __assign(__assign({}, _this.getProps(el, componentName)), { el: el });
|
|
326
|
-
// Generate the component
|
|
327
|
-
switch (componentName) {
|
|
328
|
-
case "ACCORDION":
|
|
329
|
-
props.items = _this.getChildItems(el, "item", componentName);
|
|
330
|
-
propsOnly ? null : _this._component = Components.Accordion(props);
|
|
331
|
-
break;
|
|
332
|
-
case "ALERT":
|
|
333
|
-
propsOnly ? null : _this._component = Components.Alert(props);
|
|
334
|
-
break;
|
|
335
|
-
case "BADGE":
|
|
336
|
-
propsOnly ? null : _this._component = Components.Badge(props);
|
|
337
|
-
break;
|
|
338
|
-
case "BREADCRUMB":
|
|
339
|
-
propsOnly ? null : _this._component = Components.Breadcrumb(props);
|
|
340
|
-
break;
|
|
341
|
-
case "BUTTON":
|
|
342
|
-
propsOnly ? null : _this._component = Components.Button(props);
|
|
343
|
-
break;
|
|
344
|
-
case "BUTTON-GROUP":
|
|
345
|
-
props.buttons = _this.getChildItems(el, "bs-button", componentName);
|
|
346
|
-
propsOnly ? null : _this._component = Components.ButtonGroup(props);
|
|
347
|
-
break;
|
|
348
|
-
case "CARD":
|
|
349
|
-
props.body = _this.getChildItems(el, "card-body", componentName);
|
|
350
|
-
props.header = _this.getChildItems(el, "card-footer", componentName);
|
|
351
|
-
props.footer = _this.getChildItems(el, "card-header", componentName);
|
|
352
|
-
propsOnly ? null : _this._component = Components.Card(props);
|
|
353
|
-
break;
|
|
354
|
-
case "CARD-GROUP":
|
|
355
|
-
props.cards = (new RenderComponents(el, true)).Props;
|
|
356
|
-
propsOnly ? null : _this._component = Components.CardGroup(props);
|
|
357
|
-
break;
|
|
358
|
-
case "CAROUSEL":
|
|
359
|
-
props.items = _this.getChildItems(el, "item", componentName);
|
|
360
|
-
propsOnly ? null : _this._component = Components.Carousel(props);
|
|
361
|
-
break;
|
|
362
|
-
case "CHECKBOX-GROUP":
|
|
363
|
-
props.items = _this.getChildItems(el, "item", componentName);
|
|
364
|
-
propsOnly ? null : _this._component = Components.CheckboxGroup(props);
|
|
365
|
-
break;
|
|
366
|
-
case "COLLAPSE":
|
|
367
|
-
propsOnly ? null : _this._component = Components.Collapse(props);
|
|
368
|
-
break;
|
|
369
|
-
case "DROPDOWN":
|
|
370
|
-
props.items = _this.getChildItems(el, "item", componentName);
|
|
371
|
-
propsOnly ? null : _this._component = Components.Dropdown(props);
|
|
372
|
-
break;
|
|
373
|
-
case "FORM":
|
|
374
|
-
var controls = [];
|
|
375
|
-
var rows = [];
|
|
376
|
-
var _loop_1 = function (i) {
|
|
377
|
-
var elChild = el.children[i];
|
|
378
|
-
switch (elChild.nodeName) {
|
|
379
|
-
// Append the control
|
|
380
|
-
case "BS-FORM-CONTROL":
|
|
381
|
-
controls.push((new RenderComponents(elChild, true, true)).Props[0]);
|
|
382
|
-
break;
|
|
383
|
-
// Append the row
|
|
384
|
-
case "ROW":
|
|
385
|
-
var columns = [];
|
|
386
|
-
var rowControls = (new RenderComponents(elChild, true)).Props;
|
|
387
|
-
if ((rowControls === null || rowControls === void 0 ? void 0 : rowControls.length) > 0) {
|
|
388
|
-
// Append the control
|
|
389
|
-
for (var i_2 = 0; i_2 < rowControls.length; i_2++) {
|
|
390
|
-
columns.push({ control: rowControls[i_2] });
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
// Append the row
|
|
394
|
-
rows.push({ columns: columns });
|
|
395
|
-
break;
|
|
396
|
-
// Default
|
|
397
|
-
default:
|
|
398
|
-
// Add it to the appropriate property
|
|
399
|
-
// Move the custom html
|
|
400
|
-
if (rows.length > 0) {
|
|
401
|
-
rows.push({
|
|
402
|
-
columns: [{
|
|
403
|
-
control: {
|
|
404
|
-
onControlRendered: function (ctrl) { ctrl.el.appendChild(elChild); }
|
|
405
|
-
}
|
|
406
|
-
}]
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
controls.push({
|
|
411
|
-
onControlRendered: function (ctrl) { ctrl.el.appendChild(elChild); }
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
// Parse the child elements
|
|
418
|
-
for (var i = 0; i < el.children.length; i++) {
|
|
419
|
-
_loop_1(i);
|
|
420
|
-
}
|
|
421
|
-
// Set the rows
|
|
422
|
-
props.rows = rows.length > 0 ? rows : undefined;
|
|
423
|
-
// Set the controls
|
|
424
|
-
//props.controls = this.getChildItems(el, "bs-form-control", componentName);
|
|
425
|
-
props.controls = controls.length > 0 ? controls : undefined;
|
|
426
|
-
// Render the form
|
|
427
|
-
propsOnly ? null : _this._component = Components.Form(props);
|
|
428
|
-
break;
|
|
429
|
-
case "FORM-CONTROL":
|
|
430
|
-
props.items = _this.getChildItems(el, "item", componentName);
|
|
431
|
-
propsOnly ? null : _this._component = Components.FormControl(props);
|
|
432
|
-
break;
|
|
433
|
-
case "ICON-LINK":
|
|
434
|
-
propsOnly ? null : _this._component = Components.IconLink(props);
|
|
435
|
-
break;
|
|
436
|
-
case "INPUT-GROUP":
|
|
437
|
-
// Get the prepended label
|
|
438
|
-
var prependedLabel = el.querySelector("prepended-label");
|
|
439
|
-
if (prependedLabel) {
|
|
440
|
-
// Set the property
|
|
441
|
-
props.prependedLabel = prependedLabel.innerHTML.trim();
|
|
442
|
-
}
|
|
443
|
-
// Set the properties
|
|
444
|
-
props.appendedButtons = _this.getChildItems(el, "appended-button", componentName);
|
|
445
|
-
props.prependedButtons = _this.getChildItems(el, "prepended-button", componentName);
|
|
446
|
-
propsOnly ? null : _this._component = Components.InputGroup(props);
|
|
447
|
-
break;
|
|
448
|
-
case "LIST-BOX":
|
|
449
|
-
props.items = _this.getChildItems(el, "item", componentName);
|
|
450
|
-
propsOnly ? null : _this._component = Components.ListBox(props);
|
|
451
|
-
break;
|
|
452
|
-
case "LIST-GROUP":
|
|
453
|
-
props.items = _this.getChildItems(el, "item", componentName);
|
|
454
|
-
propsOnly ? null : _this._component = Components.ListGroup(props);
|
|
455
|
-
break;
|
|
456
|
-
case "MODAL":
|
|
457
|
-
// Set the custom elements
|
|
458
|
-
props.body = _this.getElement(el, "bs-modal-body");
|
|
459
|
-
props.footer = _this.getElement(el, "bs-modal-footer");
|
|
460
|
-
props.header = _this.getElement(el, "bs-modal-header");
|
|
461
|
-
props.title = _this.getElement(el, "bs-modal-title");
|
|
462
|
-
// Render the modal
|
|
463
|
-
propsOnly ? null : _this._component = Components.Modal(props);
|
|
464
|
-
break;
|
|
465
|
-
case "NAV":
|
|
466
|
-
props.items = _this.getChildItems(el, "nav-item", componentName);
|
|
467
|
-
propsOnly ? null : _this._component = Components.Nav(props);
|
|
468
|
-
break;
|
|
469
|
-
case "NAVBAR":
|
|
470
|
-
// Parse the child elements
|
|
471
|
-
for (var i = 0; i < el.children.length; i++) {
|
|
472
|
-
var elChild = el.children[i];
|
|
473
|
-
switch (elChild.nodeName) {
|
|
474
|
-
// Append the item
|
|
475
|
-
case "NAVBAR-ITEM":
|
|
476
|
-
var item = _this.getProps(elChild, componentName);
|
|
477
|
-
item.items = _this.getChildItems(elChild, "navbar-item", componentName);
|
|
478
|
-
props.items = props.items || [];
|
|
479
|
-
props.items.push(item);
|
|
480
|
-
break;
|
|
481
|
-
// Append the item
|
|
482
|
-
case "NAVBAR-ITEM-END":
|
|
483
|
-
var itemEnd = _this.getProps(elChild, componentName);
|
|
484
|
-
itemEnd.itemsEnd = _this.getChildItems(elChild, "navbar-item-end", componentName);
|
|
485
|
-
props.itemsEnd = props.itemsEnd || [];
|
|
486
|
-
props.itemsEnd.push(itemEnd);
|
|
487
|
-
break;
|
|
488
|
-
// Set the searchbox
|
|
489
|
-
case "NAVBAR-SEARCH-BOX":
|
|
490
|
-
props.searchBox = _this.getProps(elChild, elChild.nodeName);
|
|
491
|
-
break;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
// Render the navbar
|
|
495
|
-
propsOnly ? null : _this._component = Components.Navbar(props);
|
|
496
|
-
break;
|
|
497
|
-
case "OFFCANVAS":
|
|
498
|
-
props.body = _this.createElement(el, false);
|
|
499
|
-
propsOnly ? null : _this._component = Components.Offcanvas(props);
|
|
500
|
-
break;
|
|
501
|
-
case "POPOVER":
|
|
502
|
-
props.options = props.options || {};
|
|
503
|
-
props.options["content"] = _this.createElement(el, false);
|
|
504
|
-
propsOnly ? null : _this._component = Components.Popover(props);
|
|
505
|
-
break;
|
|
506
|
-
case "PROGRESS":
|
|
507
|
-
propsOnly ? null : _this._component = Components.Progress(props);
|
|
508
|
-
break;
|
|
509
|
-
case "PROGRESS-GROUP":
|
|
510
|
-
props.progressbars = _this.getChildItems(el, "bs-progress", componentName);
|
|
511
|
-
propsOnly ? null : _this._component = Components.ProgressGroup(props);
|
|
512
|
-
break;
|
|
513
|
-
case "SPINNER":
|
|
514
|
-
propsOnly ? null : _this._component = Components.Spinner(props);
|
|
515
|
-
break;
|
|
516
|
-
case "TABLE":
|
|
517
|
-
// Parse the child elements
|
|
518
|
-
props.rows = [];
|
|
519
|
-
for (var i = 0; i < el.children.length; i++) {
|
|
520
|
-
var elChild = el.children[i];
|
|
521
|
-
if (elChild.nodeName == "BS-ROW") {
|
|
522
|
-
try {
|
|
523
|
-
var row = JSON.parse(elChild.innerHTML);
|
|
524
|
-
props.rows.push(row);
|
|
525
|
-
}
|
|
526
|
-
catch (_a) { }
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
// Set the properties
|
|
530
|
-
props.columns = _this.getChildItems(el, "bs-col", componentName);
|
|
531
|
-
propsOnly ? null : _this._component = Components.Table(props);
|
|
532
|
-
break;
|
|
533
|
-
case "TOAST":
|
|
534
|
-
props.body = _this.createElement(el, false);
|
|
535
|
-
propsOnly ? null : _this._component = Components.Toast(props);
|
|
536
|
-
break;
|
|
537
|
-
case "TOOLBAR":
|
|
538
|
-
props.items = _this.getChildItems(el, "toolbar-item", componentName);
|
|
539
|
-
propsOnly ? null : _this._component = Components.Toolbar(props);
|
|
540
|
-
break;
|
|
541
|
-
case "TOOLTIP":
|
|
542
|
-
props.btnProps = _this.getChildItems(el, "btn-props", componentName);
|
|
543
|
-
props.content = props.content || _this.createElement(el, false);
|
|
544
|
-
propsOnly ? null : _this._component = Components.Tooltip(props);
|
|
545
|
-
break;
|
|
546
|
-
// Do nothing
|
|
547
|
-
default:
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
// Clear the element
|
|
551
|
-
while (el.firstChild) {
|
|
552
|
-
el.removeChild(el.firstChild);
|
|
553
|
-
}
|
|
554
|
-
// Do nothing if we are only generating properties
|
|
555
|
-
_this._props.push(props);
|
|
556
|
-
if (propsOnly) {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
// Set the class name
|
|
560
|
-
el.classList.add("bs");
|
|
561
|
-
// Remove the id attribute
|
|
562
|
-
if (el.hasAttribute("id") && (componentName != "MODAL" && componentName != "OFFCANVAS")) {
|
|
563
|
-
el.removeAttribute("id");
|
|
564
|
-
}
|
|
565
|
-
// See if the parent exists
|
|
566
|
-
if (el.parentElement) {
|
|
567
|
-
// Replace the element
|
|
568
|
-
el.parentElement.insertBefore(_this._component.el, el);
|
|
569
|
-
el.parentElement.classList.add("bs");
|
|
570
|
-
el.remove();
|
|
571
|
-
}
|
|
572
|
-
else {
|
|
573
|
-
// Append the component
|
|
574
|
-
el.appendChild(_this._component.el);
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
};
|
|
578
|
-
return RenderComponents;
|
|
579
|
-
}());
|
|
580
|
-
var render = function (el) { new RenderComponents(el); };
|
|
581
|
-
exports.render = render;
|