@skyux/avatar 5.9.4 → 6.0.0-beta.10
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/esm2020/index.mjs +7 -0
- package/esm2020/lib/modules/avatar/avatar-adapter.service.mjs +51 -0
- package/esm2020/lib/modules/avatar/avatar-size.mjs +2 -0
- package/esm2020/lib/modules/avatar/avatar-src.mjs +2 -0
- package/esm2020/lib/modules/avatar/avatar.component.mjs +125 -0
- package/esm2020/lib/modules/avatar/avatar.inner.component.mjs +82 -0
- package/esm2020/lib/modules/avatar/avatar.module.mjs +44 -0
- package/esm2020/lib/modules/shared/sky-avatar-resources.module.mjs +62 -0
- package/esm2020/skyux-avatar.mjs +5 -0
- package/esm2020/testing/avatar-fixture.mjs +31 -0
- package/esm2020/testing/public-api.mjs +2 -0
- package/esm2020/testing/skyux-avatar-testing.mjs +5 -0
- package/fesm2015/{skyux-avatar-testing.js → skyux-avatar-testing.mjs} +1 -1
- package/fesm2015/skyux-avatar-testing.mjs.map +1 -0
- package/fesm2015/skyux-avatar.mjs +351 -0
- package/fesm2015/skyux-avatar.mjs.map +1 -0
- package/{esm2015/testing/avatar-fixture.js → fesm2020/skyux-avatar-testing.mjs} +9 -2
- package/fesm2020/skyux-avatar-testing.mjs.map +1 -0
- package/fesm2020/skyux-avatar.mjs +351 -0
- package/fesm2020/skyux-avatar.mjs.map +1 -0
- package/package.json +38 -14
- package/testing/package.json +5 -5
- package/bundles/skyux-avatar-testing.umd.js +0 -54
- package/bundles/skyux-avatar.umd.js +0 -750
- package/esm2015/index.js +0 -7
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/modules/avatar/avatar-adapter.service.js +0 -51
- package/esm2015/lib/modules/avatar/avatar-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/avatar/avatar-size.js +0 -2
- package/esm2015/lib/modules/avatar/avatar-size.js.map +0 -1
- package/esm2015/lib/modules/avatar/avatar-src.js +0 -2
- package/esm2015/lib/modules/avatar/avatar-src.js.map +0 -1
- package/esm2015/lib/modules/avatar/avatar.component.js +0 -130
- package/esm2015/lib/modules/avatar/avatar.component.js.map +0 -1
- package/esm2015/lib/modules/avatar/avatar.inner.component.js +0 -88
- package/esm2015/lib/modules/avatar/avatar.inner.component.js.map +0 -1
- package/esm2015/lib/modules/avatar/avatar.module.js +0 -44
- package/esm2015/lib/modules/avatar/avatar.module.js.map +0 -1
- package/esm2015/lib/modules/shared/sky-avatar-resources.module.js +0 -62
- package/esm2015/lib/modules/shared/sky-avatar-resources.module.js.map +0 -1
- package/esm2015/skyux-avatar.js +0 -5
- package/esm2015/skyux-avatar.js.map +0 -1
- package/esm2015/testing/avatar-fixture.js.map +0 -1
- package/esm2015/testing/public-api.js +0 -2
- package/esm2015/testing/public-api.js.map +0 -1
- package/esm2015/testing/skyux-avatar-testing.js +0 -5
- package/esm2015/testing/skyux-avatar-testing.js.map +0 -1
- package/fesm2015/skyux-avatar-testing.js.map +0 -1
- package/fesm2015/skyux-avatar.js +0 -362
- package/fesm2015/skyux-avatar.js.map +0 -1
|
@@ -1,750 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@skyux/errors'), require('@skyux/forms'), require('@skyux/i18n'), require('@skyux/theme')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@skyux/avatar', ['exports', '@angular/common', '@angular/core', '@skyux/errors', '@skyux/forms', '@skyux/i18n', '@skyux/theme'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.avatar = {}), global.ng.common, global.ng.core, global.i1, global.i2$1, global.i3, global.i3$1));
|
|
5
|
-
})(this, (function (exports, i2, i0, i1, i2$1, i3, i3$1) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return e[k]; }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
n["default"] = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
26
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
27
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
28
|
-
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
|
|
29
|
-
var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3);
|
|
30
|
-
var i3__namespace = /*#__PURE__*/_interopNamespace(i3$1);
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
34
|
-
* The contents of this file were automatically generated by
|
|
35
|
-
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-avatar' schematic.
|
|
36
|
-
* To update this file, simply rerun the command.
|
|
37
|
-
*/
|
|
38
|
-
var RESOURCES = {
|
|
39
|
-
'EN-US': {
|
|
40
|
-
skyux_avatar_error_not_image_description: {
|
|
41
|
-
message: 'Please choose a file that is a valid image.',
|
|
42
|
-
},
|
|
43
|
-
skyux_avatar_error_not_image_title: { message: 'File is not an image.' },
|
|
44
|
-
skyux_avatar_error_too_large_description: {
|
|
45
|
-
message: 'Please choose an image that is less than {0}.',
|
|
46
|
-
},
|
|
47
|
-
skyux_avatar_error_too_large_title: { message: 'File is too large.' },
|
|
48
|
-
skyux_avatar_errormodal_ok: { message: 'OK' },
|
|
49
|
-
skyux_avatar_inner_description: { message: 'Profile picture of {0}' },
|
|
50
|
-
skyux_avatar_upload_change_aria_label: {
|
|
51
|
-
message: 'Change profile photo of {0}. Drag a file here or click to browse.',
|
|
52
|
-
},
|
|
53
|
-
skyux_avatar_upload_new_aria_label: {
|
|
54
|
-
message: 'Add profile photo of {0}. Drag a file here or click to browse.',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
var SkyAvatarResourcesProvider = /** @class */ (function () {
|
|
59
|
-
function SkyAvatarResourcesProvider() {
|
|
60
|
-
}
|
|
61
|
-
SkyAvatarResourcesProvider.prototype.getString = function (localeInfo, name) {
|
|
62
|
-
return i3.getLibStringForLocale(RESOURCES, localeInfo.locale, name);
|
|
63
|
-
};
|
|
64
|
-
return SkyAvatarResourcesProvider;
|
|
65
|
-
}());
|
|
66
|
-
/**
|
|
67
|
-
* Import into any component library module that needs to use resource strings.
|
|
68
|
-
*/
|
|
69
|
-
var SkyAvatarResourcesModule = /** @class */ (function () {
|
|
70
|
-
function SkyAvatarResourcesModule() {
|
|
71
|
-
}
|
|
72
|
-
return SkyAvatarResourcesModule;
|
|
73
|
-
}());
|
|
74
|
-
SkyAvatarResourcesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarResourcesModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
75
|
-
SkyAvatarResourcesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarResourcesModule, exports: [i3.SkyI18nModule] });
|
|
76
|
-
SkyAvatarResourcesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarResourcesModule, providers: [
|
|
77
|
-
{
|
|
78
|
-
provide: i3.SKY_LIB_RESOURCES_PROVIDERS,
|
|
79
|
-
useClass: SkyAvatarResourcesProvider,
|
|
80
|
-
multi: true,
|
|
81
|
-
},
|
|
82
|
-
], imports: [i3.SkyI18nModule] });
|
|
83
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarResourcesModule, decorators: [{
|
|
84
|
-
type: i0.NgModule,
|
|
85
|
-
args: [{
|
|
86
|
-
exports: [i3.SkyI18nModule],
|
|
87
|
-
providers: [
|
|
88
|
-
{
|
|
89
|
-
provide: i3.SKY_LIB_RESOURCES_PROVIDERS,
|
|
90
|
-
useClass: SkyAvatarResourcesProvider,
|
|
91
|
-
multi: true,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
}]
|
|
95
|
-
}] });
|
|
96
|
-
|
|
97
|
-
/*! *****************************************************************************
|
|
98
|
-
Copyright (c) Microsoft Corporation.
|
|
99
|
-
|
|
100
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
101
|
-
purpose with or without fee is hereby granted.
|
|
102
|
-
|
|
103
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
104
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
105
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
106
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
107
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
108
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
109
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
110
|
-
***************************************************************************** */
|
|
111
|
-
/* global Reflect, Promise */
|
|
112
|
-
var extendStatics = function (d, b) {
|
|
113
|
-
extendStatics = Object.setPrototypeOf ||
|
|
114
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
115
|
-
function (d, b) { for (var p in b)
|
|
116
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
117
|
-
d[p] = b[p]; };
|
|
118
|
-
return extendStatics(d, b);
|
|
119
|
-
};
|
|
120
|
-
function __extends(d, b) {
|
|
121
|
-
if (typeof b !== "function" && b !== null)
|
|
122
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
123
|
-
extendStatics(d, b);
|
|
124
|
-
function __() { this.constructor = d; }
|
|
125
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
126
|
-
}
|
|
127
|
-
var __assign = function () {
|
|
128
|
-
__assign = Object.assign || function __assign(t) {
|
|
129
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
130
|
-
s = arguments[i];
|
|
131
|
-
for (var p in s)
|
|
132
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
133
|
-
t[p] = s[p];
|
|
134
|
-
}
|
|
135
|
-
return t;
|
|
136
|
-
};
|
|
137
|
-
return __assign.apply(this, arguments);
|
|
138
|
-
};
|
|
139
|
-
function __rest(s, e) {
|
|
140
|
-
var t = {};
|
|
141
|
-
for (var p in s)
|
|
142
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
143
|
-
t[p] = s[p];
|
|
144
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
145
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
146
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
147
|
-
t[p[i]] = s[p[i]];
|
|
148
|
-
}
|
|
149
|
-
return t;
|
|
150
|
-
}
|
|
151
|
-
function __decorate(decorators, target, key, desc) {
|
|
152
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
153
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
154
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
155
|
-
else
|
|
156
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
157
|
-
if (d = decorators[i])
|
|
158
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
159
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
160
|
-
}
|
|
161
|
-
function __param(paramIndex, decorator) {
|
|
162
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
163
|
-
}
|
|
164
|
-
function __metadata(metadataKey, metadataValue) {
|
|
165
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
166
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
167
|
-
}
|
|
168
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
169
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
170
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
171
|
-
function fulfilled(value) { try {
|
|
172
|
-
step(generator.next(value));
|
|
173
|
-
}
|
|
174
|
-
catch (e) {
|
|
175
|
-
reject(e);
|
|
176
|
-
} }
|
|
177
|
-
function rejected(value) { try {
|
|
178
|
-
step(generator["throw"](value));
|
|
179
|
-
}
|
|
180
|
-
catch (e) {
|
|
181
|
-
reject(e);
|
|
182
|
-
} }
|
|
183
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
184
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function __generator(thisArg, body) {
|
|
188
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
189
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
190
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
191
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
192
|
-
function step(op) {
|
|
193
|
-
if (f)
|
|
194
|
-
throw new TypeError("Generator is already executing.");
|
|
195
|
-
while (_)
|
|
196
|
-
try {
|
|
197
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
198
|
-
return t;
|
|
199
|
-
if (y = 0, t)
|
|
200
|
-
op = [op[0] & 2, t.value];
|
|
201
|
-
switch (op[0]) {
|
|
202
|
-
case 0:
|
|
203
|
-
case 1:
|
|
204
|
-
t = op;
|
|
205
|
-
break;
|
|
206
|
-
case 4:
|
|
207
|
-
_.label++;
|
|
208
|
-
return { value: op[1], done: false };
|
|
209
|
-
case 5:
|
|
210
|
-
_.label++;
|
|
211
|
-
y = op[1];
|
|
212
|
-
op = [0];
|
|
213
|
-
continue;
|
|
214
|
-
case 7:
|
|
215
|
-
op = _.ops.pop();
|
|
216
|
-
_.trys.pop();
|
|
217
|
-
continue;
|
|
218
|
-
default:
|
|
219
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
220
|
-
_ = 0;
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
224
|
-
_.label = op[1];
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
228
|
-
_.label = t[1];
|
|
229
|
-
t = op;
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
if (t && _.label < t[2]) {
|
|
233
|
-
_.label = t[2];
|
|
234
|
-
_.ops.push(op);
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
if (t[2])
|
|
238
|
-
_.ops.pop();
|
|
239
|
-
_.trys.pop();
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
op = body.call(thisArg, _);
|
|
243
|
-
}
|
|
244
|
-
catch (e) {
|
|
245
|
-
op = [6, e];
|
|
246
|
-
y = 0;
|
|
247
|
-
}
|
|
248
|
-
finally {
|
|
249
|
-
f = t = 0;
|
|
250
|
-
}
|
|
251
|
-
if (op[0] & 5)
|
|
252
|
-
throw op[1];
|
|
253
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
257
|
-
if (k2 === undefined)
|
|
258
|
-
k2 = k;
|
|
259
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
260
|
-
}) : (function (o, m, k, k2) {
|
|
261
|
-
if (k2 === undefined)
|
|
262
|
-
k2 = k;
|
|
263
|
-
o[k2] = m[k];
|
|
264
|
-
});
|
|
265
|
-
function __exportStar(m, o) {
|
|
266
|
-
for (var p in m)
|
|
267
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
268
|
-
__createBinding(o, m, p);
|
|
269
|
-
}
|
|
270
|
-
function __values(o) {
|
|
271
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
272
|
-
if (m)
|
|
273
|
-
return m.call(o);
|
|
274
|
-
if (o && typeof o.length === "number")
|
|
275
|
-
return {
|
|
276
|
-
next: function () {
|
|
277
|
-
if (o && i >= o.length)
|
|
278
|
-
o = void 0;
|
|
279
|
-
return { value: o && o[i++], done: !o };
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
283
|
-
}
|
|
284
|
-
function __read(o, n) {
|
|
285
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
286
|
-
if (!m)
|
|
287
|
-
return o;
|
|
288
|
-
var i = m.call(o), r, ar = [], e;
|
|
289
|
-
try {
|
|
290
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
291
|
-
ar.push(r.value);
|
|
292
|
-
}
|
|
293
|
-
catch (error) {
|
|
294
|
-
e = { error: error };
|
|
295
|
-
}
|
|
296
|
-
finally {
|
|
297
|
-
try {
|
|
298
|
-
if (r && !r.done && (m = i["return"]))
|
|
299
|
-
m.call(i);
|
|
300
|
-
}
|
|
301
|
-
finally {
|
|
302
|
-
if (e)
|
|
303
|
-
throw e.error;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return ar;
|
|
307
|
-
}
|
|
308
|
-
/** @deprecated */
|
|
309
|
-
function __spread() {
|
|
310
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
311
|
-
ar = ar.concat(__read(arguments[i]));
|
|
312
|
-
return ar;
|
|
313
|
-
}
|
|
314
|
-
/** @deprecated */
|
|
315
|
-
function __spreadArrays() {
|
|
316
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
317
|
-
s += arguments[i].length;
|
|
318
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
319
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
320
|
-
r[k] = a[j];
|
|
321
|
-
return r;
|
|
322
|
-
}
|
|
323
|
-
function __spreadArray(to, from, pack) {
|
|
324
|
-
if (pack || arguments.length === 2)
|
|
325
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
326
|
-
if (ar || !(i in from)) {
|
|
327
|
-
if (!ar)
|
|
328
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
329
|
-
ar[i] = from[i];
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
333
|
-
}
|
|
334
|
-
function __await(v) {
|
|
335
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
336
|
-
}
|
|
337
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
338
|
-
if (!Symbol.asyncIterator)
|
|
339
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
340
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
341
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
342
|
-
function verb(n) { if (g[n])
|
|
343
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
344
|
-
function resume(n, v) { try {
|
|
345
|
-
step(g[n](v));
|
|
346
|
-
}
|
|
347
|
-
catch (e) {
|
|
348
|
-
settle(q[0][3], e);
|
|
349
|
-
} }
|
|
350
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
351
|
-
function fulfill(value) { resume("next", value); }
|
|
352
|
-
function reject(value) { resume("throw", value); }
|
|
353
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
354
|
-
resume(q[0][0], q[0][1]); }
|
|
355
|
-
}
|
|
356
|
-
function __asyncDelegator(o) {
|
|
357
|
-
var i, p;
|
|
358
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
359
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
360
|
-
}
|
|
361
|
-
function __asyncValues(o) {
|
|
362
|
-
if (!Symbol.asyncIterator)
|
|
363
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
364
|
-
var m = o[Symbol.asyncIterator], i;
|
|
365
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
366
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
367
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
368
|
-
}
|
|
369
|
-
function __makeTemplateObject(cooked, raw) {
|
|
370
|
-
if (Object.defineProperty) {
|
|
371
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
cooked.raw = raw;
|
|
375
|
-
}
|
|
376
|
-
return cooked;
|
|
377
|
-
}
|
|
378
|
-
;
|
|
379
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
380
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
381
|
-
}) : function (o, v) {
|
|
382
|
-
o["default"] = v;
|
|
383
|
-
};
|
|
384
|
-
function __importStar(mod) {
|
|
385
|
-
if (mod && mod.__esModule)
|
|
386
|
-
return mod;
|
|
387
|
-
var result = {};
|
|
388
|
-
if (mod != null)
|
|
389
|
-
for (var k in mod)
|
|
390
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
391
|
-
__createBinding(result, mod, k);
|
|
392
|
-
__setModuleDefault(result, mod);
|
|
393
|
-
return result;
|
|
394
|
-
}
|
|
395
|
-
function __importDefault(mod) {
|
|
396
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
397
|
-
}
|
|
398
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
399
|
-
if (kind === "a" && !f)
|
|
400
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
401
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
402
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
403
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
404
|
-
}
|
|
405
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
406
|
-
if (kind === "m")
|
|
407
|
-
throw new TypeError("Private method is not writable");
|
|
408
|
-
if (kind === "a" && !f)
|
|
409
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
410
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
411
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
412
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* @internal
|
|
417
|
-
*/
|
|
418
|
-
var SkyAvatarAdapterService = /** @class */ (function () {
|
|
419
|
-
function SkyAvatarAdapterService() {
|
|
420
|
-
}
|
|
421
|
-
SkyAvatarAdapterService.prototype.updateImage = function (elementRef, src) {
|
|
422
|
-
this.revokeBlobUrl();
|
|
423
|
-
var el = elementRef.nativeElement;
|
|
424
|
-
/*istanbul ignore else */
|
|
425
|
-
if (el) {
|
|
426
|
-
var imageEl = el.querySelector('.sky-avatar-image');
|
|
427
|
-
/*istanbul ignore else */
|
|
428
|
-
if (imageEl) {
|
|
429
|
-
var url = void 0;
|
|
430
|
-
if (src) {
|
|
431
|
-
if (src instanceof File || src instanceof Blob) {
|
|
432
|
-
url = this.createBlobUrl(src);
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
url = src;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
// Notice the quotes inside the `url` function. This ensures proper url escaping.
|
|
439
|
-
imageEl.style.backgroundImage = url ? 'url("' + url + '")' : '';
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
SkyAvatarAdapterService.prototype.destroy = function () {
|
|
444
|
-
this.revokeBlobUrl();
|
|
445
|
-
};
|
|
446
|
-
SkyAvatarAdapterService.prototype.createBlobUrl = function (src) {
|
|
447
|
-
var url = URL.createObjectURL(src);
|
|
448
|
-
// Keep the last blob URL around so we can revoke it later.
|
|
449
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
|
|
450
|
-
this.blobUrl = url;
|
|
451
|
-
return url;
|
|
452
|
-
};
|
|
453
|
-
SkyAvatarAdapterService.prototype.revokeBlobUrl = function () {
|
|
454
|
-
if (this.blobUrl) {
|
|
455
|
-
URL.revokeObjectURL(this.blobUrl);
|
|
456
|
-
this.blobUrl = undefined;
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
return SkyAvatarAdapterService;
|
|
460
|
-
}());
|
|
461
|
-
SkyAvatarAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarAdapterService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
462
|
-
SkyAvatarAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarAdapterService });
|
|
463
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarAdapterService, decorators: [{
|
|
464
|
-
type: i0.Injectable
|
|
465
|
-
}] });
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* @internal
|
|
469
|
-
*/
|
|
470
|
-
var SkyAvatarInnerComponent = /** @class */ (function () {
|
|
471
|
-
function SkyAvatarInnerComponent(elementRef, adapter) {
|
|
472
|
-
this.elementRef = elementRef;
|
|
473
|
-
this.adapter = adapter;
|
|
474
|
-
}
|
|
475
|
-
Object.defineProperty(SkyAvatarInnerComponent.prototype, "src", {
|
|
476
|
-
get: function () {
|
|
477
|
-
return this._src;
|
|
478
|
-
},
|
|
479
|
-
set: function (value) {
|
|
480
|
-
this._src = value;
|
|
481
|
-
this.updateImage();
|
|
482
|
-
},
|
|
483
|
-
enumerable: false,
|
|
484
|
-
configurable: true
|
|
485
|
-
});
|
|
486
|
-
Object.defineProperty(SkyAvatarInnerComponent.prototype, "name", {
|
|
487
|
-
get: function () {
|
|
488
|
-
return this._name;
|
|
489
|
-
},
|
|
490
|
-
set: function (value) {
|
|
491
|
-
this._name = value;
|
|
492
|
-
},
|
|
493
|
-
enumerable: false,
|
|
494
|
-
configurable: true
|
|
495
|
-
});
|
|
496
|
-
Object.defineProperty(SkyAvatarInnerComponent.prototype, "initials", {
|
|
497
|
-
get: function () {
|
|
498
|
-
var initials;
|
|
499
|
-
if (this.name) {
|
|
500
|
-
var nameSplit = this.name.split(' ');
|
|
501
|
-
initials = getInitial(nameSplit[0]);
|
|
502
|
-
if (nameSplit.length > 1) {
|
|
503
|
-
initials += getInitial(nameSplit[nameSplit.length - 1]);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return initials;
|
|
507
|
-
},
|
|
508
|
-
enumerable: false,
|
|
509
|
-
configurable: true
|
|
510
|
-
});
|
|
511
|
-
Object.defineProperty(SkyAvatarInnerComponent.prototype, "colorIndex", {
|
|
512
|
-
get: function () {
|
|
513
|
-
var name = this.name;
|
|
514
|
-
var colorIndex;
|
|
515
|
-
if (name) {
|
|
516
|
-
// Generate a unique-ish color based on the record name. This is deterministic
|
|
517
|
-
// so that a given name will always generate the same color.
|
|
518
|
-
var seed = name.charCodeAt(0) + name.charCodeAt(name.length - 1) + name.length;
|
|
519
|
-
colorIndex = Math.abs(seed % 6);
|
|
520
|
-
}
|
|
521
|
-
else {
|
|
522
|
-
colorIndex = 0;
|
|
523
|
-
}
|
|
524
|
-
return colorIndex;
|
|
525
|
-
},
|
|
526
|
-
enumerable: false,
|
|
527
|
-
configurable: true
|
|
528
|
-
});
|
|
529
|
-
SkyAvatarInnerComponent.prototype.ngAfterViewInit = function () {
|
|
530
|
-
this.viewInitialized = true;
|
|
531
|
-
this.updateImage();
|
|
532
|
-
};
|
|
533
|
-
SkyAvatarInnerComponent.prototype.ngOnDestroy = function () {
|
|
534
|
-
this.adapter.destroy();
|
|
535
|
-
};
|
|
536
|
-
SkyAvatarInnerComponent.prototype.updateImage = function () {
|
|
537
|
-
if (this.viewInitialized) {
|
|
538
|
-
this.adapter.updateImage(this.elementRef, this.src);
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
return SkyAvatarInnerComponent;
|
|
542
|
-
}());
|
|
543
|
-
SkyAvatarInnerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarInnerComponent, deps: [{ token: i0__namespace.ElementRef }, { token: SkyAvatarAdapterService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
544
|
-
SkyAvatarInnerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyAvatarInnerComponent, selector: "sky-avatar-inner", inputs: { src: "src", name: "name", size: "size" }, providers: [SkyAvatarAdapterService], ngImport: i0__namespace, template: "<div\n class=\"sky-elevation-1 sky-avatar-wrapper\"\n [ngClass]=\"'sky-avatar-wrapper-size-' + (size || 'large')\"\n>\n <div class=\"sky-avatar-image\" [hidden]=\"!src\"></div>\n <div *ngIf=\"src\" class=\"sky-screen-reader-only\">\n {{ 'skyux_avatar_inner_description' | skyLibResources: name }}\n </div>\n <div\n class=\"sky-avatar-initials\"\n [hidden]=\"src || !name\"\n [ngClass]=\"'sky-palette-multi-' + (colorIndex + 1)\"\n >\n <div\n *ngIf=\"size === 'small'\"\n class=\"sky-avatar-initials-inner\"\n [skyThemeClass]=\"{\n 'sky-font-body-sm': 'modern'\n }\"\n >\n {{ initials }}\n </div>\n <div\n *ngIf=\"size === 'medium'\"\n class=\"sky-avatar-initials-inner\"\n [skyThemeClass]=\"{\n 'sky-font-display-3': 'modern'\n }\"\n >\n {{ initials }}\n </div>\n <div\n *ngIf=\"size !== 'small' && size !== 'medium'\"\n class=\"sky-avatar-initials-inner\"\n [skyThemeClass]=\"{\n 'sky-font-display-2': 'modern'\n }\"\n >\n {{ initials }}\n </div>\n </div>\n</div>\n", styles: [".sky-avatar-wrapper{height:104px;width:104px;border:solid 2px transparent;border-radius:50%;overflow:hidden;position:relative;top:-2px;left:-2px}.sky-avatar-image,.sky-avatar-initials{height:100px;width:100px;background-position:50%;background-size:cover;display:flex;align-items:center;justify-content:center}.sky-avatar-initials{font-size:50px}.sky-avatar-initials-inner{color:#fff;cursor:default;-webkit-user-select:none;user-select:none}.sky-avatar-wrapper-size-medium{height:69px;width:69px}.sky-avatar-wrapper-size-medium .sky-avatar-image,.sky-avatar-wrapper-size-medium .sky-avatar-initials{height:65px;width:65px}.sky-avatar-wrapper-size-medium .sky-avatar-initials{font-size:32.5px}.sky-avatar-wrapper-size-small{height:36px;width:36px}.sky-avatar-wrapper-size-small .sky-avatar-image,.sky-avatar-wrapper-size-small .sky-avatar-initials{height:32px;width:32px}.sky-avatar-wrapper-size-small .sky-avatar-initials{font-size:16px}.sky-file-drop .sky-avatar-wrapper{cursor:pointer}.sky-file-drop-accept .sky-avatar-wrapper{border-color:#72bf44;border-style:dashed}.sky-file-drop-reject .sky-avatar-wrapper{border-color:#ef4044;border-style:dashed}.sky-theme-modern .sky-avatar-wrapper{height:100px;width:100px;background-color:#fff;border-width:0;padding:5px;top:0;left:0}.sky-theme-modern .sky-avatar-image,.sky-theme-modern .sky-avatar-initials{border-radius:50%;height:90px;width:90px}.sky-theme-modern .sky-avatar-initials-inner{color:#212327}.sky-theme-modern .sky-file-drop-accept .sky-avatar-wrapper,.sky-theme-modern .sky-file-drop-reject .sky-avatar-wrapper{border-width:2px;padding:3px}.sky-theme-modern .sky-file-drop-accept .sky-avatar-wrapper-size-medium,.sky-theme-modern .sky-file-drop-reject .sky-avatar-wrapper-size-medium{padding:1px}.sky-theme-modern .sky-file-drop-accept .sky-avatar-wrapper-size-small,.sky-theme-modern .sky-file-drop-reject .sky-avatar-wrapper-size-small{padding:0}.sky-theme-modern .sky-avatar-wrapper-size-medium{padding:3px;height:65px;width:65px}.sky-theme-modern .sky-avatar-wrapper-size-medium .sky-avatar-image,.sky-theme-modern .sky-avatar-wrapper-size-medium .sky-avatar-initials{height:59px;width:59px}.sky-theme-modern .sky-avatar-wrapper-size-small{padding:2px;height:32px;width:32px}.sky-theme-modern .sky-avatar-wrapper-size-small .sky-avatar-image,.sky-theme-modern .sky-avatar-wrapper-size-small .sky-avatar-initials{height:28px;width:28px}.sky-theme-modern sky-file-drop:hover .sky-avatar-wrapper{border:solid 1px #1870B8;padding:4px}.sky-theme-modern sky-file-drop:hover .sky-avatar-wrapper.sky-avatar-wrapper-size-medium{padding:2px}.sky-theme-modern sky-file-drop:hover .sky-avatar-wrapper.sky-avatar-wrapper-size-small{padding:1px}.sky-theme-modern sky-file-drop:active .sky-avatar-wrapper,.sky-theme-modern sky-file-drop:focus-within .sky-avatar-wrapper{border:solid 2px #1870B8;padding:3px}.sky-theme-modern sky-file-drop:active .sky-avatar-wrapper.sky-avatar-wrapper-size-medium,.sky-theme-modern sky-file-drop:focus-within .sky-avatar-wrapper.sky-avatar-wrapper-size-medium{padding:1px}.sky-theme-modern sky-file-drop:active .sky-avatar-wrapper.sky-avatar-wrapper-size-small,.sky-theme-modern sky-file-drop:focus-within .sky-avatar-wrapper.sky-avatar-wrapper-size-small{padding:0}.sky-theme-modern sky-file-drop:focus-within:not(:active) .sky-avatar-wrapper{box-shadow:0 1px 8px #0000004d}.sky-theme-modern.sky-theme-mode-dark .sky-avatar-wrapper{background-color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-avatar-initials-inner{color:#212327}\n"], directives: [{ type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }], pipes: { "skyLibResources": i3__namespace$1.SkyLibResourcesPipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
|
|
545
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarInnerComponent, decorators: [{
|
|
546
|
-
type: i0.Component,
|
|
547
|
-
args: [{
|
|
548
|
-
selector: 'sky-avatar-inner',
|
|
549
|
-
template: "<div\n class=\"sky-elevation-1 sky-avatar-wrapper\"\n [ngClass]=\"'sky-avatar-wrapper-size-' + (size || 'large')\"\n>\n <div class=\"sky-avatar-image\" [hidden]=\"!src\"></div>\n <div *ngIf=\"src\" class=\"sky-screen-reader-only\">\n {{ 'skyux_avatar_inner_description' | skyLibResources: name }}\n </div>\n <div\n class=\"sky-avatar-initials\"\n [hidden]=\"src || !name\"\n [ngClass]=\"'sky-palette-multi-' + (colorIndex + 1)\"\n >\n <div\n *ngIf=\"size === 'small'\"\n class=\"sky-avatar-initials-inner\"\n [skyThemeClass]=\"{\n 'sky-font-body-sm': 'modern'\n }\"\n >\n {{ initials }}\n </div>\n <div\n *ngIf=\"size === 'medium'\"\n class=\"sky-avatar-initials-inner\"\n [skyThemeClass]=\"{\n 'sky-font-display-3': 'modern'\n }\"\n >\n {{ initials }}\n </div>\n <div\n *ngIf=\"size !== 'small' && size !== 'medium'\"\n class=\"sky-avatar-initials-inner\"\n [skyThemeClass]=\"{\n 'sky-font-display-2': 'modern'\n }\"\n >\n {{ initials }}\n </div>\n </div>\n</div>\n",
|
|
550
|
-
styles: [".sky-avatar-wrapper{height:104px;width:104px;border:solid 2px transparent;border-radius:50%;overflow:hidden;position:relative;top:-2px;left:-2px}.sky-avatar-image,.sky-avatar-initials{height:100px;width:100px;background-position:50%;background-size:cover;display:flex;align-items:center;justify-content:center}.sky-avatar-initials{font-size:50px}.sky-avatar-initials-inner{color:#fff;cursor:default;-webkit-user-select:none;user-select:none}.sky-avatar-wrapper-size-medium{height:69px;width:69px}.sky-avatar-wrapper-size-medium .sky-avatar-image,.sky-avatar-wrapper-size-medium .sky-avatar-initials{height:65px;width:65px}.sky-avatar-wrapper-size-medium .sky-avatar-initials{font-size:32.5px}.sky-avatar-wrapper-size-small{height:36px;width:36px}.sky-avatar-wrapper-size-small .sky-avatar-image,.sky-avatar-wrapper-size-small .sky-avatar-initials{height:32px;width:32px}.sky-avatar-wrapper-size-small .sky-avatar-initials{font-size:16px}.sky-file-drop .sky-avatar-wrapper{cursor:pointer}.sky-file-drop-accept .sky-avatar-wrapper{border-color:#72bf44;border-style:dashed}.sky-file-drop-reject .sky-avatar-wrapper{border-color:#ef4044;border-style:dashed}.sky-theme-modern .sky-avatar-wrapper{height:100px;width:100px;background-color:#fff;border-width:0;padding:5px;top:0;left:0}.sky-theme-modern .sky-avatar-image,.sky-theme-modern .sky-avatar-initials{border-radius:50%;height:90px;width:90px}.sky-theme-modern .sky-avatar-initials-inner{color:#212327}.sky-theme-modern .sky-file-drop-accept .sky-avatar-wrapper,.sky-theme-modern .sky-file-drop-reject .sky-avatar-wrapper{border-width:2px;padding:3px}.sky-theme-modern .sky-file-drop-accept .sky-avatar-wrapper-size-medium,.sky-theme-modern .sky-file-drop-reject .sky-avatar-wrapper-size-medium{padding:1px}.sky-theme-modern .sky-file-drop-accept .sky-avatar-wrapper-size-small,.sky-theme-modern .sky-file-drop-reject .sky-avatar-wrapper-size-small{padding:0}.sky-theme-modern .sky-avatar-wrapper-size-medium{padding:3px;height:65px;width:65px}.sky-theme-modern .sky-avatar-wrapper-size-medium .sky-avatar-image,.sky-theme-modern .sky-avatar-wrapper-size-medium .sky-avatar-initials{height:59px;width:59px}.sky-theme-modern .sky-avatar-wrapper-size-small{padding:2px;height:32px;width:32px}.sky-theme-modern .sky-avatar-wrapper-size-small .sky-avatar-image,.sky-theme-modern .sky-avatar-wrapper-size-small .sky-avatar-initials{height:28px;width:28px}.sky-theme-modern sky-file-drop:hover .sky-avatar-wrapper{border:solid 1px #1870B8;padding:4px}.sky-theme-modern sky-file-drop:hover .sky-avatar-wrapper.sky-avatar-wrapper-size-medium{padding:2px}.sky-theme-modern sky-file-drop:hover .sky-avatar-wrapper.sky-avatar-wrapper-size-small{padding:1px}.sky-theme-modern sky-file-drop:active .sky-avatar-wrapper,.sky-theme-modern sky-file-drop:focus-within .sky-avatar-wrapper{border:solid 2px #1870B8;padding:3px}.sky-theme-modern sky-file-drop:active .sky-avatar-wrapper.sky-avatar-wrapper-size-medium,.sky-theme-modern sky-file-drop:focus-within .sky-avatar-wrapper.sky-avatar-wrapper-size-medium{padding:1px}.sky-theme-modern sky-file-drop:active .sky-avatar-wrapper.sky-avatar-wrapper-size-small,.sky-theme-modern sky-file-drop:focus-within .sky-avatar-wrapper.sky-avatar-wrapper-size-small{padding:0}.sky-theme-modern sky-file-drop:focus-within:not(:active) .sky-avatar-wrapper{box-shadow:0 1px 8px #0000004d}.sky-theme-modern.sky-theme-mode-dark .sky-avatar-wrapper{background-color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-avatar-initials-inner{color:#212327}\n"],
|
|
551
|
-
providers: [SkyAvatarAdapterService],
|
|
552
|
-
encapsulation: i0.ViewEncapsulation.None,
|
|
553
|
-
}]
|
|
554
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: SkyAvatarAdapterService }]; }, propDecorators: { src: [{
|
|
555
|
-
type: i0.Input
|
|
556
|
-
}], name: [{
|
|
557
|
-
type: i0.Input
|
|
558
|
-
}], size: [{
|
|
559
|
-
type: i0.Input
|
|
560
|
-
}] } });
|
|
561
|
-
function getInitial(name) {
|
|
562
|
-
return name.charAt(0).toUpperCase();
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
var SkyAvatarComponent = /** @class */ (function () {
|
|
566
|
-
function SkyAvatarComponent(errorService, fileSizePipe, resourcesService) {
|
|
567
|
-
this.errorService = errorService;
|
|
568
|
-
this.fileSizePipe = fileSizePipe;
|
|
569
|
-
this.resourcesService = resourcesService;
|
|
570
|
-
/**
|
|
571
|
-
* Specifies the maximum file size for the image in bytes.
|
|
572
|
-
*/
|
|
573
|
-
this.maxFileSize = 500000;
|
|
574
|
-
/**
|
|
575
|
-
* Specifies the size of the avatar.
|
|
576
|
-
* Acceptable values are: `"small"`, `"medium"`, and `"large"`.
|
|
577
|
-
* @default "large"
|
|
578
|
-
*/
|
|
579
|
-
this.size = 'large';
|
|
580
|
-
/**
|
|
581
|
-
* Emits a `SkyFileItem` object when the image is updated.
|
|
582
|
-
*/
|
|
583
|
-
this.avatarChanged = new i0.EventEmitter();
|
|
584
|
-
}
|
|
585
|
-
Object.defineProperty(SkyAvatarComponent.prototype, "canChange", {
|
|
586
|
-
get: function () {
|
|
587
|
-
return this._canChange;
|
|
588
|
-
},
|
|
589
|
-
/**
|
|
590
|
-
* Indicates whether users can change the image. To select a different image,
|
|
591
|
-
* users click the image or drag another image on top of it,
|
|
592
|
-
* much like the `sky-file-drop` component in the
|
|
593
|
-
* [file attachment module](https://developer.blackbaud.com/skyux/components/file-attachments/file-attachment).
|
|
594
|
-
* @default false
|
|
595
|
-
*/
|
|
596
|
-
set: function (value) {
|
|
597
|
-
this._canChange = value;
|
|
598
|
-
},
|
|
599
|
-
enumerable: false,
|
|
600
|
-
configurable: true
|
|
601
|
-
});
|
|
602
|
-
Object.defineProperty(SkyAvatarComponent.prototype, "name", {
|
|
603
|
-
get: function () {
|
|
604
|
-
return this._name;
|
|
605
|
-
},
|
|
606
|
-
/**
|
|
607
|
-
* Specifies the name of the record that the avatar represents.
|
|
608
|
-
* If the `src` property does not specify an image, the component displays
|
|
609
|
-
* initials from the first and last words in the name. To ensure
|
|
610
|
-
* that the component extracts the correct initials, specify a name with no prefix
|
|
611
|
-
* or suffix, or just specify initials with a space between them. This property is
|
|
612
|
-
* not required, but the component requires either the `name` or `src` property.
|
|
613
|
-
*/
|
|
614
|
-
set: function (value) {
|
|
615
|
-
this._name = value;
|
|
616
|
-
},
|
|
617
|
-
enumerable: false,
|
|
618
|
-
configurable: true
|
|
619
|
-
});
|
|
620
|
-
Object.defineProperty(SkyAvatarComponent.prototype, "src", {
|
|
621
|
-
get: function () {
|
|
622
|
-
return this._src;
|
|
623
|
-
},
|
|
624
|
-
/**
|
|
625
|
-
* Specifies an image to display to identify a record. This property is
|
|
626
|
-
* not required, but the component requires either the `name` or `src` property.
|
|
627
|
-
*/
|
|
628
|
-
set: function (value) {
|
|
629
|
-
this._src = value;
|
|
630
|
-
},
|
|
631
|
-
enumerable: false,
|
|
632
|
-
configurable: true
|
|
633
|
-
});
|
|
634
|
-
SkyAvatarComponent.prototype.photoDrop = function (result) {
|
|
635
|
-
/* sanity check */
|
|
636
|
-
/* istanbul ignore else */
|
|
637
|
-
if (result.files && result.files.length > 0) {
|
|
638
|
-
this.avatarChanged.emit(result.files[0]);
|
|
639
|
-
}
|
|
640
|
-
else if (result.rejectedFiles && result.rejectedFiles.length > 0) {
|
|
641
|
-
this.handleError(result.rejectedFiles);
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
SkyAvatarComponent.prototype.handleError = function (rejectedFiles) {
|
|
645
|
-
var rejectedFile = rejectedFiles[0];
|
|
646
|
-
if (rejectedFile.errorType === 'maxFileSize') {
|
|
647
|
-
var title = this.getString('skyux_avatar_error_too_large_title');
|
|
648
|
-
var description = this.getString('skyux_avatar_error_too_large_description', this.maxFileSizeText());
|
|
649
|
-
this.openErrorModal(title, description);
|
|
650
|
-
}
|
|
651
|
-
else if (rejectedFile.errorType === 'fileType') {
|
|
652
|
-
var title = this.getString('skyux_avatar_error_not_image_title');
|
|
653
|
-
var description = this.getString('skyux_avatar_error_not_image_description');
|
|
654
|
-
this.openErrorModal(title, description);
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
SkyAvatarComponent.prototype.maxFileSizeText = function () {
|
|
658
|
-
return this.fileSizePipe.transform(this.maxFileSize);
|
|
659
|
-
};
|
|
660
|
-
SkyAvatarComponent.prototype.openErrorModal = function (title, description) {
|
|
661
|
-
var config = {
|
|
662
|
-
errorTitle: title,
|
|
663
|
-
errorDescription: description,
|
|
664
|
-
errorCloseText: this.getString('skyux_avatar_errormodal_ok'),
|
|
665
|
-
};
|
|
666
|
-
this.errorService.open(config);
|
|
667
|
-
};
|
|
668
|
-
SkyAvatarComponent.prototype.getString = function (key) {
|
|
669
|
-
var _a;
|
|
670
|
-
var args = [];
|
|
671
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
672
|
-
args[_i - 1] = arguments[_i];
|
|
673
|
-
}
|
|
674
|
-
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
675
|
-
return (_a = this.resourcesService).getStringForLocale.apply(_a, __spreadArray([{ locale: 'en-US' }, key], __read(args)));
|
|
676
|
-
};
|
|
677
|
-
return SkyAvatarComponent;
|
|
678
|
-
}());
|
|
679
|
-
SkyAvatarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarComponent, deps: [{ token: i1__namespace.SkyErrorModalService }, { token: i2__namespace$1.SkyFileSizePipe }, { token: i3__namespace$1.SkyLibResourcesService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
680
|
-
SkyAvatarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyAvatarComponent, selector: "sky-avatar", inputs: { canChange: "canChange", name: "name", src: "src", maxFileSize: "maxFileSize", size: "size" }, outputs: { avatarChanged: "avatarChanged" }, ngImport: i0__namespace, template: "<div class=\"sky-avatar\">\n <div *ngIf=\"canChange\">\n <div class=\"sky-avatar-file-drop\">\n <sky-file-drop\n [acceptedTypes]=\"'image/*'\"\n [fileUploadAriaLabel]=\"\n src\n ? ('skyux_avatar_upload_change_aria_label' | skyLibResources: name)\n : ('skyux_avatar_upload_new_aria_label' | skyLibResources: name)\n \"\n [multiple]=\"false\"\n [maxFileSize]=\"maxFileSize\"\n [multiple]=\"false\"\n (filesChanged)=\"photoDrop($event)\"\n >\n <ng-container *ngTemplateOutlet=\"innerTemplate\"></ng-container>\n </sky-file-drop>\n </div>\n </div>\n <div *ngIf=\"!canChange\">\n <ng-container *ngTemplateOutlet=\"innerTemplate\"></ng-container>\n </div>\n</div>\n\n<ng-template #innerTemplate>\n <sky-avatar-inner [name]=\"name\" [size]=\"size\" [src]=\"src\"></sky-avatar-inner>\n</ng-template>\n", styles: [".sky-avatar .sky-file-drop-col{flex-basis:initial}.sky-theme-modern .sky-file-drop:focus{outline:none}\n"], components: [{ type: i2__namespace$1.λ8, selector: "sky-file-drop", inputs: ["fileUploadAriaLabel", "linkUploadAriaLabel", "minFileSize", "maxFileSize", "multiple", "validateFn", "acceptedTypes", "noClick", "allowLinks"], outputs: ["filesChanged", "linkInputBlur", "linkChanged"] }, { type: SkyAvatarInnerComponent, selector: "sky-avatar-inner", inputs: ["src", "name", "size"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i3__namespace$1.SkyLibResourcesPipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
|
|
681
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarComponent, decorators: [{
|
|
682
|
-
type: i0.Component,
|
|
683
|
-
args: [{
|
|
684
|
-
selector: 'sky-avatar',
|
|
685
|
-
template: "<div class=\"sky-avatar\">\n <div *ngIf=\"canChange\">\n <div class=\"sky-avatar-file-drop\">\n <sky-file-drop\n [acceptedTypes]=\"'image/*'\"\n [fileUploadAriaLabel]=\"\n src\n ? ('skyux_avatar_upload_change_aria_label' | skyLibResources: name)\n : ('skyux_avatar_upload_new_aria_label' | skyLibResources: name)\n \"\n [multiple]=\"false\"\n [maxFileSize]=\"maxFileSize\"\n [multiple]=\"false\"\n (filesChanged)=\"photoDrop($event)\"\n >\n <ng-container *ngTemplateOutlet=\"innerTemplate\"></ng-container>\n </sky-file-drop>\n </div>\n </div>\n <div *ngIf=\"!canChange\">\n <ng-container *ngTemplateOutlet=\"innerTemplate\"></ng-container>\n </div>\n</div>\n\n<ng-template #innerTemplate>\n <sky-avatar-inner [name]=\"name\" [size]=\"size\" [src]=\"src\"></sky-avatar-inner>\n</ng-template>\n",
|
|
686
|
-
styles: [".sky-avatar .sky-file-drop-col{flex-basis:initial}.sky-theme-modern .sky-file-drop:focus{outline:none}\n"],
|
|
687
|
-
encapsulation: i0.ViewEncapsulation.None,
|
|
688
|
-
}]
|
|
689
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.SkyErrorModalService }, { type: i2__namespace$1.SkyFileSizePipe }, { type: i3__namespace$1.SkyLibResourcesService }]; }, propDecorators: { canChange: [{
|
|
690
|
-
type: i0.Input
|
|
691
|
-
}], name: [{
|
|
692
|
-
type: i0.Input
|
|
693
|
-
}], src: [{
|
|
694
|
-
type: i0.Input
|
|
695
|
-
}], maxFileSize: [{
|
|
696
|
-
type: i0.Input
|
|
697
|
-
}], size: [{
|
|
698
|
-
type: i0.Input
|
|
699
|
-
}], avatarChanged: [{
|
|
700
|
-
type: i0.Output
|
|
701
|
-
}] } });
|
|
702
|
-
|
|
703
|
-
var SkyAvatarModule = /** @class */ (function () {
|
|
704
|
-
function SkyAvatarModule() {
|
|
705
|
-
}
|
|
706
|
-
return SkyAvatarModule;
|
|
707
|
-
}());
|
|
708
|
-
SkyAvatarModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
709
|
-
SkyAvatarModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarModule, declarations: [SkyAvatarInnerComponent, SkyAvatarComponent], imports: [i2.CommonModule,
|
|
710
|
-
SkyAvatarResourcesModule,
|
|
711
|
-
i1.SkyErrorModule,
|
|
712
|
-
i2$1.SkyFileAttachmentsModule,
|
|
713
|
-
i3.SkyI18nModule,
|
|
714
|
-
i3$1.SkyThemeModule], exports: [SkyAvatarComponent] });
|
|
715
|
-
SkyAvatarModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarModule, providers: [i2$1.SkyFileSizePipe], imports: [[
|
|
716
|
-
i2.CommonModule,
|
|
717
|
-
SkyAvatarResourcesModule,
|
|
718
|
-
i1.SkyErrorModule,
|
|
719
|
-
i2$1.SkyFileAttachmentsModule,
|
|
720
|
-
i3.SkyI18nModule,
|
|
721
|
-
i3$1.SkyThemeModule,
|
|
722
|
-
]] });
|
|
723
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyAvatarModule, decorators: [{
|
|
724
|
-
type: i0.NgModule,
|
|
725
|
-
args: [{
|
|
726
|
-
declarations: [SkyAvatarInnerComponent, SkyAvatarComponent],
|
|
727
|
-
imports: [
|
|
728
|
-
i2.CommonModule,
|
|
729
|
-
SkyAvatarResourcesModule,
|
|
730
|
-
i1.SkyErrorModule,
|
|
731
|
-
i2$1.SkyFileAttachmentsModule,
|
|
732
|
-
i3.SkyI18nModule,
|
|
733
|
-
i3$1.SkyThemeModule,
|
|
734
|
-
],
|
|
735
|
-
providers: [i2$1.SkyFileSizePipe],
|
|
736
|
-
exports: [SkyAvatarComponent],
|
|
737
|
-
}]
|
|
738
|
-
}] });
|
|
739
|
-
|
|
740
|
-
/**
|
|
741
|
-
* Generated bundle index. Do not edit.
|
|
742
|
-
*/
|
|
743
|
-
|
|
744
|
-
exports.SkyAvatarModule = SkyAvatarModule;
|
|
745
|
-
exports["λ1"] = SkyAvatarComponent;
|
|
746
|
-
|
|
747
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
748
|
-
|
|
749
|
-
}));
|
|
750
|
-
//# sourceMappingURL=skyux-avatar.umd.js.map
|