@tinya-code/gas-admin-ui 0.2.0-alpha.13 → 0.2.0-alpha.17

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.
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./tinya-code-gas-admin-ui-rolldown-runtime-DpJrqANO.mjs";
2
2
  import { _ as DEFAULT_RESPONSE_UNWRAP, a as provideFirebaseAdapter, b as ApiError, c as ConfigService, d as AuthService, f as LOGIN_PATH, g as API_URL, h as API_DRIVER, i as getSchema, l as ApiService, m as SESSION_USER_KEY, n as allSchemas, o as provideGasAdmin, p as SESSION_TOKEN_KEY, r as getAuth, s as setSchemaCatalog, t as GAS_SCHEMAS, u as apiErrorInterceptor, v as FIREBASE_AUTH_ADAPTER, x as renewedTokenOf, y as VALUE_SOURCES } from "./tinya-code-gas-admin-ui-schema-catalog-D0Pk0wAN.mjs";
3
- import { a as register, c as unregister, d as SUPPORTED_FIELD_TYPE_LIST, f as fieldDescriptors, i as provideRenderDescriptors, l as viewDescriptors, m as columnFormatDescriptors, n as get, o as renderKinds, p as COLUMN_FORMAT_TYPES, r as isSupported, u as layoutDescriptors } from "./tinya-code-gas-admin-ui-render-registry-CULkxrSt.mjs";
3
+ import { a as register, c as unregister, d as SUPPORTED_FIELD_TYPE_LIST, f as fieldDescriptors, i as provideRenderDescriptors, l as viewDescriptors, m as columnFormatDescriptors, n as get, o as renderKinds, p as COLUMN_FORMAT_TYPES, r as isSupported, u as layoutDescriptors } from "./tinya-code-gas-admin-ui-render-registry-B88Pme-y.mjs";
4
4
  import { n as ViewNavigationService, t as evaluateCondition } from "./tinya-code-gas-admin-ui-condition-evaluator-DY2k1M3C.mjs";
5
5
  import { t as Button } from "./tinya-code-gas-admin-ui-button-BQjNW8KB.mjs";
6
6
  import { t as NotificationService } from "./tinya-code-gas-admin-ui-notification.service-LjSULER6.mjs";
@@ -10,14 +10,14 @@ import { t as ErrorMapperService } from "./tinya-code-gas-admin-ui-error-mapper.
10
10
  import { t as UploadService } from "./tinya-code-gas-admin-ui-upload.service-CZPEPCeN.mjs";
11
11
  import { t as EmptyState } from "./tinya-code-gas-admin-ui-empty-state-BMc0QtoT.mjs";
12
12
  import { a as stringItemTree, i as listTree, n as groupTree, r as itemTree, t as childTree } from "./tinya-code-gas-admin-ui-field-node-CIK6KNN_.mjs";
13
- import { _ as resolveShare, a as DrawerForm, c as buildFormSchema, d as actionTypes, f as actionsFor, g as isTriggerAction, h as isShareAction, i as CopyShare, l as FieldHost, m as registerAction, o as buildPayload, p as getAction, r as Modal, s as seedModel, t as FormView, u as actionType, v as RenderHost } from "./tinya-code-gas-admin-ui-form-view-C709rc57.mjs";
13
+ import { _ as resolveShare, a as DrawerForm, c as buildFormSchema, d as actionTypes, f as actionsFor, g as isTriggerAction, h as isShareAction, i as CopyShare, l as FieldHost, m as registerAction, o as buildPayload, p as getAction, r as Modal, s as seedModel, t as FormView, u as actionType, v as writeClipboard, y as RenderHost } from "./tinya-code-gas-admin-ui-form-view-CEe7aZ4m.mjs";
14
14
  import { t as Skeleton } from "./tinya-code-gas-admin-ui-skeleton-DnWK0tcZ.mjs";
15
15
  import { t as getValue } from "./tinya-code-gas-admin-ui-field-path-B4-FTBGZ.mjs";
16
16
  import * as i0 from "@angular/core";
17
17
  import { ChangeDetectionStrategy, Component, EnvironmentInjector, Injector, Service, ViewContainerRef, computed, effect, inject, input, model, output, resource, signal, viewChild } from "@angular/core";
18
18
  import { catchError, combineLatest, distinctUntilChanged, firstValueFrom, map, of, switchMap } from "rxjs";
19
19
  import { ActivatedRoute, Router, RouterLink, RouterLinkActive, RouterOutlet, convertToParamMap } from "@angular/router";
