@tectra-ng/ui 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/tectra-ng-ui-avatar.mjs +623 -2
- package/fesm2022/tectra-ng-ui-avatar.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-field.mjs +2 -2
- package/fesm2022/tectra-ng-ui-field.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-icon-field.mjs +6 -6
- package/fesm2022/tectra-ng-ui-icon-field.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-link.mjs +4 -4
- package/fesm2022/tectra-ng-ui-link.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-message.mjs +18 -1
- package/fesm2022/tectra-ng-ui-message.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tag.mjs +395 -6
- package/fesm2022/tectra-ng-ui-tag.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-truncate-text.mjs +4 -4
- package/fesm2022/tectra-ng-ui-truncate-text.mjs.map +1 -1
- package/message/README.md +1 -1
- package/package.json +4 -4
- package/types/tectra-ng-ui-avatar.d.ts +260 -0
- package/types/tectra-ng-ui-avatar.d.ts.map +1 -1
- package/types/tectra-ng-ui-message.d.ts.map +1 -1
- package/types/tectra-ng-ui-tag.d.ts +168 -0
- package/types/tectra-ng-ui-tag.d.ts.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, InjectionToken, booleanAttribute, computed, contentChildren, effect, inject, input, output, signal } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, InjectionToken, booleanAttribute, computed, contentChildren, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
4
4
|
import { optionalBoolean, optionalNumber } from "@tectra-ng/core/utils";
|
|
5
5
|
import { TxIcon, TxIconRegistry } from "@tectra-ng/icons";
|
|
@@ -8,6 +8,10 @@ import { TxTooltip } from "@tectra-ng/ui/tooltip";
|
|
|
8
8
|
import { toStyleObject } from "@tectra-ng/themes";
|
|
9
9
|
import { injectTranslations } from "@tectra-ng/core/i18n";
|
|
10
10
|
import { TxPopover, TxPopoverContent, TxPopoverTrigger } from "@tectra-ng/ui/popover";
|
|
11
|
+
import { TxButton } from "@tectra-ng/ui/button";
|
|
12
|
+
import { TxConfirmService } from "@tectra-ng/ui/confirm";
|
|
13
|
+
import { TxMenu } from "@tectra-ng/ui/menu";
|
|
14
|
+
import { TxProgressSpinner } from "@tectra-ng/ui/progress-spinner";
|
|
11
15
|
const TX_AVATAR_GROUP = new InjectionToken("TX_AVATAR_GROUP");
|
|
12
16
|
const TONES = [
|
|
13
17
|
"blue",
|
|
@@ -845,6 +849,623 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
845
849
|
}]
|
|
846
850
|
}
|
|
847
851
|
});
|
|
848
|
-
|
|
852
|
+
function acceptsFile(file, accept) {
|
|
853
|
+
const rules = accept.split(",").map((rule) => rule.trim().toLowerCase()).filter(Boolean);
|
|
854
|
+
if (!rules.length) return true;
|
|
855
|
+
const name = file.name.toLowerCase();
|
|
856
|
+
const type = (file.type || "").toLowerCase();
|
|
857
|
+
return rules.some((rule) => {
|
|
858
|
+
if (rule.startsWith(".")) return name.endsWith(rule);
|
|
859
|
+
if (rule.endsWith("/*")) return type.startsWith(rule.slice(0, -1));
|
|
860
|
+
return type === rule;
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
var TxAvatarEditor = class TxAvatarEditor {
|
|
864
|
+
image = model(void 0, ...ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []);
|
|
865
|
+
name = input(void 0, ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
866
|
+
size = input(void 0, {
|
|
867
|
+
...ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {},
|
|
868
|
+
transform: optionalNumber
|
|
869
|
+
});
|
|
870
|
+
loading = input(false, {
|
|
871
|
+
...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
|
|
872
|
+
transform: booleanAttribute
|
|
873
|
+
});
|
|
874
|
+
disabled = input(false, {
|
|
875
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
876
|
+
transform: booleanAttribute
|
|
877
|
+
});
|
|
878
|
+
hint = input(void 0, ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
|
|
879
|
+
accept = input("image/*", ...ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []);
|
|
880
|
+
maxFileSize = input(void 0, {
|
|
881
|
+
...ngDevMode ? { debugName: "maxFileSize" } : /* istanbul ignore next */ {},
|
|
882
|
+
transform: optionalNumber
|
|
883
|
+
});
|
|
884
|
+
confirmRemove = input(true, {
|
|
885
|
+
...ngDevMode ? { debugName: "confirmRemove" } : /* istanbul ignore next */ {},
|
|
886
|
+
transform: booleanAttribute
|
|
887
|
+
});
|
|
888
|
+
changeLabel = input(void 0, ...ngDevMode ? [{ debugName: "changeLabel" }] : /* istanbul ignore next */ []);
|
|
889
|
+
removeLabel = input(void 0, ...ngDevMode ? [{ debugName: "removeLabel" }] : /* istanbul ignore next */ []);
|
|
890
|
+
removeTitle = input(void 0, ...ngDevMode ? [{ debugName: "removeTitle" }] : /* istanbul ignore next */ []);
|
|
891
|
+
removeMessage = input(void 0, ...ngDevMode ? [{ debugName: "removeMessage" }] : /* istanbul ignore next */ []);
|
|
892
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
893
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
894
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
895
|
+
unstyled = input(void 0, {
|
|
896
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
897
|
+
transform: optionalBoolean
|
|
898
|
+
});
|
|
899
|
+
photoChange = output();
|
|
900
|
+
rejected = output();
|
|
901
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
902
|
+
passThrough = injectPassThrough("avatarEditor", this, this.pt, this.ptOptions);
|
|
903
|
+
t = injectTranslations();
|
|
904
|
+
confirm = inject(TxConfirmService);
|
|
905
|
+
fileInput = viewChild.required("fileInput", ...ngDevMode ? [{ debugName: "fileInput" }] : /* istanbul ignore next */ []);
|
|
906
|
+
menu = viewChild("menu", ...ngDevMode ? [{ debugName: "menu" }] : /* istanbul ignore next */ []);
|
|
907
|
+
dragOver = signal(false, ...ngDevMode ? [{ debugName: "dragOver" }] : /* istanbul ignore next */ []);
|
|
908
|
+
hasPhoto = computed(() => !!this.image(), ...ngDevMode ? [{ debugName: "hasPhoto" }] : /* istanbul ignore next */ []);
|
|
909
|
+
blocked = computed(() => this.loading() || this.disabled(), ...ngDevMode ? [{ debugName: "blocked" }] : /* istanbul ignore next */ []);
|
|
910
|
+
changeText = computed(() => this.changeLabel() ?? (this.hasPhoto() ? this.t().avatarChangePhoto : this.t().avatarUploadPhoto), ...ngDevMode ? [{ debugName: "changeText" }] : /* istanbul ignore next */ []);
|
|
911
|
+
menuItems = computed(() => [{
|
|
912
|
+
label: this.changeLabel() ?? this.t().avatarChangePhoto,
|
|
913
|
+
icon: "upload",
|
|
914
|
+
command: () => this.pick()
|
|
915
|
+
}, {
|
|
916
|
+
label: this.removeLabel() ?? this.t().avatarRemovePhoto,
|
|
917
|
+
icon: "trash",
|
|
918
|
+
severity: "danger",
|
|
919
|
+
command: () => void this.remove()
|
|
920
|
+
}], ...ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []);
|
|
921
|
+
hostStyle = computed(() => {
|
|
922
|
+
const size = this.size();
|
|
923
|
+
return {
|
|
924
|
+
...toStyleObject(this.dt(), "--tx-avatar"),
|
|
925
|
+
...size ? { "--tx-avatar-editor-size": `${size}px` } : {},
|
|
926
|
+
...this.passThrough().root?.style
|
|
927
|
+
};
|
|
928
|
+
}, ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
929
|
+
pick() {
|
|
930
|
+
if (this.blocked()) return;
|
|
931
|
+
const input = this.fileInput().nativeElement;
|
|
932
|
+
input.value = "";
|
|
933
|
+
input.click();
|
|
934
|
+
}
|
|
935
|
+
async remove() {
|
|
936
|
+
if (this.blocked() || !this.hasPhoto()) return;
|
|
937
|
+
if (this.confirmRemove()) {
|
|
938
|
+
if (!await this.confirm.dialog({
|
|
939
|
+
title: this.removeTitle() ?? this.t().avatarRemoveTitle,
|
|
940
|
+
message: this.removeMessage() ?? this.t().avatarRemoveMessage,
|
|
941
|
+
severity: "danger",
|
|
942
|
+
acceptLabel: this.removeLabel() ?? this.t().avatarRemovePhoto
|
|
943
|
+
})) return;
|
|
944
|
+
}
|
|
945
|
+
this.photoChange.emit(null);
|
|
946
|
+
}
|
|
947
|
+
onBadge(event) {
|
|
948
|
+
if (this.hasPhoto()) this.menu()?.toggle(event.currentTarget);
|
|
949
|
+
else this.pick();
|
|
950
|
+
}
|
|
951
|
+
onFile(event) {
|
|
952
|
+
const file = event.target.files?.[0];
|
|
953
|
+
if (file) this.take(file);
|
|
954
|
+
}
|
|
955
|
+
onDragOver(event) {
|
|
956
|
+
if (this.blocked() || !event.dataTransfer?.types.includes("Files")) return;
|
|
957
|
+
event.preventDefault();
|
|
958
|
+
event.dataTransfer.dropEffect = "copy";
|
|
959
|
+
this.dragOver.set(true);
|
|
960
|
+
}
|
|
961
|
+
onDragLeave() {
|
|
962
|
+
this.dragOver.set(false);
|
|
963
|
+
}
|
|
964
|
+
onDrop(event) {
|
|
965
|
+
this.dragOver.set(false);
|
|
966
|
+
const file = event.dataTransfer?.files?.[0];
|
|
967
|
+
if (this.blocked() || !file) return;
|
|
968
|
+
event.preventDefault();
|
|
969
|
+
this.take(file);
|
|
970
|
+
}
|
|
971
|
+
take(file) {
|
|
972
|
+
if (!acceptsFile(file, this.accept())) {
|
|
973
|
+
this.rejected.emit({
|
|
974
|
+
file,
|
|
975
|
+
reason: "type"
|
|
976
|
+
});
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
const max = this.maxFileSize();
|
|
980
|
+
if (max !== void 0 && file.size > max) {
|
|
981
|
+
this.rejected.emit({
|
|
982
|
+
file,
|
|
983
|
+
reason: "size"
|
|
984
|
+
});
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
this.photoChange.emit(file);
|
|
988
|
+
}
|
|
989
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
990
|
+
minVersion: "12.0.0",
|
|
991
|
+
version: "22.2.3",
|
|
992
|
+
ngImport: i0,
|
|
993
|
+
type: TxAvatarEditor,
|
|
994
|
+
deps: [],
|
|
995
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
996
|
+
});
|
|
997
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
998
|
+
minVersion: "17.0.0",
|
|
999
|
+
version: "22.2.3",
|
|
1000
|
+
type: TxAvatarEditor,
|
|
1001
|
+
isStandalone: true,
|
|
1002
|
+
selector: "tx-avatar-editor",
|
|
1003
|
+
inputs: {
|
|
1004
|
+
image: {
|
|
1005
|
+
classPropertyName: "image",
|
|
1006
|
+
publicName: "image",
|
|
1007
|
+
isSignal: true,
|
|
1008
|
+
isRequired: false,
|
|
1009
|
+
transformFunction: null
|
|
1010
|
+
},
|
|
1011
|
+
name: {
|
|
1012
|
+
classPropertyName: "name",
|
|
1013
|
+
publicName: "name",
|
|
1014
|
+
isSignal: true,
|
|
1015
|
+
isRequired: false,
|
|
1016
|
+
transformFunction: null
|
|
1017
|
+
},
|
|
1018
|
+
size: {
|
|
1019
|
+
classPropertyName: "size",
|
|
1020
|
+
publicName: "size",
|
|
1021
|
+
isSignal: true,
|
|
1022
|
+
isRequired: false,
|
|
1023
|
+
transformFunction: null
|
|
1024
|
+
},
|
|
1025
|
+
loading: {
|
|
1026
|
+
classPropertyName: "loading",
|
|
1027
|
+
publicName: "loading",
|
|
1028
|
+
isSignal: true,
|
|
1029
|
+
isRequired: false,
|
|
1030
|
+
transformFunction: null
|
|
1031
|
+
},
|
|
1032
|
+
disabled: {
|
|
1033
|
+
classPropertyName: "disabled",
|
|
1034
|
+
publicName: "disabled",
|
|
1035
|
+
isSignal: true,
|
|
1036
|
+
isRequired: false,
|
|
1037
|
+
transformFunction: null
|
|
1038
|
+
},
|
|
1039
|
+
hint: {
|
|
1040
|
+
classPropertyName: "hint",
|
|
1041
|
+
publicName: "hint",
|
|
1042
|
+
isSignal: true,
|
|
1043
|
+
isRequired: false,
|
|
1044
|
+
transformFunction: null
|
|
1045
|
+
},
|
|
1046
|
+
accept: {
|
|
1047
|
+
classPropertyName: "accept",
|
|
1048
|
+
publicName: "accept",
|
|
1049
|
+
isSignal: true,
|
|
1050
|
+
isRequired: false,
|
|
1051
|
+
transformFunction: null
|
|
1052
|
+
},
|
|
1053
|
+
maxFileSize: {
|
|
1054
|
+
classPropertyName: "maxFileSize",
|
|
1055
|
+
publicName: "maxFileSize",
|
|
1056
|
+
isSignal: true,
|
|
1057
|
+
isRequired: false,
|
|
1058
|
+
transformFunction: null
|
|
1059
|
+
},
|
|
1060
|
+
confirmRemove: {
|
|
1061
|
+
classPropertyName: "confirmRemove",
|
|
1062
|
+
publicName: "confirmRemove",
|
|
1063
|
+
isSignal: true,
|
|
1064
|
+
isRequired: false,
|
|
1065
|
+
transformFunction: null
|
|
1066
|
+
},
|
|
1067
|
+
changeLabel: {
|
|
1068
|
+
classPropertyName: "changeLabel",
|
|
1069
|
+
publicName: "changeLabel",
|
|
1070
|
+
isSignal: true,
|
|
1071
|
+
isRequired: false,
|
|
1072
|
+
transformFunction: null
|
|
1073
|
+
},
|
|
1074
|
+
removeLabel: {
|
|
1075
|
+
classPropertyName: "removeLabel",
|
|
1076
|
+
publicName: "removeLabel",
|
|
1077
|
+
isSignal: true,
|
|
1078
|
+
isRequired: false,
|
|
1079
|
+
transformFunction: null
|
|
1080
|
+
},
|
|
1081
|
+
removeTitle: {
|
|
1082
|
+
classPropertyName: "removeTitle",
|
|
1083
|
+
publicName: "removeTitle",
|
|
1084
|
+
isSignal: true,
|
|
1085
|
+
isRequired: false,
|
|
1086
|
+
transformFunction: null
|
|
1087
|
+
},
|
|
1088
|
+
removeMessage: {
|
|
1089
|
+
classPropertyName: "removeMessage",
|
|
1090
|
+
publicName: "removeMessage",
|
|
1091
|
+
isSignal: true,
|
|
1092
|
+
isRequired: false,
|
|
1093
|
+
transformFunction: null
|
|
1094
|
+
},
|
|
1095
|
+
dt: {
|
|
1096
|
+
classPropertyName: "dt",
|
|
1097
|
+
publicName: "dt",
|
|
1098
|
+
isSignal: true,
|
|
1099
|
+
isRequired: false,
|
|
1100
|
+
transformFunction: null
|
|
1101
|
+
},
|
|
1102
|
+
pt: {
|
|
1103
|
+
classPropertyName: "pt",
|
|
1104
|
+
publicName: "pt",
|
|
1105
|
+
isSignal: true,
|
|
1106
|
+
isRequired: false,
|
|
1107
|
+
transformFunction: null
|
|
1108
|
+
},
|
|
1109
|
+
ptOptions: {
|
|
1110
|
+
classPropertyName: "ptOptions",
|
|
1111
|
+
publicName: "ptOptions",
|
|
1112
|
+
isSignal: true,
|
|
1113
|
+
isRequired: false,
|
|
1114
|
+
transformFunction: null
|
|
1115
|
+
},
|
|
1116
|
+
unstyled: {
|
|
1117
|
+
classPropertyName: "unstyled",
|
|
1118
|
+
publicName: "unstyled",
|
|
1119
|
+
isSignal: true,
|
|
1120
|
+
isRequired: false,
|
|
1121
|
+
transformFunction: null
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
outputs: {
|
|
1125
|
+
image: "imageChange",
|
|
1126
|
+
photoChange: "photoChange",
|
|
1127
|
+
rejected: "rejected"
|
|
1128
|
+
},
|
|
1129
|
+
host: {
|
|
1130
|
+
properties: {
|
|
1131
|
+
"class": "passThrough().root?.class",
|
|
1132
|
+
"style": "hostStyle()",
|
|
1133
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
1134
|
+
"class.tx-avatar-editor--loading": "loading()",
|
|
1135
|
+
"class.tx-avatar-editor--dragover": "dragOver()",
|
|
1136
|
+
"attr.aria-busy": "loading() || null"
|
|
1137
|
+
},
|
|
1138
|
+
classAttribute: "tx-avatar-editor"
|
|
1139
|
+
},
|
|
1140
|
+
viewQueries: [{
|
|
1141
|
+
propertyName: "fileInput",
|
|
1142
|
+
first: true,
|
|
1143
|
+
predicate: ["fileInput"],
|
|
1144
|
+
descendants: true,
|
|
1145
|
+
isSignal: true
|
|
1146
|
+
}, {
|
|
1147
|
+
propertyName: "menu",
|
|
1148
|
+
first: true,
|
|
1149
|
+
predicate: ["menu"],
|
|
1150
|
+
descendants: true,
|
|
1151
|
+
isSignal: true
|
|
1152
|
+
}],
|
|
1153
|
+
ngImport: i0,
|
|
1154
|
+
template: "<div\n class=\"tx-avatar-editor__photo\"\n [class]=\"passThrough().photo?.class\"\n [style]=\"passThrough().photo?.style\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n>\n <tx-avatar class=\"tx-avatar-editor__image\" [image]=\"image()\" [name]=\"name()\" [tooltip]=\"false\" [unstyled]=\"isUnstyled()\" />\n <span class=\"tx-avatar-editor__badge\" [class]=\"passThrough().badge?.class\" [style]=\"passThrough().badge?.style\">\n <button\n txButton\n type=\"button\"\n icon=\"camera\"\n rounded\n size=\"small\"\n [disabled]=\"blocked()\"\n [attr.aria-label]=\"hasPhoto() ? t().avatarPhotoActions : changeText()\"\n [attr.aria-haspopup]=\"hasPhoto() ? 'menu' : null\"\n [txTooltip]=\"changeText()\"\n (click)=\"onBadge($event)\"\n ></button>\n </span>\n @if (loading()) {\n <div class=\"tx-avatar-editor__loader\" [class]=\"passThrough().loader?.class\" [style]=\"passThrough().loader?.style\">\n <tx-progress-spinner size=\"small\" [ariaLabel]=\"t().loading\" />\n </div>\n }\n</div>\n@if (hint()) {\n <span class=\"tx-avatar-editor__hint\" [class]=\"passThrough().hint?.class\" [style]=\"passThrough().hint?.style\">{{ hint() }}</span>\n}\n<tx-menu #menu popup [model]=\"menuItems()\" [ariaLabel]=\"t().avatarPhotoActions\" />\n<input #fileInput class=\"tx-avatar-editor__input\" type=\"file\" tabindex=\"-1\" aria-hidden=\"true\" [accept]=\"accept()\" (change)=\"onFile($event)\" />\n",
|
|
1155
|
+
styles: [":host{display:inline-flex;flex-direction:column;align-items:center}.tx-avatar-editor__photo{position:relative}.tx-avatar-editor__input{display:none}:host([data-styled]){gap:var(--tx-avatar-editor-gap)}:host([data-styled]) .tx-avatar-editor__photo{width:var(--tx-avatar-editor-size);height:var(--tx-avatar-editor-size)}:host([data-styled]) .tx-avatar-editor__image{--tx-avatar-size: var(--tx-avatar-editor-size);border-radius:50%;box-shadow:0 0 0 var(--tx-avatar-editor-ring-width) var(--tx-avatar-editor-ring-color);transition:box-shadow var(--tx-avatar-editor-transition-duration)}:host([data-styled]).tx-avatar-editor--dragover .tx-avatar-editor__image{box-shadow:0 0 0 var(--tx-avatar-editor-ring-width) var(--tx-avatar-editor-drop-ring-color)}:host([data-styled]) .tx-avatar-editor__badge{position:absolute;z-index:2;right:0;bottom:0;display:inline-flex;border-radius:50%;box-shadow:0 0 0 var(--tx-avatar-editor-badge-ring-width) var(--tx-avatar-editor-badge-ring-color)}:host([data-styled]) .tx-avatar-editor__badge button{width:var(--tx-avatar-editor-badge-size);height:var(--tx-avatar-editor-badge-size)}:host([data-styled]) .tx-avatar-editor__loader{position:absolute;z-index:1;inset:0;display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--tx-avatar-editor-loader-background)}:host([data-styled]) .tx-avatar-editor__hint{max-width:var(--tx-avatar-editor-hint-max-width);color:var(--tx-avatar-editor-hint-color);font-size:var(--tx-avatar-editor-hint-font-size);line-height:var(--tx-avatar-editor-hint-line-height);text-align:center}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-avatar-editor__image{transition:none}}\n"],
|
|
1156
|
+
dependencies: [
|
|
1157
|
+
{
|
|
1158
|
+
kind: "component",
|
|
1159
|
+
type: TxAvatar,
|
|
1160
|
+
selector: "tx-avatar",
|
|
1161
|
+
inputs: [
|
|
1162
|
+
"image",
|
|
1163
|
+
"name",
|
|
1164
|
+
"label",
|
|
1165
|
+
"icon",
|
|
1166
|
+
"size",
|
|
1167
|
+
"shape",
|
|
1168
|
+
"tone",
|
|
1169
|
+
"ariaLabel",
|
|
1170
|
+
"tooltip",
|
|
1171
|
+
"dt",
|
|
1172
|
+
"pt",
|
|
1173
|
+
"ptOptions",
|
|
1174
|
+
"unstyled"
|
|
1175
|
+
],
|
|
1176
|
+
outputs: ["imageError"]
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
kind: "component",
|
|
1180
|
+
type: TxButton,
|
|
1181
|
+
selector: "button[txButton], a[txButton]",
|
|
1182
|
+
inputs: [
|
|
1183
|
+
"label",
|
|
1184
|
+
"severity",
|
|
1185
|
+
"size",
|
|
1186
|
+
"variant",
|
|
1187
|
+
"outlined",
|
|
1188
|
+
"text",
|
|
1189
|
+
"link",
|
|
1190
|
+
"rounded",
|
|
1191
|
+
"raised",
|
|
1192
|
+
"plain",
|
|
1193
|
+
"fluid",
|
|
1194
|
+
"disabled",
|
|
1195
|
+
"tabindex",
|
|
1196
|
+
"icon",
|
|
1197
|
+
"iconPos",
|
|
1198
|
+
"iconOnly",
|
|
1199
|
+
"loading",
|
|
1200
|
+
"loadingIcon",
|
|
1201
|
+
"badge",
|
|
1202
|
+
"badgeSeverity",
|
|
1203
|
+
"dt",
|
|
1204
|
+
"pt",
|
|
1205
|
+
"ptOptions",
|
|
1206
|
+
"unstyled"
|
|
1207
|
+
]
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
kind: "component",
|
|
1211
|
+
type: TxMenu,
|
|
1212
|
+
selector: "tx-menu, tx-tiered-menu",
|
|
1213
|
+
inputs: [
|
|
1214
|
+
"model",
|
|
1215
|
+
"popup",
|
|
1216
|
+
"tiered",
|
|
1217
|
+
"placement",
|
|
1218
|
+
"offset",
|
|
1219
|
+
"variant",
|
|
1220
|
+
"ariaLabel",
|
|
1221
|
+
"ariaLabelledBy",
|
|
1222
|
+
"dt",
|
|
1223
|
+
"pt",
|
|
1224
|
+
"ptOptions",
|
|
1225
|
+
"unstyled"
|
|
1226
|
+
],
|
|
1227
|
+
outputs: [
|
|
1228
|
+
"itemSelected",
|
|
1229
|
+
"opened",
|
|
1230
|
+
"closed"
|
|
1231
|
+
]
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
kind: "component",
|
|
1235
|
+
type: TxProgressSpinner,
|
|
1236
|
+
selector: "tx-progress-spinner",
|
|
1237
|
+
inputs: [
|
|
1238
|
+
"size",
|
|
1239
|
+
"strokeWidth",
|
|
1240
|
+
"fill",
|
|
1241
|
+
"animationDuration",
|
|
1242
|
+
"color",
|
|
1243
|
+
"ariaLabel",
|
|
1244
|
+
"dt",
|
|
1245
|
+
"pt",
|
|
1246
|
+
"ptOptions",
|
|
1247
|
+
"unstyled"
|
|
1248
|
+
]
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
kind: "directive",
|
|
1252
|
+
type: TxTooltip,
|
|
1253
|
+
selector: "[txTooltip]",
|
|
1254
|
+
inputs: [
|
|
1255
|
+
"txTooltip",
|
|
1256
|
+
"tooltipPlacement",
|
|
1257
|
+
"tooltipEvent",
|
|
1258
|
+
"tooltipShowDelay",
|
|
1259
|
+
"tooltipHideDelay",
|
|
1260
|
+
"tooltipLife",
|
|
1261
|
+
"tooltipOffset",
|
|
1262
|
+
"tooltipArrow",
|
|
1263
|
+
"tooltipInteractive",
|
|
1264
|
+
"tooltipDisabled",
|
|
1265
|
+
"tooltipOverflowOnly",
|
|
1266
|
+
"tooltipMultiline",
|
|
1267
|
+
"tooltipContext",
|
|
1268
|
+
"tooltipClass",
|
|
1269
|
+
"tooltipDt",
|
|
1270
|
+
"tooltipPt",
|
|
1271
|
+
"tooltipPtOptions",
|
|
1272
|
+
"tooltipUnstyled"
|
|
1273
|
+
],
|
|
1274
|
+
outputs: ["tooltipShown", "tooltipHidden"],
|
|
1275
|
+
exportAs: ["txTooltip"]
|
|
1276
|
+
}
|
|
1277
|
+
],
|
|
1278
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1279
|
+
});
|
|
1280
|
+
};
|
|
1281
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1282
|
+
minVersion: "12.0.0",
|
|
1283
|
+
version: "22.2.3",
|
|
1284
|
+
ngImport: i0,
|
|
1285
|
+
type: TxAvatarEditor,
|
|
1286
|
+
decorators: [{
|
|
1287
|
+
type: Component,
|
|
1288
|
+
args: [{
|
|
1289
|
+
selector: "tx-avatar-editor",
|
|
1290
|
+
imports: [
|
|
1291
|
+
TxAvatar,
|
|
1292
|
+
TxButton,
|
|
1293
|
+
TxMenu,
|
|
1294
|
+
TxProgressSpinner,
|
|
1295
|
+
TxTooltip
|
|
1296
|
+
],
|
|
1297
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1298
|
+
host: {
|
|
1299
|
+
class: "tx-avatar-editor",
|
|
1300
|
+
"[class]": "passThrough().root?.class",
|
|
1301
|
+
"[style]": "hostStyle()",
|
|
1302
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
1303
|
+
"[class.tx-avatar-editor--loading]": "loading()",
|
|
1304
|
+
"[class.tx-avatar-editor--dragover]": "dragOver()",
|
|
1305
|
+
"[attr.aria-busy]": "loading() || null"
|
|
1306
|
+
},
|
|
1307
|
+
template: "<div\n class=\"tx-avatar-editor__photo\"\n [class]=\"passThrough().photo?.class\"\n [style]=\"passThrough().photo?.style\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n>\n <tx-avatar class=\"tx-avatar-editor__image\" [image]=\"image()\" [name]=\"name()\" [tooltip]=\"false\" [unstyled]=\"isUnstyled()\" />\n <span class=\"tx-avatar-editor__badge\" [class]=\"passThrough().badge?.class\" [style]=\"passThrough().badge?.style\">\n <button\n txButton\n type=\"button\"\n icon=\"camera\"\n rounded\n size=\"small\"\n [disabled]=\"blocked()\"\n [attr.aria-label]=\"hasPhoto() ? t().avatarPhotoActions : changeText()\"\n [attr.aria-haspopup]=\"hasPhoto() ? 'menu' : null\"\n [txTooltip]=\"changeText()\"\n (click)=\"onBadge($event)\"\n ></button>\n </span>\n @if (loading()) {\n <div class=\"tx-avatar-editor__loader\" [class]=\"passThrough().loader?.class\" [style]=\"passThrough().loader?.style\">\n <tx-progress-spinner size=\"small\" [ariaLabel]=\"t().loading\" />\n </div>\n }\n</div>\n@if (hint()) {\n <span class=\"tx-avatar-editor__hint\" [class]=\"passThrough().hint?.class\" [style]=\"passThrough().hint?.style\">{{ hint() }}</span>\n}\n<tx-menu #menu popup [model]=\"menuItems()\" [ariaLabel]=\"t().avatarPhotoActions\" />\n<input #fileInput class=\"tx-avatar-editor__input\" type=\"file\" tabindex=\"-1\" aria-hidden=\"true\" [accept]=\"accept()\" (change)=\"onFile($event)\" />\n",
|
|
1308
|
+
styles: [":host{display:inline-flex;flex-direction:column;align-items:center}.tx-avatar-editor__photo{position:relative}.tx-avatar-editor__input{display:none}:host([data-styled]){gap:var(--tx-avatar-editor-gap)}:host([data-styled]) .tx-avatar-editor__photo{width:var(--tx-avatar-editor-size);height:var(--tx-avatar-editor-size)}:host([data-styled]) .tx-avatar-editor__image{--tx-avatar-size: var(--tx-avatar-editor-size);border-radius:50%;box-shadow:0 0 0 var(--tx-avatar-editor-ring-width) var(--tx-avatar-editor-ring-color);transition:box-shadow var(--tx-avatar-editor-transition-duration)}:host([data-styled]).tx-avatar-editor--dragover .tx-avatar-editor__image{box-shadow:0 0 0 var(--tx-avatar-editor-ring-width) var(--tx-avatar-editor-drop-ring-color)}:host([data-styled]) .tx-avatar-editor__badge{position:absolute;z-index:2;right:0;bottom:0;display:inline-flex;border-radius:50%;box-shadow:0 0 0 var(--tx-avatar-editor-badge-ring-width) var(--tx-avatar-editor-badge-ring-color)}:host([data-styled]) .tx-avatar-editor__badge button{width:var(--tx-avatar-editor-badge-size);height:var(--tx-avatar-editor-badge-size)}:host([data-styled]) .tx-avatar-editor__loader{position:absolute;z-index:1;inset:0;display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--tx-avatar-editor-loader-background)}:host([data-styled]) .tx-avatar-editor__hint{max-width:var(--tx-avatar-editor-hint-max-width);color:var(--tx-avatar-editor-hint-color);font-size:var(--tx-avatar-editor-hint-font-size);line-height:var(--tx-avatar-editor-hint-line-height);text-align:center}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-avatar-editor__image{transition:none}}\n"]
|
|
1309
|
+
}]
|
|
1310
|
+
}],
|
|
1311
|
+
propDecorators: {
|
|
1312
|
+
image: [{
|
|
1313
|
+
type: i0.Input,
|
|
1314
|
+
args: [{
|
|
1315
|
+
isSignal: true,
|
|
1316
|
+
alias: "image",
|
|
1317
|
+
required: false
|
|
1318
|
+
}]
|
|
1319
|
+
}, {
|
|
1320
|
+
type: i0.Output,
|
|
1321
|
+
args: ["imageChange"]
|
|
1322
|
+
}],
|
|
1323
|
+
name: [{
|
|
1324
|
+
type: i0.Input,
|
|
1325
|
+
args: [{
|
|
1326
|
+
isSignal: true,
|
|
1327
|
+
alias: "name",
|
|
1328
|
+
required: false
|
|
1329
|
+
}]
|
|
1330
|
+
}],
|
|
1331
|
+
size: [{
|
|
1332
|
+
type: i0.Input,
|
|
1333
|
+
args: [{
|
|
1334
|
+
isSignal: true,
|
|
1335
|
+
alias: "size",
|
|
1336
|
+
required: false
|
|
1337
|
+
}]
|
|
1338
|
+
}],
|
|
1339
|
+
loading: [{
|
|
1340
|
+
type: i0.Input,
|
|
1341
|
+
args: [{
|
|
1342
|
+
isSignal: true,
|
|
1343
|
+
alias: "loading",
|
|
1344
|
+
required: false
|
|
1345
|
+
}]
|
|
1346
|
+
}],
|
|
1347
|
+
disabled: [{
|
|
1348
|
+
type: i0.Input,
|
|
1349
|
+
args: [{
|
|
1350
|
+
isSignal: true,
|
|
1351
|
+
alias: "disabled",
|
|
1352
|
+
required: false
|
|
1353
|
+
}]
|
|
1354
|
+
}],
|
|
1355
|
+
hint: [{
|
|
1356
|
+
type: i0.Input,
|
|
1357
|
+
args: [{
|
|
1358
|
+
isSignal: true,
|
|
1359
|
+
alias: "hint",
|
|
1360
|
+
required: false
|
|
1361
|
+
}]
|
|
1362
|
+
}],
|
|
1363
|
+
accept: [{
|
|
1364
|
+
type: i0.Input,
|
|
1365
|
+
args: [{
|
|
1366
|
+
isSignal: true,
|
|
1367
|
+
alias: "accept",
|
|
1368
|
+
required: false
|
|
1369
|
+
}]
|
|
1370
|
+
}],
|
|
1371
|
+
maxFileSize: [{
|
|
1372
|
+
type: i0.Input,
|
|
1373
|
+
args: [{
|
|
1374
|
+
isSignal: true,
|
|
1375
|
+
alias: "maxFileSize",
|
|
1376
|
+
required: false
|
|
1377
|
+
}]
|
|
1378
|
+
}],
|
|
1379
|
+
confirmRemove: [{
|
|
1380
|
+
type: i0.Input,
|
|
1381
|
+
args: [{
|
|
1382
|
+
isSignal: true,
|
|
1383
|
+
alias: "confirmRemove",
|
|
1384
|
+
required: false
|
|
1385
|
+
}]
|
|
1386
|
+
}],
|
|
1387
|
+
changeLabel: [{
|
|
1388
|
+
type: i0.Input,
|
|
1389
|
+
args: [{
|
|
1390
|
+
isSignal: true,
|
|
1391
|
+
alias: "changeLabel",
|
|
1392
|
+
required: false
|
|
1393
|
+
}]
|
|
1394
|
+
}],
|
|
1395
|
+
removeLabel: [{
|
|
1396
|
+
type: i0.Input,
|
|
1397
|
+
args: [{
|
|
1398
|
+
isSignal: true,
|
|
1399
|
+
alias: "removeLabel",
|
|
1400
|
+
required: false
|
|
1401
|
+
}]
|
|
1402
|
+
}],
|
|
1403
|
+
removeTitle: [{
|
|
1404
|
+
type: i0.Input,
|
|
1405
|
+
args: [{
|
|
1406
|
+
isSignal: true,
|
|
1407
|
+
alias: "removeTitle",
|
|
1408
|
+
required: false
|
|
1409
|
+
}]
|
|
1410
|
+
}],
|
|
1411
|
+
removeMessage: [{
|
|
1412
|
+
type: i0.Input,
|
|
1413
|
+
args: [{
|
|
1414
|
+
isSignal: true,
|
|
1415
|
+
alias: "removeMessage",
|
|
1416
|
+
required: false
|
|
1417
|
+
}]
|
|
1418
|
+
}],
|
|
1419
|
+
dt: [{
|
|
1420
|
+
type: i0.Input,
|
|
1421
|
+
args: [{
|
|
1422
|
+
isSignal: true,
|
|
1423
|
+
alias: "dt",
|
|
1424
|
+
required: false
|
|
1425
|
+
}]
|
|
1426
|
+
}],
|
|
1427
|
+
pt: [{
|
|
1428
|
+
type: i0.Input,
|
|
1429
|
+
args: [{
|
|
1430
|
+
isSignal: true,
|
|
1431
|
+
alias: "pt",
|
|
1432
|
+
required: false
|
|
1433
|
+
}]
|
|
1434
|
+
}],
|
|
1435
|
+
ptOptions: [{
|
|
1436
|
+
type: i0.Input,
|
|
1437
|
+
args: [{
|
|
1438
|
+
isSignal: true,
|
|
1439
|
+
alias: "ptOptions",
|
|
1440
|
+
required: false
|
|
1441
|
+
}]
|
|
1442
|
+
}],
|
|
1443
|
+
unstyled: [{
|
|
1444
|
+
type: i0.Input,
|
|
1445
|
+
args: [{
|
|
1446
|
+
isSignal: true,
|
|
1447
|
+
alias: "unstyled",
|
|
1448
|
+
required: false
|
|
1449
|
+
}]
|
|
1450
|
+
}],
|
|
1451
|
+
photoChange: [{
|
|
1452
|
+
type: i0.Output,
|
|
1453
|
+
args: ["photoChange"]
|
|
1454
|
+
}],
|
|
1455
|
+
rejected: [{
|
|
1456
|
+
type: i0.Output,
|
|
1457
|
+
args: ["rejected"]
|
|
1458
|
+
}],
|
|
1459
|
+
fileInput: [{
|
|
1460
|
+
type: i0.ViewChild,
|
|
1461
|
+
args: ["fileInput", { isSignal: true }]
|
|
1462
|
+
}],
|
|
1463
|
+
menu: [{
|
|
1464
|
+
type: i0.ViewChild,
|
|
1465
|
+
args: ["menu", { isSignal: true }]
|
|
1466
|
+
}]
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
export { TX_AVATAR_GROUP, TxAvatar, TxAvatarEditor, TxAvatarGroup, acceptsFile };
|
|
849
1470
|
|
|
850
1471
|
//# sourceMappingURL=tectra-ng-ui-avatar.mjs.map
|