keevo-components 2.0.172 → 2.0.173
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/esm2022/lib/components/kv-tree-environment/components/kv-tree-environment/kv-tree-environment.component.mjs +140 -43
- package/esm2022/lib/components/kv-tree-environment/components/no-arvore/no-arvore.component.mjs +60 -9
- package/esm2022/lib/components/kv-tree-environment/models/no-arvore.model.mjs +1 -1
- package/fesm2022/keevo-components.mjs +197 -50
- package/fesm2022/keevo-components.mjs.map +1 -1
- package/lib/components/kv-button/kv-button.component.d.ts +1 -1
- package/lib/components/kv-buttons/kv-button-popup/kv-button-popup.component.d.ts +1 -1
- package/lib/components/kv-table/kv-table.component.d.ts +1 -1
- package/lib/components/kv-table-draggable/kv-table-draggable.component.d.ts +1 -1
- package/lib/components/kv-table-expandable/kv-table-expandable.component.d.ts +1 -1
- package/lib/components/kv-tree-environment/components/kv-tree-environment/kv-tree-environment.component.d.ts +18 -3
- package/lib/components/kv-tree-environment/components/no-arvore/no-arvore.component.d.ts +11 -3
- package/lib/components/kv-tree-environment/models/no-arvore.model.d.ts +2 -0
- package/package.json +1 -1
|
@@ -13282,41 +13282,91 @@ class NoArvoreComponent {
|
|
|
13282
13282
|
constructor() {
|
|
13283
13283
|
this.noPlano = input.required();
|
|
13284
13284
|
this.noAlternado = new EventEmitter();
|
|
13285
|
+
this.actionExecuted = new EventEmitter();
|
|
13286
|
+
this._cachedItems = null;
|
|
13287
|
+
this._lastActionsLength = -1;
|
|
13288
|
+
this._lastActionsLabels = '';
|
|
13289
|
+
this._cachedStyles = {};
|
|
13290
|
+
}
|
|
13291
|
+
ngOnDestroy() {
|
|
13292
|
+
this._cachedItems = null;
|
|
13293
|
+
this._cachedStyles = {};
|
|
13294
|
+
this._lastActionsLength = -1;
|
|
13295
|
+
this._lastActionsLabels = '';
|
|
13285
13296
|
}
|
|
13286
13297
|
get items() {
|
|
13287
|
-
|
|
13298
|
+
const actionsOriginais = this.noPlano().dadosOriginais.actions || [];
|
|
13299
|
+
const currentLength = actionsOriginais.length;
|
|
13300
|
+
const currentLabels = actionsOriginais.map(a => a.label).join('|');
|
|
13301
|
+
if (this._lastActionsLength !== currentLength || this._lastActionsLabels !== currentLabels) {
|
|
13302
|
+
this._cachedItems = actionsOriginais.map(action => ({
|
|
13303
|
+
...action,
|
|
13304
|
+
command: undefined
|
|
13305
|
+
}));
|
|
13306
|
+
this._lastActionsLength = currentLength;
|
|
13307
|
+
this._lastActionsLabels = currentLabels;
|
|
13308
|
+
}
|
|
13309
|
+
return this._cachedItems || [];
|
|
13310
|
+
}
|
|
13311
|
+
getOriginalCommand(actionLabel) {
|
|
13312
|
+
const actionsOriginais = this.noPlano().dadosOriginais.actions || [];
|
|
13313
|
+
const action = actionsOriginais.find(a => a.label === actionLabel);
|
|
13314
|
+
return action?.command;
|
|
13288
13315
|
}
|
|
13289
13316
|
alternarExpansao() {
|
|
13290
13317
|
this.noAlternado.emit(this.noPlano());
|
|
13291
13318
|
}
|
|
13319
|
+
onActionClick(item, event) {
|
|
13320
|
+
this.actionExecuted.emit(this.noPlano());
|
|
13321
|
+
const originalCommand = this.getOriginalCommand(item.label);
|
|
13322
|
+
if (originalCommand) {
|
|
13323
|
+
originalCommand(event);
|
|
13324
|
+
}
|
|
13325
|
+
event.stopPropagation();
|
|
13326
|
+
event.preventDefault();
|
|
13327
|
+
}
|
|
13292
13328
|
ehNoPai() {
|
|
13293
13329
|
const no = this.noPlano().dadosOriginais;
|
|
13294
13330
|
return !!(no.filhos && no.filhos.length > 0);
|
|
13295
13331
|
}
|
|
13296
13332
|
obterEstilosIcone(no) {
|
|
13333
|
+
const cacheKey = `${no.rotulo}:${!!no.filhos?.length}:${no.ativo}:${no.cor}`;
|
|
13334
|
+
if (this._cachedStyles[cacheKey]) {
|
|
13335
|
+
return this._cachedStyles[cacheKey];
|
|
13336
|
+
}
|
|
13297
13337
|
const pai = no.filhos && no.filhos.length > 0;
|
|
13298
13338
|
const corPadrao = '#2f80ed';
|
|
13299
13339
|
const corFinal = no.cor || corPadrao;
|
|
13340
|
+
let estilos;
|
|
13300
13341
|
if (no.ativo === false) {
|
|
13301
|
-
|
|
13342
|
+
estilos = pai
|
|
13302
13343
|
? { 'background-color': '#f2f2f2', 'color': '#bdbdbd' }
|
|
13303
13344
|
: { 'background-color': 'transparent', 'color': '#bdbdbd' };
|
|
13304
13345
|
}
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13346
|
+
else {
|
|
13347
|
+
estilos = pai
|
|
13348
|
+
? { 'background-color': corFinal, 'color': 'white' }
|
|
13349
|
+
: { 'background-color': 'transparent', 'color': corFinal };
|
|
13350
|
+
}
|
|
13351
|
+
if (Object.keys(this._cachedStyles).length < 100) {
|
|
13352
|
+
this._cachedStyles[cacheKey] = estilos;
|
|
13353
|
+
}
|
|
13354
|
+
return estilos;
|
|
13308
13355
|
}
|
|
13309
13356
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NoArvoreComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
13310
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.8", type: NoArvoreComponent, isStandalone: true, selector: "no-arvore", inputs: { noPlano: { classPropertyName: "noPlano", publicName: "noPlano", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { noAlternado: "noAlternado" }, ngImport: i0, template: "<li \n class=\"no-container\"\n [class.inativo]=\"noPlano().dadosOriginais.ativo === false\">\n\n <div class=\"linhas-guia\">\n @for(i of [].constructor(noPlano().nivel); track i) {\n <div class=\"linha-vertical\"></div>\n }\n </div>\n\n <div \n class=\"no-conteudo\" \n [class.is-last-child]=\"noPlano().isLast\"\n (click)=\"alternarExpansao()\">\n\n <div class=\"container-icone\" [ngStyle]=\"obterEstilosIcone(noPlano().dadosOriginais)\">\n <span class=\"material-symbols-outlined text-lg no-icone\">\n {{ noPlano().dadosOriginais.icone }}\n </span>\n </div>\n\n <span \n class=\"no-rotulo\"\n [class.font-bold]=\"ehNoPai()\"\n [class.text-500]=\"ehNoPai()\">\n {{ noPlano().dadosOriginais.rotulo }}\n </span>\n\n @if (items.length > 0) {\n <span\n class=\"material-symbols-outlined flex text-lg ml-2 cursor-pointer icone-arrow\"\n (click)=\"$event.stopPropagation()\"\n (click)=\"menu.toggle($event)\"\n >\n more_horiz\n </span>\n\n <p-tieredMenu\n #menu\n [popup]=\"true\"\n [model]=\"items\"\n appendTo=\"body\"\n >\n <ng-template let-item pTemplate=\"item\">\n <div\n [pTooltip]=\"item.tooltip\"\n tooltipPosition=\"left\"\n class=\"cursor-pointer\"\n >\n <span class=\"text-xs\">\n {{ item.label }}\n </span>\n </div>\n </ng-template>\n </p-tieredMenu>\n }\n \n </div>\n \n \n</li>\n\n", styles: [":host{--ident-size: 2rem;--line-color: #e0e0e0;--line-width: 1px}.no-container{display:flex;align-items:stretch;position:relative}.linhas-guia{display:flex;flex-shrink:0;position:relative}.linha-vertical{width:var(--ident-size);position:relative}.linha-vertical:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:var(--line-width);background-color:var(--line-color)}.no-conteudo{display:flex;align-items:center;cursor:pointer;position:relative;padding:4px 4px 4px 0}.no-conteudo:before{content:\"\";position:absolute;left:calc(var(--ident-size) / -2);top:50%;width:calc(var(--ident-size) / 2);height:var(--line-width);background-color:var(--line-color)}.no-conteudo:hover{background-color:#0000000a;border-radius:4px}.is-last-child~.linhas-guia .linha-vertical:last-child:before,.is-last-child .linhas-guia .linha-vertical:last-child:before{height:50%}:host:first-child .no-conteudo:before,:host:first-child .linhas-guia{display:none}.no-seta{transition:transform .25s ease-in-out;color:#555;width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:24px}.no-seta.rotacionado{transform:rotate(0)}.no-seta:not(.rotacionado){transform:rotate(-90deg)}.container-icone{width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:3px;margin-right:8px;flex-shrink:0}.container-icone .no-icone{font-size:18px}.no-rotulo{font-family:system-ui,sans-serif;color:#333}.inativo .no-rotulo,.inativo .no-seta{color:#bdbdbd}.icone-arrow{font-weight:500;color:rgb(var(--kv-color-system),.75);transition:all .4s;height:15px;opacity:0;transition:opacity .2s ease,transform .2s ease;padding:1px}.icone-arrow:hover{background:#0000001a;border-radius:4px}.no-conteudo:hover .icone-arrow{opacity:1}::ng-deep .p-tieredmenu{padding:.5rem!important}::ng-deep .p-tieredmenu .p-tieredmenu-root-list{font-size:.75rem!important}::ng-deep .p-tieredmenu .p-menuitem>.p-menuitem-content{padding:.5rem}::ng-deep p-tieredmenusub .p-disabled *:active{pointer-events:none!important;font-size:.75rem!important;padding:.5rem!important}::ng-deep .p-disabled *{pointer-events:auto!important}.icon-more{font-weight:500;font-size:1.4rem!important;color:rgb(var(--kv-color-system),.75);transition:all .4s}.icon-more:hover,.icon-more:focus{color:#5e5e5e;transition:color .3s,transform .3s;background-color:#eaeaea;border-radius:50%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: TieredMenuModule }, { kind: "component", type: i13.TieredMenu, selector: "p-tieredMenu", inputs: ["model", "popup", "style", "styleClass", "appendTo", "autoZIndex", "baseZIndex", "autoDisplay", "showTransitionOptions", "hideTransitionOptions", "id", "ariaLabel", "ariaLabelledBy", "disabled", "tabindex"], outputs: ["onShow", "onHide"] }, { kind: "directive", type: i2$3.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i1$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }] }); }
|
|
13357
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.8", type: NoArvoreComponent, isStandalone: true, selector: "no-arvore", inputs: { noPlano: { classPropertyName: "noPlano", publicName: "noPlano", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { noAlternado: "noAlternado", actionExecuted: "actionExecuted" }, ngImport: i0, template: "<li \n class=\"no-container\"\n [class.inativo]=\"noPlano().dadosOriginais.ativo === false\">\n\n <div class=\"linhas-guia\">\n @for(i of [].constructor(noPlano().nivel); track i) {\n <div class=\"linha-vertical\"></div>\n }\n </div>\n\n <div \n class=\"no-conteudo\" \n [class.is-last-child]=\"noPlano().isLast\"\n (click)=\"alternarExpansao()\">\n\n <div class=\"container-icone\" [ngStyle]=\"obterEstilosIcone(noPlano().dadosOriginais)\">\n <span class=\"material-symbols-outlined text-lg no-icone\">\n {{ noPlano().dadosOriginais.icone }}\n </span>\n </div>\n\n <span \n class=\"no-rotulo\"\n [class.font-bold]=\"ehNoPai()\"\n [class.text-500]=\"ehNoPai()\">\n {{ noPlano().dadosOriginais.rotulo }}\n </span>\n\n @if (items.length > 0) {\n <span\n class=\"material-symbols-outlined flex text-lg ml-2 cursor-pointer icone-arrow\"\n (click)=\"$event.stopPropagation()\"\n (click)=\"menu.toggle($event)\"\n >\n more_horiz\n </span>\n\n <p-tieredMenu\n #menu\n [popup]=\"true\"\n [model]=\"items\"\n appendTo=\"body\"\n >\n <ng-template let-item pTemplate=\"item\">\n <div\n [pTooltip]=\"item.tooltip\"\n tooltipPosition=\"left\"\n class=\"cursor-pointer\"\n (click)=\"onActionClick(item, $event)\"\n >\n <span class=\"text-xs\">\n {{ item.label }}\n </span>\n </div>\n </ng-template>\n </p-tieredMenu>\n }\n \n </div>\n \n \n</li>\n\n", styles: [":host{--ident-size: 2rem;--line-color: #e0e0e0;--line-width: 1px}.no-container{display:flex;align-items:stretch;position:relative}.linhas-guia{display:flex;flex-shrink:0;position:relative}.linha-vertical{width:var(--ident-size);position:relative}.linha-vertical:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:var(--line-width);background-color:var(--line-color)}.no-conteudo{display:flex;align-items:center;cursor:pointer;position:relative;padding:4px 4px 4px 0}.no-conteudo:before{content:\"\";position:absolute;left:calc(var(--ident-size) / -2);top:50%;width:calc(var(--ident-size) / 2);height:var(--line-width);background-color:var(--line-color)}.no-conteudo:hover{background-color:#0000000a;border-radius:4px}.is-last-child~.linhas-guia .linha-vertical:last-child:before,.is-last-child .linhas-guia .linha-vertical:last-child:before{height:50%}:host:first-child .no-conteudo:before,:host:first-child .linhas-guia{display:none}.no-seta{transition:transform .25s ease-in-out;color:#555;width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:24px}.no-seta.rotacionado{transform:rotate(0)}.no-seta:not(.rotacionado){transform:rotate(-90deg)}.container-icone{width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:3px;margin-right:8px;flex-shrink:0}.container-icone .no-icone{font-size:18px}.no-rotulo{font-family:system-ui,sans-serif;color:#333}.inativo .no-rotulo,.inativo .no-seta{color:#bdbdbd}.icone-arrow{font-weight:500;color:rgb(var(--kv-color-system),.75);transition:all .4s;height:15px;opacity:0;transition:opacity .2s ease,transform .2s ease;padding:1px}.icone-arrow:hover{background:#0000001a;border-radius:4px}.no-conteudo:hover .icone-arrow{opacity:1}::ng-deep .p-tieredmenu{padding:.5rem!important}::ng-deep .p-tieredmenu .p-tieredmenu-root-list{font-size:.75rem!important}::ng-deep .p-tieredmenu .p-menuitem>.p-menuitem-content{padding:.5rem}::ng-deep p-tieredmenusub .p-disabled *:active{pointer-events:none!important;font-size:.75rem!important;padding:.5rem!important}::ng-deep .p-disabled *{pointer-events:auto!important}.icon-more{font-weight:500;font-size:1.4rem!important;color:rgb(var(--kv-color-system),.75);transition:all .4s}.icon-more:hover,.icon-more:focus{color:#5e5e5e;transition:color .3s,transform .3s;background-color:#eaeaea;border-radius:50%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: TieredMenuModule }, { kind: "component", type: i13.TieredMenu, selector: "p-tieredMenu", inputs: ["model", "popup", "style", "styleClass", "appendTo", "autoZIndex", "baseZIndex", "autoDisplay", "showTransitionOptions", "hideTransitionOptions", "id", "ariaLabel", "ariaLabelledBy", "disabled", "tabindex"], outputs: ["onShow", "onHide"] }, { kind: "directive", type: i2$3.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i1$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: TooltipModule }] }); }
|
|
13311
13358
|
}
|
|
13312
13359
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NoArvoreComponent, decorators: [{
|
|
13313
13360
|
type: Component,
|
|
13314
13361
|
args: [{ standalone: true, selector: 'no-arvore', imports: [
|
|
13315
13362
|
CommonModule,
|
|
13316
|
-
TieredMenuModule
|
|
13317
|
-
|
|
13363
|
+
TieredMenuModule,
|
|
13364
|
+
TooltipModule
|
|
13365
|
+
], template: "<li \n class=\"no-container\"\n [class.inativo]=\"noPlano().dadosOriginais.ativo === false\">\n\n <div class=\"linhas-guia\">\n @for(i of [].constructor(noPlano().nivel); track i) {\n <div class=\"linha-vertical\"></div>\n }\n </div>\n\n <div \n class=\"no-conteudo\" \n [class.is-last-child]=\"noPlano().isLast\"\n (click)=\"alternarExpansao()\">\n\n <div class=\"container-icone\" [ngStyle]=\"obterEstilosIcone(noPlano().dadosOriginais)\">\n <span class=\"material-symbols-outlined text-lg no-icone\">\n {{ noPlano().dadosOriginais.icone }}\n </span>\n </div>\n\n <span \n class=\"no-rotulo\"\n [class.font-bold]=\"ehNoPai()\"\n [class.text-500]=\"ehNoPai()\">\n {{ noPlano().dadosOriginais.rotulo }}\n </span>\n\n @if (items.length > 0) {\n <span\n class=\"material-symbols-outlined flex text-lg ml-2 cursor-pointer icone-arrow\"\n (click)=\"$event.stopPropagation()\"\n (click)=\"menu.toggle($event)\"\n >\n more_horiz\n </span>\n\n <p-tieredMenu\n #menu\n [popup]=\"true\"\n [model]=\"items\"\n appendTo=\"body\"\n >\n <ng-template let-item pTemplate=\"item\">\n <div\n [pTooltip]=\"item.tooltip\"\n tooltipPosition=\"left\"\n class=\"cursor-pointer\"\n (click)=\"onActionClick(item, $event)\"\n >\n <span class=\"text-xs\">\n {{ item.label }}\n </span>\n </div>\n </ng-template>\n </p-tieredMenu>\n }\n \n </div>\n \n \n</li>\n\n", styles: [":host{--ident-size: 2rem;--line-color: #e0e0e0;--line-width: 1px}.no-container{display:flex;align-items:stretch;position:relative}.linhas-guia{display:flex;flex-shrink:0;position:relative}.linha-vertical{width:var(--ident-size);position:relative}.linha-vertical:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:var(--line-width);background-color:var(--line-color)}.no-conteudo{display:flex;align-items:center;cursor:pointer;position:relative;padding:4px 4px 4px 0}.no-conteudo:before{content:\"\";position:absolute;left:calc(var(--ident-size) / -2);top:50%;width:calc(var(--ident-size) / 2);height:var(--line-width);background-color:var(--line-color)}.no-conteudo:hover{background-color:#0000000a;border-radius:4px}.is-last-child~.linhas-guia .linha-vertical:last-child:before,.is-last-child .linhas-guia .linha-vertical:last-child:before{height:50%}:host:first-child .no-conteudo:before,:host:first-child .linhas-guia{display:none}.no-seta{transition:transform .25s ease-in-out;color:#555;width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:24px}.no-seta.rotacionado{transform:rotate(0)}.no-seta:not(.rotacionado){transform:rotate(-90deg)}.container-icone{width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:3px;margin-right:8px;flex-shrink:0}.container-icone .no-icone{font-size:18px}.no-rotulo{font-family:system-ui,sans-serif;color:#333}.inativo .no-rotulo,.inativo .no-seta{color:#bdbdbd}.icone-arrow{font-weight:500;color:rgb(var(--kv-color-system),.75);transition:all .4s;height:15px;opacity:0;transition:opacity .2s ease,transform .2s ease;padding:1px}.icone-arrow:hover{background:#0000001a;border-radius:4px}.no-conteudo:hover .icone-arrow{opacity:1}::ng-deep .p-tieredmenu{padding:.5rem!important}::ng-deep .p-tieredmenu .p-tieredmenu-root-list{font-size:.75rem!important}::ng-deep .p-tieredmenu .p-menuitem>.p-menuitem-content{padding:.5rem}::ng-deep p-tieredmenusub .p-disabled *:active{pointer-events:none!important;font-size:.75rem!important;padding:.5rem!important}::ng-deep .p-disabled *{pointer-events:auto!important}.icon-more{font-weight:500;font-size:1.4rem!important;color:rgb(var(--kv-color-system),.75);transition:all .4s}.icon-more:hover,.icon-more:focus{color:#5e5e5e;transition:color .3s,transform .3s;background-color:#eaeaea;border-radius:50%}\n"] }]
|
|
13318
13366
|
}], propDecorators: { noAlternado: [{
|
|
13319
13367
|
type: Output
|
|
13368
|
+
}], actionExecuted: [{
|
|
13369
|
+
type: Output
|
|
13320
13370
|
}] } });
|
|
13321
13371
|
|
|
13322
13372
|
class KvTreeEnvironmentComponent {
|
|
@@ -13329,19 +13379,33 @@ class KvTreeEnvironmentComponent {
|
|
|
13329
13379
|
this.showButtonCollapsed = input(true);
|
|
13330
13380
|
this.showAddButton = input(true);
|
|
13331
13381
|
this.onAddClick = new EventEmitter();
|
|
13382
|
+
this.onSelectedItem = new EventEmitter();
|
|
13332
13383
|
this.mapaDeExpansao = new Map();
|
|
13384
|
+
this._cachedDados = null;
|
|
13385
|
+
this._dadosHash = null;
|
|
13386
|
+
this._cachedListaPlana = null;
|
|
13387
|
+
this._listaPlanaHash = null;
|
|
13333
13388
|
this.listaPlana = signal([]);
|
|
13334
13389
|
this.iconCollapsed = signal('collapse_all');
|
|
13335
13390
|
this.collapsedAll = signal(true);
|
|
13391
|
+
this.selectedItem = signal(null);
|
|
13336
13392
|
effect(() => {
|
|
13337
13393
|
const estrutura = this.estruturaArvore();
|
|
13338
13394
|
const dados = this.dadosArvore();
|
|
13339
13395
|
const simples = this.nosSimples();
|
|
13340
13396
|
const arvore = this.arvoreDeDados();
|
|
13341
|
-
const
|
|
13342
|
-
if (
|
|
13343
|
-
this.
|
|
13344
|
-
this.
|
|
13397
|
+
const dadosHash = this.criarHashDados(estrutura, dados, simples, arvore);
|
|
13398
|
+
if (this._dadosHash !== dadosHash) {
|
|
13399
|
+
this._dadosHash = dadosHash;
|
|
13400
|
+
this.invalidarCache();
|
|
13401
|
+
const temDados = estrutura.length > 0 || dados.length > 0 || simples.length > 0 || arvore.length > 0;
|
|
13402
|
+
if (temDados) {
|
|
13403
|
+
this.gerarListaPlanaOtimizada();
|
|
13404
|
+
this.atualizarEstadoCollapseButton();
|
|
13405
|
+
}
|
|
13406
|
+
else {
|
|
13407
|
+
this.listaPlana.set([]);
|
|
13408
|
+
}
|
|
13345
13409
|
}
|
|
13346
13410
|
}, { allowSignalWrites: true });
|
|
13347
13411
|
}
|
|
@@ -13354,25 +13418,71 @@ class KvTreeEnvironmentComponent {
|
|
|
13354
13418
|
return;
|
|
13355
13419
|
const estadoAtual = this.mapaDeExpansao.get(noPlano.dadosOriginais.rotulo) ?? false;
|
|
13356
13420
|
this.mapaDeExpansao.set(noPlano.dadosOriginais.rotulo, !estadoAtual);
|
|
13357
|
-
this.
|
|
13421
|
+
this._cachedListaPlana = null;
|
|
13422
|
+
this._listaPlanaHash = null;
|
|
13423
|
+
this.gerarListaPlanaOtimizada();
|
|
13358
13424
|
this.atualizarEstadoCollapseButton();
|
|
13359
13425
|
}
|
|
13360
|
-
|
|
13361
|
-
const
|
|
13362
|
-
const
|
|
13426
|
+
criarHashDados(estrutura, dados, simples, arvore) {
|
|
13427
|
+
const estruturaHash = `e:${estrutura.length}:${estrutura.map(e => `${e.id}:${e.label}`).join(',')}`;
|
|
13428
|
+
const dadosHash = `d:${dados.length}:${dados.map(d => `${d.id}`).join(',')}`;
|
|
13429
|
+
const simplesHash = `s:${simples.length}:${simples.map(s => s.key).join(',')}`;
|
|
13430
|
+
const arvoreHash = `a:${arvore.length}:${arvore.map(a => a.rotulo).join(',')}`;
|
|
13431
|
+
return `${estruturaHash}|${dadosHash}|${simplesHash}|${arvoreHash}`;
|
|
13432
|
+
}
|
|
13433
|
+
invalidarCache() {
|
|
13434
|
+
this._cachedDados = null;
|
|
13435
|
+
this._cachedListaPlana = null;
|
|
13436
|
+
this._listaPlanaHash = null;
|
|
13437
|
+
}
|
|
13438
|
+
gerarListaPlanaOtimizada() {
|
|
13439
|
+
const dados = this.obterDadosOtimizado();
|
|
13440
|
+
const expansaoHash = Array.from(this.mapaDeExpansao.entries())
|
|
13441
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
13442
|
+
.map(([k, v]) => `${k}:${v}`)
|
|
13443
|
+
.join(',');
|
|
13444
|
+
const listaPlanaHash = `${this._dadosHash}:${expansaoHash}`;
|
|
13445
|
+
if (this._listaPlanaHash === listaPlanaHash && this._cachedListaPlana) {
|
|
13446
|
+
this.listaPlana.set(this._cachedListaPlana);
|
|
13447
|
+
return;
|
|
13448
|
+
}
|
|
13449
|
+
const novaListaPlana = this.transformarParaListaPlanaOtimizada(dados);
|
|
13450
|
+
this._cachedListaPlana = novaListaPlana;
|
|
13451
|
+
this._listaPlanaHash = listaPlanaHash;
|
|
13363
13452
|
this.listaPlana.set(novaListaPlana);
|
|
13364
13453
|
}
|
|
13365
|
-
|
|
13454
|
+
onActionExecuted(noPlano) {
|
|
13455
|
+
const dados = noPlano.dadosOriginais;
|
|
13456
|
+
this.selectedItem.set(dados);
|
|
13457
|
+
this.onSelectedItem.emit(dados);
|
|
13458
|
+
}
|
|
13459
|
+
gerarListaPlana() {
|
|
13460
|
+
this.gerarListaPlanaOtimizada();
|
|
13461
|
+
}
|
|
13462
|
+
obterDadosOtimizado() {
|
|
13463
|
+
if (this._cachedDados && this._dadosHash) {
|
|
13464
|
+
return this._cachedDados;
|
|
13465
|
+
}
|
|
13366
13466
|
const estrutura = this.estruturaArvore();
|
|
13367
13467
|
const dados = this.dadosArvore();
|
|
13468
|
+
let resultado;
|
|
13368
13469
|
if (estrutura && estrutura.length > 0) {
|
|
13369
|
-
|
|
13470
|
+
resultado = this.combinarEstruturaComDados(estrutura, dados || []);
|
|
13370
13471
|
}
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13472
|
+
else {
|
|
13473
|
+
const nosSimples = this.nosSimples();
|
|
13474
|
+
if (nosSimples && nosSimples.length > 0) {
|
|
13475
|
+
resultado = this.converterSimplesParaCompleto(nosSimples);
|
|
13476
|
+
}
|
|
13477
|
+
else {
|
|
13478
|
+
resultado = this.arvoreDeDados();
|
|
13479
|
+
}
|
|
13374
13480
|
}
|
|
13375
|
-
|
|
13481
|
+
this._cachedDados = resultado;
|
|
13482
|
+
return resultado;
|
|
13483
|
+
}
|
|
13484
|
+
obterDados() {
|
|
13485
|
+
return this.obterDadosOtimizado();
|
|
13376
13486
|
}
|
|
13377
13487
|
converterSimplesParaCompleto(nosSimples) {
|
|
13378
13488
|
const mapa = new Map();
|
|
@@ -13406,23 +13516,35 @@ class KvTreeEnvironmentComponent {
|
|
|
13406
13516
|
return raiz;
|
|
13407
13517
|
}
|
|
13408
13518
|
transformarParaListaPlana(nodes, nivel = 0) {
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13519
|
+
return this.transformarParaListaPlanaOtimizada(nodes, nivel);
|
|
13520
|
+
}
|
|
13521
|
+
transformarParaListaPlanaOtimizada(nodes, nivel = 0) {
|
|
13522
|
+
const lista = [];
|
|
13523
|
+
const stack = [{ nodes, nivel, parentIndex: -1 }];
|
|
13524
|
+
while (stack.length > 0) {
|
|
13525
|
+
const { nodes: currentNodes, nivel: currentNivel, parentIndex } = stack.pop();
|
|
13526
|
+
currentNodes.forEach((node, index) => {
|
|
13527
|
+
const rotulo = node.rotulo;
|
|
13528
|
+
const estaExpandido = this.mapaDeExpansao.get(rotulo) ?? (node.estaExpandido ?? false);
|
|
13529
|
+
const temFilhos = !!(node.filhos && node.filhos.length > 0);
|
|
13530
|
+
const noPlano = {
|
|
13531
|
+
id: rotulo,
|
|
13532
|
+
nivel: currentNivel,
|
|
13533
|
+
expansivel: temFilhos,
|
|
13534
|
+
estaExpandido: estaExpandido,
|
|
13535
|
+
isLast: index === currentNodes.length - 1,
|
|
13536
|
+
dadosOriginais: node
|
|
13537
|
+
};
|
|
13538
|
+
lista.push(noPlano);
|
|
13539
|
+
if (estaExpandido && temFilhos) {
|
|
13540
|
+
stack.push({
|
|
13541
|
+
nodes: node.filhos,
|
|
13542
|
+
nivel: currentNivel + 1,
|
|
13543
|
+
parentIndex: lista.length - 1
|
|
13544
|
+
});
|
|
13545
|
+
}
|
|
13546
|
+
});
|
|
13547
|
+
}
|
|
13426
13548
|
return lista;
|
|
13427
13549
|
}
|
|
13428
13550
|
trackByNode(index, noPlano) {
|
|
@@ -13431,27 +13553,43 @@ class KvTreeEnvironmentComponent {
|
|
|
13431
13553
|
executeCollapsed() {
|
|
13432
13554
|
const todosColapsados = this.collapsedAll();
|
|
13433
13555
|
if (todosColapsados) {
|
|
13434
|
-
this.
|
|
13556
|
+
this.expandirTodosOtimizado();
|
|
13435
13557
|
}
|
|
13436
13558
|
else {
|
|
13437
|
-
this.
|
|
13559
|
+
this.colapsarTodosOtimizado();
|
|
13438
13560
|
}
|
|
13439
|
-
this.
|
|
13561
|
+
this._cachedListaPlana = null;
|
|
13562
|
+
this._listaPlanaHash = null;
|
|
13563
|
+
this.gerarListaPlanaOtimizada();
|
|
13440
13564
|
this.atualizarEstadoCollapseButton();
|
|
13441
13565
|
}
|
|
13442
13566
|
expandirTodos() {
|
|
13443
|
-
this.
|
|
13567
|
+
this.expandirTodosOtimizado();
|
|
13568
|
+
}
|
|
13569
|
+
colapsarTodos() {
|
|
13570
|
+
this.colapsarTodosOtimizado();
|
|
13571
|
+
}
|
|
13572
|
+
expandirTodosOtimizado() {
|
|
13573
|
+
const dados = this.obterDadosOtimizado();
|
|
13574
|
+
const stack = [...dados];
|
|
13575
|
+
while (stack.length > 0) {
|
|
13576
|
+
const node = stack.pop();
|
|
13444
13577
|
if (node.filhos && node.filhos.length > 0) {
|
|
13445
13578
|
this.mapaDeExpansao.set(node.rotulo, true);
|
|
13579
|
+
stack.push(...node.filhos);
|
|
13446
13580
|
}
|
|
13447
|
-
}
|
|
13581
|
+
}
|
|
13448
13582
|
}
|
|
13449
|
-
|
|
13450
|
-
this.
|
|
13583
|
+
colapsarTodosOtimizado() {
|
|
13584
|
+
const dados = this.obterDadosOtimizado();
|
|
13585
|
+
const stack = [...dados];
|
|
13586
|
+
while (stack.length > 0) {
|
|
13587
|
+
const node = stack.pop();
|
|
13451
13588
|
if (node.filhos && node.filhos.length > 0) {
|
|
13452
13589
|
this.mapaDeExpansao.set(node.rotulo, false);
|
|
13590
|
+
stack.push(...node.filhos);
|
|
13453
13591
|
}
|
|
13454
|
-
}
|
|
13592
|
+
}
|
|
13455
13593
|
}
|
|
13456
13594
|
percorrerTodosNos(nodes, callback) {
|
|
13457
13595
|
nodes.forEach(node => {
|
|
@@ -13498,7 +13636,8 @@ class KvTreeEnvironmentComponent {
|
|
|
13498
13636
|
ativo: dado?.ativo ?? true,
|
|
13499
13637
|
estaExpandido: est.estaExpandido,
|
|
13500
13638
|
filhos: [],
|
|
13501
|
-
actions: est.actions
|
|
13639
|
+
actions: est.actions,
|
|
13640
|
+
data: est.data
|
|
13502
13641
|
};
|
|
13503
13642
|
mapaEstrutura.set(est.id, no);
|
|
13504
13643
|
});
|
|
@@ -13519,8 +13658,14 @@ class KvTreeEnvironmentComponent {
|
|
|
13519
13658
|
executeAdd() {
|
|
13520
13659
|
this.onAddClick.emit();
|
|
13521
13660
|
}
|
|
13661
|
+
ngOnDestroy() {
|
|
13662
|
+
this._cachedDados = null;
|
|
13663
|
+
this._cachedListaPlana = null;
|
|
13664
|
+
this._dadosHash = '';
|
|
13665
|
+
this._listaPlanaHash = '';
|
|
13666
|
+
}
|
|
13522
13667
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: KvTreeEnvironmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
13523
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.8", type: KvTreeEnvironmentComponent, isStandalone: true, selector: "kv-tree-environment", inputs: { arvoreDeDados: { classPropertyName: "arvoreDeDados", publicName: "arvoreDeDados", isSignal: true, isRequired: false, transformFunction: null }, nosSimples: { classPropertyName: "nosSimples", publicName: "nosSimples", isSignal: true, isRequired: false, transformFunction: null }, estruturaArvore: { classPropertyName: "estruturaArvore", publicName: "estruturaArvore", isSignal: true, isRequired: false, transformFunction: null }, dadosArvore: { classPropertyName: "dadosArvore", publicName: "dadosArvore", isSignal: true, isRequired: false, transformFunction: null }, configuracao: { classPropertyName: "configuracao", publicName: "configuracao", isSignal: true, isRequired: false, transformFunction: null }, showButtonCollapsed: { classPropertyName: "showButtonCollapsed", publicName: "showButtonCollapsed", isSignal: true, isRequired: false, transformFunction: null }, showAddButton: { classPropertyName: "showAddButton", publicName: "showAddButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onAddClick: "onAddClick" }, ngImport: i0, template: "<div class=\"grid-container h-full\">\n <span \n class=\"material-symbols-outlined text-sm text-500 mx-1 p-1 cursor-pointer hover:surface-300\"\n style=\"border-radius: 4px; margin-top: 12px;\" \n (click)=\"executeCollapsed()\"\n [pTooltip]=\"collapsedAll() ? 'Expandir tudo' : 'Recolher tudo'\"\n >\n {{ iconCollapsed() }}\n </span>\n <cdk-virtual-scroll-viewport class=\"h-full w-full\" itemSize=\"40\">\n \n <ul class=\"lista-arvore-virtual pr-2 py-2\">\n <no-arvore \n *cdkVirtualFor=\"let no of listaPlana(); trackBy: trackByNode\" \n [noPlano]=\"no\"\n (noAlternado)=\"alternarNo($event)\" />\n </ul>\n\n </cdk-virtual-scroll-viewport>\n</div>", styles: [".grid-container{display:grid;grid-template-columns:auto 1fr;align-items:start}.lista-arvore-virtual{list-style:none;padding:0;margin:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: NoArvoreComponent, selector: "no-arvore", inputs: ["noPlano"], outputs: ["noAlternado"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1$8.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1$8.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1$8.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "ngmodule", type: PrimeNgModule }, { kind: "directive", type: i2$3.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] }); }
|
|
13668
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.8", type: KvTreeEnvironmentComponent, isStandalone: true, selector: "kv-tree-environment", inputs: { arvoreDeDados: { classPropertyName: "arvoreDeDados", publicName: "arvoreDeDados", isSignal: true, isRequired: false, transformFunction: null }, nosSimples: { classPropertyName: "nosSimples", publicName: "nosSimples", isSignal: true, isRequired: false, transformFunction: null }, estruturaArvore: { classPropertyName: "estruturaArvore", publicName: "estruturaArvore", isSignal: true, isRequired: false, transformFunction: null }, dadosArvore: { classPropertyName: "dadosArvore", publicName: "dadosArvore", isSignal: true, isRequired: false, transformFunction: null }, configuracao: { classPropertyName: "configuracao", publicName: "configuracao", isSignal: true, isRequired: false, transformFunction: null }, showButtonCollapsed: { classPropertyName: "showButtonCollapsed", publicName: "showButtonCollapsed", isSignal: true, isRequired: false, transformFunction: null }, showAddButton: { classPropertyName: "showAddButton", publicName: "showAddButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onAddClick: "onAddClick", onSelectedItem: "onSelectedItem" }, ngImport: i0, template: "<div class=\"grid-container h-full\">\n <span \n class=\"material-symbols-outlined text-sm text-500 mx-1 p-1 cursor-pointer hover:surface-300\"\n style=\"border-radius: 4px; margin-top: 12px;\" \n (click)=\"executeCollapsed()\"\n [pTooltip]=\"collapsedAll() ? 'Expandir tudo' : 'Recolher tudo'\"\n >\n {{ iconCollapsed() }}\n </span>\n <cdk-virtual-scroll-viewport class=\"h-full w-full\" itemSize=\"40\">\n \n <ul class=\"lista-arvore-virtual pr-2 py-2\">\n <no-arvore \n *cdkVirtualFor=\"let no of listaPlana(); trackBy: trackByNode\" \n [noPlano]=\"no\"\n (noAlternado)=\"alternarNo($event)\"\n (actionExecuted)=\"onActionExecuted($event)\" />\n </ul>\n\n </cdk-virtual-scroll-viewport>\n</div>", styles: [".grid-container{display:grid;grid-template-columns:auto 1fr;align-items:start}.lista-arvore-virtual{list-style:none;padding:0;margin:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: NoArvoreComponent, selector: "no-arvore", inputs: ["noPlano"], outputs: ["noAlternado", "actionExecuted"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1$8.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1$8.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1$8.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "ngmodule", type: PrimeNgModule }, { kind: "directive", type: i2$3.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] }); }
|
|
13524
13669
|
}
|
|
13525
13670
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: KvTreeEnvironmentComponent, decorators: [{
|
|
13526
13671
|
type: Component,
|
|
@@ -13529,9 +13674,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImpor
|
|
|
13529
13674
|
NoArvoreComponent,
|
|
13530
13675
|
ScrollingModule,
|
|
13531
13676
|
PrimeNgModule
|
|
13532
|
-
], template: "<div class=\"grid-container h-full\">\n <span \n class=\"material-symbols-outlined text-sm text-500 mx-1 p-1 cursor-pointer hover:surface-300\"\n style=\"border-radius: 4px; margin-top: 12px;\" \n (click)=\"executeCollapsed()\"\n [pTooltip]=\"collapsedAll() ? 'Expandir tudo' : 'Recolher tudo'\"\n >\n {{ iconCollapsed() }}\n </span>\n <cdk-virtual-scroll-viewport class=\"h-full w-full\" itemSize=\"40\">\n \n <ul class=\"lista-arvore-virtual pr-2 py-2\">\n <no-arvore \n *cdkVirtualFor=\"let no of listaPlana(); trackBy: trackByNode\" \n [noPlano]=\"no\"\n (noAlternado)=\"alternarNo($event)\" />\n </ul>\n\n </cdk-virtual-scroll-viewport>\n</div>", styles: [".grid-container{display:grid;grid-template-columns:auto 1fr;align-items:start}.lista-arvore-virtual{list-style:none;padding:0;margin:0}\n"] }]
|
|
13677
|
+
], template: "<div class=\"grid-container h-full\">\n <span \n class=\"material-symbols-outlined text-sm text-500 mx-1 p-1 cursor-pointer hover:surface-300\"\n style=\"border-radius: 4px; margin-top: 12px;\" \n (click)=\"executeCollapsed()\"\n [pTooltip]=\"collapsedAll() ? 'Expandir tudo' : 'Recolher tudo'\"\n >\n {{ iconCollapsed() }}\n </span>\n <cdk-virtual-scroll-viewport class=\"h-full w-full\" itemSize=\"40\">\n \n <ul class=\"lista-arvore-virtual pr-2 py-2\">\n <no-arvore \n *cdkVirtualFor=\"let no of listaPlana(); trackBy: trackByNode\" \n [noPlano]=\"no\"\n (noAlternado)=\"alternarNo($event)\"\n (actionExecuted)=\"onActionExecuted($event)\" />\n </ul>\n\n </cdk-virtual-scroll-viewport>\n</div>", styles: [".grid-container{display:grid;grid-template-columns:auto 1fr;align-items:start}.lista-arvore-virtual{list-style:none;padding:0;margin:0}\n"] }]
|
|
13533
13678
|
}], ctorParameters: () => [], propDecorators: { onAddClick: [{
|
|
13534
13679
|
type: Output
|
|
13680
|
+
}], onSelectedItem: [{
|
|
13681
|
+
type: Output
|
|
13535
13682
|
}] } });
|
|
13536
13683
|
|
|
13537
13684
|
/*
|