@seniorsistemas/components-ai 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6956,8 +6956,8 @@ class DynamicFormComponent {
6956
6956
  if (control) {
6957
6957
  const shouldDisable = this.isFieldDisabled(field);
6958
6958
  if (shouldDisable && control.enabled) {
6959
- control.setValue(null, { emitEvent: false });
6960
6959
  control.disable({ emitEvent: false });
6960
+ control.setValue(null);
6961
6961
  }
6962
6962
  else if (!shouldDisable && control.disabled && !field.disabled) {
6963
6963
  control.enable({ emitEvent: false });
@@ -7551,6 +7551,142 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
7551
7551
  args: ['blur', ['$event']]
7552
7552
  }] } });
7553
7553
 
7554
+ const STORAGE_KEY = 'sia-layout-expanded';
7555
+ /**
7556
+ * Directive that injects an expand/collapse toggle button into elements
7557
+ * with the `.layout-main` class. The button is only visible on screens
7558
+ * wider than 1400px (where the max-width constraint is active).
7559
+ *
7560
+ * When expanded, the element gets `max-width: 100%` removing the 1400px cap.
7561
+ * The user preference is persisted in localStorage.
7562
+ *
7563
+ * Usage:
7564
+ * Just import the directive in your standalone component or module.
7565
+ * It auto-applies to any element with class `.layout-main`.
7566
+ *
7567
+ * ```ts
7568
+ * imports: [LayoutExpandDirective]
7569
+ * ```
7570
+ */
7571
+ class LayoutExpandDirective {
7572
+ el;
7573
+ renderer;
7574
+ button = null;
7575
+ styleEl = null;
7576
+ expanded = false;
7577
+ constructor(el, renderer) {
7578
+ this.el = el;
7579
+ this.renderer = renderer;
7580
+ }
7581
+ ngAfterViewInit() {
7582
+ this.expanded = localStorage.getItem(STORAGE_KEY) === 'true';
7583
+ this.injectStyles();
7584
+ this.createButton();
7585
+ this.applyState();
7586
+ }
7587
+ ngOnDestroy() {
7588
+ this.button?.remove();
7589
+ this.styleEl?.remove();
7590
+ }
7591
+ toggle() {
7592
+ this.expanded = !this.expanded;
7593
+ localStorage.setItem(STORAGE_KEY, String(this.expanded));
7594
+ this.applyState();
7595
+ }
7596
+ applyState() {
7597
+ const host = this.el.nativeElement;
7598
+ if (this.expanded) {
7599
+ this.renderer.addClass(host, 'layout-main--expanded');
7600
+ }
7601
+ else {
7602
+ this.renderer.removeClass(host, 'layout-main--expanded');
7603
+ }
7604
+ if (this.button) {
7605
+ const icon = this.button.querySelector('i');
7606
+ if (icon) {
7607
+ icon.className = this.expanded ? 'pi pi-window-minimize' : 'pi pi-window-maximize';
7608
+ }
7609
+ this.button.title = this.expanded ? 'Recolher layout' : 'Expandir layout';
7610
+ }
7611
+ }
7612
+ createButton() {
7613
+ const host = this.el.nativeElement;
7614
+ this.button = this.renderer.createElement('button');
7615
+ this.renderer.addClass(this.button, 'sia-layout-expand-btn');
7616
+ this.renderer.setAttribute(this.button, 'type', 'button');
7617
+ this.renderer.setAttribute(this.button, 'title', this.expanded ? 'Recolher layout' : 'Expandir layout');
7618
+ this.renderer.setAttribute(this.button, 'aria-label', 'Expandir ou recolher layout');
7619
+ const icon = this.renderer.createElement('i');
7620
+ icon.className = this.expanded ? 'pi pi-window-minimize' : 'pi pi-window-maximize';
7621
+ this.renderer.appendChild(this.button, icon);
7622
+ this.renderer.listen(this.button, 'click', () => this.toggle());
7623
+ this.renderer.appendChild(host, this.button);
7624
+ }
7625
+ injectStyles() {
7626
+ const host = this.el.nativeElement;
7627
+ // Ensure host is positioned for absolute child
7628
+ const currentPosition = getComputedStyle(host).position;
7629
+ if (currentPosition === 'static') {
7630
+ this.renderer.setStyle(host, 'position', 'relative');
7631
+ }
7632
+ this.styleEl = this.renderer.createElement('style');
7633
+ this.styleEl.textContent = `
7634
+ .layout-main--expanded {
7635
+ max-width: 100% !important;
7636
+ transition: max-width 0.3s ease;
7637
+ }
7638
+
7639
+ .sia-layout-expand-btn {
7640
+ display: none;
7641
+ position: absolute;
7642
+ top: 0.75rem;
7643
+ right: 0.75rem;
7644
+ background: var(--p-surface-0, #ffffff);
7645
+ border: 1px solid var(--p-surface-200, #e2e8f0);
7646
+ border-radius: 6px;
7647
+ padding: 0.5rem;
7648
+ cursor: pointer;
7649
+ color: var(--p-surface-600, #64748b);
7650
+ font-size: 1rem;
7651
+ line-height: 1;
7652
+ transition: all 0.2s ease;
7653
+ z-index: 10;
7654
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
7655
+ }
7656
+
7657
+ .sia-layout-expand-btn:hover {
7658
+ background: var(--p-surface-50, #f8fafc);
7659
+ color: var(--p-primary-color, #3b82f6);
7660
+ border-color: var(--p-primary-color, #3b82f6);
7661
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
7662
+ }
7663
+
7664
+ .sia-layout-expand-btn:active {
7665
+ transform: scale(0.95);
7666
+ }
7667
+
7668
+ @media (min-width: 1401px) {
7669
+ .sia-layout-expand-btn {
7670
+ display: flex;
7671
+ align-items: center;
7672
+ justify-content: center;
7673
+ }
7674
+ }
7675
+ `;
7676
+ this.renderer.appendChild(host, this.styleEl);
7677
+ }
7678
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LayoutExpandDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
7679
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: LayoutExpandDirective, isStandalone: true, selector: ".layout-main", ngImport: i0 });
7680
+ }
7681
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LayoutExpandDirective, decorators: [{
7682
+ type: Directive,
7683
+ args: [{
7684
+ // eslint-disable-next-line @angular-eslint/directive-selector
7685
+ selector: '.layout-main',
7686
+ standalone: true,
7687
+ }]
7688
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }] });
7689
+
7554
7690
  class CpfPipe {
7555
7691
  maskService;
7556
7692
  constructor(maskService) {
@@ -8098,5 +8234,5 @@ const throttle = (func, limit) => {
8098
8234
  * Generated bundle index. Do not edit.
8099
8235
  */
8100
8236
 
8101
- export { AngularComponentsModule, AuthService, BreadcrumbComponent, BulkDeleteDialogComponent, CnpjPipe, CookieService, CpfPipe, DEFAULT_LANGUAGE, DateFormatPipe, DocumentMaskDirective, DocumentPipe, DynamicFieldCheckboxComponent, DynamicFieldDateComponent, DynamicFieldDropdownComponent, DynamicFieldImageComponent, DynamicFieldLookupComponent, DynamicFieldMultiselectComponent, DynamicFieldNumberComponent, DynamicFieldTextComponent, DynamicFieldTextareaComponent, DynamicFieldTimeComponent, DynamicFieldWrapperComponent, DynamicFormComponent, EntityListBaseComponent, EntityService, ExportDialogComponent, FieldType, IassistIconComponent, KanbanBoardComponent, LoadingComponent, LocaleService, MaskService, MoneyMaskDirective, MoneyPipe, PermissionService, PhoneMaskDirective, PhonePipe, PostalCodeMaskDirective, PostalCodePipe, SUPPORTED_LANGUAGES, SeniorPreset, SeniorTokenService, StepsComponent, TRANSLATION_CONFIG, TableLoadingDirective, ThemeService, TranslatePipe, TranslationHelper, TranslationService, WebSocketService, apiInterceptor, createFilterString, createFilterTokens, debounce, deepClone, deepEqual, escapeFilterValue, getEnumQuery, getLabelValueRequest, getLanguageInfo, getProp, getSuggestionValue, getTypeInformation, isValidFilter, mapTokenLocaleToLanguage, mergeUnique, provideSeniorPrimeNG, resolveRefs, setProp, throttle };
8237
+ export { AngularComponentsModule, AuthService, BreadcrumbComponent, BulkDeleteDialogComponent, CnpjPipe, CookieService, CpfPipe, DEFAULT_LANGUAGE, DateFormatPipe, DocumentMaskDirective, DocumentPipe, DynamicFieldCheckboxComponent, DynamicFieldDateComponent, DynamicFieldDropdownComponent, DynamicFieldImageComponent, DynamicFieldLookupComponent, DynamicFieldMultiselectComponent, DynamicFieldNumberComponent, DynamicFieldTextComponent, DynamicFieldTextareaComponent, DynamicFieldTimeComponent, DynamicFieldWrapperComponent, DynamicFormComponent, EntityListBaseComponent, EntityService, ExportDialogComponent, FieldType, IassistIconComponent, KanbanBoardComponent, LayoutExpandDirective, LoadingComponent, LocaleService, MaskService, MoneyMaskDirective, MoneyPipe, PermissionService, PhoneMaskDirective, PhonePipe, PostalCodeMaskDirective, PostalCodePipe, SUPPORTED_LANGUAGES, SeniorPreset, SeniorTokenService, StepsComponent, TRANSLATION_CONFIG, TableLoadingDirective, ThemeService, TranslatePipe, TranslationHelper, TranslationService, WebSocketService, apiInterceptor, createFilterString, createFilterTokens, debounce, deepClone, deepEqual, escapeFilterValue, getEnumQuery, getLabelValueRequest, getLanguageInfo, getProp, getSuggestionValue, getTypeInformation, isValidFilter, mapTokenLocaleToLanguage, mergeUnique, provideSeniorPrimeNG, resolveRefs, setProp, throttle };
8102
8238
  //# sourceMappingURL=seniorsistemas-components-ai.mjs.map