@leavittsoftware/web 2.26.0 → 2.27.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leavittsoftware/web",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"files": [
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"url": "https://github.com/LeavittSoftware/titanium-elements/issues"
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://github.com/LeavittSoftware/titanium-elements/#readme",
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "f4dc42ba265d1ec213b831834f2a7ae85bf22cba"
|
|
44
44
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Person } from '@leavittsoftware/lg-core-typescript';
|
|
2
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
3
|
+
import '@leavittsoftware/web/leavitt/profile-picture/profile-picture';
|
|
4
|
+
import '@material/web/icon/icon';
|
|
5
|
+
/**
|
|
6
|
+
* A smart profile picture stack component
|
|
7
|
+
*
|
|
8
|
+
* @element titanium-profile-picture-stack
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare class TitaniumProfilePictureStack extends LitElement {
|
|
12
|
+
#private;
|
|
13
|
+
/**
|
|
14
|
+
* Array of people to display in a stack.
|
|
15
|
+
*/
|
|
16
|
+
accessor people: Array<Partial<Person | null | undefined>>;
|
|
17
|
+
/**
|
|
18
|
+
* Number to define the max number of people to display in a stack.
|
|
19
|
+
*/
|
|
20
|
+
accessor max: number;
|
|
21
|
+
/**
|
|
22
|
+
* Enable a link to directory for each person visible in the stack.
|
|
23
|
+
* This will open a new tab to the directory profile of the person.
|
|
24
|
+
* This will only work if the person has an Id.
|
|
25
|
+
*/
|
|
26
|
+
accessor enableDirectoryHref: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Enable auto resizing of the profile picture stack. Setting this will supersede the max property.
|
|
29
|
+
*/
|
|
30
|
+
accessor autoResize: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Size of the profile picture.
|
|
33
|
+
*/
|
|
34
|
+
accessor size: number;
|
|
35
|
+
/**
|
|
36
|
+
* Used internally by the resize observer to keep track of the max number of people to display in a stack.
|
|
37
|
+
* @ignore
|
|
38
|
+
*/
|
|
39
|
+
autoMax: number;
|
|
40
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
41
|
+
static styles: import("lit").CSSResult[];
|
|
42
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=profile-picture-stack.d.ts.map
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
3
|
+
import { property, customElement, state } from 'lit/decorators.js';
|
|
4
|
+
import { isDevelopment } from '../helpers/is-development';
|
|
5
|
+
import { p } from '../styles/p';
|
|
6
|
+
import { ellipsis } from '../styles/ellipsis';
|
|
7
|
+
import '@leavittsoftware/web/leavitt/profile-picture/profile-picture';
|
|
8
|
+
import '@material/web/icon/icon';
|
|
9
|
+
/**
|
|
10
|
+
* A smart profile picture stack component
|
|
11
|
+
*
|
|
12
|
+
* @element titanium-profile-picture-stack
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
let TitaniumProfilePictureStack = class TitaniumProfilePictureStack extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.#max_accessor_storage = 5;
|
|
19
|
+
this.#enableDirectoryHref_accessor_storage = false;
|
|
20
|
+
this.#autoResize_accessor_storage = false;
|
|
21
|
+
this.#size_accessor_storage = 30;
|
|
22
|
+
/**
|
|
23
|
+
* Used internally by the resize observer to keep track of the max number of people to display in a stack.
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
this.autoMax = 0;
|
|
27
|
+
}
|
|
28
|
+
#people_accessor_storage;
|
|
29
|
+
/**
|
|
30
|
+
* Array of people to display in a stack.
|
|
31
|
+
*/
|
|
32
|
+
get people() { return this.#people_accessor_storage; }
|
|
33
|
+
set people(value) { this.#people_accessor_storage = value; }
|
|
34
|
+
#max_accessor_storage;
|
|
35
|
+
/**
|
|
36
|
+
* Number to define the max number of people to display in a stack.
|
|
37
|
+
*/
|
|
38
|
+
get max() { return this.#max_accessor_storage; }
|
|
39
|
+
set max(value) { this.#max_accessor_storage = value; }
|
|
40
|
+
#enableDirectoryHref_accessor_storage;
|
|
41
|
+
/**
|
|
42
|
+
* Enable a link to directory for each person visible in the stack.
|
|
43
|
+
* This will open a new tab to the directory profile of the person.
|
|
44
|
+
* This will only work if the person has an Id.
|
|
45
|
+
*/
|
|
46
|
+
get enableDirectoryHref() { return this.#enableDirectoryHref_accessor_storage; }
|
|
47
|
+
set enableDirectoryHref(value) { this.#enableDirectoryHref_accessor_storage = value; }
|
|
48
|
+
#autoResize_accessor_storage;
|
|
49
|
+
/**
|
|
50
|
+
* Enable auto resizing of the profile picture stack. Setting this will supersede the max property.
|
|
51
|
+
*/
|
|
52
|
+
get autoResize() { return this.#autoResize_accessor_storage; }
|
|
53
|
+
set autoResize(value) { this.#autoResize_accessor_storage = value; }
|
|
54
|
+
#size_accessor_storage;
|
|
55
|
+
/**
|
|
56
|
+
* Size of the profile picture.
|
|
57
|
+
*/
|
|
58
|
+
get size() { return this.#size_accessor_storage; }
|
|
59
|
+
set size(value) { this.#size_accessor_storage = value; }
|
|
60
|
+
#resizeObserver;
|
|
61
|
+
updated(changedProperties) {
|
|
62
|
+
if (changedProperties.has('autoResize')) {
|
|
63
|
+
if (this.autoResize) {
|
|
64
|
+
this.#setUpResizeObserver();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.#resizeObserver?.disconnect?.();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
#setUpResizeObserver() {
|
|
72
|
+
this.#resizeObserver = new ResizeObserver((entries) => {
|
|
73
|
+
for (const entry of entries) {
|
|
74
|
+
if (entry.contentBoxSize) {
|
|
75
|
+
const inlineSize = entry.contentBoxSize[0].inlineSize;
|
|
76
|
+
this.autoMax = Math.floor(inlineSize / this.size);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
this.#resizeObserver.observe(this);
|
|
81
|
+
}
|
|
82
|
+
static { this.styles = [
|
|
83
|
+
p,
|
|
84
|
+
ellipsis,
|
|
85
|
+
css `
|
|
86
|
+
:host {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: row;
|
|
89
|
+
position: relative;
|
|
90
|
+
align-self: start;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
profile-picture {
|
|
94
|
+
transition: all 0.2s ease-in-out;
|
|
95
|
+
transform-origin: bottom;
|
|
96
|
+
background-color: var(--titanium-profile-picture-stack-bg-color, var(--md-sys-color-surface));
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
border: 2px solid transparent;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
profile-picture:not(:first-child) {
|
|
102
|
+
margin-left: -10px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
profile-picture:hover {
|
|
106
|
+
transform: scale(var(--titanium-profile-picture-stack-transform-scale, 1.3));
|
|
107
|
+
position: relative;
|
|
108
|
+
z-index: 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
md-icon {
|
|
112
|
+
font-size: 12px;
|
|
113
|
+
height: 7px;
|
|
114
|
+
margin-top: 25px;
|
|
115
|
+
margin-left: -4px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
p {
|
|
119
|
+
align-self: center;
|
|
120
|
+
margin-left: 10px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:host([enable-directory-href]) profile-picture {
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
}
|
|
126
|
+
`,
|
|
127
|
+
]; }
|
|
128
|
+
render() {
|
|
129
|
+
const max = this.autoResize ? this.autoMax : this.max;
|
|
130
|
+
return html `
|
|
131
|
+
${this.people?.slice(0, max)?.map((o) => html `
|
|
132
|
+
<profile-picture
|
|
133
|
+
@click=${() => {
|
|
134
|
+
if (this.enableDirectoryHref && o?.Id) {
|
|
135
|
+
window.open(`https://${isDevelopment ? 'dev' : ''}directory.leavitt.com/profile/${o?.Id}`, '_blank');
|
|
136
|
+
}
|
|
137
|
+
}}
|
|
138
|
+
title=${o?.FullName ?? ''}
|
|
139
|
+
size=${this.size}
|
|
140
|
+
.fileName=${o?.ProfilePictureCdnFileName ?? null}
|
|
141
|
+
part="profile-picture"
|
|
142
|
+
></profile-picture>
|
|
143
|
+
${this.people?.length === 1 ? html `<p part="name" ellipsis>${o?.FullName ?? ''}</p>` : nothing}
|
|
144
|
+
`)}
|
|
145
|
+
${this.people?.length > max ? html `<md-icon part="more-icon" title="Shared with ${this.people.length} total users">more_horiz</md-icon>` : nothing}
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
__decorate([
|
|
150
|
+
property({ type: Array })
|
|
151
|
+
], TitaniumProfilePictureStack.prototype, "people", null);
|
|
152
|
+
__decorate([
|
|
153
|
+
property({ type: Number })
|
|
154
|
+
], TitaniumProfilePictureStack.prototype, "max", null);
|
|
155
|
+
__decorate([
|
|
156
|
+
property({ type: Boolean, attribute: 'enable-directory-href' })
|
|
157
|
+
], TitaniumProfilePictureStack.prototype, "enableDirectoryHref", null);
|
|
158
|
+
__decorate([
|
|
159
|
+
property({ type: Boolean, attribute: 'auto-resize' })
|
|
160
|
+
], TitaniumProfilePictureStack.prototype, "autoResize", null);
|
|
161
|
+
__decorate([
|
|
162
|
+
property({ type: Number })
|
|
163
|
+
], TitaniumProfilePictureStack.prototype, "size", null);
|
|
164
|
+
__decorate([
|
|
165
|
+
state()
|
|
166
|
+
], TitaniumProfilePictureStack.prototype, "autoMax", void 0);
|
|
167
|
+
TitaniumProfilePictureStack = __decorate([
|
|
168
|
+
customElement('titanium-profile-picture-stack')
|
|
169
|
+
], TitaniumProfilePictureStack);
|
|
170
|
+
export { TitaniumProfilePictureStack };
|
|
171
|
+
//# sourceMappingURL=profile-picture-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-picture-stack.js","sourceRoot":"","sources":["profile-picture-stack.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,8DAA8D,CAAC;AACtE,OAAO,yBAAyB,CAAC;AAEjC;;;;;GAKG;AAGI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,UAAU;IAApD;;QASgC,6BAAc,CAAC,CAAC;QAOqB,6CAA+B,KAAK,CAAC;QAK/C,oCAAsB,KAAK,CAAC;QAKvD,8BAAe,EAAE,CAAC;QAEvD;;;WAGG;QACM,YAAO,GAAW,CAAC,CAAC;IAgG/B,CAAC;IA5HqC,yBAAkD;IAHtF;;OAEG;IACiC,IAAA,MAAM,4CAA4C;IAAlD,IAAA,MAAM,kDAA4C;IAKjD,sBAAgB;IAHrD;;OAEG;IACkC,IAAA,GAAG,yCAAa;IAAhB,IAAA,GAAG,+CAAa;IAOqB,sCAAqC;IAL/G;;;;OAIG;IACuE,IAAA,mBAAmB,yDAAkB;IAArC,IAAA,mBAAmB,+DAAkB;IAK/C,6BAA4B;IAH5F;;OAEG;IA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