@paperless/angular 1.52.1 → 1.52.3

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.
@@ -13,7 +13,7 @@ import { PlatformModule } from '@angular/cdk/platform';
13
13
  import { PortalModule, CdkPortal, ComponentPortal } from '@angular/cdk/portal';
14
14
  import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
15
15
  import { startWith, tap, pairwise, map, filter, debounce } from 'rxjs/operators';
16
- import { objectGetByPath, isTableColumnSizesKey, isMobile, tableColumSizesOptions } from '@paperless/core';
16
+ import { getTableCellColumnClasses, objectGetByPath, isMobile, tableColumSizesOptions } from '@paperless/core';
17
17
  import * as i2 from '@angular/router';
18
18
  import { RouterModule } from '@angular/router';
19
19
  import { v4 } from 'uuid';
@@ -2370,98 +2370,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2370
2370
  }] } });
2371
2371
 
2372
2372
  /* eslint-disable max-len */
2373
- class TableCell {
2374
- constructor() {
2375
- /**
2376
- * The variant of the column
2377
- */
2378
- this.variant = 'default';
2379
- /**
2380
- * The index of the column
2381
- */
2382
- this.index = 0;
2383
- /**
2384
- * The index of the row
2385
- */
2386
- this.rowIndex = 0;
2387
- /**
2388
- * Wether the table has actions
2389
- */
2390
- this.tableHasActions = false;
2391
- }
2392
- get class() {
2393
- return this.getColumnClasses();
2394
- }
2395
- get data() {
2396
- if (this.variant === 'header') {
2397
- return {
2398
- value: this.value,
2399
- };
2400
- }
2401
- if (this.variant === 'actions') {
2402
- return {
2403
- value: this.value,
2404
- item: this.item,
2405
- index: this.index,
2406
- rowIndex: this.rowIndex,
2407
- };
2408
- }
2409
- return {
2410
- value: this.value ?? objectGetByPath(this.item, this.definition.path),
2411
- item: this.item,
2412
- index: this.index,
2413
- rowIndex: this.rowIndex,
2414
- };
2415
- }
2416
- // render() {
2417
- // return (
2418
- // <Host
2419
- // class={{
2420
- // 'p-table-column': true,
2421
- // [`variant-${this.variant}`]: true,
2422
- // ...this._getColumnClasses(),
2423
- // }}
2424
- // >
2425
- // {this.checkbox}
2426
- // {this.variant === 'loading' ? (
2427
- // <p-loader
2428
- // variant="ghost"
2429
- // class="rounded flex-1 w-full h-6"
2430
- // />
2431
- // ) : (
2432
- // <div class="flex">
2433
- // {this.variant === 'header' ? (
2434
- // this.data.value
2435
- // ) : this.definition.useSlot ? (
2436
- // <slot />
2437
- // ) : (
2438
- // this.template(this.data as TableDefinitionData)
2439
- // )}
2440
- // </div>
2441
- // )}
2442
- // </Host>
2443
- // );
2444
- // }
2445
- getColumnClasses() {
2446
- const sizes = this.definition ? this._getSizes(this.definition) : {};
2447
- const isLastValues = this.definition
2448
- ? this._getIsLastValues(this.definition)
2449
- : {};
2450
- return {
2451
- 'justify-start': !this.definition?.align || this.definition?.align === 'start',
2452
- 'justify-center': this.definition?.align === 'center',
2453
- 'justify-end': this.definition?.align === 'end',
2454
- 'font-semibold': this.variant !== 'header' && this.definition?.type === 'th',
2455
- 'text-storm-dark': this.variant !== 'header' && this.definition?.type === 'th',
2456
- 'group-hover:flex': this.variant === 'actions' && this.tableHasActions,
2457
- hidden: this.variant === 'actions' && this.tableHasActions,
2458
- ...sizes,
2459
- ...isLastValues,
2460
- };
2461
- }
2462
- /*
2373
+ /*
2463
2374
  With this, we shall hack the system in ways no one would ever have thought.
2464
2375
 
2376
+ justify-start justify-center justify-end
2377
+ font-semibold text-storm-dark
2465
2378
  w-1/12 w-2/12 w-3/12 w-4/12 w-5/12 w-6/12 w-7/12 w-8/12 w-9/12 w-10/12 w-11/12 w-12/12
2466
2379
  tablet:w-1/12 tablet:w-2/12 tablet:w-3/12 tablet:w-4/12 tablet:w-5/12 tablet:w-6/12 tablet:w-7/12 tablet:w-8/12 tablet:w-9/12 tablet:w-10/12 tablet:w-11/12 tablet:w-12/12
2467
2380
  desktop-xs:w-1/12 desktop-xs:w-2/12 desktop-xs:w-3/12 desktop-xs:w-4/12 desktop-xs:w-5/12 desktop-xs:w-6/12 desktop-xs:w-7/12 desktop-xs:w-8/12 desktop-xs:w-9/12 desktop-xs:w-10/12 desktop-xs:w-11/12 desktop-xs:w-12/12
@@ -2477,6 +2390,13 @@ class TableCell {
2477
2390
  desktop:hidden desktop:flex desktop:group-hover:hidden desktop:group-hover:flex
2478
2391
  desktop-lg:hidden desktop-lg:flex desktop-lg:group-hover:hidden desktop-lg:group-hover:flex
2479
2392
  desktop-xl:hidden desktop-xl:flex desktop-xl:group-hover:hidden desktop-xl:group-hover:flex
2393
+ pr-4 pr-0
2394
+ tablet:pr-4 tablet:pr-0
2395
+ desktop-xs:pr-4 desktop-xs:pr-0
2396
+ desktop-sm:pr-4 desktop-sm:pr-0
2397
+ desktop:pr-4 desktop:pr-0
2398
+ desktop-lg:pr-4 desktop-lg:pr-0
2399
+ desktop-xl:pr-4 desktop-xl:pr-0
2480
2400
 
2481
2401
 
2482
2402
  ⠀⠀⠀⠀⠀⣠⣴⣶⣿⣿⠿⣷⣶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣷⠿⣿⣿⣶⣦⣀⠀⠀⠀⠀⠀
@@ -2489,7 +2409,8 @@ class TableCell {
2489
2409
  ⠀⠀⣨⣷⣶⣿⣧⣛⣛⠿⠿⣿⢿⣿⣿⣛⣿⡿⠀⠀⡇⠀⠀⠀⠀⢸⠀⠈⢿⣟⣛⠿⢿⡿⢿⢿⢿⣛⣫⣼⡿⣶⣾⣅⡀⠀
2490
2410
  ⢀⡼⠋⠁⠀⠀⠈⠉⠛⠛⠻⠟⠸⠛⠋⠉⠁⠀⠀⢸⡇⠀⠀⠄⠀⢸⡄⠀⠀⠈⠉⠙⠛⠃⠻⠛⠛⠛⠉⠁⠀⠀⠈⠙⢧⡀
2491
2411
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⡇⢠⠀⠀⠀⢸⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2492
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡇⠀⠀⠀⠀⢸⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠟⠁⣿⠇⠀⠀⠀⠀⢸⡇⠙⢿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2412
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡇⠀⠀⠀⠀⢸⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2413
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠟⠁⣿⠇⠀⠀⠀⠀⢸⡇⠙⢿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2493
2414
  ⠀⠰⣄⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⠖⡾⠁⠀⠀⣿⠀⠀⠀⠀⠀⠘⣿⠀⠀⠙⡇⢸⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠄⠀
2494
2415
  ⠀⠀⢻⣷⡦⣤⣤⣤⡴⠶⠿⠛⠉⠁⠀⢳⠀⢠⡀⢿⣀⠀⠀⠀⠀⣠⡟⢀⣀⢠⠇⠀⠈⠙⠛⠷⠶⢦⣤⣤⣤⢴⣾⡏⠀⠀
2495
2416
  ⠀⠀⠈⣿⣧⠙⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠘⠛⢊⣙⠛⠒⠒⢛⣋⡚⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⡿⠁⣾⡿⠀⠀⠀
@@ -2506,85 +2427,49 @@ class TableCell {
2506
2427
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2507
2428
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2508
2429
  */
2509
- _getSizes({ sizes, } /* Table Definition */) {
2510
- if (sizes === 'auto' || !sizes) {
2511
- return {
2512
- 'w-auto': true,
2513
- };
2514
- }
2515
- if (sizes === 'hidden') {
2430
+ class TableCell {
2431
+ constructor() {
2432
+ /**
2433
+ * The variant of the column
2434
+ */
2435
+ this.variant = 'default';
2436
+ /**
2437
+ * The index of the column
2438
+ */
2439
+ this.index = 0;
2440
+ /**
2441
+ * The index of the row
2442
+ */
2443
+ this.rowIndex = 0;
2444
+ /**
2445
+ * Wether the table has actions
2446
+ */
2447
+ this.tableHasActions = false;
2448
+ }
2449
+ get class() {
2450
+ return getTableCellColumnClasses(this.definition, this.variant, this.tableHasActions);
2451
+ }
2452
+ get data() {
2453
+ if (this.variant === 'header') {
2516
2454
  return {
2517
- hidden: true,
2455
+ value: this.value,
2518
2456
  };
2519
2457
  }
2520
- if (typeof sizes === 'object') {
2521
- sizes = sizes;
2522
- const classes = {};
2523
- let previousSize;
2524
- for (let size in sizes) {
2525
- if (!isTableColumnSizesKey(sizes, size)) {
2526
- continue;
2527
- }
2528
- if (size === 'default') {
2529
- if (sizes.default === 'hidden') {
2530
- classes['hidden'] = true;
2531
- previousSize = size;
2532
- continue;
2533
- }
2534
- classes[`w-${sizes.default}/12`] = true;
2535
- previousSize = size;
2536
- continue;
2537
- }
2538
- const currentValue = sizes[size];
2539
- const previousValue = previousSize ? sizes[previousSize] : null;
2540
- if (currentValue !== 'hidden' &&
2541
- previousValue &&
2542
- previousValue === 'hidden' &&
2543
- this.variant !== 'actions') {
2544
- classes[`${size}:flex`] = true;
2545
- }
2546
- if (currentValue === 'hidden' && this.variant !== 'actions') {
2547
- classes[`${size}:hidden`] = true;
2548
- previousSize = size;
2549
- continue;
2550
- }
2551
- if (currentValue === 12 || currentValue === 'full') {
2552
- classes[`${size}:w-full`] = true;
2553
- }
2554
- classes[`${size}:w-${currentValue}/12`] = true;
2555
- previousSize = size;
2556
- }
2557
- return classes;
2558
- }
2559
- if (sizes === 12 || sizes === 'full') {
2458
+ if (this.variant === 'actions') {
2560
2459
  return {
2561
- 'w-full': true,
2460
+ value: this.value,
2461
+ item: this.item,
2462
+ index: this.index,
2463
+ rowIndex: this.rowIndex,
2562
2464
  };
2563
2465
  }
2564
- // is a number.
2565
2466
  return {
2566
- [`w-${sizes}/12`]: true,
2467
+ value: this.value ?? objectGetByPath(this.item, this.definition.path),
2468
+ item: this.item,
2469
+ index: this.index,
2470
+ rowIndex: this.rowIndex,
2567
2471
  };
2568
2472
  }
2569
- _getIsLastValues({ isLast, parsedSizes, } /* Table Definition */) {
2570
- const values = {};
2571
- for (let size of Object.keys(isLast)) {
2572
- let prefix = '';
2573
- if (size !== 'default') {
2574
- prefix = `${size}:`;
2575
- }
2576
- values[`${prefix}pr-4`] = !isLast[size];
2577
- values[`${prefix}group-hover:hidden`] =
2578
- isLast[size] && this.tableHasActions && this.variant !== 'actions';
2579
- values[`${prefix}group-hover:flex`] =
2580
- parsedSizes[size] !== 'hidden' ||
2581
- this.variant === 'actions';
2582
- values[`${prefix}flex`] =
2583
- parsedSizes[size] !== 'hidden' &&
2584
- this.variant !== 'actions';
2585
- }
2586
- return values;
2587
- }
2588
2473
  }
2589
2474
  TableCell.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TableCell, deps: [], target: i0.ɵɵFactoryTarget.Component });
2590
2475
  TableCell.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TableCell, selector: "p-table-cell-ngx", inputs: { variant: "variant", index: "index", rowIndex: "rowIndex", definition: "definition", item: "item", value: "value", tableHasActions: "tableHasActions", checkbox: "checkbox", template: "template" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: "<ng-container *ngIf=\"checkbox\">\n\t<ng-container *ngTemplateOutlet=\"checkbox\"></ng-container>\n</ng-container>\n\n<ng-container [ngSwitch]=\"variant\">\n\t<p-loader\n\t\t*ngSwitchCase=\"'loading'\"\n\t\tvariant=\"ghost\"\n\t\tclass=\"h-6 w-full flex-1 rounded\"\n\t></p-loader>\n\n\t<ng-container *ngSwitchCase=\"'actions'\">\n\t\t<ng-container *ngIf=\"template\">\n\t\t\t<ng-container *ngTemplateOutlet=\"template; context: data\"></ng-container>\n\t\t</ng-container>\n\t</ng-container>\n\n\t<div\n\t\t*ngSwitchCase=\"'header'\"\n\t\tclass=\"flex w-full overflow-hidden\"\n\t\t[class.justify-start]=\"definition.align === 'start'\"\n\t\t[class.justify-center]=\"definition.align === 'center'\"\n\t\t[class.justify-end]=\"definition.align === 'end'\"\n\t>\n\t\t<ng-container *ngTemplateOutlet=\"valueTemplate\"></ng-container>\n\t</div>\n\n\t<div\n\t\t*ngSwitchCase=\"'default'\"\n\t\tclass=\"flex min-w-0 flex-1\"\n\t\t[class.justify-start]=\"definition.align === 'start'\"\n\t\t[class.justify-center]=\"definition.align === 'center'\"\n\t\t[class.justify-end]=\"definition.align === 'end'\"\n\t>\n\t\t<ng-container *ngIf=\"template; else valueTemplate\">\n\t\t\t<ng-container *ngTemplateOutlet=\"template; context: data\"></ng-container>\n\t\t</ng-container>\n\t</div>\n</ng-container>\n\n<ng-template #valueTemplate>\n\t{{ data.value }}\n</ng-template>\n", styles: [":host{align-items:center;gap:1rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: PLoader, selector: "p-loader", inputs: ["color", "modalDescription", "modalTitle", "show", "variant"] }] });