juxscript 1.1.38 → 1.1.40
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/lib/components/tabs.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ export declare class Tabs extends BaseComponent<TabsState> {
|
|
|
34
34
|
* Update content of a specific tab by ID
|
|
35
35
|
*/
|
|
36
36
|
updateTabContent(tabId: string, content: string | BaseComponent<any>): this;
|
|
37
|
+
/**
|
|
38
|
+
* ✅ NEW: Append content to a specific tab
|
|
39
|
+
* Accepts single item or array of strings/BaseComponents
|
|
40
|
+
*/
|
|
41
|
+
addTabContent(tabId: string, content: string | BaseComponent<any> | Array<string | BaseComponent<any>>): this;
|
|
37
42
|
/**
|
|
38
43
|
* Get tab by ID
|
|
39
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMnE,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,SAAS,GAAG,SAAS,GAAG;IAC3B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,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,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI;IA2B7G;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS;IAItC;;OAEG;IACH,aAAa,IAAI,GAAG,GAAG,SAAS;IAQhC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CA+EnE;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAEhE"}
|
package/lib/components/tabs.js
CHANGED
|
@@ -163,6 +163,34 @@ export class Tabs extends BaseComponent {
|
|
|
163
163
|
}
|
|
164
164
|
return this;
|
|
165
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* ✅ NEW: Append content to a specific tab
|
|
168
|
+
* Accepts single item or array of strings/BaseComponents
|
|
169
|
+
*/
|
|
170
|
+
addTabContent(tabId, content) {
|
|
171
|
+
const panel = document.getElementById(`${this._id}-${tabId}-panel`);
|
|
172
|
+
if (!panel) {
|
|
173
|
+
console.warn(`[Tabs] Panel not found for tab: ${tabId}`);
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
176
|
+
// Normalize to array
|
|
177
|
+
const items = Array.isArray(content) ? content : [content];
|
|
178
|
+
items.forEach(item => {
|
|
179
|
+
if (typeof item === 'string') {
|
|
180
|
+
// Append HTML string
|
|
181
|
+
const tempDiv = document.createElement('div');
|
|
182
|
+
tempDiv.innerHTML = item;
|
|
183
|
+
while (tempDiv.firstChild) {
|
|
184
|
+
panel.appendChild(tempDiv.firstChild);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (item instanceof BaseComponent) {
|
|
188
|
+
// Render component into panel
|
|
189
|
+
item.render(`#${panel.id}`);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
166
194
|
/**
|
|
167
195
|
* Get tab by ID
|
|
168
196
|
*/
|
|
@@ -192,6 +220,10 @@ export class Tabs extends BaseComponent {
|
|
|
192
220
|
tabList.className = 'jux-tabs-list';
|
|
193
221
|
const tabPanels = document.createElement('div');
|
|
194
222
|
tabPanels.className = 'jux-tabs-panels';
|
|
223
|
+
// ✅ Append structure to DOM FIRST, then render content
|
|
224
|
+
wrapper.appendChild(tabList);
|
|
225
|
+
wrapper.appendChild(tabPanels);
|
|
226
|
+
container.appendChild(wrapper);
|
|
195
227
|
tabs.forEach(tab => {
|
|
196
228
|
// Tab button with unique ID
|
|
197
229
|
const tabButton = document.createElement('button');
|
|
@@ -226,19 +258,17 @@ export class Tabs extends BaseComponent {
|
|
|
226
258
|
}
|
|
227
259
|
// ✅ Append panel to DOM FIRST
|
|
228
260
|
tabPanels.appendChild(tabPanel);
|
|
229
|
-
// ✅ THEN render content into it
|
|
261
|
+
// ✅ THEN render content into it (panel is now in DOM)
|
|
230
262
|
if (typeof tab.content === 'string') {
|
|
231
263
|
tabPanel.innerHTML = tab.content;
|
|
232
264
|
}
|
|
233
265
|
else if (tab.content instanceof BaseComponent) {
|
|
266
|
+
// Now panel exists in DOM, so render() can find it
|
|
234
267
|
tab.content.render(`#${tabPanel.id}`);
|
|
235
268
|
}
|
|
236
269
|
});
|
|
237
|
-
wrapper.appendChild(tabList);
|
|
238
|
-
wrapper.appendChild(tabPanels);
|
|
239
270
|
this._wireStandardEvents(wrapper);
|
|
240
271
|
this._wireAllSyncs();
|
|
241
|
-
container.appendChild(wrapper);
|
|
242
272
|
this._tabsWrapper = wrapper;
|
|
243
273
|
return this;
|
|
244
274
|
}
|
package/lib/components/tabs.ts
CHANGED
|
@@ -218,6 +218,37 @@ export class Tabs extends BaseComponent<TabsState> {
|
|
|
218
218
|
return this;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
/**
|
|
222
|
+
* ✅ NEW: Append content to a specific tab
|
|
223
|
+
* Accepts single item or array of strings/BaseComponents
|
|
224
|
+
*/
|
|
225
|
+
addTabContent(tabId: string, content: string | BaseComponent<any> | Array<string | BaseComponent<any>>): this {
|
|
226
|
+
const panel = document.getElementById(`${this._id}-${tabId}-panel`);
|
|
227
|
+
if (!panel) {
|
|
228
|
+
console.warn(`[Tabs] Panel not found for tab: ${tabId}`);
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Normalize to array
|
|
233
|
+
const items = Array.isArray(content) ? content : [content];
|
|
234
|
+
|
|
235
|
+
items.forEach(item => {
|
|
236
|
+
if (typeof item === 'string') {
|
|
237
|
+
// Append HTML string
|
|
238
|
+
const tempDiv = document.createElement('div');
|
|
239
|
+
tempDiv.innerHTML = item;
|
|
240
|
+
while (tempDiv.firstChild) {
|
|
241
|
+
panel.appendChild(tempDiv.firstChild);
|
|
242
|
+
}
|
|
243
|
+
} else if (item instanceof BaseComponent) {
|
|
244
|
+
// Render component into panel
|
|
245
|
+
item.render(`#${panel.id}`);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
return this;
|
|
250
|
+
}
|
|
251
|
+
|
|
221
252
|
/**
|
|
222
253
|
* Get tab by ID
|
|
223
254
|
*/
|
|
@@ -252,6 +283,11 @@ export class Tabs extends BaseComponent<TabsState> {
|
|
|
252
283
|
const tabPanels = document.createElement('div');
|
|
253
284
|
tabPanels.className = 'jux-tabs-panels';
|
|
254
285
|
|
|
286
|
+
// ✅ Append structure to DOM FIRST, then render content
|
|
287
|
+
wrapper.appendChild(tabList);
|
|
288
|
+
wrapper.appendChild(tabPanels);
|
|
289
|
+
container.appendChild(wrapper);
|
|
290
|
+
|
|
255
291
|
tabs.forEach(tab => {
|
|
256
292
|
// Tab button with unique ID
|
|
257
293
|
const tabButton = document.createElement('button');
|
|
@@ -294,21 +330,18 @@ export class Tabs extends BaseComponent<TabsState> {
|
|
|
294
330
|
// ✅ Append panel to DOM FIRST
|
|
295
331
|
tabPanels.appendChild(tabPanel);
|
|
296
332
|
|
|
297
|
-
// ✅ THEN render content into it
|
|
333
|
+
// ✅ THEN render content into it (panel is now in DOM)
|
|
298
334
|
if (typeof tab.content === 'string') {
|
|
299
335
|
tabPanel.innerHTML = tab.content;
|
|
300
336
|
} else if (tab.content instanceof BaseComponent) {
|
|
337
|
+
// Now panel exists in DOM, so render() can find it
|
|
301
338
|
tab.content.render(`#${tabPanel.id}`);
|
|
302
339
|
}
|
|
303
340
|
});
|
|
304
341
|
|
|
305
|
-
wrapper.appendChild(tabList);
|
|
306
|
-
wrapper.appendChild(tabPanels);
|
|
307
|
-
|
|
308
342
|
this._wireStandardEvents(wrapper);
|
|
309
343
|
this._wireAllSyncs();
|
|
310
344
|
|
|
311
|
-
container.appendChild(wrapper);
|
|
312
345
|
this._tabsWrapper = wrapper;
|
|
313
346
|
|
|
314
347
|
return this;
|