@ebrains/react 0.9.2-beta → 0.9.3-beta
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/analytics-44b1416b.esm.js +55 -0
- package/arrow-diagonal-black-8f0494c3.esm.js +3 -0
- package/arrow-right-9322ba8a.esm.js +5 -0
- package/bluesky-cc5edd2d.esm.js +14 -0
- package/bookmark-c200037c.esm.js +16 -0
- package/chevron-down-6144c823.esm.js +12 -0
- package/chevron-left-ca6c66e1.esm.js +11 -0
- package/chevron-right-b88ed2d4.esm.js +5 -0
- package/chevron-up-c66bd477.esm.js +12 -0
- package/close-87fc0d63.esm.js +5 -0
- package/color-2554aad6.esm.js +122 -0
- package/color-primary-palette_6.entry.esm.js +778 -0
- package/components-section.entry.esm.js +165 -0
- package/copy-03b72cb6.esm.js +5 -0
- package/correct-use-of-colors.entry.esm.js +243 -0
- package/docs-palettes.entry.esm.js +29 -0
- package/docs-tokens.entry.esm.js +45 -0
- package/eds-accordion.entry.esm.js +132 -0
- package/eds-alert.entry.esm.js +112 -0
- package/eds-app-root.entry.esm.js +53 -0
- package/eds-avatar_27.entry.esm.js +332 -0
- package/eds-card-desc_2.entry.esm.js +86 -0
- package/eds-card-generic.entry.esm.js +114 -0
- package/eds-card-project.entry.esm.js +93 -0
- package/eds-card-section.entry.esm.js +56 -0
- package/eds-card-tags.entry.esm.js +27 -0
- package/eds-card-tool.entry.esm.js +105 -0
- package/eds-card-wrapper.entry.esm.js +39 -0
- package/eds-code-block.entry.esm.js +2290 -0
- package/eds-cookies-preference.entry.esm.js +47 -0
- package/eds-feedback.entry.esm.js +82 -0
- package/eds-frame.entry.esm.js +112 -0
- package/eds-icon-arrow-diagonal.entry.esm.js +21 -0
- package/eds-icon-arrow-right.entry.esm.js +21 -0
- package/eds-icon-bluesky.entry.esm.js +21 -0
- package/eds-icon-bookmark.entry.esm.js +21 -0
- package/eds-icon-chevron-down.entry.esm.js +21 -0
- package/eds-icon-chevron-left.entry.esm.js +21 -0
- package/eds-icon-chevron-right.entry.esm.js +21 -0
- package/eds-icon-chevron-up.entry.esm.js +21 -0
- package/eds-icon-close.entry.esm.js +21 -0
- package/eds-icon-copy.entry.esm.js +21 -0
- package/eds-icon-eu.entry.esm.js +21 -0
- package/eds-icon-external.entry.esm.js +21 -0
- package/eds-icon-facebook.entry.esm.js +21 -0
- package/eds-icon-gitlab.entry.esm.js +21 -0
- package/eds-icon-linkedin.entry.esm.js +21 -0
- package/eds-icon-loader.entry.esm.js +21 -0
- package/eds-icon-mastodon.entry.esm.js +21 -0
- package/eds-icon-menu.entry.esm.js +21 -0
- package/eds-icon-minus.entry.esm.js +21 -0
- package/eds-icon-more.entry.esm.js +21 -0
- package/eds-icon-paper.entry.esm.js +21 -0
- package/eds-icon-plus.entry.esm.js +21 -0
- package/eds-icon-portal.entry.esm.js +21 -0
- package/eds-icon-private.entry.esm.js +21 -0
- package/eds-icon-public.entry.esm.js +21 -0
- package/eds-icon-search.entry.esm.js +21 -0
- package/eds-icon-star.entry.esm.js +21 -0
- package/eds-icon-success.entry.esm.js +21 -0
- package/eds-icon-thumbs-down.entry.esm.js +21 -0
- package/eds-icon-thumbs-up.entry.esm.js +21 -0
- package/eds-icon-tutorial.entry.esm.js +21 -0
- package/eds-icon-twitter.entry.esm.js +21 -0
- package/eds-icon-unknown.entry.esm.js +21 -0
- package/eds-icon-updown.entry.esm.js +21 -0
- package/eds-icon-user.entry.esm.js +21 -0
- package/eds-icon-youtube.entry.esm.js +21 -0
- package/eds-login_2.entry.esm.js +1828 -0
- package/eds-matomo-notice.entry.esm.js +162 -0
- package/eds-pagination_2.entry.esm.js +493 -0
- package/eds-progress-bar.entry.esm.js +41 -0
- package/eds-rating.entry.esm.js +79 -0
- package/eds-section-core_2.entry.esm.js +69 -0
- package/eds-spinner.entry.esm.js +67 -0
- package/eds-switch.entry.esm.js +58 -0
- package/eds-tabs.entry.esm.js +143 -0
- package/eds-timeline.entry.esm.js +117 -0
- package/eds-toast-manager.entry.esm.js +62 -0
- package/eds-toast.entry.esm.js +92 -0
- package/eds-tooltip.entry.esm.js +125 -0
- package/eds-trl.entry.esm.js +68 -0
- package/eu-9ddde93a.esm.js +30 -0
- package/facebook-9cb5c17f.esm.js +14 -0
- package/incorrect-use-of-colors.entry.esm.js +71 -0
- package/index-39c58238.esm.js +58 -0
- package/index.esm.d.ts +1 -0
- package/index.esm.js +4 -0
- package/index.esm2.js +4833 -0
- package/linkedin-e8650abb.esm.js +28 -0
- package/loader-c9628637.esm.js +30 -0
- package/logo-color-7f1fd803.esm.js +115 -0
- package/logo-color-margins-ff8ce71b.esm.js +118 -0
- package/logo-space.entry.esm.js +48 -0
- package/logo-variations-horizontal_2.entry.esm.js +123 -0
- package/logo-variations-tabs.entry.esm.js +29 -0
- package/logo-white-no-bg-f382f86f.esm.js +1021 -0
- package/logo-wrong-usage.entry.esm.js +101 -0
- package/mastodon-3703ec61.esm.js +14 -0
- package/menu-340ea948.esm.js +11 -0
- package/minus-b30a7c71.esm.js +11 -0
- package/mono-53f70232.esm.js +11 -0
- package/more-4449d549.esm.js +13 -0
- package/package.json +6 -2
- package/paper-8e74ea31.esm.js +15 -0
- package/plus-89c07be2.esm.js +12 -0
- package/portal-d6c8ce56.esm.js +18 -0
- package/private-1c25ff8e.esm.js +25 -0
- package/public-d4d8c585.esm.js +16 -0
- package/search-fbcd79c2.esm.js +12 -0
- package/sharedUtils-a550989c.esm.js +17 -0
- package/src/components.d.ts +40 -0
- package/src/generated/components.d.ts +38 -0
- package/src/generated/react-component-lib/attachProps.d.ts +16 -0
- package/src/generated/react-component-lib/case.d.ts +2 -0
- package/src/generated/react-component-lib/createComponent.d.ts +10 -0
- package/src/generated/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/src/generated/react-component-lib/dev.d.ts +2 -0
- package/src/generated/react-component-lib/interfaces.d.ts +29 -0
- package/src/generated/react-component-lib/utils/attachProps.d.ts +16 -0
- package/src/generated/react-component-lib/utils/case.d.ts +2 -0
- package/src/generated/react-component-lib/utils/dev.d.ts +2 -0
- package/src/generated/react-component-lib/utils/index.d.ts +10 -0
- package/src/react-component-lib/attachProps.d.ts +16 -0
- package/src/react-component-lib/case.d.ts +2 -0
- package/src/react-component-lib/createComponent.d.ts +10 -0
- package/src/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/src/react-component-lib/dev.d.ts +2 -0
- package/src/react-component-lib/interfaces.d.ts +29 -0
- package/src/react-component-lib/utils/attachProps.d.ts +16 -0
- package/src/react-component-lib/utils/case.d.ts +2 -0
- package/src/react-component-lib/utils/index.d.ts +10 -0
- package/star-0da9b5e9.esm.js +5 -0
- package/success-443809da.esm.js +18 -0
- package/svg-repository.entry.esm.js +337 -0
- package/thumbs-down-a18fd049.esm.js +5 -0
- package/thumbs-up-c19a71bc.esm.js +6 -0
- package/toastManager-d9eee791.esm.js +34 -0
- package/token-list_3.entry.esm.js +385 -0
- package/token-ratios.entry.esm.js +49 -0
- package/token-typography.entry.esm.js +267 -0
- package/tutotial-150ee1fd.esm.js +27 -0
- package/twitter-ac21b505.esm.js +14 -0
- package/unknown-ed01a24c.esm.js +22 -0
- package/up-and-down-d747abee.esm.js +12 -0
- package/user-71ebdc15.esm.js +16 -0
- package/youtube-efbfbdc4.esm.js +14 -0
- package/.babelrc +0 -12
- package/project.json +0 -10
- package/rollup.config.js +0 -43
- package/src/components.ts +0 -49
- package/src/generated/components.ts +0 -47
- package/src/generated/react-component-lib/attachProps.ts +0 -125
- package/src/generated/react-component-lib/case.ts +0 -7
- package/src/generated/react-component-lib/createComponent.tsx +0 -106
- package/src/generated/react-component-lib/createOverlayComponent.tsx +0 -142
- package/src/generated/react-component-lib/dev.ts +0 -14
- package/src/generated/react-component-lib/index.tsx +0 -50
- package/src/generated/react-component-lib/interfaces.ts +0 -34
- package/src/generated/react-component-lib/utils/attachProps.ts +0 -125
- package/src/generated/react-component-lib/utils/case.ts +0 -7
- package/src/generated/react-component-lib/utils/dev.ts +0 -14
- package/src/generated/react-component-lib/utils/index.tsx +0 -50
- package/src/react-component-lib/attachProps.ts +0 -125
- package/src/react-component-lib/case.ts +0 -7
- package/src/react-component-lib/createComponent.tsx +0 -106
- package/src/react-component-lib/createOverlayComponent.tsx +0 -142
- package/src/react-component-lib/dev.ts +0 -14
- package/src/react-component-lib/index.tsx +0 -50
- package/src/react-component-lib/interfaces.ts +0 -34
- package/src/react-component-lib/utils/attachProps.ts +0 -125
- package/src/react-component-lib/utils/case.ts +0 -7
- package/src/react-component-lib/utils/index.tsx +0 -50
- package/tsconfig.json +0 -17
- package/tsconfig.lib.json +0 -23
- /package/src/generated/react-component-lib/{index.ts → index.d.ts} +0 -0
- /package/src/{index.ts → index.d.ts} +0 -0
- /package/src/react-component-lib/{index.ts → index.d.ts} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index.esm2.js';
|
|
2
|
+
import { m as matomoOptIn, a as matomoOptOut } from './analytics-44b1416b.esm.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import 'react-dom';
|
|
6
|
+
|
|
7
|
+
const edsMatomoNoticeCss = ".fixed{position:fixed}.absolute{position:absolute}.w-full{width:100%}.bottom-0{bottom:0rem}.bottom-4{bottom:0.25rem}.p-4{padding:0.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.z-10{z-index:10}.z-\\[999999\\]{z-index:999999}.left-0{left:0rem}.left-1\\/2{left:50%}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.flex{display:flex}.gap-12{gap:0.75rem}.gap-20{gap:1.25rem}.gap-4{gap:0.25rem}@media (min-width: 750px){.md\\:left-1\\/2{left:50%}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}}";
|
|
8
|
+
const EdsMatomoNoticeStyle0 = edsMatomoNoticeCss;
|
|
9
|
+
const EdsMatomoNotice = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
this.consent = createEvent(this, "consent", 7);
|
|
13
|
+
this.heading = 'Analytics Consent';
|
|
14
|
+
this.description = "We use anonymous analytics to improve our services. No data is collected unless you give your consent. If you don't wish to send data right now, you can always re-enable analytics later by clicking the Cookies Preference button in the footer. However, by opting in today, you're joining a community that shapes our product's future—all while keeping your data completely anonymous.";
|
|
15
|
+
this.optOutMessage = "You are already part of our community, and your anonymous data helps shape our product's future! Rest assured, your privacy is fully protected.";
|
|
16
|
+
this.forceShow = false;
|
|
17
|
+
this.showNotice = true;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Listens for global custom events to open the matomo-consent.
|
|
21
|
+
*/
|
|
22
|
+
toggleCookiesConsent() {
|
|
23
|
+
this.showNotice = !this.showNotice;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the consent cookie exists.
|
|
27
|
+
*/
|
|
28
|
+
hasCookieConsent() {
|
|
29
|
+
return !!document.cookie.split('; ').find(row => row.startsWith('mtm_consent='));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the user has opted out after has opted in.
|
|
33
|
+
*/
|
|
34
|
+
optedOut() {
|
|
35
|
+
return !!document.cookie.split('; ').find(row => row.startsWith('mtm_consent_removed'));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generate a unique storage key based on appId or the app's domain.
|
|
39
|
+
*/
|
|
40
|
+
getStorageKey() {
|
|
41
|
+
return `${window.location.host}-matomo-deferred`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check cookies and sessionStorage (unless forceShow is true) to decide if the notice should be shown.
|
|
45
|
+
*/
|
|
46
|
+
componentWillLoad() {
|
|
47
|
+
// If a decision has been made previously (opted in or out), don't show the notice.
|
|
48
|
+
const consentGiven = localStorage.getItem(`${window.location.host}-matomo-consent-given`);
|
|
49
|
+
if (consentGiven === 'out' || this.optedOut()) {
|
|
50
|
+
this.showNotice = false;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (this.forceShow) {
|
|
54
|
+
// If forceShow is true, always show the notice
|
|
55
|
+
this.showNotice = true;
|
|
56
|
+
} else {
|
|
57
|
+
// If user has already consented, hide the notice
|
|
58
|
+
// eslint-disable-next-line
|
|
59
|
+
if (this.hasCookieConsent()) {
|
|
60
|
+
this.showNotice = false;
|
|
61
|
+
} else {
|
|
62
|
+
// Otherwise check if user deferred in this session
|
|
63
|
+
const sessionDeferred = sessionStorage.getItem(this.getStorageKey());
|
|
64
|
+
this.showNotice = !sessionDeferred;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
componentDidLoad() {
|
|
69
|
+
const btns = this.el.shadowRoot.querySelectorAll('eds-button');
|
|
70
|
+
btns.forEach(b => {
|
|
71
|
+
this.emitContext(b);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
emitContext(linkElement) {
|
|
75
|
+
const event = new CustomEvent('parentContext', {
|
|
76
|
+
detail: {
|
|
77
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
78
|
+
identifier: null
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
linkElement.dispatchEvent(event);
|
|
82
|
+
}
|
|
83
|
+
optInAnalytics() {
|
|
84
|
+
matomoOptIn();
|
|
85
|
+
localStorage.removeItem(`${window.location.host}-matomo-consent-given`);
|
|
86
|
+
this.hideNotice();
|
|
87
|
+
this.consent.emit('in');
|
|
88
|
+
}
|
|
89
|
+
optOutAnalytics() {
|
|
90
|
+
matomoOptOut();
|
|
91
|
+
this.hideNotice();
|
|
92
|
+
this.consent.emit('out');
|
|
93
|
+
}
|
|
94
|
+
noThanks() {
|
|
95
|
+
localStorage.setItem(`${window.location.host}-matomo-consent-given`, 'out');
|
|
96
|
+
this.hideNotice();
|
|
97
|
+
}
|
|
98
|
+
deferDecision() {
|
|
99
|
+
sessionStorage.setItem(this.getStorageKey(), 'true');
|
|
100
|
+
this.hideNotice();
|
|
101
|
+
this.consent.emit('defer');
|
|
102
|
+
}
|
|
103
|
+
keepMeIn() {
|
|
104
|
+
this.hideNotice();
|
|
105
|
+
}
|
|
106
|
+
hideNotice() {
|
|
107
|
+
this.showNotice = false;
|
|
108
|
+
}
|
|
109
|
+
render() {
|
|
110
|
+
if (!this.showNotice) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
return h("div", {
|
|
114
|
+
class: "fixed bottom-0 p-8 z-[999999] grow md:left-1/2 md:-translate-x-1/2 md:-translate-y-1/2 justify-center"
|
|
115
|
+
}, h("eds-accordion", {
|
|
116
|
+
title: this.heading,
|
|
117
|
+
description: this.hasCookieConsent() ? this.optOutMessage : this.description,
|
|
118
|
+
switchBg: true,
|
|
119
|
+
expanded: true
|
|
120
|
+
}, this.hasCookieConsent() ? h("div", {
|
|
121
|
+
class: "flex items-center gap-4"
|
|
122
|
+
}, this.optedOut() ? h("eds-button", {
|
|
123
|
+
intent: "primary",
|
|
124
|
+
label: "Opt me in again",
|
|
125
|
+
"aria-label": "Opt me in again",
|
|
126
|
+
onClick: () => this.optInAnalytics()
|
|
127
|
+
}) : h("eds-button", {
|
|
128
|
+
intent: "primary",
|
|
129
|
+
label: "Keep Me In",
|
|
130
|
+
"aria-label": "Keep Me In",
|
|
131
|
+
onClick: () => this.keepMeIn()
|
|
132
|
+
}), h("eds-button", {
|
|
133
|
+
intent: "ghostInverse",
|
|
134
|
+
label: "Opt-out",
|
|
135
|
+
"aria-label": "Opt-out from analytics",
|
|
136
|
+
onClick: () => this.optOutAnalytics()
|
|
137
|
+
})) : h("div", {
|
|
138
|
+
class: "flex items-center gap-4"
|
|
139
|
+
}, h("eds-button", {
|
|
140
|
+
intent: "primary",
|
|
141
|
+
label: "I agree",
|
|
142
|
+
"aria-label": "Opt-in for analytics",
|
|
143
|
+
onClick: () => this.optInAnalytics()
|
|
144
|
+
}), h("eds-button", {
|
|
145
|
+
intent: "ghost",
|
|
146
|
+
label: "No, thanks",
|
|
147
|
+
"aria-label": "Opt-out from analytics",
|
|
148
|
+
onClick: () => this.noThanks()
|
|
149
|
+
}), h("eds-button", {
|
|
150
|
+
intent: "ghost",
|
|
151
|
+
label: "Ask me later",
|
|
152
|
+
"aria-label": "Defer analytics decision",
|
|
153
|
+
onClick: () => this.deferDecision()
|
|
154
|
+
}))));
|
|
155
|
+
}
|
|
156
|
+
get el() {
|
|
157
|
+
return getElement(this);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
EdsMatomoNotice.style = EdsMatomoNoticeStyle0;
|
|
161
|
+
|
|
162
|
+
export { EdsMatomoNotice as eds_matomo_notice };
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index.esm2.js';
|
|
2
|
+
import { s as sendAnalytics } from './analytics-44b1416b.esm.js';
|
|
3
|
+
import { p as parseData } from './sharedUtils-a550989c.esm.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'react-dom';
|
|
7
|
+
|
|
8
|
+
const edsPaginationCss = "ul,menu{list-style:none;margin:0;padding:0}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.f-ui-02-light{font-family:var(--f-ui-02-light-fontFamily);font-weight:var(--f-ui-02-light-fontWeight);font-size:var(--f-ui-02-light-fontSize);line-height:var(--f-ui-02-light-lineHeight);letter-spacing:var(--f-ui-02-light-letterSpacing)}.text-lightest{color:var(--grey-500)}.mb-28{margin-bottom:1.75rem}.w-full{width:100%}.w-20{width:1.25rem}.h-20{height:1.25rem}.h-28{height:1.75rem}.h-32{height:2rem}.h-36{height:2.25rem}.text-center{text-align:center}.flex{display:flex}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-x-8{-moz-column-gap:0.5rem;column-gap:0.5rem}.mr-auto{margin-right:auto}.ml-auto{margin-left:auto}.\\!p-8{padding:0.5rem !important}.ml-4{margin-left:0.25rem}.mr-4{margin-right:0.25rem}.hidden{display:none}.gap-1{gap:0.0625rem}.py-4{padding-top:0.25rem;padding-bottom:0.25rem}.transition-colors{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}@media (min-width: 900px){.lg\\:\\!pr-12{padding-right:0.75rem !important}.lg\\:flex{display:flex}}";
|
|
9
|
+
const EdsPaginationStyle0 = edsPaginationCss;
|
|
10
|
+
const EdsPagination = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
registerInstance(this, hostRef);
|
|
13
|
+
this.currentPage = undefined;
|
|
14
|
+
this.lastPage = undefined;
|
|
15
|
+
this.perPage = 10;
|
|
16
|
+
this.total = 0;
|
|
17
|
+
this.url = '';
|
|
18
|
+
this.mode = 'default';
|
|
19
|
+
this.prevLabel = 'Prev';
|
|
20
|
+
this.nextLabel = 'Next';
|
|
21
|
+
this.prevUrl = '';
|
|
22
|
+
this.nextUrl = '';
|
|
23
|
+
this.links = [];
|
|
24
|
+
}
|
|
25
|
+
/** Lifecycle hook to generate pagination links on component load */
|
|
26
|
+
componentWillLoad() {
|
|
27
|
+
if (this.mode === 'default') {
|
|
28
|
+
this.generateLinks();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
componentDidLoad() {
|
|
32
|
+
// Emit context for each eds-link element after the component is fully loaded
|
|
33
|
+
const links = this.hostEl.shadowRoot.querySelectorAll('eds-link');
|
|
34
|
+
links.forEach(lnk => {
|
|
35
|
+
this.emitContext(lnk);
|
|
36
|
+
});
|
|
37
|
+
/*if (links.length > 0) {
|
|
38
|
+
// Emit context for the first link
|
|
39
|
+
this.emitContext(links[0]);
|
|
40
|
+
// Emit context for the last link, if it's different from the first
|
|
41
|
+
if (links.length > 1) {
|
|
42
|
+
this.emitContext(links[links.length - 1]);
|
|
43
|
+
}
|
|
44
|
+
}*/
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Emits a custom event called `parentContext` for a given link element.
|
|
48
|
+
* This event provides context information about the breadcrumb component.
|
|
49
|
+
*
|
|
50
|
+
* @param linkElement - The link element to which the event will be dispatched.
|
|
51
|
+
*/
|
|
52
|
+
emitContext(linkElement) {
|
|
53
|
+
const event = new CustomEvent('parentContext', {
|
|
54
|
+
detail: {
|
|
55
|
+
componentName: this.hostEl.tagName.toLowerCase(),
|
|
56
|
+
identifier: null
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
linkElement.dispatchEvent(event);
|
|
60
|
+
}
|
|
61
|
+
onPageOrLastPageChange() {
|
|
62
|
+
if (this.mode === 'default') {
|
|
63
|
+
this.generateLinks();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the current page is the first page
|
|
68
|
+
* @returns {boolean} - true if current page is the first page
|
|
69
|
+
*/
|
|
70
|
+
isFirstPage() {
|
|
71
|
+
return this.currentPage === 1;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the current page is the last page
|
|
75
|
+
* @returns {boolean} - true if current page is the last page
|
|
76
|
+
*/
|
|
77
|
+
isLastPage() {
|
|
78
|
+
return this.currentPage === this.lastPage;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Generates a pagination link object
|
|
82
|
+
* @param {number} page - Page number for the link
|
|
83
|
+
* @returns {Link} - Link object with page details
|
|
84
|
+
*/
|
|
85
|
+
generateLink(page) {
|
|
86
|
+
const urlHasQuery = this.url.includes('?');
|
|
87
|
+
return {
|
|
88
|
+
ariaLabel: `Page ${page}`,
|
|
89
|
+
url: `${this.url}${urlHasQuery ? '&' : '?'}page=${page}`,
|
|
90
|
+
label: page.toString(),
|
|
91
|
+
current: this.currentPage === page,
|
|
92
|
+
disabled: false
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Generates pagination links based on the last page and current page */
|
|
96
|
+
generateLinks() {
|
|
97
|
+
if (this.lastPage && this.lastPage > 5) {
|
|
98
|
+
this.links = this.getPaginationGenerator(this.currentPage || 1, this.lastPage).map(page => typeof page === 'number' ? this.generateLink(page) : page);
|
|
99
|
+
} else if (this.lastPage) {
|
|
100
|
+
this.links = Array.from({
|
|
101
|
+
length: this.lastPage
|
|
102
|
+
}).map((_, i) => this.generateLink(i + 1));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates a pagination range based on delta, current, and total pages
|
|
107
|
+
* @param {number} current - Current page number
|
|
108
|
+
* @param {number} total - Total number of pages
|
|
109
|
+
* @param {number} delta - Range of pages to display around the current page
|
|
110
|
+
* @returns {(number | string)[]} - Range of page numbers or ellipses
|
|
111
|
+
*/
|
|
112
|
+
getPaginationGenerator(current, total) {
|
|
113
|
+
const delta = 1; // Show one page before and one after the current page
|
|
114
|
+
const range = [];
|
|
115
|
+
if (total <= 5) {
|
|
116
|
+
// If total pages are 5 or less, show all pages
|
|
117
|
+
for (let i = 1; i <= total; i++) {
|
|
118
|
+
range.push(i);
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
// Always show the first page
|
|
122
|
+
range.push(1);
|
|
123
|
+
// Add ellipsis if there’s a gap between the first page and the current range start
|
|
124
|
+
if (current - delta > 2) {
|
|
125
|
+
range.push('...');
|
|
126
|
+
}
|
|
127
|
+
// Determine range for pages around the current page
|
|
128
|
+
for (let i = Math.max(2, current - delta); i <= Math.min(total - 1, current + delta); i++) {
|
|
129
|
+
range.push(i);
|
|
130
|
+
}
|
|
131
|
+
// Add ellipsis if there’s a gap between the current range end and the last page
|
|
132
|
+
if (current + delta < total - 1) {
|
|
133
|
+
range.push('...');
|
|
134
|
+
}
|
|
135
|
+
// Always show the last page
|
|
136
|
+
range.push(total);
|
|
137
|
+
}
|
|
138
|
+
return range;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Formats the current page results information for display
|
|
142
|
+
* @returns {string} - Formatted page result information
|
|
143
|
+
*/
|
|
144
|
+
pageResults() {
|
|
145
|
+
if (this.total > 0) {
|
|
146
|
+
return this.total > this.perPage ? `${this.perPage * ((this.currentPage || 1) - 1) + 1} - ${this.perPage * (this.currentPage || 1) >= this.total ? this.total : this.perPage * (this.currentPage || 1)} of ${this.total}` : `${this.total}`;
|
|
147
|
+
}
|
|
148
|
+
return '';
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Handles a page click event, updating the current page and dispatching an event
|
|
152
|
+
* @param {MouseEvent} event - Click event
|
|
153
|
+
* @param {number} newPage - New page number
|
|
154
|
+
*/
|
|
155
|
+
handlePageClick(event, newPage) {
|
|
156
|
+
if (this.mode === 'navigator') {
|
|
157
|
+
return; // No page clicking logic for navigator mode
|
|
158
|
+
}
|
|
159
|
+
event.preventDefault(); // Prevent default link navigation
|
|
160
|
+
if (newPage !== this.currentPage) {
|
|
161
|
+
this.links = this.links.map(link => typeof link === 'object' ? Object.assign(Object.assign({}, link), {
|
|
162
|
+
current: parseInt(link.label) === newPage
|
|
163
|
+
}) : link);
|
|
164
|
+
const pageChangeEvent = new CustomEvent('page', {
|
|
165
|
+
detail: newPage,
|
|
166
|
+
bubbles: true,
|
|
167
|
+
composed: true
|
|
168
|
+
});
|
|
169
|
+
this.hostEl.dispatchEvent(pageChangeEvent);
|
|
170
|
+
this.currentPage = newPage;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
render() {
|
|
174
|
+
return h("div", {
|
|
175
|
+
key: '1d53f69179791434224f152503c0b81c4cfc7cd3'
|
|
176
|
+
}, this.total > 0 && this.mode === 'default' && h("p", {
|
|
177
|
+
key: '00ae324b49d62a74feee9d1cde21d67cd726ecf0',
|
|
178
|
+
class: "f-ui-03 text-lightest mb-28 w-full text-center"
|
|
179
|
+
}, h("span", {
|
|
180
|
+
key: 'dedf2ce2700eae9d1386b305ec1d1904b133f992',
|
|
181
|
+
class: "sr-only"
|
|
182
|
+
}, "Results:"), this.pageResults()), this.mode === 'navigator' || this.lastPage && this.lastPage > 1 ? h("nav", {
|
|
183
|
+
"aria-label": "Pagination"
|
|
184
|
+
}, h("ul", {
|
|
185
|
+
class: "flex items-center justify-center gap-x-8"
|
|
186
|
+
}, h("li", {
|
|
187
|
+
class: "mr-auto"
|
|
188
|
+
}, h("eds-link", {
|
|
189
|
+
label: this.prevLabel,
|
|
190
|
+
url: this.mode === 'navigator' ? this.prevUrl || '#' // Use prevUrl if provided, otherwise disable with '#'
|
|
191
|
+
: this.isFirstPage() ? '#' : this.generateLink(this.currentPage - 1).url,
|
|
192
|
+
disabled: this.mode === 'navigator' ? !this.prevUrl // Disable if prevUrl is not provided
|
|
193
|
+
: this.isFirstPage(),
|
|
194
|
+
"aria-label": "Previous page",
|
|
195
|
+
icon: "chevron-left",
|
|
196
|
+
"icon-pos": "left",
|
|
197
|
+
size: "small",
|
|
198
|
+
"icon-small": "true",
|
|
199
|
+
intent: "strong",
|
|
200
|
+
"hide-label-on-small-screen": true,
|
|
201
|
+
class: "!p-8 lg:!pr-12",
|
|
202
|
+
onClick: event => {
|
|
203
|
+
if (this.mode === 'default') {
|
|
204
|
+
if (this.isFirstPage()) {
|
|
205
|
+
event.preventDefault(); // Prevent click if disabled
|
|
206
|
+
} else {
|
|
207
|
+
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
})), this.mode === 'default' && this.links.map((link, index) => h("li", {
|
|
212
|
+
key: index,
|
|
213
|
+
class: "f-ui-02 flex h-36 items-center justify-center"
|
|
214
|
+
}, typeof link === 'string' ? h("span", {
|
|
215
|
+
class: "flex items-center justify-center"
|
|
216
|
+
}, link) : h("eds-link", {
|
|
217
|
+
url: link.url,
|
|
218
|
+
"aria-label": link.ariaLabel,
|
|
219
|
+
label: link.label,
|
|
220
|
+
current: link.current,
|
|
221
|
+
size: "small",
|
|
222
|
+
class: "!p-8",
|
|
223
|
+
intent: link.current ? 'secondary' : 'ghost',
|
|
224
|
+
onClick: event => this.handlePageClick(event, parseInt(link.label))
|
|
225
|
+
}))), h("li", {
|
|
226
|
+
class: "ml-auto"
|
|
227
|
+
}, h("eds-link", {
|
|
228
|
+
label: this.nextLabel,
|
|
229
|
+
url: this.mode === 'navigator' ? this.nextUrl || '#' // Use nextUrl if provided, otherwise disable with '#'
|
|
230
|
+
: this.isLastPage() ? '#' : this.generateLink(this.currentPage + 1).url,
|
|
231
|
+
disabled: this.mode === 'navigator' ? !this.nextUrl // Disable if nextUrl is not provided
|
|
232
|
+
: this.isLastPage(),
|
|
233
|
+
"aria-label": "Next page",
|
|
234
|
+
size: "small",
|
|
235
|
+
"icon-small": "true",
|
|
236
|
+
icon: "chevron-right",
|
|
237
|
+
intent: "strong",
|
|
238
|
+
"hide-label-on-small-screen": true,
|
|
239
|
+
class: "!p-8 lg:!pl-12 flex items-center gap-1 py-4 transition-colors",
|
|
240
|
+
onClick: event => {
|
|
241
|
+
if (this.mode === 'default') {
|
|
242
|
+
if (this.isLastPage()) {
|
|
243
|
+
event.preventDefault(); // Prevent click if disabled
|
|
244
|
+
} else {
|
|
245
|
+
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
})))) : null);
|
|
250
|
+
}
|
|
251
|
+
get hostEl() {
|
|
252
|
+
return getElement(this);
|
|
253
|
+
}
|
|
254
|
+
static get watchers() {
|
|
255
|
+
return {
|
|
256
|
+
"currentPage": ["onPageOrLastPageChange"],
|
|
257
|
+
"lastPage": ["onPageOrLastPageChange"]
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
EdsPagination.style = EdsPaginationStyle0;
|
|
262
|
+
const edsTableCss = "table{text-indent:0;border-color:inherit;border-collapse:collapse;}.container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.pt-32{padding-top:2rem}.pt-40{padding-top:2.5rem}.pt-48{padding-top:3rem}.pb-28{padding-bottom:1.75rem}.pb-60{padding-bottom:3.75rem}.mt-20{margin-top:1.25rem}.mt-28{margin-top:1.75rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.overflow-x-auto{overflow-x:auto}.mt-6{margin-top:0.375rem}.p-0{padding:0rem}.m-0{margin:0rem}.border{border-width:1px}.border-softer{border:1px solid rgba(0, 0, 0, .1)}.even\\:bg-inverse-softer:nth-child(even){background-color:rgba(255, 255, 255, .15)}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-8{padding-top:0.5rem;padding-bottom:0.5rem}.f-ui-01{font-family:var(--f-ui-01-fontFamily);font-weight:var(--f-ui-01-fontWeight);font-size:var(--f-ui-01-fontSize);line-height:var(--f-ui-01-lineHeight);letter-spacing:var(--f-ui-01-letterSpacing)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.text-center{text-align:center}.break-words{overflow-wrap:anywhere}";
|
|
263
|
+
const EdsTableStyle0 = edsTableCss;
|
|
264
|
+
const EdsTable = class {
|
|
265
|
+
constructor(hostRef) {
|
|
266
|
+
registerInstance(this, hostRef);
|
|
267
|
+
this.handleResize = () => {
|
|
268
|
+
this.updateContainerWidth();
|
|
269
|
+
};
|
|
270
|
+
this.data = null;
|
|
271
|
+
this.endpoint = null;
|
|
272
|
+
this.config = {};
|
|
273
|
+
this.rowsPerPage = 10;
|
|
274
|
+
this.paginationEnabled = true;
|
|
275
|
+
this.searchEnabled = false;
|
|
276
|
+
this.hostWidth = undefined;
|
|
277
|
+
this.columnSize = 'default';
|
|
278
|
+
this.tbData = [];
|
|
279
|
+
this.columns = [];
|
|
280
|
+
this.currentPage = 1;
|
|
281
|
+
this.parsedConfig = {};
|
|
282
|
+
this.totalRows = 0;
|
|
283
|
+
this.searchQuery = '';
|
|
284
|
+
this.containerWidth = 0;
|
|
285
|
+
}
|
|
286
|
+
handleDataChange() {
|
|
287
|
+
this.parseData();
|
|
288
|
+
}
|
|
289
|
+
handleConfigChange() {
|
|
290
|
+
this.parseConfig();
|
|
291
|
+
}
|
|
292
|
+
componentWillLoad() {
|
|
293
|
+
this.parseConfig();
|
|
294
|
+
this.data ? this.parseData() : this.endpoint && this.fetchData();
|
|
295
|
+
}
|
|
296
|
+
componentDidLoad() {
|
|
297
|
+
this.updateContainerWidth();
|
|
298
|
+
window.addEventListener('resize', this.handleResize);
|
|
299
|
+
this.setupPaginationListener();
|
|
300
|
+
}
|
|
301
|
+
componentDidUpdate() {
|
|
302
|
+
this.setupPaginationListener();
|
|
303
|
+
}
|
|
304
|
+
disconnectedCallback() {
|
|
305
|
+
window.removeEventListener('resize', this.handleResize);
|
|
306
|
+
}
|
|
307
|
+
updateContainerWidth() {
|
|
308
|
+
// Use hostWidth prop if provided; otherwise, measure parent element
|
|
309
|
+
if (this.hostWidth && this.hostWidth.trim() !== '') {
|
|
310
|
+
this.containerWidth = Number(this.hostWidth);
|
|
311
|
+
} else if (this.hostEl.parentElement instanceof HTMLElement) {
|
|
312
|
+
this.containerWidth = this.hostEl.parentElement.getBoundingClientRect().width;
|
|
313
|
+
} else {
|
|
314
|
+
this.containerWidth = 400;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
parseData() {
|
|
318
|
+
try {
|
|
319
|
+
this.tbData = parseData(this.data);
|
|
320
|
+
//this.tbData = typeof this.data === 'string' ? JSON.parse(this.data) : this.data || [];
|
|
321
|
+
this.totalRows = this.tbData.length;
|
|
322
|
+
this.updateColumns();
|
|
323
|
+
this.currentPage = 1;
|
|
324
|
+
} catch (error) {
|
|
325
|
+
// eslint-disable-next-line
|
|
326
|
+
console.error('Failed to parse data:', error);
|
|
327
|
+
this.tbData = [];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
parseConfig() {
|
|
331
|
+
try {
|
|
332
|
+
//this.parsedConfig = parseData(this.config);
|
|
333
|
+
this.parsedConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
|
|
334
|
+
} catch (error) {
|
|
335
|
+
// eslint-disable-next-line
|
|
336
|
+
console.error('Failed to parse config:', error);
|
|
337
|
+
this.parsedConfig = {};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
async fetchData() {
|
|
341
|
+
try {
|
|
342
|
+
const response = await fetch(this.endpoint);
|
|
343
|
+
const data = await response.json();
|
|
344
|
+
this.data = data;
|
|
345
|
+
} catch (error) {
|
|
346
|
+
// eslint-disable-next-line
|
|
347
|
+
console.error('Failed to fetch data:', error);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
setupPaginationListener() {
|
|
351
|
+
if (!this.shouldEnablePagination()) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const paginationEl = this.hostEl.shadowRoot.querySelector('eds-pagination');
|
|
355
|
+
if (paginationEl && !paginationEl.hasAttribute('listener-attached')) {
|
|
356
|
+
paginationEl.addEventListener('page', event => this.handlePageChange(event.detail));
|
|
357
|
+
paginationEl.setAttribute('listener-attached', 'true');
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
getFilteredRows() {
|
|
361
|
+
return this.tbData.filter(row => Object.values(row).some(value => value.toString().toLowerCase().includes(this.searchQuery.toLowerCase())));
|
|
362
|
+
}
|
|
363
|
+
getPaginatedRows() {
|
|
364
|
+
const filteredRows = this.getFilteredRows();
|
|
365
|
+
this.totalRows = filteredRows.length;
|
|
366
|
+
const start = (this.currentPage - 1) * this.rowsPerPage;
|
|
367
|
+
return filteredRows.slice(start, start + this.rowsPerPage);
|
|
368
|
+
}
|
|
369
|
+
handlePageChange(newPage) {
|
|
370
|
+
this.currentPage = newPage;
|
|
371
|
+
sendAnalytics({
|
|
372
|
+
category: 'ui-component',
|
|
373
|
+
parentContext: null,
|
|
374
|
+
tag: `${this.hostEl.tagName.toLowerCase()}/eds-pagination`,
|
|
375
|
+
name: `${newPage}` || '',
|
|
376
|
+
action: 'page'
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
handleSearch(event) {
|
|
380
|
+
this.searchQuery = event.target.value;
|
|
381
|
+
this.currentPage = 1;
|
|
382
|
+
/*sendAnalytics({
|
|
383
|
+
category: 'ui-component',
|
|
384
|
+
parentContext: null,
|
|
385
|
+
tag: `${this.hostEl.tagName.toLowerCase()}/eds-input-field/search`,
|
|
386
|
+
name: `${this.searchQuery}` || '',
|
|
387
|
+
action: 'page'
|
|
388
|
+
});*/
|
|
389
|
+
}
|
|
390
|
+
renderCell(value, column) {
|
|
391
|
+
var _a;
|
|
392
|
+
const format = (_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.format;
|
|
393
|
+
return format === 'uppercase' ? value === null || value === void 0 ? void 0 : value.toString().toUpperCase() : format === 'svg' ? h("div", {
|
|
394
|
+
innerHTML: value
|
|
395
|
+
}) : format === 'bold' ? h("strong", null, value) : format === 'code' ? h("code", null, value) : value;
|
|
396
|
+
}
|
|
397
|
+
shouldEnablePagination() {
|
|
398
|
+
return this.paginationEnabled && this.totalRows > this.rowsPerPage;
|
|
399
|
+
}
|
|
400
|
+
updateColumns() {
|
|
401
|
+
this.columns = this.tbData.length > 0 ? Object.keys(this.tbData[0]) : [];
|
|
402
|
+
}
|
|
403
|
+
getVisibleColumnsCount() {
|
|
404
|
+
return this.columns.filter(column => {
|
|
405
|
+
var _a;
|
|
406
|
+
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden);
|
|
407
|
+
}).length;
|
|
408
|
+
}
|
|
409
|
+
divisionFactor() {
|
|
410
|
+
let divisionFactor = 1;
|
|
411
|
+
if (this.columnSize === 'medium') {
|
|
412
|
+
divisionFactor = 2;
|
|
413
|
+
} else if (this.columnSize === 'large') {
|
|
414
|
+
divisionFactor = 4;
|
|
415
|
+
}
|
|
416
|
+
return divisionFactor;
|
|
417
|
+
}
|
|
418
|
+
render() {
|
|
419
|
+
// Use containerWidth state that is updated on resize.
|
|
420
|
+
const currentContainerWidth = this.hostWidth && this.hostWidth.trim() !== '' ? Number(this.hostWidth) : this.containerWidth || 400;
|
|
421
|
+
// Calculate the number of visible columns and the column width.
|
|
422
|
+
const visibleColumnsCount = this.getVisibleColumnsCount();
|
|
423
|
+
const columnWidth = visibleColumnsCount > 0 ? Math.floor(currentContainerWidth / visibleColumnsCount * this.divisionFactor()) : 100;
|
|
424
|
+
const paginatedRows = this.getPaginatedRows();
|
|
425
|
+
const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
|
|
426
|
+
return h("div", {
|
|
427
|
+
key: '9ac7ad4f02237c02eaf5d3b351ded21bce29bd6c'
|
|
428
|
+
}, this.searchEnabled && h("div", {
|
|
429
|
+
key: '1cecf9a9089391c3bce72dd53a6f5ffa92692661'
|
|
430
|
+
}, h("eds-input-field", {
|
|
431
|
+
key: 1,
|
|
432
|
+
name: "search",
|
|
433
|
+
"aria-label": "Search",
|
|
434
|
+
type: "text",
|
|
435
|
+
placeholder: "Search...",
|
|
436
|
+
// @ts-ignore
|
|
437
|
+
onInput: event => this.handleSearch(event)
|
|
438
|
+
})), h("div", {
|
|
439
|
+
key: '435bbfd0a4dd3ddd0a7766863cdd8c2eaf41eb8f',
|
|
440
|
+
class: "mt-20"
|
|
441
|
+
}, h("table", {
|
|
442
|
+
key: '4785490532015b7069be068e80135220f37c3955',
|
|
443
|
+
class: "block overflow-x-auto mt-6 p-0"
|
|
444
|
+
}, h("thead", {
|
|
445
|
+
key: '8a99a961cf350bca26b1f73b8ffd6c8e1c48378f'
|
|
446
|
+
}, h("tr", {
|
|
447
|
+
key: 'a4ee04e342687830e905a3bd5217e53e513f0167',
|
|
448
|
+
class: "m-0 p-0 border border-softer even:bg-inverse-softer"
|
|
449
|
+
}, this.columns.map(column => {
|
|
450
|
+
var _a;
|
|
451
|
+
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("th", {
|
|
452
|
+
class: "m-0 py-8 border border-softer f-ui-02 break-words",
|
|
453
|
+
style: {
|
|
454
|
+
minWidth: `${columnWidth - 4}px`
|
|
455
|
+
}
|
|
456
|
+
}, column);
|
|
457
|
+
}))), h("tbody", {
|
|
458
|
+
key: '3c764ac7137d1b21f45003c6df5324e7d0db749f'
|
|
459
|
+
}, paginatedRows.map(row => h("tr", {
|
|
460
|
+
class: "m-0 p-0 border border-softer even:bg-inverse-softer"
|
|
461
|
+
}, this.columns.map(column => {
|
|
462
|
+
var _a;
|
|
463
|
+
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("td", {
|
|
464
|
+
class: "text-center border border-softer m-0 py-8 f-ui-2 break-words",
|
|
465
|
+
style: {
|
|
466
|
+
minWidth: `${columnWidth - 4}px`
|
|
467
|
+
}
|
|
468
|
+
}, this.renderCell(row[column], column));
|
|
469
|
+
})))))), this.shouldEnablePagination() && h("div", {
|
|
470
|
+
key: '98a1179b45fbc1b2f079825c899410ef4faf8c45',
|
|
471
|
+
class: "mt-20"
|
|
472
|
+
}, h("eds-pagination", {
|
|
473
|
+
key: '662c479139658ea7f3d2a3955c77e24d44dd6e74',
|
|
474
|
+
currentPage: this.currentPage,
|
|
475
|
+
lastPage: lastPage,
|
|
476
|
+
perPage: this.rowsPerPage,
|
|
477
|
+
total: this.totalRows,
|
|
478
|
+
mode: "default"
|
|
479
|
+
})));
|
|
480
|
+
}
|
|
481
|
+
get hostEl() {
|
|
482
|
+
return getElement(this);
|
|
483
|
+
}
|
|
484
|
+
static get watchers() {
|
|
485
|
+
return {
|
|
486
|
+
"data": ["handleDataChange", "parseData"],
|
|
487
|
+
"config": ["handleConfigChange"]
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
EdsTable.style = EdsTableStyle0;
|
|
492
|
+
|
|
493
|
+
export { EdsPagination as eds_pagination, EdsTable as eds_table };
|