20
- import { LucideArrowLeft, LucideChevronDown, LucideChevronRight, LucideChevronUp, LucideCircleCheck, LucideCircleX, LucideDynamicIcon, LucideExternalLink, LucideEye, LucideGripVertical, LucideInfo, LucideLogOut, LucideMonitor, LucideMoon, LucidePencil, LucidePlus, LucideRotateCw, LucideSun, LucideTrash2, LucideX, LucideZap } from "@lucide/angular";
20
+ import { LucideArrowLeft, LucideCheck, LucideChevronDown, LucideChevronRight, LucideChevronUp, LucideCircleCheck, LucideCircleX, LucideCopy, LucideDynamicIcon, LucideExternalLink, LucideEye, LucideGripVertical, LucideInfo, LucideLogOut, LucideMonitor, LucideMoon, LucidePencil, LucidePlus, LucideRotateCw, LucideSun, LucideTrash2, LucideX, LucideZap } from "@lucide/angular";
21
21
  import { takeUntilDestroyed, toObservable, toSignal } from "@angular/core/rxjs-interop";
22
22
  import { CdkDrag, CdkDragHandle, CdkDropList } from "@angular/cdk/drag-drop";
23
23
  const authGuard = () => {
@@ -2773,6 +2773,129 @@ i0.ɵɵngDeclareClassMetadata({
2773
2773
  }]
2774
2774
  }
2775
2775
  });
