@paperless/angular 1.52.1 → 1.52.2

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,96 +2370,7 @@ 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
 
2465
2376
  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
@@ -2489,7 +2400,8 @@ class TableCell {
2489
2400
  ⠀⠀⣨⣷⣶⣿⣧⣛⣛⠿⠿⣿⢿⣿⣿⣛⣿⡿⠀⠀⡇⠀⠀⠀⠀⢸⠀⠈⢿⣟⣛⠿⢿⡿⢿⢿⢿⣛⣫⣼⡿⣶⣾⣅⡀⠀
2490
2401
  ⢀⡼⠋⠁⠀⠀⠈⠉⠛⠛⠻⠟⠸⠛⠋⠉⠁⠀⠀⢸⡇⠀⠀⠄⠀⢸⡄⠀⠀⠈⠉⠙⠛⠃⠻⠛⠛⠛⠉⠁⠀⠀⠈⠙⢧⡀
2491
2402
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⡇⢠⠀⠀⠀⢸⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2492
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡇⠀⠀⠀⠀⢸⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠟⠁⣿⠇⠀⠀⠀⠀⢸⡇⠙⢿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2403
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡇⠀⠀⠀⠀⢸⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2404
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠟⠁⣿⠇⠀⠀⠀⠀⢸⡇⠙⢿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2493
2405
  ⠀⠰⣄⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⠖⡾⠁⠀⠀⣿⠀⠀⠀⠀⠀⠘⣿⠀⠀⠙⡇⢸⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠄⠀
2494
2406
  ⠀⠀⢻⣷⡦⣤⣤⣤⡴⠶⠿⠛⠉⠁⠀⢳⠀⢠⡀⢿⣀⠀⠀⠀⠀⣠⡟⢀⣀⢠⠇⠀⠈⠙⠛⠷⠶⢦⣤⣤⣤⢴⣾⡏⠀⠀
2495
2407
  ⠀⠀⠈⣿⣧⠙⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠘⠛⢊⣙⠛⠒⠒⢛⣋⡚⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⡿⠁⣾⡿⠀⠀⠀
@@ -2506,85 +2418,49 @@ class TableCell {
2506
2418
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2507
2419
  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2508
2420
  */
2509
- _getSizes({ sizes, } /* Table Definition */) {
2510
- if (sizes === 'auto' || !sizes) {
2511
- return {
2512
- 'w-auto': true,
2513
- };
2514
- }
2515
- if (sizes === 'hidden') {
2421
+ class TableCell {
2422
+ constructor() {
2423
+ /**
2424
+ * The variant of the column
2425
+ */
2426
+ this.variant = 'default';
2427
+ /**
2428
+ * The index of the column
2429
+ */
2430
+ this.index = 0;
2431
+ /**
2432
+ * The index of the row
2433
+ */
2434
+ this.rowIndex = 0;
2435
+ /**
2436
+ * Wether the table has actions
2437
+ */
2438
+ this.tableHasActions = false;
2439
+ }
2440
+ get class() {
2441
+ return getTableCellColumnClasses(this.definition, this.variant, this.tableHasActions);
2442
+ }
2443
+ get data() {
2444
+ if (this.variant === 'header') {
2516
2445
  return {
2517
- hidden: true,
2446
+ value: this.value,
2518
2447
  };
2519
2448
  }
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') {
2449
+ if (this.variant === 'actions') {
2560
2450
  return {
2561
- 'w-full': true,
2451
+ value: this.value,
2452
+ item: this.item,
2453
+ index: this.index,
2454
+ rowIndex: this.rowIndex,
2562
2455
  };
2563
2456
  }
2564
- // is a number.
2565
2457
  return {
2566
- [`w-${sizes}/12`]: true,
2458
+ value: this.value ?? objectGetByPath(this.item, this.definition.path),
2459
+ item: this.item,
2460
+ index: this.index,
2461
+ rowIndex: this.rowIndex,
2567
2462
  };
2568
2463
  }
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
2464
  }
2589
2465
  TableCell.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TableCell, deps: [], target: i0.ɵɵFactoryTarget.Component });
2590
2466
  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"] }] });