@limetech/lime-crm-building-blocks 1.32.4-dev.7 → 1.33.0
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/CHANGELOG.md +3 -63
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-feed.cjs.entry.js +26 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/feed/feed.css +28 -0
- package/dist/collection/components/feed/feed.js +48 -0
- package/dist/components/limebb-feed.js +28 -2
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-feed.entry.js +26 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-220c28d8.entry.js +1 -0
- package/dist/types/components/feed/feed.d.ts +12 -0
- package/dist/types/components.d.ts +8 -0
- package/package.json +2 -2
- package/dist/lime-crm-building-blocks/p-102dd265.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,70 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
## [1.33.0](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.3...v1.33.0) (2024-04-22)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* trigger release ([9441cef](https://github.com/Lundalogik/lime-crm-building-blocks/commit/9441cef20ffc8e0564d203fe5aac1d87405135c5))
|
|
8
|
-
* trigger release ([e31a907](https://github.com/Lundalogik/lime-crm-building-blocks/commit/e31a907ffe026477cebd602fe23379c84e7ce740))
|
|
9
|
-
|
|
10
|
-
### [1.32.4-dev.6](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.4-dev.5...v1.32.4-dev.6) (2024-04-16)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* trigger release ([8898f5a](https://github.com/Lundalogik/lime-crm-building-blocks/commit/8898f5a740f753f1c2f78e7dbf7b416f9a6aa6a5))
|
|
17
|
-
|
|
18
|
-
### [1.32.4-dev.5](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.4-dev.4...v1.32.4-dev.5) (2024-04-16)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Bug Fixes
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* trigger release ([3a23cdc](https://github.com/Lundalogik/lime-crm-building-blocks/commit/3a23cdc52f2aa88c3b5e7f4bf7b16e28b99a04b8))
|
|
25
|
-
|
|
26
|
-
### [1.32.4-dev.4](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.4-dev.3...v1.32.4-dev.4) (2024-04-16)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Bug Fixes
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* trigger release ([fa2e5fd](https://github.com/Lundalogik/lime-crm-building-blocks/commit/fa2e5fde7238ffc5b512066c239f7cb83a744262))
|
|
33
|
-
|
|
34
|
-
### Reverts
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* Revert "ci(release.yml): publish releases on s3" ([45a4e00](https://github.com/Lundalogik/lime-crm-building-blocks/commit/45a4e003b4c9e883be7ac77d04d987948d557320))
|
|
38
|
-
|
|
39
|
-
### [1.32.4-dev.3](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.4-dev.2...v1.32.4-dev.3) (2024-04-15)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### Bug Fixes
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* trigger release ([f48fd46](https://github.com/Lundalogik/lime-crm-building-blocks/commit/f48fd467526e8988dc07a43c3a51d0544392064d))
|
|
46
|
-
|
|
47
|
-
### Reverts
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* Revert "ci(release.yml): publish releases on s3" ([33b8bd3](https://github.com/Lundalogik/lime-crm-building-blocks/commit/33b8bd3d924ed167b604d7ef2a4ae74f5606640c))
|
|
51
|
-
* Revert "fix(release.yml): publish releases on s3" ([2740fb8](https://github.com/Lundalogik/lime-crm-building-blocks/commit/2740fb8f98e004a3bf408e934272ebafb90ad373))
|
|
52
|
-
|
|
53
|
-
### [1.32.4-dev.2](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.4-dev.1...v1.32.4-dev.2) (2024-04-15)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Bug Fixes
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* **release.yml:** publish releases on s3 ([d94fe5b](https://github.com/Lundalogik/lime-crm-building-blocks/commit/d94fe5be9c1f96db4fb6cdcbc471d781cb809b17))
|
|
60
|
-
|
|
61
|
-
### [1.32.4-dev.1](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.3...v1.32.4-dev.1) (2024-04-15)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
### Bug Fixes
|
|
4
|
+
### Features
|
|
65
5
|
|
|
66
6
|
|
|
67
|
-
*
|
|
7
|
+
* **feed:** indicate new items since last time user visited the feed ([ef54fed](https://github.com/Lundalogik/lime-crm-building-blocks/commit/ef54feda0e47abe960cc797ac45004f1369bb6e6))
|
|
68
8
|
|
|
69
9
|
### [1.32.3](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.32.2...v1.32.3) (2024-03-21)
|
|
70
10
|
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button.cjs",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
18
|
+
return index.bootstrapLazy([["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button.cjs",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -164,7 +164,7 @@ function differenceInMinutes(dateLeft, dateRight, options) {
|
|
|
164
164
|
return getRoundingMethod(options?.roundingMethod)(diff);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
const feedCss = ":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}";
|
|
167
|
+
const feedCss = ":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}.new-items-indicator{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:flex-end}.new-items-indicator hr{border:none;position:absolute;width:100%;height:1px;background-color:rgb(var(--color-red-lighter))}.new-items-indicator h3{z-index:1;padding:0 0.5rem;border-radius:1rem;margin:0.5rem 1rem;font-size:small;text-transform:lowercase;color:rgb(var(--color-red-default));background-color:var(--limebb-feed-background-color)}.new-items-indicator+.date-heading{margin-top:-0.5rem}";
|
|
168
168
|
|
|
169
169
|
const MINUTES_OF_PROXIMITY = 5;
|
|
170
170
|
const Feed = class {
|
|
@@ -235,11 +235,36 @@ const Feed = class {
|
|
|
235
235
|
renderFeedItems() {
|
|
236
236
|
return this.items.map((item, index$1) => {
|
|
237
237
|
return [
|
|
238
|
+
this.renderNewItemsIndicator(item.timestamp, index$1),
|
|
238
239
|
this.renderDateHeader(item.timestamp, index$1),
|
|
239
240
|
index.h("limebb-feed-timeline-item", { platform: this.platform, context: this.context, item: item, key: item.id, ui: item === null || item === void 0 ? void 0 : item.ui, isBundled: this.isBundled(item, index$1) }),
|
|
240
241
|
];
|
|
241
242
|
});
|
|
242
243
|
}
|
|
244
|
+
renderNewItemsIndicator(timestamp, index) {
|
|
245
|
+
if (!this.lastVisitedTimestamp) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const totalCount = this.items.length;
|
|
249
|
+
const lastVisitedTimestamp = new Date(this.lastVisitedTimestamp);
|
|
250
|
+
const currentItemTimestamp = new Date(timestamp);
|
|
251
|
+
const isCurrentItemNewer = lastVisitedTimestamp < currentItemTimestamp;
|
|
252
|
+
if (!isCurrentItemNewer) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (totalCount === 1 || index === 0) {
|
|
256
|
+
return this.renderIndicator();
|
|
257
|
+
}
|
|
258
|
+
const previousItemTimestamp = new Date(this.items[index - 1].timestamp);
|
|
259
|
+
const isPreviousItemNewer = lastVisitedTimestamp < previousItemTimestamp;
|
|
260
|
+
if (isPreviousItemNewer) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
return this.renderIndicator();
|
|
264
|
+
}
|
|
265
|
+
renderIndicator() {
|
|
266
|
+
return (index.h("div", { class: "new-items-indicator" }, index.h("hr", null), index.h("h3", null, this.translator.get('webclient.new'))));
|
|
267
|
+
}
|
|
243
268
|
renderDateHeader(timestamp, index$1) {
|
|
244
269
|
const currentIndexDate = this.dateTimeFormatter.format(timestamp, 'date');
|
|
245
270
|
if (index$1 === 0) {
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button.cjs",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button.cjs",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -37,4 +37,32 @@ limebb-feed-timeline-item:has(+ limebb-feed-timeline-item[is-bundled]) {
|
|
|
37
37
|
|
|
38
38
|
.load-more-button {
|
|
39
39
|
margin-top: 0.5rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.new-items-indicator {
|
|
43
|
+
position: relative;
|
|
44
|
+
isolation: isolate;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: flex-end;
|
|
48
|
+
}
|
|
49
|
+
.new-items-indicator hr {
|
|
50
|
+
border: none;
|
|
51
|
+
position: absolute;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 1px;
|
|
54
|
+
background-color: rgb(var(--color-red-lighter));
|
|
55
|
+
}
|
|
56
|
+
.new-items-indicator h3 {
|
|
57
|
+
z-index: 1;
|
|
58
|
+
padding: 0 0.5rem;
|
|
59
|
+
border-radius: 1rem;
|
|
60
|
+
margin: 0.5rem 1rem;
|
|
61
|
+
font-size: small;
|
|
62
|
+
text-transform: lowercase;
|
|
63
|
+
color: rgb(var(--color-red-default));
|
|
64
|
+
background-color: var(--limebb-feed-background-color);
|
|
65
|
+
}
|
|
66
|
+
.new-items-indicator + .date-heading {
|
|
67
|
+
margin-top: -0.5rem;
|
|
40
68
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable multiline-ternary */
|
|
1
2
|
import { h } from '@stencil/core';
|
|
2
3
|
import { PlatformServiceName, } from '@limetech/lime-web-components';
|
|
3
4
|
import { differenceInMinutes } from 'date-fns/differenceInMinutes.mjs';
|
|
@@ -25,6 +26,7 @@ const MINUTES_OF_PROXIMITY = 5;
|
|
|
25
26
|
* @exampleComponent limebb-example-feed-tall-item
|
|
26
27
|
* @exampleComponent limebb-example-feed-item-types
|
|
27
28
|
* @exampleComponent limebb-example-feed-item-color-coding
|
|
29
|
+
* @exampleComponent limebb-example-feed-new-items
|
|
28
30
|
* @private
|
|
29
31
|
*/
|
|
30
32
|
export class Feed {
|
|
@@ -93,11 +95,36 @@ export class Feed {
|
|
|
93
95
|
renderFeedItems() {
|
|
94
96
|
return this.items.map((item, index) => {
|
|
95
97
|
return [
|
|
98
|
+
this.renderNewItemsIndicator(item.timestamp, index),
|
|
96
99
|
this.renderDateHeader(item.timestamp, index),
|
|
97
100
|
h("limebb-feed-timeline-item", { platform: this.platform, context: this.context, item: item, key: item.id, ui: item === null || item === void 0 ? void 0 : item.ui, isBundled: this.isBundled(item, index) }),
|
|
98
101
|
];
|
|
99
102
|
});
|
|
100
103
|
}
|
|
104
|
+
renderNewItemsIndicator(timestamp, index) {
|
|
105
|
+
if (!this.lastVisitedTimestamp) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const totalCount = this.items.length;
|
|
109
|
+
const lastVisitedTimestamp = new Date(this.lastVisitedTimestamp);
|
|
110
|
+
const currentItemTimestamp = new Date(timestamp);
|
|
111
|
+
const isCurrentItemNewer = lastVisitedTimestamp < currentItemTimestamp;
|
|
112
|
+
if (!isCurrentItemNewer) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (totalCount === 1 || index === 0) {
|
|
116
|
+
return this.renderIndicator();
|
|
117
|
+
}
|
|
118
|
+
const previousItemTimestamp = new Date(this.items[index - 1].timestamp);
|
|
119
|
+
const isPreviousItemNewer = lastVisitedTimestamp < previousItemTimestamp;
|
|
120
|
+
if (isPreviousItemNewer) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
return this.renderIndicator();
|
|
124
|
+
}
|
|
125
|
+
renderIndicator() {
|
|
126
|
+
return (h("div", { class: "new-items-indicator" }, h("hr", null), h("h3", null, this.translator.get('webclient.new'))));
|
|
127
|
+
}
|
|
101
128
|
renderDateHeader(timestamp, index) {
|
|
102
129
|
const currentIndexDate = this.dateTimeFormatter.format(timestamp, 'date');
|
|
103
130
|
if (index === 0) {
|
|
@@ -274,6 +301,27 @@ export class Feed {
|
|
|
274
301
|
"attribute": "total-count",
|
|
275
302
|
"reflect": false,
|
|
276
303
|
"defaultValue": "0"
|
|
304
|
+
},
|
|
305
|
+
"lastVisitedTimestamp": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"mutable": false,
|
|
308
|
+
"complexType": {
|
|
309
|
+
"original": "string | Date | null",
|
|
310
|
+
"resolved": "Date | null | string | undefined",
|
|
311
|
+
"references": {
|
|
312
|
+
"Date": {
|
|
313
|
+
"location": "global"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
"required": false,
|
|
318
|
+
"optional": true,
|
|
319
|
+
"docs": {
|
|
320
|
+
"tags": [],
|
|
321
|
+
"text": "The date and time of the last time the user visited the feed.\nWhen provided, the feed will display a divider line between the\nlast visited items (the old items which have a date and time earlier than\n`lastVisitedTimestamp`) and the newer items.\n\nIf there are no newer items, the divider line will not be displayed."
|
|
322
|
+
},
|
|
323
|
+
"attribute": "last-visited-timestamp",
|
|
324
|
+
"reflect": false
|
|
277
325
|
}
|
|
278
326
|
};
|
|
279
327
|
}
|
|
@@ -161,7 +161,7 @@ function differenceInMinutes(dateLeft, dateRight, options) {
|
|
|
161
161
|
return getRoundingMethod(options?.roundingMethod)(diff);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
const feedCss = ":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}";
|
|
164
|
+
const feedCss = ":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}.new-items-indicator{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:flex-end}.new-items-indicator hr{border:none;position:absolute;width:100%;height:1px;background-color:rgb(var(--color-red-lighter))}.new-items-indicator h3{z-index:1;padding:0 0.5rem;border-radius:1rem;margin:0.5rem 1rem;font-size:small;text-transform:lowercase;color:rgb(var(--color-red-default));background-color:var(--limebb-feed-background-color)}.new-items-indicator+.date-heading{margin-top:-0.5rem}";
|
|
165
165
|
|
|
166
166
|
const MINUTES_OF_PROXIMITY = 5;
|
|
167
167
|
const Feed = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -234,11 +234,36 @@ const Feed = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
234
234
|
renderFeedItems() {
|
|
235
235
|
return this.items.map((item, index) => {
|
|
236
236
|
return [
|
|
237
|
+
this.renderNewItemsIndicator(item.timestamp, index),
|
|
237
238
|
this.renderDateHeader(item.timestamp, index),
|
|
238
239
|
h("limebb-feed-timeline-item", { platform: this.platform, context: this.context, item: item, key: item.id, ui: item === null || item === void 0 ? void 0 : item.ui, isBundled: this.isBundled(item, index) }),
|
|
239
240
|
];
|
|
240
241
|
});
|
|
241
242
|
}
|
|
243
|
+
renderNewItemsIndicator(timestamp, index) {
|
|
244
|
+
if (!this.lastVisitedTimestamp) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const totalCount = this.items.length;
|
|
248
|
+
const lastVisitedTimestamp = new Date(this.lastVisitedTimestamp);
|
|
249
|
+
const currentItemTimestamp = new Date(timestamp);
|
|
250
|
+
const isCurrentItemNewer = lastVisitedTimestamp < currentItemTimestamp;
|
|
251
|
+
if (!isCurrentItemNewer) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (totalCount === 1 || index === 0) {
|
|
255
|
+
return this.renderIndicator();
|
|
256
|
+
}
|
|
257
|
+
const previousItemTimestamp = new Date(this.items[index - 1].timestamp);
|
|
258
|
+
const isPreviousItemNewer = lastVisitedTimestamp < previousItemTimestamp;
|
|
259
|
+
if (isPreviousItemNewer) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
return this.renderIndicator();
|
|
263
|
+
}
|
|
264
|
+
renderIndicator() {
|
|
265
|
+
return (h("div", { class: "new-items-indicator" }, h("hr", null), h("h3", null, this.translator.get('webclient.new'))));
|
|
266
|
+
}
|
|
242
267
|
renderDateHeader(timestamp, index) {
|
|
243
268
|
const currentIndexDate = this.dateTimeFormatter.format(timestamp, 'date');
|
|
244
269
|
if (index === 0) {
|
|
@@ -273,7 +298,8 @@ const Feed = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
273
298
|
"emptyStateMessage": [1, "empty-state-message"],
|
|
274
299
|
"loading": [4],
|
|
275
300
|
"minutesOfProximity": [2, "minutes-of-proximity"],
|
|
276
|
-
"totalCount": [2, "total-count"]
|
|
301
|
+
"totalCount": [2, "total-count"],
|
|
302
|
+
"lastVisitedTimestamp": [1, "last-visited-timestamp"]
|
|
277
303
|
}]);
|
|
278
304
|
function defineCustomElement$1() {
|
|
279
305
|
if (typeof customElements === "undefined") {
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["limebb-date-range",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"]}]]],["limebb-currency-picker",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
16
|
+
return bootstrapLazy([["limebb-date-range",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-currency-picker",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
17
17
|
});
|
|
@@ -160,7 +160,7 @@ function differenceInMinutes(dateLeft, dateRight, options) {
|
|
|
160
160
|
return getRoundingMethod(options?.roundingMethod)(diff);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
const feedCss = ":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}";
|
|
163
|
+
const feedCss = ":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}.new-items-indicator{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:flex-end}.new-items-indicator hr{border:none;position:absolute;width:100%;height:1px;background-color:rgb(var(--color-red-lighter))}.new-items-indicator h3{z-index:1;padding:0 0.5rem;border-radius:1rem;margin:0.5rem 1rem;font-size:small;text-transform:lowercase;color:rgb(var(--color-red-default));background-color:var(--limebb-feed-background-color)}.new-items-indicator+.date-heading{margin-top:-0.5rem}";
|
|
164
164
|
|
|
165
165
|
const MINUTES_OF_PROXIMITY = 5;
|
|
166
166
|
const Feed = class {
|
|
@@ -231,11 +231,36 @@ const Feed = class {
|
|
|
231
231
|
renderFeedItems() {
|
|
232
232
|
return this.items.map((item, index) => {
|
|
233
233
|
return [
|
|
234
|
+
this.renderNewItemsIndicator(item.timestamp, index),
|
|
234
235
|
this.renderDateHeader(item.timestamp, index),
|
|
235
236
|
h("limebb-feed-timeline-item", { platform: this.platform, context: this.context, item: item, key: item.id, ui: item === null || item === void 0 ? void 0 : item.ui, isBundled: this.isBundled(item, index) }),
|
|
236
237
|
];
|
|
237
238
|
});
|
|
238
239
|
}
|
|
240
|
+
renderNewItemsIndicator(timestamp, index) {
|
|
241
|
+
if (!this.lastVisitedTimestamp) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const totalCount = this.items.length;
|
|
245
|
+
const lastVisitedTimestamp = new Date(this.lastVisitedTimestamp);
|
|
246
|
+
const currentItemTimestamp = new Date(timestamp);
|
|
247
|
+
const isCurrentItemNewer = lastVisitedTimestamp < currentItemTimestamp;
|
|
248
|
+
if (!isCurrentItemNewer) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (totalCount === 1 || index === 0) {
|
|
252
|
+
return this.renderIndicator();
|
|
253
|
+
}
|
|
254
|
+
const previousItemTimestamp = new Date(this.items[index - 1].timestamp);
|
|
255
|
+
const isPreviousItemNewer = lastVisitedTimestamp < previousItemTimestamp;
|
|
256
|
+
if (isPreviousItemNewer) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
return this.renderIndicator();
|
|
260
|
+
}
|
|
261
|
+
renderIndicator() {
|
|
262
|
+
return (h("div", { class: "new-items-indicator" }, h("hr", null), h("h3", null, this.translator.get('webclient.new'))));
|
|
263
|
+
}
|
|
239
264
|
renderDateHeader(timestamp, index) {
|
|
240
265
|
const currentIndexDate = this.dateTimeFormatter.format(timestamp, 'date');
|
|
241
266
|
if (index === 0) {
|
package/dist/esm/loader.js
CHANGED
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["limebb-date-range",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"]}]]],["limebb-currency-picker",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
13
|
+
return bootstrapLazy([["limebb-date-range",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-feed",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-currency-picker",[[1,"limebb-currency-picker",{"label":[513],"platform":[16],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[16]}]]],["limebb-dashboard-widget",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-limeobject-file-viewer",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-navigation-button",[[1,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-date-picker",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-2912b7e7.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),e(l)})().then((e=>t([["p-81bfe796",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-2912b7e7.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),e(l)})().then((e=>t([["p-81bfe796",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-220c28d8",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-31668b58",[[1,"limebb-currency-picker",{label:[513],platform:[16],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[16]}]]],["p-0f8928a9",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-9f986917",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-575e0050",[[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]]],["p-5e0a5876",[[1,"limebb-locale-picker",{platform:[16],context:[16],value:[1],required:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],readonly:[4],multipleChoice:[4,"multiple-choice"],allLanguages:[32]}]]],["p-6ad70097",[[1,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-7b0263f8",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-654da86c",[[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],ui:[513],isBundled:[516,"is-bundled"],headingCanExpand:[32],isHeadingExpanded:[32],showMore:[32],isTall:[32]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-2912b7e7.js";import{P as r}from"./p-11eb7b1e.js";function n(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}const o=class{constructor(i){e(this,i),this.loadMore=t(this,"loadMore",7),this.items=[],this.minutesOfProximity=5,this.totalCount=0,this.isBundled=(e,t)=>{var i,r,o,s,a,l;if(0===t)return!1;if((null===(r=null===(i=this.items[t-1])||void 0===i?void 0:i.author)||void 0===r?void 0:r.id)!==(null===(o=null==e?void 0:e.author)||void 0===o?void 0:o.id))return!1;if((null===(a=null===(s=this.items[t-1])||void 0===s?void 0:s.icon)||void 0===a?void 0:a.name)!==(null===(l=null==e?void 0:e.icon)||void 0===l?void 0:l.name))return!1;const d=new Date(e.timestamp),c=new Date(this.items[t-1].timestamp),m=new Date(c);return function(e,t,i){const r=function(e,t){return+n(e)-+n(t)}(e,t)/6e4;return(o=i?.roundingMethod,e=>{const t=(o?Math[o]:Math.trunc)(e);return 0===t?0:t})(r);var o}(new Date(d),m)<=this.minutesOfProximity},this.handleLoadMore=e=>{e.stopPropagation(),this.loadMore.emit()}}render(){return[this.renderLoadMore(),this.renderEmptyFeedMessage(),this.renderSpinner(),this.renderFeedItems()]}renderSpinner(){if(this.loading)return i("limel-spinner",{size:"small"})}renderEmptyFeedMessage(){if(!this.loading)return 0===this.items.length?i("p",{class:"empty-state"},this.emptyStateMessage):void 0}renderFeedItems(){return this.items.map(((e,t)=>[this.renderNewItemsIndicator(e.timestamp,t),this.renderDateHeader(e.timestamp,t),i("limebb-feed-timeline-item",{platform:this.platform,context:this.context,item:e,key:e.id,ui:null==e?void 0:e.ui,isBundled:this.isBundled(e,t)})]))}renderNewItemsIndicator(e,t){if(!this.lastVisitedTimestamp)return;const i=this.items.length,r=new Date(this.lastVisitedTimestamp);return r<new Date(e)?1===i||0===t?this.renderIndicator():r<new Date(this.items[t-1].timestamp)?void 0:this.renderIndicator():void 0}renderIndicator(){return i("div",{class:"new-items-indicator"},i("hr",null),i("h3",null,this.translator.get("webclient.new")))}renderDateHeader(e,t){const r=this.dateTimeFormatter.format(e,"date");return 0===t||this.dateTimeFormatter.format(this.items[t-1].timestamp,"date")!==r?i("a",{class:"date-heading"},r):void 0}renderLoadMore(){if(this.items.length&&!(this.totalCount<=this.items.length))return i("limel-icon-button",{class:"load-more-button",icon:"more",onClick:this.handleLoadMore,elevated:!0,label:this.loadMoreLabel})}get dateTimeFormatter(){return this.platform.get(r.DateTimeFormatter)}get loadMoreLabel(){return this.translator.get("webclient.load-more")}get translator(){return this.platform.get(r.Translate)}};o.style=":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}.new-items-indicator{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:flex-end}.new-items-indicator hr{border:none;position:absolute;width:100%;height:1px;background-color:rgb(var(--color-red-lighter))}.new-items-indicator h3{z-index:1;padding:0 0.5rem;border-radius:1rem;margin:0.5rem 1rem;font-size:small;text-transform:lowercase;color:rgb(var(--color-red-default));background-color:var(--limebb-feed-background-color)}.new-items-indicator+.date-heading{margin-top:-0.5rem}";export{o as limebb_feed}
|
|
@@ -24,6 +24,7 @@ import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } f
|
|
|
24
24
|
* @exampleComponent limebb-example-feed-tall-item
|
|
25
25
|
* @exampleComponent limebb-example-feed-item-types
|
|
26
26
|
* @exampleComponent limebb-example-feed-item-color-coding
|
|
27
|
+
* @exampleComponent limebb-example-feed-new-items
|
|
27
28
|
* @private
|
|
28
29
|
*/
|
|
29
30
|
export declare class Feed implements LimeWebComponent {
|
|
@@ -56,6 +57,15 @@ export declare class Feed implements LimeWebComponent {
|
|
|
56
57
|
* The total number of items available
|
|
57
58
|
*/
|
|
58
59
|
totalCount: number;
|
|
60
|
+
/**
|
|
61
|
+
* The date and time of the last time the user visited the feed.
|
|
62
|
+
* When provided, the feed will display a divider line between the
|
|
63
|
+
* last visited items (the old items which have a date and time earlier than
|
|
64
|
+
* `lastVisitedTimestamp`) and the newer items.
|
|
65
|
+
*
|
|
66
|
+
* If there are no newer items, the divider line will not be displayed.
|
|
67
|
+
*/
|
|
68
|
+
lastVisitedTimestamp?: string | Date | null;
|
|
59
69
|
/**
|
|
60
70
|
* Emitted when the load more button is clicked
|
|
61
71
|
*/
|
|
@@ -64,6 +74,8 @@ export declare class Feed implements LimeWebComponent {
|
|
|
64
74
|
private renderSpinner;
|
|
65
75
|
private renderEmptyFeedMessage;
|
|
66
76
|
private renderFeedItems;
|
|
77
|
+
private renderNewItemsIndicator;
|
|
78
|
+
private renderIndicator;
|
|
67
79
|
private renderDateHeader;
|
|
68
80
|
private isBundled;
|
|
69
81
|
private renderLoadMore;
|
|
@@ -169,6 +169,10 @@ export namespace Components {
|
|
|
169
169
|
* List of items to display in the feed.
|
|
170
170
|
*/
|
|
171
171
|
"items": FeedItem[];
|
|
172
|
+
/**
|
|
173
|
+
* The date and time of the last time the user visited the feed. When provided, the feed will display a divider line between the last visited items (the old items which have a date and time earlier than `lastVisitedTimestamp`) and the newer items. If there are no newer items, the divider line will not be displayed.
|
|
174
|
+
*/
|
|
175
|
+
"lastVisitedTimestamp"?: string | Date | null;
|
|
172
176
|
/**
|
|
173
177
|
* True if items have not finished loading.
|
|
174
178
|
*/
|
|
@@ -603,6 +607,10 @@ declare namespace LocalJSX {
|
|
|
603
607
|
* List of items to display in the feed.
|
|
604
608
|
*/
|
|
605
609
|
"items"?: FeedItem[];
|
|
610
|
+
/**
|
|
611
|
+
* The date and time of the last time the user visited the feed. When provided, the feed will display a divider line between the last visited items (the old items which have a date and time earlier than `lastVisitedTimestamp`) and the newer items. If there are no newer items, the divider line will not be displayed.
|
|
612
|
+
*/
|
|
613
|
+
"lastVisitedTimestamp"?: string | Date | null;
|
|
606
614
|
/**
|
|
607
615
|
* True if items have not finished loading.
|
|
608
616
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-crm-building-blocks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.0",
|
|
4
4
|
"description": "A home for shared components meant for use with Lime CRM",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@limetech/lime-elements": "^37.
|
|
44
|
+
"@limetech/lime-elements": "^37.18.0",
|
|
45
45
|
"@limetech/lime-web-components": "^5.31.0",
|
|
46
46
|
"@lundalogik/lime-icons8": "^2.21.0",
|
|
47
47
|
"@lundalogik/limeclient.js": "^1.64.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-2912b7e7.js";import{P as r}from"./p-11eb7b1e.js";function n(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}const o=class{constructor(i){e(this,i),this.loadMore=t(this,"loadMore",7),this.items=[],this.minutesOfProximity=5,this.totalCount=0,this.isBundled=(e,t)=>{var i,r,o,s,a,l;if(0===t)return!1;if((null===(r=null===(i=this.items[t-1])||void 0===i?void 0:i.author)||void 0===r?void 0:r.id)!==(null===(o=null==e?void 0:e.author)||void 0===o?void 0:o.id))return!1;if((null===(a=null===(s=this.items[t-1])||void 0===s?void 0:s.icon)||void 0===a?void 0:a.name)!==(null===(l=null==e?void 0:e.icon)||void 0===l?void 0:l.name))return!1;const d=new Date(e.timestamp),m=new Date(this.items[t-1].timestamp),c=new Date(m);return function(e,t,i){const r=function(e,t){return+n(e)-+n(t)}(e,t)/6e4;return(o=i?.roundingMethod,e=>{const t=(o?Math[o]:Math.trunc)(e);return 0===t?0:t})(r);var o}(new Date(d),c)<=this.minutesOfProximity},this.handleLoadMore=e=>{e.stopPropagation(),this.loadMore.emit()}}render(){return[this.renderLoadMore(),this.renderEmptyFeedMessage(),this.renderSpinner(),this.renderFeedItems()]}renderSpinner(){if(this.loading)return i("limel-spinner",{size:"small"})}renderEmptyFeedMessage(){if(!this.loading)return 0===this.items.length?i("p",{class:"empty-state"},this.emptyStateMessage):void 0}renderFeedItems(){return this.items.map(((e,t)=>[this.renderDateHeader(e.timestamp,t),i("limebb-feed-timeline-item",{platform:this.platform,context:this.context,item:e,key:e.id,ui:null==e?void 0:e.ui,isBundled:this.isBundled(e,t)})]))}renderDateHeader(e,t){const r=this.dateTimeFormatter.format(e,"date");return 0===t||this.dateTimeFormatter.format(this.items[t-1].timestamp,"date")!==r?i("a",{class:"date-heading"},r):void 0}renderLoadMore(){if(this.items.length&&!(this.totalCount<=this.items.length))return i("limel-icon-button",{class:"load-more-button",icon:"more",onClick:this.handleLoadMore,elevated:!0,label:this.loadMoreLabel})}get dateTimeFormatter(){return this.platform.get(r.DateTimeFormatter)}get loadMoreLabel(){return this.translator.get("webclient.load-more")}get translator(){return this.platform.get(r.Translate)}};o.style=":host(limebb-feed){--limebb-feed-background-color:var(\n --feed-background-color,\n rgb(var(--contrast-100))\n );--limebb-feed-item-background-color:var(--contrast-300);display:flex;flex-direction:column;gap:0.25rem;max-width:45rem;background-color:var(--limebb-feed-background-color)}.empty-state{text-align:center}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-heading{font-weight:600;font-size:0.875rem;margin:1.25rem 0 0.5rem 0;color:rgb(var(--contrast-900))}limebb-feed-timeline-item:has(+limebb-feed-timeline-item[is-bundled]){--limebb-feed-item-action-bar-grid-template-rows:0fr}.load-more-button{margin-top:0.5rem}";export{o as limebb_feed}
|