2776
+ var CopyButton = class CopyButton {
2777
+ value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
2778
+ notify = inject(NotificationService);
2779
+ copied = signal(false, ...ngDevMode ? [{ debugName: "copied" }] : /* istanbul ignore next */ []);
2780
+ copied$ = this.copied.asReadonly();
2781
+ async copy() {
2782
+ const text = String(this.value() ?? "");
2783
+ if (await writeClipboard(text)) {
2784
+ this.copied.set(true);
2785
+ this.notify.success("Copiado al portapapeles.");
2786
+ setTimeout(() => this.copied.set(false), 1500);
2787
+ } else this.notify.error("No se pudo copiar.");
2788
+ }
2789
+ static ɵfac = i0.ɵɵngDeclareFactory({
2790
+ minVersion: "12.0.0",
2791
+ version: "22.2.3",
2792
+ ngImport: i0,
2793
+ type: CopyButton,
2794
+ deps: [],
2795
+ target: i0.ɵɵFactoryTarget.Component
2796
+ });
2797
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2798
+ minVersion: "17.0.0",
2799
+ version: "22.2.3",
2800
+ type: CopyButton,
2801
+ isStandalone: true,
2802
+ selector: "app-copy-button",
2803
+ inputs: { value: {
2804
+ classPropertyName: "value",
2805
+ publicName: "value",
2806
+ isSignal: true,
2807
+ isRequired: true,
2808
+ transformFunction: null
2809
+ } },
2810
+ ngImport: i0,
2811
+ template: `
2812
+ <button
2813
+ app-button
2814
+ type="button"
2815
+ variant="ghost"
2816
+ size="icon"
2817
+ [disabled]="copied()"
2818
+ (click)="copy()"
2819
+ [title]="'Copiar ' + value()"
2820
+ class="text-neutral hover:text-primary"
2821
+ >
2822
+ @if (copied()) {
2823
+ <svg lucideCheck size="16" class="text-primary" />
2824
+ } @else {
2825
+ <svg lucideCopy size="16" />
2826
+ }
2827
+ </button>
2828
+ `,
2829
+ isInline: true,
2830
+ dependencies: [
2831
+ {
2832
+ kind: "component",
2833
+ type: Button,
2834
+ selector: "button[app-button]",
2835
+ inputs: [
2836
+ "variant",
2837
+ "size",
2838
+ "type",
2839
+ "disabled",
2840
+ "loading"
2841
+ ]
2842
+ },
2843
+ {
2844
+ kind: "component",
2845
+ type: LucideCopy,
2846
+ selector: "svg[lucideCopy]"
2847
+ },
2848
+ {
2849
+ kind: "component",
2850
+ type: LucideCheck,
2851
+ selector: "svg[lucideCheck]"
2852
+ }
2853
+ ]
2854
+ });
2855
+ };
2856
+ i0.ɵɵngDeclareClassMetadata({
2857
+ minVersion: "12.0.0",
2858
+ version: "22.2.3",
2859
+ ngImport: i0,
2860
+ type: CopyButton,
2861
+ decorators: [{
2862
+ type: Component,
2863
+ args: [{
2864
+ selector: "app-copy-button",
2865
+ imports: [
2866
+ Button,
2867
+ LucideCopy,
2868
+ LucideCheck
2869
+ ],
2870
+ template: `
2871
+ <button
2872
+ app-button
2873
+ type="button"
2874
+ variant="ghost"
2875
+ size="icon"
2876
+ [disabled]="copied()"
2877
+ (click)="copy()"
2878
+ [title]="'Copiar ' + value()"
2879
+ class="text-neutral hover:text-primary"
2880
+ >
2881
+ @if (copied()) {
2882
+ <svg lucideCheck size="16" class="text-primary" />
2883
+ } @else {
2884
+ <svg lucideCopy size="16" />
2885
+ }
2886
+ </button>
2887
+ `
2888
+ }]
2889
+ }],
2890
+ propDecorators: { value: [{
2891
+ type: i0.Input,
2892
+ args: [{
2893
+ isSignal: true,
2894
+ alias: "value",
2895
+ required: true
2896
+ }]
2897
+ }] }
2898
+ });
2776
2899
  var DetailView = class DetailView {
2777
2900
  api = inject(ApiService, { optional: true });
2778
2901
  actionService = inject(ActionService);
@@ -2930,6 +3053,9 @@ var DetailView = class DetailView {
2930
3053
  hasLargeContent(section) {
2931
3054
  return section.fields.some((f) => this.esHistorial(f) || f.key === "description");
2932
3055
  }
3056
+ colSpanFor(width) {
3057
+ return `lg:col-span-${Math.min(width ?? 6, 9)}`;
3058
+ }
2933
3059
  shareOf(action) {
2934
3060
  return resolveShare(action, this.actionService.vars(this.effectiveRecord()));
2935
3061
  }
@@ -3102,17 +3228,20 @@ var DetailView = class DetailView {
3102
3228
  <div class="p-5 flex-1 space-y-4">
3103
3229
  <!-- Grid para campos regulares -->
3104
3230
  @if (regularFields(section).length > 0) {
3105
- <dl class="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2">
3231
+ <dl class="grid grid-cols-1 gap-x-6 gap-y-4 lg:grid-cols-12">
3106
3232
  @for (campo of regularFields(section); track campo.key) {
3107
3233
  <div class="space-y-1">
3108
- <dt class="text-xs font-medium text-neutral">{{ campo.label }}</dt>
3109
- <dd class="text-sm font-medium text-neutral-light break-words">
3234
+ <dt class="col-span-12 sm:col-span-12 lg:col-span-3 text-xs font-medium text-neutral">{{ campo.label }}</dt>
3235
+ <dd class="col-span-12 sm:col-span-12 lg:col-span-{{ colSpanFor(campo.field.width) }} text-sm font-medium text-neutral-light break-words">
3110
3236
  <app-render-host
3111
3237
  mode="display"
3112
3238
  [type]="campo.field.type"
3113
3239
  [config]="campo.field"
3114
3240
  [value]="campo.raw"
3115
3241
  />
3242
+ @if (campo.field.copyable && campo.raw !== null && campo.raw !== undefined && campo.raw !== '') {
3243
+ <app-copy-button [value]="campo.raw" />
3244
+ }
3116
3245
  </dd>
3117
3246
  </div>
3118
3247
  }
@@ -3165,6 +3294,12 @@ var DetailView = class DetailView {
3165
3294
  "shareText"
3166
3295
  ]
3167
3296
  },
3297
+ {
3298
+ kind: "component",
3299
+ type: CopyButton,
3300
+ selector: "app-copy-button",
3301
+ inputs: ["value"]
3302
+ },
3168
3303
  {
3169
3304
  kind: "component",
3170
3305
  type: EmptyState,
@@ -3236,6 +3371,7 @@ i0.ɵɵngDeclareClassMetadata({
3236
3371
  imports: [
3237
3372
  Button,
3238
3373
  CopyShare,
3374
+ CopyButton,
3239
3375
  EmptyState,
3240
3376
  LucideArrowLeft,
3241
3377
  LucideExternalLink,
@@ -3378,17 +3514,20 @@ i0.ɵɵngDeclareClassMetadata({
3378
3514
  <div class="p-5 flex-1 space-y-4">
3379
3515
  <!-- Grid para campos regulares -->
3380
3516
  @if (regularFields(section).length > 0) {
3381
- <dl class="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2">
3517
+ <dl class="grid grid-cols-1 gap-x-6 gap-y-4 lg:grid-cols-12">
3382
3518
  @for (campo of regularFields(section); track campo.key) {
3383
3519
  <div class="space-y-1">
3384
- <dt class="text-xs font-medium text-neutral">{{ campo.label }}</dt>
3385
- <dd class="text-sm font-medium text-neutral-light break-words">
3520
+ <dt class="col-span-12 sm:col-span-12 lg:col-span-3 text-xs font-medium text-neutral">{{ campo.label }}</dt>
3521
+ <dd class="col-span-12 sm:col-span-12 lg:col-span-{{ colSpanFor(campo.field.width) }} text-sm font-medium text-neutral-light break-words">
3386
3522
  <app-render-host
3387
3523
  mode="display"
3388
3524
  [type]="campo.field.type"
3389
3525
  [config]="campo.field"
3390
3526
  [value]="campo.raw"
3391
3527
  />
3528
+ @if (campo.field.copyable && campo.raw !== null && campo.raw !== undefined && campo.raw !== '') {
3529
+ <app-copy-button [value]="campo.raw" />
3530
+ }
3392
3531
  </dd>
3393
3532
  </div>
3394
3533
  }