@ptcwebops/ptcw-design 5.0.0 → 5.0.2
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptc-button.cjs.entry.js +5 -4
- package/dist/cjs/ptc-form-checkbox_2.cjs.entry.js +1 -1
- package/dist/cjs/ptc-para.cjs.entry.js +53 -8
- package/dist/cjs/ptc-title.cjs.entry.js +52 -10
- package/dist/cjs/ptc-tooltip-v3.cjs.entry.js +100 -0
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ptc-button/ptc-button.css +4 -0
- package/dist/collection/components/ptc-button/ptc-button.js +21 -3
- package/dist/collection/components/ptc-para/ptc-para.css +11 -0
- package/dist/collection/components/ptc-para/ptc-para.js +181 -7
- package/dist/collection/components/ptc-textfield/ptc-textfield.js +1 -1
- package/dist/collection/components/ptc-title/ptc-title.css +14 -0
- package/dist/collection/components/ptc-title/ptc-title.js +180 -9
- package/dist/collection/components/ptc-tooltip-v3/ptc-tooltip-v3.css +189 -0
- package/dist/collection/components/ptc-tooltip-v3/ptc-tooltip-v3.js +281 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +211 -27
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ptc-button.entry.js +5 -4
- package/dist/esm/ptc-form-checkbox_2.entry.js +1 -1
- package/dist/esm/ptc-para.entry.js +53 -8
- package/dist/esm/ptc-title.entry.js +52 -10
- package/dist/esm/ptc-tooltip-v3.entry.js +96 -0
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/ptcw-design/p-6b6d712a.entry.js +1 -0
- package/dist/ptcw-design/{p-1b831296.entry.js → p-81ec875a.entry.js} +2 -2
- package/dist/ptcw-design/p-90a0a077.entry.js +1 -0
- package/dist/ptcw-design/p-98eff76b.entry.js +1 -0
- package/dist/ptcw-design/p-dad891a9.entry.js +1 -0
- package/dist/ptcw-design/ptcw-design.css +1 -1
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/ptc-button/ptc-button.d.ts +1 -0
- package/dist/types/components/ptc-para/ptc-para.d.ts +21 -0
- package/dist/types/components/ptc-title/ptc-title.d.ts +21 -0
- package/dist/types/components/ptc-tooltip-v3/ptc-tooltip-v3.d.ts +41 -0
- package/dist/types/components.d.ts +121 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/ptcw-design/p-24c19e39.entry.js +0 -1
- package/dist/ptcw-design/p-3e0b63cc.entry.js +0 -1
- package/dist/ptcw-design/p-6bd4a6bf.entry.js +0 -1
|
@@ -20,6 +20,7 @@ export class PtcButton {
|
|
|
20
20
|
this.ariaLabel = '';
|
|
21
21
|
this.seoCompatibilityMode = false;
|
|
22
22
|
this.maintainContent = false;
|
|
23
|
+
this.trackerId = undefined;
|
|
23
24
|
}
|
|
24
25
|
clickEventHandler() {
|
|
25
26
|
this.clickEvent.emit();
|
|
@@ -35,14 +36,14 @@ export class PtcButton {
|
|
|
35
36
|
if (this.maintainContent) {
|
|
36
37
|
this.el.innerHTML = html;
|
|
37
38
|
}
|
|
38
|
-
return (h(Host, null, this.styles && h("style", null, this.styles), h(TagType, Object.assign({ class: classMap, onClick: this.clickEventHandler.bind(this) }, (!!this.linkHref ? { href: this.linkHref } : {}), (!this.linkHref ? { type: this.type } : {}), (!!this.target && !!this.linkHref ? { target: this.target } : {}), (!!this.rel && !!this.linkHref ? { rel: this.rel } : {}), (!!this.linkHref ? { title: this.linkTitle ? this.linkTitle : this.linkHref } : {}), (!!this.tabNav ? { tabindex: -1 } : { tabindex: 0 }), { title: this.buttonTitle }, (this.ariaLabel !== '' ? { ariaLabel: this.ariaLabel } : {})), h("span", { innerHTML: html }, h("slot", { name: "slot-before-text" }), h("slot", { name: "slot-after-text" })))));
|
|
39
|
+
return (h(Host, null, this.styles && h("style", null, this.styles), h("div", { id: this.trackerId, class: "tracker-div" }, h(TagType, Object.assign({ class: classMap, onClick: this.clickEventHandler.bind(this) }, (!!this.linkHref ? { href: this.linkHref } : {}), (!this.linkHref ? { type: this.type } : {}), (!!this.target && !!this.linkHref ? { target: this.target } : {}), (!!this.rel && !!this.linkHref ? { rel: this.rel } : {}), (!!this.linkHref ? { title: this.linkTitle ? this.linkTitle : this.linkHref } : {}), (!!this.tabNav ? { tabindex: -1 } : { tabindex: 0 }), { title: this.buttonTitle }, (this.ariaLabel !== '' ? { ariaLabel: this.ariaLabel } : {})), h("span", { innerHTML: html }, h("slot", { name: "slot-before-text" }), h("slot", { name: "slot-after-text" }))))));
|
|
39
40
|
}
|
|
40
41
|
standardRender() {
|
|
41
42
|
const classMap = this.getCssClassMap();
|
|
42
43
|
const Tag = !!this.linkHref ? 'a' : 'button';
|
|
43
|
-
return (h(Host, null, this.styles && h("style", null, this.styles), h(Tag, Object.assign({ class: classMap, onClick: this.clickEventHandler.bind(this) }, (!!this.linkHref ? { href: this.linkHref } : {}), (!this.linkHref ? { type: this.type } : {}), (!!this.target && !!this.linkHref ? { target: this.target } : {}), (!!this.rel && !!this.linkHref ? { rel: this.rel } : {}), (!!this.linkHref ? { title: this.linkTitle ? this.linkTitle : this.linkHref } : {}), (!!this.tabNav ? { tabindex: -1 } : { tabindex: 0 }), { title: this.buttonTitle }, (this.ariaLabel !== '' ? { ariaLabel: this.ariaLabel } : {})), this.iconAnimation == 'reveal-down' ?
|
|
44
|
+
return (h(Host, null, this.styles && h("style", null, this.styles), h("div", { id: this.trackerId, class: "tracker-div" }, h(Tag, Object.assign({ class: classMap, onClick: this.clickEventHandler.bind(this) }, (!!this.linkHref ? { href: this.linkHref } : {}), (!this.linkHref ? { type: this.type } : {}), (!!this.target && !!this.linkHref ? { target: this.target } : {}), (!!this.rel && !!this.linkHref ? { rel: this.rel } : {}), (!!this.linkHref ? { title: this.linkTitle ? this.linkTitle : this.linkHref } : {}), (!!this.tabNav ? { tabindex: -1 } : { tabindex: 0 }), { title: this.buttonTitle }, (this.ariaLabel !== '' ? { ariaLabel: this.ariaLabel } : {})), this.iconAnimation == 'reveal-down' ?
|
|
44
45
|
h("span", null, h("div", { class: "content" }, h("slot", null)), h("div", { class: "icon-wrapper" }, h("div", { class: "icon" }, h("slot", { name: "slot-after-text" })))) :
|
|
45
|
-
h("span", null, h("slot", { name: "slot-before-text" }), h("slot", null), h("slot", { name: "slot-after-text" })))));
|
|
46
|
+
h("span", null, h("slot", { name: "slot-before-text" }), h("slot", null), h("slot", { name: "slot-after-text" }))))));
|
|
46
47
|
}
|
|
47
48
|
render() {
|
|
48
49
|
if (this.seoCompatibilityMode) {
|
|
@@ -396,6 +397,23 @@ export class PtcButton {
|
|
|
396
397
|
"attribute": "maintain-content",
|
|
397
398
|
"reflect": false,
|
|
398
399
|
"defaultValue": "false"
|
|
400
|
+
},
|
|
401
|
+
"trackerId": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"mutable": false,
|
|
404
|
+
"complexType": {
|
|
405
|
+
"original": "string",
|
|
406
|
+
"resolved": "string",
|
|
407
|
+
"references": {}
|
|
408
|
+
},
|
|
409
|
+
"required": false,
|
|
410
|
+
"optional": true,
|
|
411
|
+
"docs": {
|
|
412
|
+
"tags": [],
|
|
413
|
+
"text": ""
|
|
414
|
+
},
|
|
415
|
+
"attribute": "tracker-id",
|
|
416
|
+
"reflect": false
|
|
399
417
|
}
|
|
400
418
|
};
|
|
401
419
|
}
|
|
@@ -289,4 +289,15 @@ p.ellipsis-boxing {
|
|
|
289
289
|
overflow: hidden;
|
|
290
290
|
text-overflow: ellipsis;
|
|
291
291
|
overflow-wrap: break-word;
|
|
292
|
+
}
|
|
293
|
+
p.line-clamp-title {
|
|
294
|
+
display: -webkit-box !important;
|
|
295
|
+
-webkit-box-orient: vertical;
|
|
296
|
+
overflow: hidden;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@media (max-width: 768px) {
|
|
300
|
+
:host(.hide-tooltip-on-mobile) .line-clamp-title {
|
|
301
|
+
-webkit-line-clamp: initial !important;
|
|
302
|
+
}
|
|
292
303
|
}
|
|
@@ -13,13 +13,62 @@ export class PtcPara {
|
|
|
13
13
|
this.paraZIndex = undefined;
|
|
14
14
|
this.styles = undefined;
|
|
15
15
|
this.seoCompatibilityMode = false;
|
|
16
|
+
this.tooltipZIndex = 'auto';
|
|
17
|
+
this.tooltipPosition = 'bottom';
|
|
18
|
+
this.tooltipTheme = 'standard';
|
|
19
|
+
this.enableTooltip = false;
|
|
20
|
+
this.maxChars = undefined;
|
|
21
|
+
this.maxLines = undefined;
|
|
22
|
+
this.hideTooltipOnMobile = false;
|
|
23
|
+
this.ismob = undefined;
|
|
16
24
|
}
|
|
25
|
+
// Tooltip Properties ends
|
|
17
26
|
render() {
|
|
18
27
|
if (this.seoCompatibilityMode) {
|
|
19
28
|
seoSlotReset(this.el);
|
|
20
29
|
}
|
|
21
30
|
return this.standardRender();
|
|
22
31
|
}
|
|
32
|
+
//tooltip code
|
|
33
|
+
getSortedText(content) {
|
|
34
|
+
if (!this.enableTooltip)
|
|
35
|
+
return;
|
|
36
|
+
const shouldTruncate = (content.length > this.maxChars) && !this.maxLines;
|
|
37
|
+
return shouldTruncate ? content.slice(0, this.maxChars) + '...' : content;
|
|
38
|
+
}
|
|
39
|
+
componentDidLoad() {
|
|
40
|
+
if (this.hideTooltipOnMobile) {
|
|
41
|
+
this.el.classList.add('hide-tooltip-on-mobile');
|
|
42
|
+
}
|
|
43
|
+
this.el.addEventListener('mouseenter', () => this.toggleTitleTooltip(true));
|
|
44
|
+
this.el.addEventListener('mouseleave', () => this.toggleTitleTooltip(false));
|
|
45
|
+
if (this.enableTooltip) {
|
|
46
|
+
let paraContent = this.el.innerText;
|
|
47
|
+
this.tooltipText = paraContent;
|
|
48
|
+
this.el.innerText = this.getSortedText(paraContent);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
toggleTitleTooltip(show) {
|
|
52
|
+
const tooltipClass = 'tooltip-box';
|
|
53
|
+
const existingTooltip = this.el.querySelector(`.${tooltipClass}`);
|
|
54
|
+
if (show && this.enableTooltip) {
|
|
55
|
+
if (!existingTooltip) {
|
|
56
|
+
const tooltipMarkup = document.createElement('div');
|
|
57
|
+
tooltipMarkup.className = tooltipClass;
|
|
58
|
+
tooltipMarkup.innerText = this.tooltipText;
|
|
59
|
+
tooltipMarkup.style.zIndex = String(this.tooltipZIndex); // Ensures zIndex is a string
|
|
60
|
+
tooltipMarkup.classList.add(this.tooltipPosition, this.tooltipTheme);
|
|
61
|
+
if (this.hideTooltipOnMobile) {
|
|
62
|
+
tooltipMarkup.classList.add('hide-tooltip-mobile');
|
|
63
|
+
}
|
|
64
|
+
this.el.appendChild(tooltipMarkup);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
existingTooltip === null || existingTooltip === void 0 ? void 0 : existingTooltip.remove();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//tooltip code ends
|
|
23
72
|
standardRender() {
|
|
24
73
|
const classMap = this.getCssClassMap();
|
|
25
74
|
const colorClass = this.addWhiteClass();
|
|
@@ -36,6 +85,7 @@ export class PtcPara {
|
|
|
36
85
|
[this.paraLineH]: true,
|
|
37
86
|
[this.paraAlign]: !!this.paraAlign ? true : false,
|
|
38
87
|
['ellipsis-boxing']: this.ellipsisLineCutoff && this.ellipsisLineCutoff > 0,
|
|
88
|
+
['line-clamp-title']: this.maxLines && this.maxLines > 0 //tooltip code
|
|
39
89
|
};
|
|
40
90
|
}
|
|
41
91
|
//WEB-2392
|
|
@@ -47,13 +97,8 @@ export class PtcPara {
|
|
|
47
97
|
}
|
|
48
98
|
}
|
|
49
99
|
getLineCuttoff() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
result = {
|
|
53
|
-
['-webkit-line-clamp']: `${this.ellipsisLineCutoff}`,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return result;
|
|
100
|
+
const lineClamp = this.ellipsisLineCutoff > 0 ? this.ellipsisLineCutoff : this.maxLines;
|
|
101
|
+
return lineClamp > 0 ? { '-webkit-line-clamp': `${lineClamp}` } : {};
|
|
57
102
|
}
|
|
58
103
|
static get is() { return "ptc-para"; }
|
|
59
104
|
static get encapsulation() { return "shadow"; }
|
|
@@ -261,8 +306,137 @@ export class PtcPara {
|
|
|
261
306
|
"attribute": "seo-compatibility-mode",
|
|
262
307
|
"reflect": false,
|
|
263
308
|
"defaultValue": "false"
|
|
309
|
+
},
|
|
310
|
+
"tooltipZIndex": {
|
|
311
|
+
"type": "string",
|
|
312
|
+
"mutable": false,
|
|
313
|
+
"complexType": {
|
|
314
|
+
"original": "string",
|
|
315
|
+
"resolved": "string",
|
|
316
|
+
"references": {}
|
|
317
|
+
},
|
|
318
|
+
"required": false,
|
|
319
|
+
"optional": false,
|
|
320
|
+
"docs": {
|
|
321
|
+
"tags": [],
|
|
322
|
+
"text": "index of hover tooltip element"
|
|
323
|
+
},
|
|
324
|
+
"attribute": "tooltip-z-index",
|
|
325
|
+
"reflect": false,
|
|
326
|
+
"defaultValue": "'auto'"
|
|
327
|
+
},
|
|
328
|
+
"tooltipPosition": {
|
|
329
|
+
"type": "string",
|
|
330
|
+
"mutable": false,
|
|
331
|
+
"complexType": {
|
|
332
|
+
"original": "'left' | 'right' | 'bottom' | 'bottom-right' | 'top'",
|
|
333
|
+
"resolved": "\"bottom\" | \"bottom-right\" | \"left\" | \"right\" | \"top\"",
|
|
334
|
+
"references": {}
|
|
335
|
+
},
|
|
336
|
+
"required": false,
|
|
337
|
+
"optional": false,
|
|
338
|
+
"docs": {
|
|
339
|
+
"tags": [],
|
|
340
|
+
"text": "Tooltip position"
|
|
341
|
+
},
|
|
342
|
+
"attribute": "tooltip-position",
|
|
343
|
+
"reflect": false,
|
|
344
|
+
"defaultValue": "'bottom'"
|
|
345
|
+
},
|
|
346
|
+
"tooltipTheme": {
|
|
347
|
+
"type": "string",
|
|
348
|
+
"mutable": false,
|
|
349
|
+
"complexType": {
|
|
350
|
+
"original": "'standard' | 'danger'",
|
|
351
|
+
"resolved": "\"danger\" | \"standard\"",
|
|
352
|
+
"references": {}
|
|
353
|
+
},
|
|
354
|
+
"required": false,
|
|
355
|
+
"optional": false,
|
|
356
|
+
"docs": {
|
|
357
|
+
"tags": [],
|
|
358
|
+
"text": "(optional) Injected CSS Styles"
|
|
359
|
+
},
|
|
360
|
+
"attribute": "tooltip-theme",
|
|
361
|
+
"reflect": false,
|
|
362
|
+
"defaultValue": "'standard'"
|
|
363
|
+
},
|
|
364
|
+
"enableTooltip": {
|
|
365
|
+
"type": "boolean",
|
|
366
|
+
"mutable": false,
|
|
367
|
+
"complexType": {
|
|
368
|
+
"original": "boolean",
|
|
369
|
+
"resolved": "boolean",
|
|
370
|
+
"references": {}
|
|
371
|
+
},
|
|
372
|
+
"required": false,
|
|
373
|
+
"optional": false,
|
|
374
|
+
"docs": {
|
|
375
|
+
"tags": [],
|
|
376
|
+
"text": ""
|
|
377
|
+
},
|
|
378
|
+
"attribute": "enable-tooltip",
|
|
379
|
+
"reflect": false,
|
|
380
|
+
"defaultValue": "false"
|
|
381
|
+
},
|
|
382
|
+
"maxChars": {
|
|
383
|
+
"type": "number",
|
|
384
|
+
"mutable": false,
|
|
385
|
+
"complexType": {
|
|
386
|
+
"original": "number",
|
|
387
|
+
"resolved": "number",
|
|
388
|
+
"references": {}
|
|
389
|
+
},
|
|
390
|
+
"required": false,
|
|
391
|
+
"optional": false,
|
|
392
|
+
"docs": {
|
|
393
|
+
"tags": [],
|
|
394
|
+
"text": ""
|
|
395
|
+
},
|
|
396
|
+
"attribute": "max-chars",
|
|
397
|
+
"reflect": false
|
|
398
|
+
},
|
|
399
|
+
"maxLines": {
|
|
400
|
+
"type": "number",
|
|
401
|
+
"mutable": false,
|
|
402
|
+
"complexType": {
|
|
403
|
+
"original": "number",
|
|
404
|
+
"resolved": "number",
|
|
405
|
+
"references": {}
|
|
406
|
+
},
|
|
407
|
+
"required": false,
|
|
408
|
+
"optional": false,
|
|
409
|
+
"docs": {
|
|
410
|
+
"tags": [],
|
|
411
|
+
"text": ""
|
|
412
|
+
},
|
|
413
|
+
"attribute": "max-lines",
|
|
414
|
+
"reflect": false
|
|
415
|
+
},
|
|
416
|
+
"hideTooltipOnMobile": {
|
|
417
|
+
"type": "boolean",
|
|
418
|
+
"mutable": false,
|
|
419
|
+
"complexType": {
|
|
420
|
+
"original": "boolean",
|
|
421
|
+
"resolved": "boolean",
|
|
422
|
+
"references": {}
|
|
423
|
+
},
|
|
424
|
+
"required": false,
|
|
425
|
+
"optional": false,
|
|
426
|
+
"docs": {
|
|
427
|
+
"tags": [],
|
|
428
|
+
"text": ""
|
|
429
|
+
},
|
|
430
|
+
"attribute": "hide-tooltip-on-mobile",
|
|
431
|
+
"reflect": false,
|
|
432
|
+
"defaultValue": "false"
|
|
264
433
|
}
|
|
265
434
|
};
|
|
266
435
|
}
|
|
436
|
+
static get states() {
|
|
437
|
+
return {
|
|
438
|
+
"ismob": {}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
267
441
|
static get elementRef() { return "el"; }
|
|
268
442
|
}
|
|
@@ -167,7 +167,7 @@ export class PtcTextfield {
|
|
|
167
167
|
getValidationPattern() {
|
|
168
168
|
let validationPattern = '';
|
|
169
169
|
if ((this.type === 'email' && this.fieldName === 'email') || (this.type === 'email' && this.fieldName === "companyemail")) {
|
|
170
|
-
validationPattern = "[a-
|
|
170
|
+
validationPattern = "[a-zA-Z0-9._%+\\-]+@[a-zA-Z0-9.\\-]+\\.(?!.*\\..*\\.)[a-zA-Z]{2,15}$"; //updated TLD character limit from 7 to 15
|
|
171
171
|
}
|
|
172
172
|
if (this.fieldName === 'firstname' || this.fieldName === 'lastname') {
|
|
173
173
|
validationPattern = '^[^!*@&$¥£€>#^~+=<>%]+$';
|
|
@@ -638,4 +638,18 @@ div.block h4,
|
|
|
638
638
|
div.block h5,
|
|
639
639
|
div.block h6 {
|
|
640
640
|
display: block;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.line-clamp-title {
|
|
644
|
+
display: -webkit-box !important;
|
|
645
|
+
-webkit-box-orient: vertical;
|
|
646
|
+
overflow: hidden;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
:host {
|
|
650
|
+
display: block;
|
|
651
|
+
}
|
|
652
|
+
:host div {
|
|
653
|
+
position: relative;
|
|
654
|
+
display: inline-block;
|
|
641
655
|
}
|
|
@@ -16,6 +16,22 @@ export class PtcTitle {
|
|
|
16
16
|
this.ellipsisLineCutoff = undefined;
|
|
17
17
|
this.titleDisplay = 'inline-block';
|
|
18
18
|
this.seoCompatibilityMode = false;
|
|
19
|
+
this.tooltipZIndex = 'auto';
|
|
20
|
+
this.tooltipPosition = 'bottom';
|
|
21
|
+
this.tooltipTheme = 'standard';
|
|
22
|
+
this.enableTooltip = false;
|
|
23
|
+
this.maxChars = undefined;
|
|
24
|
+
this.maxLines = undefined;
|
|
25
|
+
this.hideTooltipOnMobile = false;
|
|
26
|
+
this.ismob = undefined;
|
|
27
|
+
}
|
|
28
|
+
// Tooltip Properties ends
|
|
29
|
+
componentDidLoad() {
|
|
30
|
+
if (this.hideTooltipOnMobile) {
|
|
31
|
+
this.el.classList.add('hide-tooltip-on-mobile');
|
|
32
|
+
}
|
|
33
|
+
this.el.addEventListener('mouseenter', () => this.toggleTitleTooltip(true));
|
|
34
|
+
this.el.addEventListener('mouseleave', () => this.toggleTitleTooltip(false));
|
|
19
35
|
}
|
|
20
36
|
render() {
|
|
21
37
|
if (this.seoCompatibilityMode) {
|
|
@@ -25,15 +41,46 @@ export class PtcTitle {
|
|
|
25
41
|
return this.standardRender();
|
|
26
42
|
}
|
|
27
43
|
}
|
|
44
|
+
getSortedText(content) {
|
|
45
|
+
if (!this.enableTooltip)
|
|
46
|
+
return;
|
|
47
|
+
const shouldTruncate = (content.length > this.maxChars) && !this.maxLines;
|
|
48
|
+
return shouldTruncate ? content.slice(0, this.maxChars) + '...' : content;
|
|
49
|
+
}
|
|
50
|
+
toggleTitleTooltip(show) {
|
|
51
|
+
var _a;
|
|
52
|
+
const tooltipClass = 'tooltip-box';
|
|
53
|
+
const existingTooltip = this.el.querySelector(`.${tooltipClass}`);
|
|
54
|
+
if (show && this.enableTooltip) {
|
|
55
|
+
if (!existingTooltip) {
|
|
56
|
+
const tooltipMarkup = document.createElement('div');
|
|
57
|
+
tooltipMarkup.className = tooltipClass;
|
|
58
|
+
tooltipMarkup.innerText = this.tooltipText;
|
|
59
|
+
tooltipMarkup.style.zIndex = String(this.tooltipZIndex); // Ensures zIndex is a string
|
|
60
|
+
tooltipMarkup.classList.add(this.tooltipPosition, this.tooltipTheme);
|
|
61
|
+
if (this.hideTooltipOnMobile) {
|
|
62
|
+
tooltipMarkup.classList.add('hide-tooltip-mobile');
|
|
63
|
+
}
|
|
64
|
+
(_a = this.el.querySelector('div')) === null || _a === void 0 ? void 0 : _a.appendChild(tooltipMarkup);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
existingTooltip === null || existingTooltip === void 0 ? void 0 : existingTooltip.remove();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
28
71
|
seoCompRender() {
|
|
29
72
|
const classMap = this.getCssClassMap();
|
|
30
73
|
const cutOff = this.getLineCuttoff();
|
|
31
74
|
const [TagType, firstChild] = getSeoTagType(this.el, this.type);
|
|
32
|
-
|
|
75
|
+
let html = firstChild && firstChild.innerHTML;
|
|
76
|
+
// added for tooltip
|
|
77
|
+
this.tooltipText = html;
|
|
78
|
+
let eleText = firstChild && firstChild.innerText;
|
|
79
|
+
html = this.enableTooltip ? this.getSortedText(eleText) : html;
|
|
33
80
|
if (this.el == firstChild) {
|
|
34
81
|
this.el.innerHTML = '';
|
|
35
82
|
}
|
|
36
|
-
return (h(Host, null, this.styles && h("style", null, this.styles), h("div", { class: classMap }, h(TagType, { innerHTML: html, style: cutOff }))));
|
|
83
|
+
return (h(Host, null, this.styles && h("style", null, this.styles), h("div", { class: classMap }, h(TagType, { innerHTML: html, style: cutOff, class: this.maxLines && this.maxLines > 0 ? 'line-clamp-title' : '' }))));
|
|
37
84
|
}
|
|
38
85
|
standardRender() {
|
|
39
86
|
const classMap = this.getCssClassMap();
|
|
@@ -76,13 +123,8 @@ export class PtcTitle {
|
|
|
76
123
|
};
|
|
77
124
|
}
|
|
78
125
|
getLineCuttoff() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
result = {
|
|
82
|
-
['-webkit-line-clamp']: `${this.ellipsisLineCutoff}`,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
126
|
+
const lineClamp = this.ellipsisLineCutoff > 0 ? this.ellipsisLineCutoff : this.maxLines;
|
|
127
|
+
return lineClamp > 0 ? { '-webkit-line-clamp': `${lineClamp}` } : {};
|
|
86
128
|
}
|
|
87
129
|
static get is() { return "ptc-title"; }
|
|
88
130
|
static get encapsulation() { return "scoped"; }
|
|
@@ -342,8 +384,137 @@ export class PtcTitle {
|
|
|
342
384
|
"attribute": "seo-compatibility-mode",
|
|
343
385
|
"reflect": false,
|
|
344
386
|
"defaultValue": "false"
|
|
387
|
+
},
|
|
388
|
+
"tooltipZIndex": {
|
|
389
|
+
"type": "string",
|
|
390
|
+
"mutable": false,
|
|
391
|
+
"complexType": {
|
|
392
|
+
"original": "string",
|
|
393
|
+
"resolved": "string",
|
|
394
|
+
"references": {}
|
|
395
|
+
},
|
|
396
|
+
"required": false,
|
|
397
|
+
"optional": false,
|
|
398
|
+
"docs": {
|
|
399
|
+
"tags": [],
|
|
400
|
+
"text": "index of hover tooltip element"
|
|
401
|
+
},
|
|
402
|
+
"attribute": "tooltip-z-index",
|
|
403
|
+
"reflect": false,
|
|
404
|
+
"defaultValue": "'auto'"
|
|
405
|
+
},
|
|
406
|
+
"tooltipPosition": {
|
|
407
|
+
"type": "string",
|
|
408
|
+
"mutable": false,
|
|
409
|
+
"complexType": {
|
|
410
|
+
"original": "'left' | 'right' | 'bottom' | 'bottom-right' | 'top'",
|
|
411
|
+
"resolved": "\"bottom\" | \"bottom-right\" | \"left\" | \"right\" | \"top\"",
|
|
412
|
+
"references": {}
|
|
413
|
+
},
|
|
414
|
+
"required": false,
|
|
415
|
+
"optional": false,
|
|
416
|
+
"docs": {
|
|
417
|
+
"tags": [],
|
|
418
|
+
"text": "Tooltip position"
|
|
419
|
+
},
|
|
420
|
+
"attribute": "tooltip-position",
|
|
421
|
+
"reflect": false,
|
|
422
|
+
"defaultValue": "'bottom'"
|
|
423
|
+
},
|
|
424
|
+
"tooltipTheme": {
|
|
425
|
+
"type": "string",
|
|
426
|
+
"mutable": false,
|
|
427
|
+
"complexType": {
|
|
428
|
+
"original": "'standard' | 'danger'",
|
|
429
|
+
"resolved": "\"danger\" | \"standard\"",
|
|
430
|
+
"references": {}
|
|
431
|
+
},
|
|
432
|
+
"required": false,
|
|
433
|
+
"optional": false,
|
|
434
|
+
"docs": {
|
|
435
|
+
"tags": [],
|
|
436
|
+
"text": "(optional) Injected CSS Styles"
|
|
437
|
+
},
|
|
438
|
+
"attribute": "tooltip-theme",
|
|
439
|
+
"reflect": false,
|
|
440
|
+
"defaultValue": "'standard'"
|
|
441
|
+
},
|
|
442
|
+
"enableTooltip": {
|
|
443
|
+
"type": "boolean",
|
|
444
|
+
"mutable": false,
|
|
445
|
+
"complexType": {
|
|
446
|
+
"original": "boolean",
|
|
447
|
+
"resolved": "boolean",
|
|
448
|
+
"references": {}
|
|
449
|
+
},
|
|
450
|
+
"required": false,
|
|
451
|
+
"optional": false,
|
|
452
|
+
"docs": {
|
|
453
|
+
"tags": [],
|
|
454
|
+
"text": ""
|
|
455
|
+
},
|
|
456
|
+
"attribute": "enable-tooltip",
|
|
457
|
+
"reflect": false,
|
|
458
|
+
"defaultValue": "false"
|
|
459
|
+
},
|
|
460
|
+
"maxChars": {
|
|
461
|
+
"type": "number",
|
|
462
|
+
"mutable": false,
|
|
463
|
+
"complexType": {
|
|
464
|
+
"original": "number",
|
|
465
|
+
"resolved": "number",
|
|
466
|
+
"references": {}
|
|
467
|
+
},
|
|
468
|
+
"required": false,
|
|
469
|
+
"optional": false,
|
|
470
|
+
"docs": {
|
|
471
|
+
"tags": [],
|
|
472
|
+
"text": ""
|
|
473
|
+
},
|
|
474
|
+
"attribute": "max-chars",
|
|
475
|
+
"reflect": false
|
|
476
|
+
},
|
|
477
|
+
"maxLines": {
|
|
478
|
+
"type": "number",
|
|
479
|
+
"mutable": false,
|
|
480
|
+
"complexType": {
|
|
481
|
+
"original": "number",
|
|
482
|
+
"resolved": "number",
|
|
483
|
+
"references": {}
|
|
484
|
+
},
|
|
485
|
+
"required": false,
|
|
486
|
+
"optional": false,
|
|
487
|
+
"docs": {
|
|
488
|
+
"tags": [],
|
|
489
|
+
"text": ""
|
|
490
|
+
},
|
|
491
|
+
"attribute": "max-lines",
|
|
492
|
+
"reflect": false
|
|
493
|
+
},
|
|
494
|
+
"hideTooltipOnMobile": {
|
|
495
|
+
"type": "boolean",
|
|
496
|
+
"mutable": false,
|
|
497
|
+
"complexType": {
|
|
498
|
+
"original": "boolean",
|
|
499
|
+
"resolved": "boolean",
|
|
500
|
+
"references": {}
|
|
501
|
+
},
|
|
502
|
+
"required": false,
|
|
503
|
+
"optional": false,
|
|
504
|
+
"docs": {
|
|
505
|
+
"tags": [],
|
|
506
|
+
"text": ""
|
|
507
|
+
},
|
|
508
|
+
"attribute": "hide-tooltip-on-mobile",
|
|
509
|
+
"reflect": false,
|
|
510
|
+
"defaultValue": "false"
|
|
345
511
|
}
|
|
346
512
|
};
|
|
347
513
|
}
|
|
514
|
+
static get states() {
|
|
515
|
+
return {
|
|
516
|
+
"ismob": {}
|
|
517
|
+
};
|
|
518
|
+
}
|
|
348
519
|
static get elementRef() { return "el"; }
|
|
349
520
|
}
|