ui-core-abv 0.5.26 → 0.5.35
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/ui-core-abv.mjs
CHANGED
|
@@ -5171,6 +5171,281 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5171
5171
|
type: Output
|
|
5172
5172
|
}] } });
|
|
5173
5173
|
|
|
5174
|
+
class UicTreeAdminComponent {
|
|
5175
|
+
loading = false;
|
|
5176
|
+
emptyMessage = 'Sin subcategorias';
|
|
5177
|
+
createSubcategoryFn;
|
|
5178
|
+
edit = new EventEmitter();
|
|
5179
|
+
remove = new EventEmitter();
|
|
5180
|
+
deactivate = new EventEmitter();
|
|
5181
|
+
nameChange = new EventEmitter();
|
|
5182
|
+
tree = [
|
|
5183
|
+
{
|
|
5184
|
+
id: 0,
|
|
5185
|
+
name: 'Sin hijos',
|
|
5186
|
+
enabled: true
|
|
5187
|
+
},
|
|
5188
|
+
{
|
|
5189
|
+
id: 1,
|
|
5190
|
+
name: 'Equipo A',
|
|
5191
|
+
enabled: true,
|
|
5192
|
+
children: [
|
|
5193
|
+
{
|
|
5194
|
+
id: 10,
|
|
5195
|
+
enabled: true,
|
|
5196
|
+
name: 'Miembro 1'
|
|
5197
|
+
},
|
|
5198
|
+
{
|
|
5199
|
+
id: 11,
|
|
5200
|
+
enabled: true,
|
|
5201
|
+
name: 'Miembro 3'
|
|
5202
|
+
},
|
|
5203
|
+
{
|
|
5204
|
+
id: 12,
|
|
5205
|
+
enabled: true,
|
|
5206
|
+
name: 'Miembro 5'
|
|
5207
|
+
},
|
|
5208
|
+
{
|
|
5209
|
+
id: 13,
|
|
5210
|
+
enabled: true,
|
|
5211
|
+
name: 'Miembro 10'
|
|
5212
|
+
},
|
|
5213
|
+
{
|
|
5214
|
+
id: 14,
|
|
5215
|
+
enabled: true,
|
|
5216
|
+
name: 'Miembro 9'
|
|
5217
|
+
}
|
|
5218
|
+
]
|
|
5219
|
+
},
|
|
5220
|
+
{
|
|
5221
|
+
id: 2,
|
|
5222
|
+
name: 'Team B',
|
|
5223
|
+
enabled: true,
|
|
5224
|
+
children: [
|
|
5225
|
+
{
|
|
5226
|
+
id: 20,
|
|
5227
|
+
enabled: true,
|
|
5228
|
+
name: 'Person 1'
|
|
5229
|
+
},
|
|
5230
|
+
{
|
|
5231
|
+
id: 21,
|
|
5232
|
+
enabled: true,
|
|
5233
|
+
name: 'Person 3'
|
|
5234
|
+
}
|
|
5235
|
+
]
|
|
5236
|
+
}
|
|
5237
|
+
];
|
|
5238
|
+
childNameInputs;
|
|
5239
|
+
parentNameInputs;
|
|
5240
|
+
collapsedIds = new Set();
|
|
5241
|
+
editingParentId = null;
|
|
5242
|
+
editingChildId = null;
|
|
5243
|
+
pendingFocusParentId = null;
|
|
5244
|
+
pendingFocusChildId = null;
|
|
5245
|
+
creatingChildIds = new Set();
|
|
5246
|
+
originalNames = new Map();
|
|
5247
|
+
tempId = 0;
|
|
5248
|
+
ngAfterViewChecked() {
|
|
5249
|
+
if (this.pendingFocusParentId !== null) {
|
|
5250
|
+
const targetId = String(this.pendingFocusParentId);
|
|
5251
|
+
const target = this.parentNameInputs?.find((input) => input.nativeElement.dataset['id'] === targetId);
|
|
5252
|
+
if (target) {
|
|
5253
|
+
target.nativeElement.focus();
|
|
5254
|
+
target.nativeElement.select();
|
|
5255
|
+
this.pendingFocusParentId = null;
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
if (this.pendingFocusChildId !== null) {
|
|
5259
|
+
const targetId = String(this.pendingFocusChildId);
|
|
5260
|
+
const target = this.childNameInputs?.find((input) => input.nativeElement.dataset['id'] === targetId);
|
|
5261
|
+
if (target) {
|
|
5262
|
+
target.nativeElement.focus();
|
|
5263
|
+
target.nativeElement.select();
|
|
5264
|
+
this.pendingFocusChildId = null;
|
|
5265
|
+
}
|
|
5266
|
+
}
|
|
5267
|
+
}
|
|
5268
|
+
isExpanded(item) {
|
|
5269
|
+
return !this.collapsedIds.has(item.id);
|
|
5270
|
+
}
|
|
5271
|
+
toggleItem(item) {
|
|
5272
|
+
if (this.collapsedIds.has(item.id)) {
|
|
5273
|
+
this.collapsedIds.delete(item.id);
|
|
5274
|
+
}
|
|
5275
|
+
else {
|
|
5276
|
+
this.collapsedIds.add(item.id);
|
|
5277
|
+
}
|
|
5278
|
+
}
|
|
5279
|
+
startEditParent(item, event) {
|
|
5280
|
+
event?.stopPropagation();
|
|
5281
|
+
this.editingParentId = item.id;
|
|
5282
|
+
this.pendingFocusParentId = item.id;
|
|
5283
|
+
if (!this.originalNames.has(item.id)) {
|
|
5284
|
+
this.originalNames.set(item.id, item.name);
|
|
5285
|
+
}
|
|
5286
|
+
}
|
|
5287
|
+
stopEditParent() {
|
|
5288
|
+
this.editingParentId = null;
|
|
5289
|
+
}
|
|
5290
|
+
isEditingParent(item) {
|
|
5291
|
+
return this.editingParentId === item.id;
|
|
5292
|
+
}
|
|
5293
|
+
startEditChild(subitem, event) {
|
|
5294
|
+
event?.stopPropagation();
|
|
5295
|
+
this.editingChildId = subitem.id;
|
|
5296
|
+
this.pendingFocusChildId = subitem.id;
|
|
5297
|
+
if (!this.originalNames.has(subitem.id)) {
|
|
5298
|
+
this.originalNames.set(subitem.id, subitem.name);
|
|
5299
|
+
}
|
|
5300
|
+
}
|
|
5301
|
+
stopEditChild() {
|
|
5302
|
+
this.editingChildId = null;
|
|
5303
|
+
}
|
|
5304
|
+
isEditingChild(subitem) {
|
|
5305
|
+
return this.editingChildId === subitem.id;
|
|
5306
|
+
}
|
|
5307
|
+
updateParentName(item, event) {
|
|
5308
|
+
item.name = event.target.value;
|
|
5309
|
+
}
|
|
5310
|
+
updateChildName(parent, subitem, event) {
|
|
5311
|
+
subitem.name = event.target.value;
|
|
5312
|
+
}
|
|
5313
|
+
finalizeParentEdit(item) {
|
|
5314
|
+
this.nameChange.emit({ kind: 'parent', id: item.id, name: item.name });
|
|
5315
|
+
this.originalNames.delete(item.id);
|
|
5316
|
+
this.stopEditParent();
|
|
5317
|
+
}
|
|
5318
|
+
async finalizeChildEdit(parent, subitem) {
|
|
5319
|
+
const trimmed = subitem.name.trim();
|
|
5320
|
+
if (!trimmed) {
|
|
5321
|
+
this.removeChild(parent, subitem);
|
|
5322
|
+
this.originalNames.delete(subitem.id);
|
|
5323
|
+
return;
|
|
5324
|
+
}
|
|
5325
|
+
subitem.name = trimmed;
|
|
5326
|
+
this.nameChange.emit({ kind: 'child', parentId: parent.id, id: subitem.id, name: subitem.name });
|
|
5327
|
+
this.originalNames.delete(subitem.id);
|
|
5328
|
+
if (this.isTempId(subitem.id) && this.createSubcategoryFn) {
|
|
5329
|
+
const tempId = subitem.id;
|
|
5330
|
+
this.creatingChildIds.add(tempId);
|
|
5331
|
+
try {
|
|
5332
|
+
const result = await Promise.resolve(this.createSubcategoryFn({ parentId: Number(parent.id), name: trimmed }));
|
|
5333
|
+
if (result?.id !== undefined) {
|
|
5334
|
+
subitem.id = result.id;
|
|
5335
|
+
}
|
|
5336
|
+
}
|
|
5337
|
+
finally {
|
|
5338
|
+
this.creatingChildIds.delete(tempId);
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
this.stopEditChild();
|
|
5342
|
+
}
|
|
5343
|
+
cancelParentEdit(item) {
|
|
5344
|
+
const original = this.originalNames.get(item.id);
|
|
5345
|
+
if (original !== undefined) {
|
|
5346
|
+
item.name = original;
|
|
5347
|
+
}
|
|
5348
|
+
this.originalNames.delete(item.id);
|
|
5349
|
+
this.stopEditParent();
|
|
5350
|
+
}
|
|
5351
|
+
cancelChildEdit(parent, subitem) {
|
|
5352
|
+
const original = this.originalNames.get(subitem.id);
|
|
5353
|
+
if (original !== undefined) {
|
|
5354
|
+
subitem.name = original;
|
|
5355
|
+
}
|
|
5356
|
+
this.originalNames.delete(subitem.id);
|
|
5357
|
+
if (this.isTempId(subitem.id) && !subitem.name.trim()) {
|
|
5358
|
+
this.removeChild(parent, subitem);
|
|
5359
|
+
return;
|
|
5360
|
+
}
|
|
5361
|
+
this.stopEditChild();
|
|
5362
|
+
}
|
|
5363
|
+
addSubItem(item, event) {
|
|
5364
|
+
event?.stopPropagation();
|
|
5365
|
+
if (!item.children) {
|
|
5366
|
+
item.children = [];
|
|
5367
|
+
}
|
|
5368
|
+
const newId = `new-${Date.now()}-${this.tempId++}`;
|
|
5369
|
+
const newChild = { id: newId, name: '', enabled: true };
|
|
5370
|
+
item.children.unshift(newChild);
|
|
5371
|
+
this.collapsedIds.delete(item.id);
|
|
5372
|
+
this.editingChildId = newChild.id;
|
|
5373
|
+
this.pendingFocusChildId = newChild.id;
|
|
5374
|
+
}
|
|
5375
|
+
emitEditParent(item, event) {
|
|
5376
|
+
event?.stopPropagation();
|
|
5377
|
+
this.edit.emit({ kind: 'parent', id: item.id });
|
|
5378
|
+
this.startEditParent(item);
|
|
5379
|
+
}
|
|
5380
|
+
emitEditChild(parent, subitem, event) {
|
|
5381
|
+
event?.stopPropagation();
|
|
5382
|
+
this.edit.emit({ kind: 'child', parentId: parent.id, id: subitem.id });
|
|
5383
|
+
this.startEditChild(subitem);
|
|
5384
|
+
}
|
|
5385
|
+
emitDeleteParent(item, event) {
|
|
5386
|
+
event?.stopPropagation();
|
|
5387
|
+
this.remove.emit({ kind: 'parent', id: item.id });
|
|
5388
|
+
}
|
|
5389
|
+
emitDeleteChild(parent, subitem, event) {
|
|
5390
|
+
event?.stopPropagation();
|
|
5391
|
+
this.remove.emit({ kind: 'child', parentId: parent.id, id: subitem.id });
|
|
5392
|
+
}
|
|
5393
|
+
emitDeactivateParent(item, checked) {
|
|
5394
|
+
this.deactivate.emit({ kind: 'parent', id: item.id, checked });
|
|
5395
|
+
}
|
|
5396
|
+
emitDeactivateChild(parent, subitem, checked) {
|
|
5397
|
+
subitem.enabled = checked;
|
|
5398
|
+
this.deactivate.emit({ kind: 'child', parentId: parent.id, id: subitem.id, checked });
|
|
5399
|
+
}
|
|
5400
|
+
isCreatingChild(subitem) {
|
|
5401
|
+
return this.creatingChildIds.has(subitem.id);
|
|
5402
|
+
}
|
|
5403
|
+
removeChild(parent, subitem) {
|
|
5404
|
+
if (!parent.children) {
|
|
5405
|
+
return;
|
|
5406
|
+
}
|
|
5407
|
+
parent.children = parent.children.filter((child) => child.id !== subitem.id);
|
|
5408
|
+
if (this.editingChildId === subitem.id) {
|
|
5409
|
+
this.editingChildId = null;
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
isTempId(id) {
|
|
5413
|
+
return typeof id === 'string' && id.startsWith('new-');
|
|
5414
|
+
}
|
|
5415
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicTreeAdminComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5416
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: UicTreeAdminComponent, isStandalone: true, selector: "ui-tree-admin", inputs: { loading: "loading", emptyMessage: "emptyMessage", createSubcategoryFn: "createSubcategoryFn", tree: "tree" }, outputs: { edit: "edit", remove: "remove", deactivate: "deactivate", nameChange: "nameChange" }, viewQueries: [{ propertyName: "childNameInputs", predicate: ["childNameInput"], descendants: true }, { propertyName: "parentNameInputs", predicate: ["parentNameInput"], descendants: true }], ngImport: i0, template: "@if (loading) {\n <div class=\"tree-skeleton\">\n <ui-skeleton-loader [inputs]=\"4\" [cols]=\"1\"></ui-skeleton-loader>\n </div>\n} @else {\n @for (item of tree; track item.id) {\n <div class=\"tree-item\" [class.is-collapsed]=\"!isExpanded(item)\">\n <div class=\"tree-header\" (click)=\"toggleItem(item)\">\n <i class=\"ri-arrow-down-s-line tree-arrow\" [class.is-collapsed]=\"!isExpanded(item)\"></i>\n <div class=\"tree-header-name\">\n @if (isEditingParent(item)) {\n <input\n #parentNameInput\n class=\"tree-name-input\"\n [attr.data-id]=\"item.id\"\n [value]=\"item.name\"\n (input)=\"updateParentName(item, $event)\"\n (blur)=\"finalizeParentEdit(item)\"\n (keydown.enter)=\"finalizeParentEdit(item)\"\n (keydown.escape)=\"cancelParentEdit(item)\"\n (click)=\"$event.stopPropagation()\"\n />\n } @else {\n <div class=\"tree-name-text\" (click)=\"startEditParent(item, $event)\">\n {{item.name}}\n </div>\n }\n <span>{{item.children?.length || 0}}</span>\n </div>\n <div>\n <ui-switch\n [checked]=\"item.enabled\"\n (click)=\"$event.stopPropagation()\"\n (checkedChange)=\"emitDeactivateParent(item, $event)\"\n ></ui-switch>\n </div>\n <ui-button (click)=\"addSubItem(item, $event)\" icon=\"ri-add-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n <ui-button (click)=\"emitEditParent(item, $event)\" icon=\"ri-edit-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n @if (!item.children?.length) {\n <ui-button (click)=\"emitDeleteParent(item, $event)\" icon=\"ri-delete-bin-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n }\n </div>\n <div class=\"tree-body\">\n @if (item.children?.length) {\n @for (subitem of item.children; track subitem.id) {\n <div\n class=\"tree-subitem\"\n [class.is-loading]=\"isCreatingChild(subitem)\"\n [class.is-disabled]=\"!subitem.enabled\"\n >\n <div class=\"tree-subitem-name\">\n <i\n class=\"ri-circle-fill tree-subitem-status\"\n [class.is-enabled]=\"subitem.enabled\"\n [class.is-disabled]=\"!subitem.enabled\"\n ></i>\n @if (isEditingChild(subitem)) {\n <input\n #childNameInput\n class=\"tree-name-input tree-name-input--sub\"\n [attr.data-id]=\"subitem.id\"\n [value]=\"subitem.name\"\n (input)=\"updateChildName(item, subitem, $event)\"\n (blur)=\"finalizeChildEdit(item, subitem)\"\n (keydown.enter)=\"finalizeChildEdit(item, subitem)\"\n (keydown.escape)=\"cancelChildEdit(item, subitem)\"\n (click)=\"$event.stopPropagation()\"\n />\n } @else {\n <span class=\"tree-name-text\" (click)=\"startEditChild(subitem, $event)\">{{subitem.name}}</span>\n }\n </div>\n <div class=\"tree-subitem-actions\">\n @if (isCreatingChild(subitem)) {\n <div class=\"tree-subitem-loader\"></div>\n } @else {\n <ui-switch\n [checked]=\"subitem.enabled\"\n (checkedChange)=\"emitDeactivateChild(item, subitem, $event)\"\n ></ui-switch>\n <ui-button (click)=\"emitEditChild(item, subitem, $event)\" icon=\"ri-edit-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n <ui-button (click)=\"emitDeleteChild(item, subitem, $event)\" icon=\"ri-delete-bin-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n }\n </div>\n </div>\n }\n } @else {\n <div class=\"tree-empty\">\n {{emptyMessage}}\n </div>\n }\n </div>\n </div>\n }\n}\n", styles: [":host{width:100%}.tree-item{border:solid 1px var(--grey-400);border-radius:10px;overflow:hidden;margin-bottom:4px;background:linear-gradient(180deg,var(--grey-100) 0%,var(--grey-50) 100%);transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease}.tree-header{width:100%;display:flex;align-items:center;gap:5px;padding:4px 10px;border-bottom:solid 1px var(--grey-400);background-color:var(--grey-100);cursor:pointer;transition:background-color .16s ease}.tree-header:hover{background-color:var(--grey-200)}.tree-header-name{flex:1 1;display:flex;align-items:center;gap:10px}.tree-header-name span{border-radius:10px;padding:2px 10px;font-size:10px;color:var(--blue-800);background-color:var(--blue-100)}.tree-arrow{transition:transform .18s ease}.tree-arrow.is-collapsed{transform:rotate(-90deg)}.tree-body{background-color:var(--white);padding:2px 16px;display:flex;flex-direction:column;gap:1px;max-height:600px;opacity:1;transition:max-height .2s ease,opacity .2s ease,padding .2s ease}.tree-empty{padding:8px 10px;font-size:12px;color:var(--grey-500);background-color:var(--grey-50);border-radius:8px}.tree-subitem{color:var(--grey-700);border-radius:5px;padding:3px 15px;gap:5px;font-size:13px;display:flex;align-items:center;justify-content:space-between}.tree-subitem-name{flex:1 1;display:inline-flex;align-items:center;gap:6px}.tree-subitem-status{font-size:10px;color:var(--grey-400)}.tree-subitem-status.is-enabled{color:var(--green-500)}.tree-subitem-status.is-disabled{color:var(--grey-400)}.tree-subitem-actions{display:inline-flex;align-items:center;gap:4px;opacity:0;pointer-events:none;transform:translateY(-2px);transition:opacity .16s ease,transform .16s ease}.tree-subitem-loader{width:46px;height:8px;border-radius:999px;background:linear-gradient(90deg,var(--grey-200) 0%,var(--grey-100) 40%,var(--grey-200) 80%);background-size:200% 100%;animation:shimmer 1.2s linear infinite}.tree-subitem:hover{background-color:var(--blue-100)}.tree-subitem:hover .tree-subitem-actions{opacity:1;pointer-events:auto;transform:translateY(0)}.tree-subitem.is-loading{opacity:.8}.tree-subitem.is-loading .tree-subitem-actions{opacity:1;pointer-events:none;transform:translateY(0)}.tree-subitem.is-disabled .tree-name-text,.tree-subitem.is-disabled .tree-name-input{color:var(--grey-500)}.tree-name-text{color:var(--grey-900);cursor:text}.tree-name-input{flex:1 1;min-width:0;width:300px;border:solid 1px var(--grey-300);border-radius:6px;padding:2px 6px;font-size:13px;color:var(--grey-900);background-color:var(--white);outline:none;transition:border-color .16s ease,box-shadow .16s ease}.tree-name-input:focus{border-color:var(--blue-500);box-shadow:0 0 0 2px #3b82f626}.tree-name-input--sub{font-size:12px;padding:1px 6px}.tree-item.is-collapsed .tree-body{max-height:0;opacity:0;padding-top:0;padding-bottom:0;overflow:hidden}.tree-skeleton{padding:8px;border:solid 1px var(--grey-400);border-radius:10px;background-color:var(--grey-50)}@keyframes shimmer{0%{background-position:0% 0%}to{background-position:200% 0%}}\n"], dependencies: [{ kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "component", type: UicSkeletonLoaderComponent, selector: "ui-skeleton-loader", inputs: ["inputs", "cols"] }, { kind: "component", type: UicSwichComponent, selector: "ui-switch", inputs: ["checked", "disabled", "placeholder", "label"], outputs: ["checkedChange"] }] });
|
|
5417
|
+
}
|
|
5418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicTreeAdminComponent, decorators: [{
|
|
5419
|
+
type: Component,
|
|
5420
|
+
args: [{ selector: 'ui-tree-admin', imports: [
|
|
5421
|
+
UicButtonComponent,
|
|
5422
|
+
UicSkeletonLoaderComponent,
|
|
5423
|
+
UicSwichComponent
|
|
5424
|
+
], template: "@if (loading) {\n <div class=\"tree-skeleton\">\n <ui-skeleton-loader [inputs]=\"4\" [cols]=\"1\"></ui-skeleton-loader>\n </div>\n} @else {\n @for (item of tree; track item.id) {\n <div class=\"tree-item\" [class.is-collapsed]=\"!isExpanded(item)\">\n <div class=\"tree-header\" (click)=\"toggleItem(item)\">\n <i class=\"ri-arrow-down-s-line tree-arrow\" [class.is-collapsed]=\"!isExpanded(item)\"></i>\n <div class=\"tree-header-name\">\n @if (isEditingParent(item)) {\n <input\n #parentNameInput\n class=\"tree-name-input\"\n [attr.data-id]=\"item.id\"\n [value]=\"item.name\"\n (input)=\"updateParentName(item, $event)\"\n (blur)=\"finalizeParentEdit(item)\"\n (keydown.enter)=\"finalizeParentEdit(item)\"\n (keydown.escape)=\"cancelParentEdit(item)\"\n (click)=\"$event.stopPropagation()\"\n />\n } @else {\n <div class=\"tree-name-text\" (click)=\"startEditParent(item, $event)\">\n {{item.name}}\n </div>\n }\n <span>{{item.children?.length || 0}}</span>\n </div>\n <div>\n <ui-switch\n [checked]=\"item.enabled\"\n (click)=\"$event.stopPropagation()\"\n (checkedChange)=\"emitDeactivateParent(item, $event)\"\n ></ui-switch>\n </div>\n <ui-button (click)=\"addSubItem(item, $event)\" icon=\"ri-add-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n <ui-button (click)=\"emitEditParent(item, $event)\" icon=\"ri-edit-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n @if (!item.children?.length) {\n <ui-button (click)=\"emitDeleteParent(item, $event)\" icon=\"ri-delete-bin-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n }\n </div>\n <div class=\"tree-body\">\n @if (item.children?.length) {\n @for (subitem of item.children; track subitem.id) {\n <div\n class=\"tree-subitem\"\n [class.is-loading]=\"isCreatingChild(subitem)\"\n [class.is-disabled]=\"!subitem.enabled\"\n >\n <div class=\"tree-subitem-name\">\n <i\n class=\"ri-circle-fill tree-subitem-status\"\n [class.is-enabled]=\"subitem.enabled\"\n [class.is-disabled]=\"!subitem.enabled\"\n ></i>\n @if (isEditingChild(subitem)) {\n <input\n #childNameInput\n class=\"tree-name-input tree-name-input--sub\"\n [attr.data-id]=\"subitem.id\"\n [value]=\"subitem.name\"\n (input)=\"updateChildName(item, subitem, $event)\"\n (blur)=\"finalizeChildEdit(item, subitem)\"\n (keydown.enter)=\"finalizeChildEdit(item, subitem)\"\n (keydown.escape)=\"cancelChildEdit(item, subitem)\"\n (click)=\"$event.stopPropagation()\"\n />\n } @else {\n <span class=\"tree-name-text\" (click)=\"startEditChild(subitem, $event)\">{{subitem.name}}</span>\n }\n </div>\n <div class=\"tree-subitem-actions\">\n @if (isCreatingChild(subitem)) {\n <div class=\"tree-subitem-loader\"></div>\n } @else {\n <ui-switch\n [checked]=\"subitem.enabled\"\n (checkedChange)=\"emitDeactivateChild(item, subitem, $event)\"\n ></ui-switch>\n <ui-button (click)=\"emitEditChild(item, subitem, $event)\" icon=\"ri-edit-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n <ui-button (click)=\"emitDeleteChild(item, subitem, $event)\" icon=\"ri-delete-bin-line\" type=\"ghost\" [iconOnly]=\"true\" size=\"s\"></ui-button>\n }\n </div>\n </div>\n }\n } @else {\n <div class=\"tree-empty\">\n {{emptyMessage}}\n </div>\n }\n </div>\n </div>\n }\n}\n", styles: [":host{width:100%}.tree-item{border:solid 1px var(--grey-400);border-radius:10px;overflow:hidden;margin-bottom:4px;background:linear-gradient(180deg,var(--grey-100) 0%,var(--grey-50) 100%);transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease}.tree-header{width:100%;display:flex;align-items:center;gap:5px;padding:4px 10px;border-bottom:solid 1px var(--grey-400);background-color:var(--grey-100);cursor:pointer;transition:background-color .16s ease}.tree-header:hover{background-color:var(--grey-200)}.tree-header-name{flex:1 1;display:flex;align-items:center;gap:10px}.tree-header-name span{border-radius:10px;padding:2px 10px;font-size:10px;color:var(--blue-800);background-color:var(--blue-100)}.tree-arrow{transition:transform .18s ease}.tree-arrow.is-collapsed{transform:rotate(-90deg)}.tree-body{background-color:var(--white);padding:2px 16px;display:flex;flex-direction:column;gap:1px;max-height:600px;opacity:1;transition:max-height .2s ease,opacity .2s ease,padding .2s ease}.tree-empty{padding:8px 10px;font-size:12px;color:var(--grey-500);background-color:var(--grey-50);border-radius:8px}.tree-subitem{color:var(--grey-700);border-radius:5px;padding:3px 15px;gap:5px;font-size:13px;display:flex;align-items:center;justify-content:space-between}.tree-subitem-name{flex:1 1;display:inline-flex;align-items:center;gap:6px}.tree-subitem-status{font-size:10px;color:var(--grey-400)}.tree-subitem-status.is-enabled{color:var(--green-500)}.tree-subitem-status.is-disabled{color:var(--grey-400)}.tree-subitem-actions{display:inline-flex;align-items:center;gap:4px;opacity:0;pointer-events:none;transform:translateY(-2px);transition:opacity .16s ease,transform .16s ease}.tree-subitem-loader{width:46px;height:8px;border-radius:999px;background:linear-gradient(90deg,var(--grey-200) 0%,var(--grey-100) 40%,var(--grey-200) 80%);background-size:200% 100%;animation:shimmer 1.2s linear infinite}.tree-subitem:hover{background-color:var(--blue-100)}.tree-subitem:hover .tree-subitem-actions{opacity:1;pointer-events:auto;transform:translateY(0)}.tree-subitem.is-loading{opacity:.8}.tree-subitem.is-loading .tree-subitem-actions{opacity:1;pointer-events:none;transform:translateY(0)}.tree-subitem.is-disabled .tree-name-text,.tree-subitem.is-disabled .tree-name-input{color:var(--grey-500)}.tree-name-text{color:var(--grey-900);cursor:text}.tree-name-input{flex:1 1;min-width:0;width:300px;border:solid 1px var(--grey-300);border-radius:6px;padding:2px 6px;font-size:13px;color:var(--grey-900);background-color:var(--white);outline:none;transition:border-color .16s ease,box-shadow .16s ease}.tree-name-input:focus{border-color:var(--blue-500);box-shadow:0 0 0 2px #3b82f626}.tree-name-input--sub{font-size:12px;padding:1px 6px}.tree-item.is-collapsed .tree-body{max-height:0;opacity:0;padding-top:0;padding-bottom:0;overflow:hidden}.tree-skeleton{padding:8px;border:solid 1px var(--grey-400);border-radius:10px;background-color:var(--grey-50)}@keyframes shimmer{0%{background-position:0% 0%}to{background-position:200% 0%}}\n"] }]
|
|
5425
|
+
}], propDecorators: { loading: [{
|
|
5426
|
+
type: Input
|
|
5427
|
+
}], emptyMessage: [{
|
|
5428
|
+
type: Input
|
|
5429
|
+
}], createSubcategoryFn: [{
|
|
5430
|
+
type: Input
|
|
5431
|
+
}], edit: [{
|
|
5432
|
+
type: Output
|
|
5433
|
+
}], remove: [{
|
|
5434
|
+
type: Output
|
|
5435
|
+
}], deactivate: [{
|
|
5436
|
+
type: Output
|
|
5437
|
+
}], nameChange: [{
|
|
5438
|
+
type: Output
|
|
5439
|
+
}], tree: [{
|
|
5440
|
+
type: Input
|
|
5441
|
+
}], childNameInputs: [{
|
|
5442
|
+
type: ViewChildren,
|
|
5443
|
+
args: ['childNameInput']
|
|
5444
|
+
}], parentNameInputs: [{
|
|
5445
|
+
type: ViewChildren,
|
|
5446
|
+
args: ['parentNameInput']
|
|
5447
|
+
}] } });
|
|
5448
|
+
|
|
5174
5449
|
const base = createValueAccessor();
|
|
5175
5450
|
class UicTagSelectorComponent extends base {
|
|
5176
5451
|
icon = ''; // Icono externo
|
|
@@ -5317,5 +5592,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5317
5592
|
* Generated bundle index. Do not edit.
|
|
5318
5593
|
*/
|
|
5319
5594
|
|
|
5320
|
-
export { DROPDOWN_OVERLAY_CONTROLS, FirstCapitalPipe, MODAL_CLOSE_EVENT, MODAL_CLOSE_REQUEST, MODAL_COMPONENT, MODAL_CONFIG, MODAL_DATA, UiDropdownCloseDirective, UiModalRef, UicAccordionComponent, UicActionButtonComponent, UicAlertContainerComponent, UicButtonComponent, UicCheckboxComponent, UicDatePickerComponent, UicDropdownContainerComponent, UicFileInputComponent, UicFormWrapperComponent, UicInputComponent, UicKpiCardComponent, UicModalService, UicMultySearcherComponent, UicMultySelectComponent, UicNameInitsPipe, UicOverlayCardComponent, UicPhoneInputComponent, UicPoolOptionsComponent, UicPortletCardComponent, UicPushAlertService, UicRadioComponent, UicSearcherComponent, UicSelectComponent, UicShortTableComponent, UicSignaturePadComponent, UicSkeletonLoaderComponent, UicSliderComponent, UicStepTabsComponent, UicStepsFormComponent, UicSwichComponent, UicTableComponent, UicTabsButtonComponent, UicTagSelectorComponent, UicTimePickerComponent, UicTinyAlertService, UicToolTipDirective, UicWorkPanelComponent, animatedRow, fadeAndRise, fadeBackdrop, helperFormMapFormdataToObject, helperTableMapDatoToColums, highlightRow, isMobile, pushTop, sideModal, simpleFade };
|
|
5595
|
+
export { DROPDOWN_OVERLAY_CONTROLS, FirstCapitalPipe, MODAL_CLOSE_EVENT, MODAL_CLOSE_REQUEST, MODAL_COMPONENT, MODAL_CONFIG, MODAL_DATA, UiDropdownCloseDirective, UiModalRef, UicAccordionComponent, UicActionButtonComponent, UicAlertContainerComponent, UicButtonComponent, UicCheckboxComponent, UicDatePickerComponent, UicDropdownContainerComponent, UicFileInputComponent, UicFormWrapperComponent, UicInputComponent, UicKpiCardComponent, UicModalService, UicMultySearcherComponent, UicMultySelectComponent, UicNameInitsPipe, UicOverlayCardComponent, UicPhoneInputComponent, UicPoolOptionsComponent, UicPortletCardComponent, UicPushAlertService, UicRadioComponent, UicSearcherComponent, UicSelectComponent, UicShortTableComponent, UicSignaturePadComponent, UicSkeletonLoaderComponent, UicSliderComponent, UicStepTabsComponent, UicStepsFormComponent, UicSwichComponent, UicTableComponent, UicTabsButtonComponent, UicTagSelectorComponent, UicTimePickerComponent, UicTinyAlertService, UicToolTipDirective, UicTreeAdminComponent, UicWorkPanelComponent, animatedRow, fadeAndRise, fadeBackdrop, helperFormMapFormdataToObject, helperTableMapDatoToColums, highlightRow, isMobile, pushTop, sideModal, simpleFade };
|
|
5321
5596
|
//# sourceMappingURL=ui-core-abv.mjs.map
|