@piying-lib/angular-daisyui 1.0.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.
- package/README.md +64 -0
- package/extension/index.d.ts +449 -0
- package/fesm2022/piying-lib-angular-daisyui-extension.mjs +1356 -0
- package/fesm2022/piying-lib-angular-daisyui-extension.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui-field-control-props.directive-C5mF89PX.mjs +27 -0
- package/fesm2022/piying-lib-angular-daisyui-field-control-props.directive-C5mF89PX.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui-field-control.mjs +616 -0
- package/fesm2022/piying-lib-angular-daisyui-field-control.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui-field-group.mjs +345 -0
- package/fesm2022/piying-lib-angular-daisyui-field-group.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui-non-field-control.mjs +452 -0
- package/fesm2022/piying-lib-angular-daisyui-non-field-control.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui-pipe.mjs +55 -0
- package/fesm2022/piying-lib-angular-daisyui-pipe.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui-service.mjs +115 -0
- package/fesm2022/piying-lib-angular-daisyui-service.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui-wrapper.mjs +75 -0
- package/fesm2022/piying-lib-angular-daisyui-wrapper.mjs.map +1 -0
- package/fesm2022/piying-lib-angular-daisyui.mjs +4 -0
- package/fesm2022/piying-lib-angular-daisyui.mjs.map +1 -0
- package/field-control/index.d.ts +204 -0
- package/field-group/index.d.ts +162 -0
- package/index.d.ts +2 -0
- package/non-field-control/index.d.ts +255 -0
- package/package.json +54 -0
- package/pipe/index.d.ts +25 -0
- package/preset-css/css/style.css +1 -0
- package/preset-css/css/style.split.css +126 -0
- package/preset-css/json/manifest.json +739 -0
- package/preset-css/ts/accordion.ts +9 -0
- package/preset-css/ts/alert.ts +12 -0
- package/preset-css/ts/avatar.ts +7 -0
- package/preset-css/ts/badge.ts +20 -0
- package/preset-css/ts/breadcrumbs.ts +1 -0
- package/preset-css/ts/browser-mockup.ts +1 -0
- package/preset-css/ts/button.ts +27 -0
- package/preset-css/ts/calendar.ts +1 -0
- package/preset-css/ts/card.ts +15 -0
- package/preset-css/ts/carousel.ts +9 -0
- package/preset-css/ts/chat-bubble.ts +17 -0
- package/preset-css/ts/checkbox.ts +16 -0
- package/preset-css/ts/code-mockup.ts +1 -0
- package/preset-css/ts/collapse.ts +9 -0
- package/preset-css/ts/countdown.ts +1 -0
- package/preset-css/ts/diff.ts +1 -0
- package/preset-css/ts/divider.ts +15 -0
- package/preset-css/ts/dock.ts +10 -0
- package/preset-css/ts/drawer-sidebar.ts +11 -0
- package/preset-css/ts/dropdown.ts +13 -0
- package/preset-css/ts/fab-speed-dial.ts +1 -0
- package/preset-css/ts/fieldset.ts +1 -0
- package/preset-css/ts/file-input.ts +17 -0
- package/preset-css/ts/filter.ts +1 -0
- package/preset-css/ts/footer.ts +7 -0
- package/preset-css/ts/hero.ts +1 -0
- package/preset-css/ts/hover-gallery.ts +1 -0
- package/preset-css/ts/index.ts +63 -0
- package/preset-css/ts/indicator.ts +10 -0
- package/preset-css/ts/join.ts +1 -0
- package/preset-css/ts/kbd.ts +1 -0
- package/preset-css/ts/label.ts +1 -0
- package/preset-css/ts/link.ts +12 -0
- package/preset-css/ts/list.ts +1 -0
- package/preset-css/ts/loading.ts +14 -0
- package/preset-css/ts/mask.ts +20 -0
- package/preset-css/ts/menu.ts +17 -0
- package/preset-css/ts/modal.ts +13 -0
- package/preset-css/ts/navbar.ts +1 -0
- package/preset-css/ts/pagination.ts +1 -0
- package/preset-css/ts/phone-mockup.ts +5 -0
- package/preset-css/ts/progress.ts +11 -0
- package/preset-css/ts/radial-progress.ts +1 -0
- package/preset-css/ts/radio.ts +16 -0
- package/preset-css/ts/range-slider.ts +16 -0
- package/preset-css/ts/rating.ts +10 -0
- package/preset-css/ts/select.ts +17 -0
- package/preset-css/ts/skeleton.ts +1 -0
- package/preset-css/ts/stack.ts +1 -0
- package/preset-css/ts/stat.ts +11 -0
- package/preset-css/ts/status.ts +16 -0
- package/preset-css/ts/steps.ts +15 -0
- package/preset-css/ts/swap.ts +9 -0
- package/preset-css/ts/table.ts +11 -0
- package/preset-css/ts/tabs.ts +17 -0
- package/preset-css/ts/text-input.ts +17 -0
- package/preset-css/ts/textarea.ts +17 -0
- package/preset-css/ts/theme-controller.ts +1 -0
- package/preset-css/ts/timeline.ts +11 -0
- package/preset-css/ts/toast.ts +9 -0
- package/preset-css/ts/toggle.ts +16 -0
- package/preset-css/ts/tooltip.ts +17 -0
- package/preset-css/ts/validator.ts +1 -0
- package/preset-css/ts/window-mockup.ts +1 -0
- package/service/index.d.ts +42 -0
- package/wrapper/index.d.ts +27 -0
|
@@ -0,0 +1,1356 @@
|
|
|
1
|
+
import { NgTemplateOutlet, NgClass, JsonPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { viewChild, input, inject, computed, Component, model, InjectionToken, Injector, untracked, signal, resource, Injectable, ElementRef, HostListener, Directive, linkedSignal, NgZone, EventEmitter, TemplateRef, ViewContainerRef, Output, forwardRef, ChangeDetectionStrategy, effect } from '@angular/core';
|
|
4
|
+
import { SelectorlessOutlet } from '@cyia/ngx-common/directive';
|
|
5
|
+
import { StrOrTemplateComponent, isSchema, computedWithPrev, DefaultOptionConvert, transformOption } from '@piying-lib/angular-core';
|
|
6
|
+
import { CssPrefixPipe, MergeClassPipe, TwPrefixPipe } from '@piying-lib/angular-daisyui/pipe';
|
|
7
|
+
import { ThemeService, CheckboxService } from '@piying-lib/angular-daisyui/service';
|
|
8
|
+
import { AttributesDirective, PI_VIEW_FIELD_TOKEN, PiyingViewGroupBase, InsertFieldDirective, BaseControl, PiyingView, PI_INPUT_OPTIONS_TOKEN } from '@piying/view-angular';
|
|
9
|
+
import { RouterLink, RouterLinkActive } from '@angular/router';
|
|
10
|
+
import * as i1 from '@angular/material/icon';
|
|
11
|
+
import { MatIconModule, MatIcon } from '@angular/material/icon';
|
|
12
|
+
import * as i1$1 from '@angular/forms';
|
|
13
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
14
|
+
import { PurePipe } from '@cyia/ngx-common/pipe';
|
|
15
|
+
import clsx from 'clsx';
|
|
16
|
+
import * as v from 'valibot';
|
|
17
|
+
import { setComponent, NFCSchema, actions } from '@piying/view-angular-core';
|
|
18
|
+
import { ThWC, TdWC } from '@piying-lib/angular-daisyui/wrapper';
|
|
19
|
+
import { Subject, filter, BehaviorSubject, Subscription } from 'rxjs';
|
|
20
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
21
|
+
import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
22
|
+
import { createRepositionScrollStrategy, createOverlayRef, OverlayConfig, createFlexibleConnectedPositionStrategy } from '@angular/cdk/overlay';
|
|
23
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
24
|
+
import { takeWhile } from 'rxjs/operators';
|
|
25
|
+
|
|
26
|
+
const routerLinkActiveOptions = { exact: false };
|
|
27
|
+
class MenuTreeNFCC {
|
|
28
|
+
static __version = 2;
|
|
29
|
+
routerLinkActiveOptions = routerLinkActiveOptions;
|
|
30
|
+
StrOrTemplateComponent = StrOrTemplateComponent;
|
|
31
|
+
templateRef = viewChild.required('templateRef');
|
|
32
|
+
list = input([], ...(ngDevMode ? [{ debugName: "list" }] : []));
|
|
33
|
+
size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : []));
|
|
34
|
+
direction = input(...(ngDevMode ? [undefined, { debugName: "direction" }] : []));
|
|
35
|
+
#theme = inject(ThemeService);
|
|
36
|
+
wrapperClass$ = computed(() => {
|
|
37
|
+
return this.#theme.setClass(this.#theme.addPrefix('menu'), this.#theme.addPrefix2('menu', this.direction()), this.#theme.setSize('menu', this.size()));
|
|
38
|
+
}, ...(ngDevMode ? [{ debugName: "wrapperClass$" }] : []));
|
|
39
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: MenuTreeNFCC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
40
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: MenuTreeNFCC, isStandalone: true, selector: "app-menu-tree", inputs: { list: { classPropertyName: "list", publicName: "list", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #liBaseContent let-item>\n @if (item.icon; as icon) {\n <mat-icon\n [inline]=\"icon.inline\"\n [fontIcon]=\"icon.fontIcon\"\n [fontSet]=\"icon.fontSet\"\n [svgIcon]=\"icon.svgIcon\"\n ></mat-icon>\n }\n <span>\n {{ item.title }}\n </span>\n @if (item.badge; as badge) {\n <span [class]=\"badge.class | mergeClass: 'badge' | cssPrefix\">{{ badge.title }}</span>\n }\n</ng-template>\n\n<ng-template #liBase let-item>\n @if (item.router) {\n @let router = item.router;\n <a\n [queryParams]=\"router.queryParams\"\n [fragment]=\"router.fragment\"\n [queryParamsHandling]=\"router.queryParamsHandling\"\n [state]=\"router.state\"\n [info]=\"router.info\"\n [relativeTo]=\"router.relativeTo\"\n [target]=\"router.target\"\n [preserveFragment]=\"router.preserveFragment\"\n [skipLocationChange]=\"router.skipLocationChange\"\n [replaceUrl]=\"router.replaceUrl\"\n [routerLink]=\"router.routerLink\"\n [preserveFragment]=\"router.preserveFragment\"\n [routerLinkActive]=\"'menu-active'\"\n [routerLinkActiveOptions]=\"\n router.activate?.routerLinkActiveOptions ?? routerLinkActiveOptions\n \"\n [ariaCurrentWhenActive]=\"router.activate?.ariaCurrentWhenActive ?? undefined\"\n class=\"tooltip\"\n [attr.data-tip]=\"item.tooltip || ''\"\n >\n <ng-container *ngTemplateOutlet=\"liBaseContent; context: { $implicit: item }\"></ng-container>\n </a>\n } @else if (item.href) {\n <a [href]=\"item.href\" [target]=\"item.target\">\n <ng-container *ngTemplateOutlet=\"liBaseContent; context: { $implicit: item }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"liBaseContent; context: { $implicit: item }\"></ng-container>\n }\n</ng-template>\n<ng-template #liGroup let-item>\n <!-- todo open\u6D4B\u8BD5 -->\n <details open>\n <summary>{{ item.title }}</summary>\n <ul>\n @for (child of item.children; track $index) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"\n ></ng-container>\n }\n </ul>\n </details>\n</ng-template>\n\n<ng-template #itemTemplate let-item>\n @if ((item.hidden && !item.hidden(item)) || !item.hidden) {\n @switch (item.type) {\n @case ('group') {\n <li class=\"tooltip\" [attr.data-tip]=\"item.tooltip || ''\">\n <ng-container *ngTemplateOutlet=\"liGroup; context: { $implicit: item }\"></ng-container>\n </li>\n }\n @case ('divider') {\n <li></li>\n }\n @default {\n <li class=\"tooltip\" [attr.data-tip]=\"item.tooltip || ''\">\n <ng-container *ngTemplateOutlet=\"liBase; context: { $implicit: item }\"></ng-container>\n </li>\n }\n }\n }\n</ng-template>\n<ng-template #templateRef let-attr=\"attributes\">\n <ul\n [class]=\"wrapperClass$() | mergeClass: attr()?.class\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n @for (child of list(); track $index) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"></ng-container>\n }\n </ul>\n</ng-template>\n", dependencies: [{ kind: "directive", type: AttributesDirective, selector: "[attributes]", inputs: ["attributes", "excludes"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: CssPrefixPipe, name: "cssPrefix" }, { kind: "pipe", type: MergeClassPipe, name: "mergeClass" }] });
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: MenuTreeNFCC, decorators: [{
|
|
43
|
+
type: Component,
|
|
44
|
+
args: [{ selector: 'app-menu-tree', imports: [
|
|
45
|
+
AttributesDirective,
|
|
46
|
+
NgClass,
|
|
47
|
+
CssPrefixPipe,
|
|
48
|
+
SelectorlessOutlet,
|
|
49
|
+
StrOrTemplateComponent,
|
|
50
|
+
RouterLink,
|
|
51
|
+
RouterLinkActive,
|
|
52
|
+
NgTemplateOutlet,
|
|
53
|
+
MatIconModule,
|
|
54
|
+
MergeClassPipe,
|
|
55
|
+
JsonPipe,
|
|
56
|
+
MergeClassPipe,
|
|
57
|
+
], template: "<ng-template #liBaseContent let-item>\n @if (item.icon; as icon) {\n <mat-icon\n [inline]=\"icon.inline\"\n [fontIcon]=\"icon.fontIcon\"\n [fontSet]=\"icon.fontSet\"\n [svgIcon]=\"icon.svgIcon\"\n ></mat-icon>\n }\n <span>\n {{ item.title }}\n </span>\n @if (item.badge; as badge) {\n <span [class]=\"badge.class | mergeClass: 'badge' | cssPrefix\">{{ badge.title }}</span>\n }\n</ng-template>\n\n<ng-template #liBase let-item>\n @if (item.router) {\n @let router = item.router;\n <a\n [queryParams]=\"router.queryParams\"\n [fragment]=\"router.fragment\"\n [queryParamsHandling]=\"router.queryParamsHandling\"\n [state]=\"router.state\"\n [info]=\"router.info\"\n [relativeTo]=\"router.relativeTo\"\n [target]=\"router.target\"\n [preserveFragment]=\"router.preserveFragment\"\n [skipLocationChange]=\"router.skipLocationChange\"\n [replaceUrl]=\"router.replaceUrl\"\n [routerLink]=\"router.routerLink\"\n [preserveFragment]=\"router.preserveFragment\"\n [routerLinkActive]=\"'menu-active'\"\n [routerLinkActiveOptions]=\"\n router.activate?.routerLinkActiveOptions ?? routerLinkActiveOptions\n \"\n [ariaCurrentWhenActive]=\"router.activate?.ariaCurrentWhenActive ?? undefined\"\n class=\"tooltip\"\n [attr.data-tip]=\"item.tooltip || ''\"\n >\n <ng-container *ngTemplateOutlet=\"liBaseContent; context: { $implicit: item }\"></ng-container>\n </a>\n } @else if (item.href) {\n <a [href]=\"item.href\" [target]=\"item.target\">\n <ng-container *ngTemplateOutlet=\"liBaseContent; context: { $implicit: item }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"liBaseContent; context: { $implicit: item }\"></ng-container>\n }\n</ng-template>\n<ng-template #liGroup let-item>\n <!-- todo open\u6D4B\u8BD5 -->\n <details open>\n <summary>{{ item.title }}</summary>\n <ul>\n @for (child of item.children; track $index) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"\n ></ng-container>\n }\n </ul>\n </details>\n</ng-template>\n\n<ng-template #itemTemplate let-item>\n @if ((item.hidden && !item.hidden(item)) || !item.hidden) {\n @switch (item.type) {\n @case ('group') {\n <li class=\"tooltip\" [attr.data-tip]=\"item.tooltip || ''\">\n <ng-container *ngTemplateOutlet=\"liGroup; context: { $implicit: item }\"></ng-container>\n </li>\n }\n @case ('divider') {\n <li></li>\n }\n @default {\n <li class=\"tooltip\" [attr.data-tip]=\"item.tooltip || ''\">\n <ng-container *ngTemplateOutlet=\"liBase; context: { $implicit: item }\"></ng-container>\n </li>\n }\n }\n }\n</ng-template>\n<ng-template #templateRef let-attr=\"attributes\">\n <ul\n [class]=\"wrapperClass$() | mergeClass: attr()?.class\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n @for (child of list(); track $index) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"></ng-container>\n }\n </ul>\n</ng-template>\n" }]
|
|
58
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], list: [{ type: i0.Input, args: [{ isSignal: true, alias: "list", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }] } });
|
|
59
|
+
|
|
60
|
+
const ExactMatchOptions = {
|
|
61
|
+
paths: 'exact',
|
|
62
|
+
fragment: 'ignored',
|
|
63
|
+
matrixParams: 'ignored',
|
|
64
|
+
queryParams: 'exact',
|
|
65
|
+
};
|
|
66
|
+
const SubsetMatchOptions = {
|
|
67
|
+
paths: 'subset',
|
|
68
|
+
fragment: 'ignored',
|
|
69
|
+
matrixParams: 'ignored',
|
|
70
|
+
queryParams: 'subset',
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
function goPage(value) {
|
|
74
|
+
return { type: 'go', value };
|
|
75
|
+
}
|
|
76
|
+
class PaginationNFCC {
|
|
77
|
+
static __version = 2;
|
|
78
|
+
StrOrTemplateComponent = StrOrTemplateComponent;
|
|
79
|
+
templateRef = viewChild.required('templateRef');
|
|
80
|
+
direction = input(...(ngDevMode ? [undefined, { debugName: "direction" }] : []));
|
|
81
|
+
sizeOptions = input(...(ngDevMode ? [undefined, { debugName: "sizeOptions" }] : []));
|
|
82
|
+
optionsLabel = input(...(ngDevMode ? [undefined, { debugName: "optionsLabel" }] : []));
|
|
83
|
+
value = model.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
84
|
+
count = input.required(...(ngDevMode ? [{ debugName: "count" }] : []));
|
|
85
|
+
#theme = inject(ThemeService);
|
|
86
|
+
wrapperClass$ = computed(() => {
|
|
87
|
+
return clsx(this.#theme.addPrefix('join'), this.#theme.addPrefix2('join', this.direction()));
|
|
88
|
+
}, ...(ngDevMode ? [{ debugName: "wrapperClass$" }] : []));
|
|
89
|
+
maxPageCount$$ = computed(() => {
|
|
90
|
+
return Math.ceil((this.count() ?? 0) / this.value().size);
|
|
91
|
+
}, ...(ngDevMode ? [{ debugName: "maxPageCount$$" }] : []));
|
|
92
|
+
pageRange$$ = computed(() => {
|
|
93
|
+
let list = [];
|
|
94
|
+
const current = this.value().index;
|
|
95
|
+
const fullStart = current - 4 < 0;
|
|
96
|
+
const fullEnd = current + 5 > this.maxPageCount$$();
|
|
97
|
+
if (fullStart) {
|
|
98
|
+
let index = current - 1;
|
|
99
|
+
while (index !== -1) {
|
|
100
|
+
list.unshift(goPage(index));
|
|
101
|
+
index--;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
list.push({ type: 'prev', value: 5 });
|
|
106
|
+
let index = current - 1;
|
|
107
|
+
const tempList = [];
|
|
108
|
+
while (index !== -1 && current - index < 3) {
|
|
109
|
+
tempList.unshift(goPage(index));
|
|
110
|
+
index--;
|
|
111
|
+
}
|
|
112
|
+
list = list.concat(tempList);
|
|
113
|
+
}
|
|
114
|
+
list.push(goPage(current));
|
|
115
|
+
if (fullEnd) {
|
|
116
|
+
let index = current + 1;
|
|
117
|
+
while (index < this.maxPageCount$$()) {
|
|
118
|
+
list.push(goPage(index));
|
|
119
|
+
index++;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
let index = current + 1;
|
|
124
|
+
while (index < this.maxPageCount$$() && index - current < 3) {
|
|
125
|
+
list.push(goPage(index));
|
|
126
|
+
index++;
|
|
127
|
+
}
|
|
128
|
+
list.push({ type: 'next', value: 5 });
|
|
129
|
+
}
|
|
130
|
+
return list;
|
|
131
|
+
}, ...(ngDevMode ? [{ debugName: "pageRange$$" }] : []));
|
|
132
|
+
#field = inject(PI_VIEW_FIELD_TOKEN, { optional: true });
|
|
133
|
+
ngOnInit() {
|
|
134
|
+
this.updatePageToProps();
|
|
135
|
+
}
|
|
136
|
+
gotoPage(value) {
|
|
137
|
+
this.value.update((data) => {
|
|
138
|
+
return { ...data, index: value };
|
|
139
|
+
});
|
|
140
|
+
this.updatePageToProps();
|
|
141
|
+
}
|
|
142
|
+
pageSizeChange(value) {
|
|
143
|
+
this.value.update((item) => {
|
|
144
|
+
return { ...item, size: value };
|
|
145
|
+
});
|
|
146
|
+
this.updatePageToProps();
|
|
147
|
+
}
|
|
148
|
+
updatePageToProps() {
|
|
149
|
+
const field = this.#field?.();
|
|
150
|
+
if (!field) {
|
|
151
|
+
console.warn(`❌piying-view🗄️`);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
field.props.update((data) => {
|
|
155
|
+
return {
|
|
156
|
+
...data,
|
|
157
|
+
pageQueryParams: this.value(),
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: PaginationNFCC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
162
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: PaginationNFCC, isStandalone: true, selector: "app-pagination", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, sizeOptions: { classPropertyName: "sizeOptions", publicName: "sizeOptions", isSignal: true, isRequired: false, transformFunction: null }, optionsLabel: { classPropertyName: "optionsLabel", publicName: "optionsLabel", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { value: "valueChange" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <div\n [class]=\"'flex items-center gap-2' | mergeClass: attr()?.class\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n @if (sizeOptions(); as sizeOptions) {\n <select class=\"select w-20\" [ngModel]=\"value().size\" (ngModelChange)=\"pageSizeChange($event)\">\n @for (item of sizeOptions; track $index) {\n <option [ngValue]=\"item\">\n {{ optionsLabel() ? (optionsLabel()! | pure: item : value().index : count()) : item }}\n </option>\n }\n </select>\n }\n <div [class]=\"wrapperClass$()\">\n <button\n class=\"join-item btn p-0 w-(--size)\"\n [disabled]=\"value().index === 0\"\n (click)=\"gotoPage(0)\"\n >\n \u00AB\n </button>\n @for (item of pageRange$$(); track $index) {\n @if (item.type === 'go') {\n <button\n class=\"join-item btn p-0 w-(--size)\"\n [aria-label]=\"item.value + 1\"\n [class.btn-active]=\"item.value === value().index\"\n (click)=\"gotoPage(item.value)\"\n >\n {{ item.value + 1 }}\n </button>\n } @else if (item.type === 'prev') {\n <button class=\"join-item btn p-0 w-(--size)\" (click)=\"gotoPage(value().index - 5)\">\n <\n </button>\n } @else if (item.type === 'next') {\n <button class=\"join-item btn p-0 w-(--size)\" (click)=\"gotoPage(value().index + 5)\">\n >\n </button>\n }\n }\n <button\n class=\"join-item btn p-0 w-(--size)\"\n [disabled]=\"value().index === maxPageCount$$() - 1\"\n (click)=\"gotoPage(maxPageCount$$() - 1)\"\n >\n \u00BB\n </button>\n </div>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: AttributesDirective, selector: "[attributes]", inputs: ["attributes", "excludes"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: PurePipe, name: "pure" }, { kind: "pipe", type: MergeClassPipe, name: "mergeClass" }] });
|
|
163
|
+
}
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: PaginationNFCC, decorators: [{
|
|
165
|
+
type: Component,
|
|
166
|
+
args: [{ selector: 'app-pagination', imports: [
|
|
167
|
+
AttributesDirective,
|
|
168
|
+
MatIcon,
|
|
169
|
+
NgTemplateOutlet,
|
|
170
|
+
NgClass,
|
|
171
|
+
CssPrefixPipe,
|
|
172
|
+
StrOrTemplateComponent,
|
|
173
|
+
SelectorlessOutlet,
|
|
174
|
+
PurePipe,
|
|
175
|
+
FormsModule,
|
|
176
|
+
MergeClassPipe,
|
|
177
|
+
], template: "<ng-template #templateRef let-attr=\"attributes\">\n <div\n [class]=\"'flex items-center gap-2' | mergeClass: attr()?.class\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n @if (sizeOptions(); as sizeOptions) {\n <select class=\"select w-20\" [ngModel]=\"value().size\" (ngModelChange)=\"pageSizeChange($event)\">\n @for (item of sizeOptions; track $index) {\n <option [ngValue]=\"item\">\n {{ optionsLabel() ? (optionsLabel()! | pure: item : value().index : count()) : item }}\n </option>\n }\n </select>\n }\n <div [class]=\"wrapperClass$()\">\n <button\n class=\"join-item btn p-0 w-(--size)\"\n [disabled]=\"value().index === 0\"\n (click)=\"gotoPage(0)\"\n >\n \u00AB\n </button>\n @for (item of pageRange$$(); track $index) {\n @if (item.type === 'go') {\n <button\n class=\"join-item btn p-0 w-(--size)\"\n [aria-label]=\"item.value + 1\"\n [class.btn-active]=\"item.value === value().index\"\n (click)=\"gotoPage(item.value)\"\n >\n {{ item.value + 1 }}\n </button>\n } @else if (item.type === 'prev') {\n <button class=\"join-item btn p-0 w-(--size)\" (click)=\"gotoPage(value().index - 5)\">\n <\n </button>\n } @else if (item.type === 'next') {\n <button class=\"join-item btn p-0 w-(--size)\" (click)=\"gotoPage(value().index + 5)\">\n >\n </button>\n }\n }\n <button\n class=\"join-item btn p-0 w-(--size)\"\n [disabled]=\"value().index === maxPageCount$$() - 1\"\n (click)=\"gotoPage(maxPageCount$$() - 1)\"\n >\n \u00BB\n </button>\n </div>\n </div>\n</ng-template>\n" }]
|
|
178
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], sizeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "sizeOptions", required: false }] }], optionsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionsLabel", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }, { type: i0.Output, args: ["valueChange"] }], count: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: true }] }] } });
|
|
179
|
+
|
|
180
|
+
class TableRowFGC extends PiyingViewGroupBase {
|
|
181
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableRowFGC, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
182
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TableRowFGC, isStandalone: true, selector: "tr", providers: [], usesInheritance: true, ngImport: i0, template: "@for (field of children$$(); track $index) {\n <ng-container\n *ngTemplateOutlet=\"fieldTemplateRef(); context: { $implicit: field }\"\n ></ng-container>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }] });
|
|
183
|
+
}
|
|
184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableRowFGC, decorators: [{
|
|
185
|
+
type: Component,
|
|
186
|
+
args: [{ selector: 'tr', imports: [
|
|
187
|
+
AttributesDirective,
|
|
188
|
+
NgTemplateOutlet,
|
|
189
|
+
PurePipe,
|
|
190
|
+
SelectorlessOutlet,
|
|
191
|
+
StrOrTemplateComponent,
|
|
192
|
+
JsonPipe,
|
|
193
|
+
FormsModule,
|
|
194
|
+
], providers: [], template: "@for (field of children$$(); track $index) {\n <ng-container\n *ngTemplateOutlet=\"fieldTemplateRef(); context: { $implicit: field }\"\n ></ng-container>\n}\n" }]
|
|
195
|
+
}] });
|
|
196
|
+
|
|
197
|
+
const TABLE_STATUS_TOKEN = new InjectionToken('TABLE_STATUS');
|
|
198
|
+
|
|
199
|
+
function createRowDefine() {
|
|
200
|
+
return v.pipe(v.tuple([]), setComponent(TableRowFGC));
|
|
201
|
+
}
|
|
202
|
+
function createDefaultColDefine(isHeader, content, context) {
|
|
203
|
+
return v.pipe(NFCSchema, setComponent(StrOrTemplateComponent), actions.inputs.patch({ content, context }), actions.wrappers.set([{ type: isHeader ? ThWC : TdWC }]));
|
|
204
|
+
}
|
|
205
|
+
function createDefaultColDefineFn(isHeader, content, context) {
|
|
206
|
+
return v.pipe(NFCSchema, setComponent(StrOrTemplateComponent), actions.inputs.patch({ context }), actions.inputs.patchAsync({
|
|
207
|
+
content: ({ context }) => {
|
|
208
|
+
return computed(() => {
|
|
209
|
+
const item = context['item$']();
|
|
210
|
+
return content(item, context['index']);
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
}), actions.wrappers.set([{ type: isHeader ? ThWC : TdWC }]));
|
|
214
|
+
}
|
|
215
|
+
class TableNFCC {
|
|
216
|
+
static __version = 2;
|
|
217
|
+
templateRef = viewChild.required('templateRef');
|
|
218
|
+
StrOrTemplateComponent = StrOrTemplateComponent;
|
|
219
|
+
define = input(...(ngDevMode ? [undefined, { debugName: "define" }] : []));
|
|
220
|
+
// todo待修改
|
|
221
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
222
|
+
injector = inject(Injector);
|
|
223
|
+
data$$ = computed(() => {
|
|
224
|
+
const data = this.data();
|
|
225
|
+
return Array.isArray(data) ? data : data();
|
|
226
|
+
}, ...(ngDevMode ? [{ debugName: "data$$" }] : []));
|
|
227
|
+
#status = inject(TABLE_STATUS_TOKEN, { optional: true });
|
|
228
|
+
zebra = input(...(ngDevMode ? [undefined, { debugName: "zebra" }] : []));
|
|
229
|
+
pin = input(...(ngDevMode ? [undefined, { debugName: "pin" }] : []));
|
|
230
|
+
size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : []));
|
|
231
|
+
trackBy = input((key, value) => {
|
|
232
|
+
return key;
|
|
233
|
+
}, ...(ngDevMode ? [{ debugName: "trackBy" }] : []));
|
|
234
|
+
pagination = input(...(ngDevMode ? [undefined, { debugName: "pagination" }] : []));
|
|
235
|
+
type = input(...(ngDevMode ? [undefined, { debugName: "type" }] : []));
|
|
236
|
+
#theme = inject(ThemeService);
|
|
237
|
+
wrapperClass$$ = computed(() => {
|
|
238
|
+
return clsx(this.zebra() ? this.#theme.addPrefix(`table-zebra`) : undefined, this.pin()?.rows ? this.#theme.addPrefix(`table-pin-rows`) : undefined, this.pin()?.cols ? this.#theme.addPrefix(`table-pin-cols`) : undefined, this.#theme.setSize('table', this.size()));
|
|
239
|
+
}, ...(ngDevMode ? [{ debugName: "wrapperClass$$" }] : []));
|
|
240
|
+
columnsList$$ = computed(() => {
|
|
241
|
+
return Object.values(this.define().columns);
|
|
242
|
+
}, ...(ngDevMode ? [{ debugName: "columnsList$$" }] : []));
|
|
243
|
+
headList$$ = computed(() => {
|
|
244
|
+
return this.#toColList('head');
|
|
245
|
+
}, ...(ngDevMode ? [{ debugName: "headList$$" }] : []));
|
|
246
|
+
bodyList$$ = computed(() => {
|
|
247
|
+
return this.#toColList('body');
|
|
248
|
+
}, ...(ngDevMode ? [{ debugName: "bodyList$$" }] : []));
|
|
249
|
+
footList$$ = computed(() => {
|
|
250
|
+
return this.#toColList('foot');
|
|
251
|
+
}, ...(ngDevMode ? [{ debugName: "footList$$" }] : []));
|
|
252
|
+
#toColList(name) {
|
|
253
|
+
const define = this.define();
|
|
254
|
+
const rowList = (define.row?.[name] ?? [{}]).map((item) => {
|
|
255
|
+
return 'define' in item ? item : { ...item, define: createRowDefine() };
|
|
256
|
+
});
|
|
257
|
+
const isHeader = name === 'head';
|
|
258
|
+
return rowList
|
|
259
|
+
.map((row) => {
|
|
260
|
+
let colList;
|
|
261
|
+
if (!row.columns) {
|
|
262
|
+
colList = this.columnsList$$().map((item) => item[name]);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
colList = row.columns.map((col) => {
|
|
266
|
+
const item = define.columns[col][name];
|
|
267
|
+
return item;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
colList = colList
|
|
271
|
+
.map((itemDefine) => {
|
|
272
|
+
if (itemDefine) {
|
|
273
|
+
if (isSchema(itemDefine)) {
|
|
274
|
+
return itemDefine;
|
|
275
|
+
}
|
|
276
|
+
else if (typeof itemDefine === 'function') {
|
|
277
|
+
return createDefaultColDefineFn(isHeader, itemDefine);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
return createDefaultColDefine(isHeader, itemDefine);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return undefined;
|
|
284
|
+
})
|
|
285
|
+
.filter(Boolean);
|
|
286
|
+
if (colList.length) {
|
|
287
|
+
row.define.items.push(...colList);
|
|
288
|
+
return row.define;
|
|
289
|
+
}
|
|
290
|
+
return undefined;
|
|
291
|
+
})
|
|
292
|
+
.filter((a) => !!a);
|
|
293
|
+
}
|
|
294
|
+
dataConvert(data) {
|
|
295
|
+
if (data.length === 2 && typeof data[0] === 'number' && Array.isArray(data[1])) {
|
|
296
|
+
return data;
|
|
297
|
+
}
|
|
298
|
+
return [data.length, data];
|
|
299
|
+
}
|
|
300
|
+
isFunction(input) {
|
|
301
|
+
return typeof input === 'function';
|
|
302
|
+
}
|
|
303
|
+
selectorlessInput = (content, context) => {
|
|
304
|
+
const obj = { content: computed(() => content) };
|
|
305
|
+
if (context) {
|
|
306
|
+
obj['context'] = computed(() => {
|
|
307
|
+
return { ...context, status: this.#status };
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
return obj;
|
|
311
|
+
};
|
|
312
|
+
#itemDataMap = new Map();
|
|
313
|
+
getItemData = (id, value) => {
|
|
314
|
+
return untracked(() => {
|
|
315
|
+
const data = this.#itemDataMap.get(id) ?? signal(undefined);
|
|
316
|
+
data.set(value);
|
|
317
|
+
this.#itemDataMap.set(id, data);
|
|
318
|
+
return data;
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
isSchema = isSchema;
|
|
322
|
+
categoryHeadData = (data) => {
|
|
323
|
+
return computed(() => {
|
|
324
|
+
return data()[0];
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
categoryBodyData = (data, index) => {
|
|
328
|
+
return computed(() => {
|
|
329
|
+
return data()[1][index];
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableNFCC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
333
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TableNFCC, isStandalone: true, selector: "app-table", inputs: { define: { classPropertyName: "define", publicName: "define", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, zebra: { classPropertyName: "zebra", publicName: "zebra", isSignal: true, isRequired: false, transformFunction: null }, pin: { classPropertyName: "pin", publicName: "pin", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <div\n [class]=\"'overflow-x-auto' | mergeClass: attr()?.class\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n <table [class]=\"'table' | cssPrefix | mergeClass: wrapperClass$$()\">\n @let headList = headList$$();\n @let bodyList = bodyList$$();\n @if (type() === 'category') {\n @for (item of data$$(); track trackBy()($index, item)) {\n @let id = trackBy() | pure: $index : item;\n @let itemData = getItemData | pure: id : item;\n <thead>\n @let row = headList[0];\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"\n selectorlessInput | pure: row : { item$: categoryHeadData | pure: itemData }\n \"\n ></ng-container>\n </thead>\n <tbody>\n @let bodyData = item[1];\n @for (groupItem of bodyData; track $index) {\n @let index3 = $index;\n @for (row of bodyList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"\n selectorlessInput\n | pure\n : row\n : { item$: categoryBodyData | pure: itemData : index3, index: index3 }\n \"\n ></ng-container>\n }\n }\n </tbody>\n }\n } @else {\n @if (headList.length) {\n <thead>\n @for (item of headList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"selectorlessInput | pure: item\"\n ></ng-container>\n }\n </thead>\n }\n @if (bodyList.length) {\n <tbody>\n @for (item of data$$(); track trackBy()($index, item)) {\n @let index2 = $index;\n @let id = trackBy() | pure: $index : item;\n @let itemData = getItemData | pure: id : item;\n @for (row of bodyList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"\n selectorlessInput | pure: row : { item$: itemData, index: index2 }\n \"\n ></ng-container>\n }\n }\n </tbody>\n }\n @let footList = footList$$();\n @if (footList.length) {\n <tfoot>\n @for (item of footList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"selectorlessInput | pure: item\"\n ></ng-container>\n }\n </tfoot>\n }\n }\n </table>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: AttributesDirective, selector: "[attributes]", inputs: ["attributes", "excludes"] }, { kind: "directive", type: SelectorlessOutlet, selector: "[selectlessOutlet]", inputs: ["selectlessOutlet", "selectlessOutletInputs", "selectlessOutletOutputs", "selectlessOutletDirectives", "selectlessOutletInjector", "selectlessOutletEnvironmentInjector"], exportAs: ["selectlessOutlet"] }, { kind: "ngmodule", type: FormsModule }, { kind: "pipe", type: PurePipe, name: "pure" }, { kind: "pipe", type: CssPrefixPipe, name: "cssPrefix" }, { kind: "pipe", type: MergeClassPipe, name: "mergeClass" }] });
|
|
334
|
+
}
|
|
335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableNFCC, decorators: [{
|
|
336
|
+
type: Component,
|
|
337
|
+
args: [{ selector: 'app-table', imports: [
|
|
338
|
+
AttributesDirective,
|
|
339
|
+
NgTemplateOutlet,
|
|
340
|
+
PurePipe,
|
|
341
|
+
SelectorlessOutlet,
|
|
342
|
+
StrOrTemplateComponent,
|
|
343
|
+
JsonPipe,
|
|
344
|
+
FormsModule,
|
|
345
|
+
CssPrefixPipe,
|
|
346
|
+
MergeClassPipe,
|
|
347
|
+
], template: "<ng-template #templateRef let-attr=\"attributes\">\n <div\n [class]=\"'overflow-x-auto' | mergeClass: attr()?.class\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n <table [class]=\"'table' | cssPrefix | mergeClass: wrapperClass$$()\">\n @let headList = headList$$();\n @let bodyList = bodyList$$();\n @if (type() === 'category') {\n @for (item of data$$(); track trackBy()($index, item)) {\n @let id = trackBy() | pure: $index : item;\n @let itemData = getItemData | pure: id : item;\n <thead>\n @let row = headList[0];\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"\n selectorlessInput | pure: row : { item$: categoryHeadData | pure: itemData }\n \"\n ></ng-container>\n </thead>\n <tbody>\n @let bodyData = item[1];\n @for (groupItem of bodyData; track $index) {\n @let index3 = $index;\n @for (row of bodyList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"\n selectorlessInput\n | pure\n : row\n : { item$: categoryBodyData | pure: itemData : index3, index: index3 }\n \"\n ></ng-container>\n }\n }\n </tbody>\n }\n } @else {\n @if (headList.length) {\n <thead>\n @for (item of headList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"selectorlessInput | pure: item\"\n ></ng-container>\n }\n </thead>\n }\n @if (bodyList.length) {\n <tbody>\n @for (item of data$$(); track trackBy()($index, item)) {\n @let index2 = $index;\n @let id = trackBy() | pure: $index : item;\n @let itemData = getItemData | pure: id : item;\n @for (row of bodyList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"\n selectorlessInput | pure: row : { item$: itemData, index: index2 }\n \"\n ></ng-container>\n }\n }\n </tbody>\n }\n @let footList = footList$$();\n @if (footList.length) {\n <tfoot>\n @for (item of footList; track $index) {\n <ng-container\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"selectorlessInput | pure: item\"\n ></ng-container>\n }\n </tfoot>\n }\n }\n </table>\n </div>\n</ng-template>\n" }]
|
|
348
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], define: [{ type: i0.Input, args: [{ isSignal: true, alias: "define", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], zebra: [{ type: i0.Input, args: [{ isSignal: true, alias: "zebra", required: false }] }], pin: [{ type: i0.Input, args: [{ isSignal: true, alias: "pin", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], pagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagination", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }] } });
|
|
349
|
+
|
|
350
|
+
function dataConvert(data) {
|
|
351
|
+
if (data.length === 2 && typeof data[0] === 'number' && Array.isArray(data[1])) {
|
|
352
|
+
return data;
|
|
353
|
+
}
|
|
354
|
+
return [data.length, data];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function localData(data) {
|
|
358
|
+
const result = dataConvert(data);
|
|
359
|
+
return async (res) => {
|
|
360
|
+
const page = res.params.params?.['page'];
|
|
361
|
+
let list;
|
|
362
|
+
if (!page) {
|
|
363
|
+
list = result[1];
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
const start = page.index * page.size;
|
|
367
|
+
list = result[1].slice(start, start + page.size);
|
|
368
|
+
}
|
|
369
|
+
const direction = res.params.params?.['direction'];
|
|
370
|
+
if (direction) {
|
|
371
|
+
for (const item of direction) {
|
|
372
|
+
list = list.sort((a, b) => {
|
|
373
|
+
const result = a[item.key] > b[item.key] ? 1 : -1;
|
|
374
|
+
return item.value === 1 ? result : -result;
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return [result[0], list];
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
class TableResourceWC {
|
|
383
|
+
static __version = 2;
|
|
384
|
+
templateRef = viewChild.required('templateRef');
|
|
385
|
+
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
386
|
+
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
387
|
+
rawData$$ = computed(() => {
|
|
388
|
+
const data = this.field$$().props()['data'];
|
|
389
|
+
return Array.isArray(data) ? localData(data) : data;
|
|
390
|
+
}, ...(ngDevMode ? [{ debugName: "rawData$$" }] : []));
|
|
391
|
+
queryParams$$ = computed(() => {
|
|
392
|
+
return this.field$$().props()['queryParams'];
|
|
393
|
+
}, ...(ngDevMode ? [{ debugName: "queryParams$$" }] : []));
|
|
394
|
+
data$ = resource({
|
|
395
|
+
params: computed(() => {
|
|
396
|
+
const params = this.queryParams$$();
|
|
397
|
+
return {
|
|
398
|
+
data: this.rawData$$(),
|
|
399
|
+
params,
|
|
400
|
+
};
|
|
401
|
+
}),
|
|
402
|
+
loader: async (res) => {
|
|
403
|
+
const { params } = res;
|
|
404
|
+
return params.data(res).then((data) => {
|
|
405
|
+
return dataConvert(data);
|
|
406
|
+
});
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
list$$ = computedWithPrev((value) => {
|
|
410
|
+
return this.data$.value()?.[1] ?? value;
|
|
411
|
+
});
|
|
412
|
+
count$$ = computedWithPrev((value) => {
|
|
413
|
+
return this.data$.value()?.[0] ?? value;
|
|
414
|
+
});
|
|
415
|
+
constructor() {
|
|
416
|
+
this.field$$().inputs.update((inputs) => {
|
|
417
|
+
return {
|
|
418
|
+
...inputs,
|
|
419
|
+
data: this.list$$,
|
|
420
|
+
};
|
|
421
|
+
});
|
|
422
|
+
this.field$$().props.update((props) => {
|
|
423
|
+
return {
|
|
424
|
+
...props,
|
|
425
|
+
count$$: this.count$$,
|
|
426
|
+
};
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableResourceWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
430
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: TableResourceWC, isStandalone: true, selector: "app-table-resource", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }] });
|
|
431
|
+
}
|
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableResourceWC, decorators: [{
|
|
433
|
+
type: Component,
|
|
434
|
+
args: [{
|
|
435
|
+
selector: 'app-table-resource',
|
|
436
|
+
template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`,
|
|
437
|
+
imports: [InsertFieldDirective],
|
|
438
|
+
}]
|
|
439
|
+
}], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
440
|
+
|
|
441
|
+
const SortMultiToken = new InjectionToken('SortMultiToken');
|
|
442
|
+
class SortService {
|
|
443
|
+
direction$ = signal({}, ...(ngDevMode ? [{ debugName: "direction$" }] : []));
|
|
444
|
+
multiple = inject(SortMultiToken, { optional: true }) ?? true;
|
|
445
|
+
update(key, direction) {
|
|
446
|
+
if (this.multiple) {
|
|
447
|
+
this.direction$.update((data) => {
|
|
448
|
+
if (direction === 0) {
|
|
449
|
+
data = { ...data };
|
|
450
|
+
delete data[key];
|
|
451
|
+
return data;
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
...data,
|
|
455
|
+
[key]: direction,
|
|
456
|
+
};
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
if (direction === 0) {
|
|
461
|
+
if (key in this.direction$()) {
|
|
462
|
+
this.direction$.set({});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
Object.keys(this.direction$()).forEach((k) => {
|
|
467
|
+
if (k === key) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
this.#restore$.next({ key: k, value: 0 });
|
|
471
|
+
});
|
|
472
|
+
this.direction$.set({
|
|
473
|
+
[key]: direction,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
this.#update(this.direction$());
|
|
478
|
+
}
|
|
479
|
+
#update;
|
|
480
|
+
setUpdate(fn) {
|
|
481
|
+
this.#update = fn;
|
|
482
|
+
}
|
|
483
|
+
#restore$ = new Subject();
|
|
484
|
+
listenRestore(key) {
|
|
485
|
+
return this.#restore$.pipe(filter((a) => a.key === key));
|
|
486
|
+
}
|
|
487
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
488
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortService });
|
|
489
|
+
}
|
|
490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortService, decorators: [{
|
|
491
|
+
type: Injectable
|
|
492
|
+
}] });
|
|
493
|
+
|
|
494
|
+
class inputSortDirective {
|
|
495
|
+
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
|
|
496
|
+
inputSort = model.required(...(ngDevMode ? [{ debugName: "inputSort" }] : []));
|
|
497
|
+
#el = inject(ElementRef).nativeElement;
|
|
498
|
+
#sort = inject(SortService);
|
|
499
|
+
ngOnChanges() {
|
|
500
|
+
const result = this.inputSort();
|
|
501
|
+
this.#changeElProps(result);
|
|
502
|
+
this.#sort.update(this.key(), result);
|
|
503
|
+
}
|
|
504
|
+
#changeElProps(value) {
|
|
505
|
+
switch (value) {
|
|
506
|
+
case 0:
|
|
507
|
+
this.#el.indeterminate = true;
|
|
508
|
+
break;
|
|
509
|
+
case 1:
|
|
510
|
+
this.#el.checked = true;
|
|
511
|
+
break;
|
|
512
|
+
case -1:
|
|
513
|
+
this.#el.checked = false;
|
|
514
|
+
break;
|
|
515
|
+
default:
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
ngOnInit() {
|
|
520
|
+
this.#sort.listenRestore(this.key()).subscribe(({ value }) => {
|
|
521
|
+
this.inputSort.set(value);
|
|
522
|
+
this.#changeElProps(value);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
chagne() {
|
|
526
|
+
this.inputSort.update((a) => {
|
|
527
|
+
const value = ++a;
|
|
528
|
+
return value === 2 ? -1 : value;
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: inputSortDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
532
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.14", type: inputSortDirective, isStandalone: true, selector: "[inputSort]", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, inputSort: { classPropertyName: "inputSort", publicName: "inputSort", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { inputSort: "inputSortChange" }, host: { listeners: { "change": "chagne()" } }, usesOnChanges: true, ngImport: i0 });
|
|
533
|
+
}
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: inputSortDirective, decorators: [{
|
|
535
|
+
type: Directive,
|
|
536
|
+
args: [{
|
|
537
|
+
selector: '[inputSort]',
|
|
538
|
+
}]
|
|
539
|
+
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], inputSort: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputSort", required: true }] }, { type: i0.Output, args: ["inputSortChange"] }], chagne: [{
|
|
540
|
+
type: HostListener,
|
|
541
|
+
args: ['change']
|
|
542
|
+
}] } });
|
|
543
|
+
|
|
544
|
+
class SortHeaderWC {
|
|
545
|
+
static __version = 2;
|
|
546
|
+
templateRef = viewChild.required('templateRef');
|
|
547
|
+
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
548
|
+
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
549
|
+
key$$ = computed(() => {
|
|
550
|
+
return this.props$$()['key'];
|
|
551
|
+
}, ...(ngDevMode ? [{ debugName: "key$$" }] : []));
|
|
552
|
+
#direction$$ = computed(() => {
|
|
553
|
+
return this.props$$()['direction'];
|
|
554
|
+
}, ...(ngDevMode ? [{ debugName: "#direction$$", equal: () => false }] : [{ equal: () => false }]));
|
|
555
|
+
index$ = linkedSignal(() => {
|
|
556
|
+
return this.#direction$$() ?? 0;
|
|
557
|
+
}, ...(ngDevMode ? [{ debugName: "index$" }] : []));
|
|
558
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortHeaderWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
559
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: SortHeaderWC, isStandalone: true, selector: "app-sort-header", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <ng-container insertField></ng-container>\n\n <label\n [class]=\"'swap swap-rotate' | mergeClass: attr()?.class | cssPrefix\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n <input type=\"checkbox\" [(inputSort)]=\"index$\" [key]=\"key$$()\" />\n\n <div [class]=\"'swap-indeterminate' | cssPrefix\"></div>\n <div [class]=\"'swap-on' | cssPrefix\"><mat-icon>arrow_upward</mat-icon></div>\n <div [class]=\"'swap-off' | cssPrefix\"><mat-icon>arrow_downward</mat-icon></div>\n </label>\n</ng-template>\n", dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: AttributesDirective, selector: "[attributes]", inputs: ["attributes", "excludes"] }, { kind: "directive", type: inputSortDirective, selector: "[inputSort]", inputs: ["key", "inputSort"], outputs: ["inputSortChange"] }, { kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }, { kind: "pipe", type: CssPrefixPipe, name: "cssPrefix" }, { kind: "pipe", type: MergeClassPipe, name: "mergeClass" }] });
|
|
560
|
+
}
|
|
561
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortHeaderWC, decorators: [{
|
|
562
|
+
type: Component,
|
|
563
|
+
args: [{ selector: 'app-sort-header', imports: [
|
|
564
|
+
MatIcon,
|
|
565
|
+
FormsModule,
|
|
566
|
+
CssPrefixPipe,
|
|
567
|
+
MergeClassPipe,
|
|
568
|
+
AttributesDirective,
|
|
569
|
+
inputSortDirective,
|
|
570
|
+
InsertFieldDirective,
|
|
571
|
+
], template: "<ng-template #templateRef let-attr=\"attributes\">\n <ng-container insertField></ng-container>\n\n <label\n [class]=\"'swap swap-rotate' | mergeClass: attr()?.class | cssPrefix\"\n [attributes]=\"attr()\"\n [excludes]=\"['class']\"\n >\n <input type=\"checkbox\" [(inputSort)]=\"index$\" [key]=\"key$$()\" />\n\n <div [class]=\"'swap-indeterminate' | cssPrefix\"></div>\n <div [class]=\"'swap-on' | cssPrefix\"><mat-icon>arrow_upward</mat-icon></div>\n <div [class]=\"'swap-off' | cssPrefix\"><mat-icon>arrow_downward</mat-icon></div>\n </label>\n</ng-template>\n" }]
|
|
572
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
573
|
+
|
|
574
|
+
class SortTablehWC {
|
|
575
|
+
static __version = 2;
|
|
576
|
+
templateRef = viewChild.required('templateRef');
|
|
577
|
+
#sort = inject(SortService);
|
|
578
|
+
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
579
|
+
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
580
|
+
constructor() {
|
|
581
|
+
this.#sort.setUpdate((value) => {
|
|
582
|
+
this.field$$().props.update((data) => {
|
|
583
|
+
return {
|
|
584
|
+
...data,
|
|
585
|
+
sortQueryParams: (this.props$$()['sortList'] ?? Object.keys(value))
|
|
586
|
+
.map((key) => {
|
|
587
|
+
return value[key] ? { key: key, value: value[key] } : undefined;
|
|
588
|
+
})
|
|
589
|
+
.filter(Boolean),
|
|
590
|
+
};
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortTablehWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
595
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: SortTablehWC, isStandalone: true, selector: "app-sort-table", providers: [SortService, { provide: SortMultiToken, useValue: false }], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }] });
|
|
596
|
+
}
|
|
597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortTablehWC, decorators: [{
|
|
598
|
+
type: Component,
|
|
599
|
+
args: [{
|
|
600
|
+
selector: 'app-sort-table',
|
|
601
|
+
template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`,
|
|
602
|
+
providers: [SortService, { provide: SortMultiToken, useValue: false }],
|
|
603
|
+
imports: [InsertFieldDirective],
|
|
604
|
+
}]
|
|
605
|
+
}], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
606
|
+
|
|
607
|
+
class TableStatusService {
|
|
608
|
+
expanded = new BehaviorSubject(undefined);
|
|
609
|
+
toggleExpand(value) {
|
|
610
|
+
this.expanded.next(value === this.expanded.value ? undefined : value);
|
|
611
|
+
}
|
|
612
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
613
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusService });
|
|
614
|
+
}
|
|
615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusService, decorators: [{
|
|
616
|
+
type: Injectable
|
|
617
|
+
}] });
|
|
618
|
+
|
|
619
|
+
class ExpandRowDirective {
|
|
620
|
+
#field = inject(PI_VIEW_FIELD_TOKEN);
|
|
621
|
+
#status = inject(TableStatusService);
|
|
622
|
+
a(event) {
|
|
623
|
+
if (event.target instanceof HTMLInputElement) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
this.#status.toggleExpand(this.#field().context['item$']());
|
|
627
|
+
}
|
|
628
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ExpandRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
629
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.14", type: ExpandRowDirective, isStandalone: true, selector: "app-expand", host: { listeners: { "click": "a($event)" } }, ngImport: i0 });
|
|
630
|
+
}
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ExpandRowDirective, decorators: [{
|
|
632
|
+
type: Directive,
|
|
633
|
+
args: [{
|
|
634
|
+
selector: 'app-expand',
|
|
635
|
+
}]
|
|
636
|
+
}], propDecorators: { a: [{
|
|
637
|
+
type: HostListener,
|
|
638
|
+
args: ['click', ['$event']]
|
|
639
|
+
}] } });
|
|
640
|
+
|
|
641
|
+
// 切换状态演示,继承TABLE_STATUS_TOKEN自定义
|
|
642
|
+
class TableStatusWC {
|
|
643
|
+
static __version = 2;
|
|
644
|
+
templateRef = viewChild.required('templateRef');
|
|
645
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
646
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: TableStatusWC, isStandalone: true, selector: "app-table-status", providers: [TableStatusService, { provide: TABLE_STATUS_TOKEN, useExisting: TableStatusService }], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <ng-container insertField></ng-container>\n</ng-template>\n", dependencies: [{ kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }] });
|
|
647
|
+
}
|
|
648
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusWC, decorators: [{
|
|
649
|
+
type: Component,
|
|
650
|
+
args: [{ selector: 'app-table-status', providers: [TableStatusService, { provide: TABLE_STATUS_TOKEN, useExisting: TableStatusService }], imports: [InsertFieldDirective], template: "<ng-template #templateRef let-attr=\"attributes\">\n <ng-container insertField></ng-container>\n</ng-template>\n" }]
|
|
651
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
652
|
+
|
|
653
|
+
class CheckboxTableWC {
|
|
654
|
+
static __version = 2;
|
|
655
|
+
templateRef = viewChild.required('templateRef');
|
|
656
|
+
#checkbox = inject(CheckboxService);
|
|
657
|
+
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
658
|
+
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
659
|
+
constructor() {
|
|
660
|
+
this.#checkbox.setAllList(() => {
|
|
661
|
+
// todo 去掉数量
|
|
662
|
+
const data = this.field$$().inputs()['data'];
|
|
663
|
+
return Array.isArray(data) ? data[1] : data.value();
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CheckboxTableWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
667
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: CheckboxTableWC, isStandalone: true, selector: "app-checkbox-table", providers: [CheckboxService], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }] });
|
|
668
|
+
}
|
|
669
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CheckboxTableWC, decorators: [{
|
|
670
|
+
type: Component,
|
|
671
|
+
args: [{
|
|
672
|
+
selector: 'app-checkbox-table',
|
|
673
|
+
template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`,
|
|
674
|
+
providers: [CheckboxService],
|
|
675
|
+
imports: [InsertFieldDirective],
|
|
676
|
+
}]
|
|
677
|
+
}], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
678
|
+
|
|
679
|
+
class TableCheckboxAllWC {
|
|
680
|
+
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
681
|
+
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
682
|
+
static __version = 2;
|
|
683
|
+
templateRef = viewChild.required('templateRef');
|
|
684
|
+
#checkboxService = inject(CheckboxService);
|
|
685
|
+
#key$$ = computed(() => {
|
|
686
|
+
return this.props$$()['key'];
|
|
687
|
+
}, ...(ngDevMode ? [{ debugName: "#key$$" }] : []));
|
|
688
|
+
toggle() {
|
|
689
|
+
this.#checkboxService.toggle(this.#key$$(), this.props$$()['item$']());
|
|
690
|
+
}
|
|
691
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableCheckboxAllWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
692
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: TableCheckboxAllWC, isStandalone: true, selector: "app-table-checkbox-all", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <div (click)=\"toggle()\">\n <ng-container insertField></ng-container>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }] });
|
|
693
|
+
}
|
|
694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableCheckboxAllWC, decorators: [{
|
|
695
|
+
type: Component,
|
|
696
|
+
args: [{ selector: 'app-table-checkbox-all', imports: [InsertFieldDirective], template: "<ng-template #templateRef let-attr=\"attributes\">\n <div (click)=\"toggle()\">\n <ng-container insertField></ng-container>\n </div>\n</ng-template>\n" }]
|
|
697
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
698
|
+
|
|
699
|
+
class TableCheckboxOneWC {
|
|
700
|
+
static __version = 2;
|
|
701
|
+
templateRef = viewChild.required('templateRef');
|
|
702
|
+
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
703
|
+
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
704
|
+
#checkboxService = inject(CheckboxService);
|
|
705
|
+
#key$$ = computed(() => {
|
|
706
|
+
return this.props$$()['key'];
|
|
707
|
+
}, ...(ngDevMode ? [{ debugName: "#key$$" }] : []));
|
|
708
|
+
constructor() {
|
|
709
|
+
this.field$$()
|
|
710
|
+
.form.control.valueChanges.pipe(filter((a) => a !== undefined))
|
|
711
|
+
.subscribe((a) => {
|
|
712
|
+
this.#checkboxService.toggle(this.#key$$(), this.field$$().context['item$']());
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableCheckboxOneWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
716
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: TableCheckboxOneWC, isStandalone: true, selector: "app-table-checkbox-body", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <ng-container insertField></ng-container>\n</ng-template>\n", dependencies: [{ kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }] });
|
|
717
|
+
}
|
|
718
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableCheckboxOneWC, decorators: [{
|
|
719
|
+
type: Component,
|
|
720
|
+
args: [{ selector: 'app-table-checkbox-body', imports: [InsertFieldDirective], template: "<ng-template #templateRef let-attr=\"attributes\">\n <ng-container insertField></ng-container>\n</ng-template>\n" }]
|
|
721
|
+
}], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
722
|
+
|
|
723
|
+
var wrapper_index$1 = /*#__PURE__*/Object.freeze({
|
|
724
|
+
__proto__: null,
|
|
725
|
+
CheckboxTablehWC: CheckboxTableWC,
|
|
726
|
+
SortHeaderWC: SortHeaderWC,
|
|
727
|
+
SortTablehWC: SortTablehWC,
|
|
728
|
+
TableCheckboxAllWC: TableCheckboxAllWC,
|
|
729
|
+
TableCheckboxOneWC: TableCheckboxOneWC,
|
|
730
|
+
TableResourceWC: TableResourceWC,
|
|
731
|
+
TableStatusWC: TableStatusWC
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* @license
|
|
736
|
+
* Copyright Google LLC All Rights Reserved.
|
|
737
|
+
*
|
|
738
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
739
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
740
|
+
*/
|
|
741
|
+
/** Gets the target of an event while accounting for Shadow DOM. */
|
|
742
|
+
function _getEventTarget(event) {
|
|
743
|
+
// If an event is bound outside the Shadow DOM, the `event.target` will
|
|
744
|
+
// point to the shadow root so we have to use `composedPath` instead.
|
|
745
|
+
return (event.composedPath ? event.composedPath()[0] : event.target);
|
|
746
|
+
}
|
|
747
|
+
/** Default set of positions for the overlay. Follows the behavior of a dropdown. */
|
|
748
|
+
const defaultPositionList = [
|
|
749
|
+
{
|
|
750
|
+
originX: 'start',
|
|
751
|
+
originY: 'bottom',
|
|
752
|
+
overlayX: 'start',
|
|
753
|
+
overlayY: 'top',
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
originX: 'start',
|
|
757
|
+
originY: 'top',
|
|
758
|
+
overlayX: 'start',
|
|
759
|
+
overlayY: 'bottom',
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
originX: 'end',
|
|
763
|
+
originY: 'top',
|
|
764
|
+
overlayX: 'end',
|
|
765
|
+
overlayY: 'bottom',
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
originX: 'end',
|
|
769
|
+
originY: 'bottom',
|
|
770
|
+
overlayX: 'end',
|
|
771
|
+
overlayY: 'top',
|
|
772
|
+
},
|
|
773
|
+
];
|
|
774
|
+
/** Injection token that determines the scroll handling while the connected overlay is open. */
|
|
775
|
+
const CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY = new InjectionToken('cdk-connected-overlay-scroll-strategy', {
|
|
776
|
+
providedIn: 'root',
|
|
777
|
+
factory: () => {
|
|
778
|
+
const injector = inject(Injector);
|
|
779
|
+
return () => createRepositionScrollStrategy(injector);
|
|
780
|
+
},
|
|
781
|
+
});
|
|
782
|
+
/**
|
|
783
|
+
* Directive applied to an element to make it usable as an origin for an Overlay using a
|
|
784
|
+
* ConnectedPositionStrategy.
|
|
785
|
+
*/
|
|
786
|
+
class CdkOverlayOrigin {
|
|
787
|
+
elementRef = inject(ElementRef);
|
|
788
|
+
constructor() { }
|
|
789
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CdkOverlayOrigin, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
790
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.14", type: CdkOverlayOrigin, isStandalone: true, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"], ngImport: i0 });
|
|
791
|
+
}
|
|
792
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CdkOverlayOrigin, decorators: [{
|
|
793
|
+
type: Directive,
|
|
794
|
+
args: [{
|
|
795
|
+
selector: '[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]',
|
|
796
|
+
exportAs: 'cdkOverlayOrigin',
|
|
797
|
+
}]
|
|
798
|
+
}], ctorParameters: () => [] });
|
|
799
|
+
/**
|
|
800
|
+
* Directive to facilitate declarative creation of an
|
|
801
|
+
* Overlay using a FlexibleConnectedPositionStrategy.
|
|
802
|
+
*/
|
|
803
|
+
class CdkConnectedOverlay {
|
|
804
|
+
_dir = inject(Directionality, { optional: true });
|
|
805
|
+
_injector = inject(Injector);
|
|
806
|
+
_overlayRef;
|
|
807
|
+
_backdropSubscription = Subscription.EMPTY;
|
|
808
|
+
_attachSubscription = Subscription.EMPTY;
|
|
809
|
+
_detachSubscription = Subscription.EMPTY;
|
|
810
|
+
_positionSubscription = Subscription.EMPTY;
|
|
811
|
+
_position;
|
|
812
|
+
_scrollStrategyFactory = inject(CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY);
|
|
813
|
+
_ngZone = inject(NgZone);
|
|
814
|
+
/** Origin for the connected overlay. */
|
|
815
|
+
origin = input.required(...(ngDevMode ? [{ debugName: "origin" }] : []));
|
|
816
|
+
/** Registered connected position pairs. */
|
|
817
|
+
positions = input(...(ngDevMode ? [undefined, { debugName: "positions" }] : []));
|
|
818
|
+
positions$$ = computed(() => {
|
|
819
|
+
const pos = this.positions();
|
|
820
|
+
return pos && pos.length ? pos : defaultPositionList;
|
|
821
|
+
}, ...(ngDevMode ? [{ debugName: "positions$$" }] : []));
|
|
822
|
+
/** The offset in pixels for the overlay connection point on the x-axis */
|
|
823
|
+
offsetX = input(...(ngDevMode ? [undefined, { debugName: "offsetX" }] : []));
|
|
824
|
+
/** The offset in pixels for the overlay connection point on the y-axis */
|
|
825
|
+
offsetY = input(...(ngDevMode ? [undefined, { debugName: "offsetY" }] : []));
|
|
826
|
+
overlayConfig = input(...(ngDevMode ? [undefined, { debugName: "overlayConfig" }] : []));
|
|
827
|
+
/** Margin between the overlay and the viewport edges. */
|
|
828
|
+
viewportMargin = input(0, ...(ngDevMode ? [{ debugName: "viewportMargin" }] : []));
|
|
829
|
+
open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
830
|
+
/** Whether the overlay can be closed by user interaction. */
|
|
831
|
+
disableClose = input(false, ...(ngDevMode ? [{ debugName: "disableClose" }] : []));
|
|
832
|
+
/** CSS selector which to set the transform origin. */
|
|
833
|
+
transformOriginSelector = input(...(ngDevMode ? [undefined, { debugName: "transformOriginSelector" }] : []));
|
|
834
|
+
/** Whether or not the overlay should be locked when scrolling. */
|
|
835
|
+
lockPosition = input(false, ...(ngDevMode ? [{ debugName: "lockPosition" }] : []));
|
|
836
|
+
/** Whether the overlay's width and height can be constrained to fit within the viewport. */
|
|
837
|
+
flexibleDimensions = input(false, ...(ngDevMode ? [{ debugName: "flexibleDimensions" }] : []));
|
|
838
|
+
/** Whether the overlay can grow after the initial open when flexible positioning is turned on. */
|
|
839
|
+
growAfterOpen = input(false, ...(ngDevMode ? [{ debugName: "growAfterOpen" }] : []));
|
|
840
|
+
/** Whether the overlay can be pushed on-screen if none of the provided positions fit. */
|
|
841
|
+
push = input(false, ...(ngDevMode ? [{ debugName: "push" }] : []));
|
|
842
|
+
matchWidth = input(false, ...(ngDevMode ? [{ debugName: "matchWidth" }] : []));
|
|
843
|
+
/** Event emitted when the backdrop is clicked. */
|
|
844
|
+
backdropClick = new EventEmitter();
|
|
845
|
+
/** Event emitted when the position has changed. */
|
|
846
|
+
positionChange = new EventEmitter();
|
|
847
|
+
/** Event emitted when the overlay has been attached. */
|
|
848
|
+
attach = new EventEmitter();
|
|
849
|
+
/** Event emitted when the overlay has been detached. */
|
|
850
|
+
detach = new EventEmitter();
|
|
851
|
+
/** Emits when there are keyboard events that are targeted at the overlay. */
|
|
852
|
+
overlayKeydown = new EventEmitter();
|
|
853
|
+
/** Emits when there are mouse outside click events that are targeted at the overlay. */
|
|
854
|
+
overlayOutsideClick = new EventEmitter();
|
|
855
|
+
// TODO(jelbourn): inputs for size, scroll behavior, animation, etc.
|
|
856
|
+
defaultStrategy$$ = computed(() => {
|
|
857
|
+
return this._scrollStrategyFactory();
|
|
858
|
+
}, ...(ngDevMode ? [{ debugName: "defaultStrategy$$" }] : []));
|
|
859
|
+
_templatePortal = new TemplatePortal(inject(TemplateRef), inject(ViewContainerRef));
|
|
860
|
+
/** The associated overlay reference. */
|
|
861
|
+
get overlayRef() {
|
|
862
|
+
return this._overlayRef;
|
|
863
|
+
}
|
|
864
|
+
/** The element's layout direction. */
|
|
865
|
+
get dir() {
|
|
866
|
+
return this._dir ? this._dir.value : 'ltr';
|
|
867
|
+
}
|
|
868
|
+
ngOnDestroy() {
|
|
869
|
+
this._attachSubscription.unsubscribe();
|
|
870
|
+
this._detachSubscription.unsubscribe();
|
|
871
|
+
this._backdropSubscription.unsubscribe();
|
|
872
|
+
this._positionSubscription.unsubscribe();
|
|
873
|
+
this._overlayRef?.dispose();
|
|
874
|
+
this.disposeResizeUpdate?.();
|
|
875
|
+
}
|
|
876
|
+
ngOnChanges(changes) {
|
|
877
|
+
if (this._position) {
|
|
878
|
+
this._updatePositionStrategy(this._position);
|
|
879
|
+
this._overlayRef?.updateSize({
|
|
880
|
+
width: this._getWidth(),
|
|
881
|
+
minWidth: this.overlayConfig()?.minWidth,
|
|
882
|
+
height: this.overlayConfig()?.height,
|
|
883
|
+
minHeight: this.overlayConfig()?.minHeight,
|
|
884
|
+
});
|
|
885
|
+
if (changes['origin'] && this.open()) {
|
|
886
|
+
this._position.apply();
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
if (changes['open']) {
|
|
890
|
+
this.open() ? this.attachOverlay() : this.detachOverlay();
|
|
891
|
+
}
|
|
892
|
+
if (this._position && (changes['offsetX'] || changes['offsetY'])) {
|
|
893
|
+
this._updatePositionStrategy(this._position);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
disposeResizeUpdate;
|
|
897
|
+
/** Creates an overlay */
|
|
898
|
+
_createOverlay() {
|
|
899
|
+
const overlayRef = (this._overlayRef = createOverlayRef(this._injector, this._buildConfig()));
|
|
900
|
+
this.disposeResizeUpdate?.();
|
|
901
|
+
const ob = new ResizeObserver(() => {
|
|
902
|
+
overlayRef.getConfig().positionStrategy.apply();
|
|
903
|
+
});
|
|
904
|
+
// 开始观察 overlay 元素
|
|
905
|
+
ob.observe(overlayRef.overlayElement);
|
|
906
|
+
this.disposeResizeUpdate = () => {
|
|
907
|
+
this.disposeResizeUpdate = undefined;
|
|
908
|
+
ob.disconnect();
|
|
909
|
+
};
|
|
910
|
+
this._attachSubscription = overlayRef.attachments().subscribe(() => {
|
|
911
|
+
this.attach.emit();
|
|
912
|
+
});
|
|
913
|
+
this._detachSubscription = overlayRef.detachments().subscribe(() => this.detach.emit());
|
|
914
|
+
overlayRef.keydownEvents().subscribe((event) => {
|
|
915
|
+
this.overlayKeydown.next(event);
|
|
916
|
+
if (event.keyCode === ESCAPE && !this.disableClose() && !hasModifierKey(event)) {
|
|
917
|
+
event.preventDefault();
|
|
918
|
+
this.detachOverlay();
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
this._overlayRef.outsidePointerEvents().subscribe((event) => {
|
|
922
|
+
const origin = this._getOriginElement();
|
|
923
|
+
const target = _getEventTarget(event);
|
|
924
|
+
if (!origin || (origin !== target && !origin.contains(target))) {
|
|
925
|
+
this.overlayOutsideClick.next(event);
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
/** Builds the overlay config based on the directive's inputs */
|
|
930
|
+
_buildConfig() {
|
|
931
|
+
const overlayConfig = new OverlayConfig({
|
|
932
|
+
direction: this._dir || 'ltr',
|
|
933
|
+
...this.overlayConfig(),
|
|
934
|
+
});
|
|
935
|
+
if (!overlayConfig.scrollStrategy) {
|
|
936
|
+
overlayConfig.scrollStrategy = this.defaultStrategy$$();
|
|
937
|
+
}
|
|
938
|
+
if (!overlayConfig.positionStrategy) {
|
|
939
|
+
overlayConfig.positionStrategy = this._createPositionStrategy();
|
|
940
|
+
}
|
|
941
|
+
this._position = overlayConfig.positionStrategy;
|
|
942
|
+
return overlayConfig;
|
|
943
|
+
}
|
|
944
|
+
/** Updates the state of a position strategy, based on the values of the directive inputs. */
|
|
945
|
+
_updatePositionStrategy(positionStrategy) {
|
|
946
|
+
const positions = this.positions$$().map((currentPosition) => ({
|
|
947
|
+
originX: currentPosition.originX,
|
|
948
|
+
originY: currentPosition.originY,
|
|
949
|
+
overlayX: currentPosition.overlayX,
|
|
950
|
+
overlayY: currentPosition.overlayY,
|
|
951
|
+
offsetX: currentPosition.offsetX || this.offsetX(),
|
|
952
|
+
offsetY: currentPosition.offsetY || this.offsetY(),
|
|
953
|
+
panelClass: currentPosition.panelClass || undefined,
|
|
954
|
+
}));
|
|
955
|
+
return positionStrategy
|
|
956
|
+
.setOrigin(this._getOrigin())
|
|
957
|
+
.withPositions(positions)
|
|
958
|
+
.withFlexibleDimensions(this.flexibleDimensions())
|
|
959
|
+
.withPush(this.push())
|
|
960
|
+
.withGrowAfterOpen(this.growAfterOpen())
|
|
961
|
+
.withViewportMargin(this.viewportMargin())
|
|
962
|
+
.withLockedPosition(this.lockPosition())
|
|
963
|
+
.withTransformOriginOn(this.transformOriginSelector());
|
|
964
|
+
}
|
|
965
|
+
/** Returns the position strategy of the overlay to be set on the overlay config */
|
|
966
|
+
_createPositionStrategy() {
|
|
967
|
+
const strategy = createFlexibleConnectedPositionStrategy(this._injector, this._getOrigin());
|
|
968
|
+
this._updatePositionStrategy(strategy);
|
|
969
|
+
return strategy;
|
|
970
|
+
}
|
|
971
|
+
_getOrigin() {
|
|
972
|
+
const origin = this.origin();
|
|
973
|
+
if (origin instanceof CdkOverlayOrigin) {
|
|
974
|
+
return origin.elementRef;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
return origin;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
_getOriginElement() {
|
|
981
|
+
const origin = this.origin();
|
|
982
|
+
if (origin instanceof CdkOverlayOrigin) {
|
|
983
|
+
return origin.elementRef.nativeElement;
|
|
984
|
+
}
|
|
985
|
+
if (origin instanceof ElementRef) {
|
|
986
|
+
return origin.nativeElement;
|
|
987
|
+
}
|
|
988
|
+
if (typeof Element !== 'undefined' && origin instanceof Element) {
|
|
989
|
+
return origin;
|
|
990
|
+
}
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
_getWidth() {
|
|
994
|
+
if (this.overlayConfig()?.width) {
|
|
995
|
+
return this.overlayConfig().width;
|
|
996
|
+
}
|
|
997
|
+
// Null check `getBoundingClientRect` in case this is called during SSR.
|
|
998
|
+
return this.matchWidth()
|
|
999
|
+
? this._getOriginElement()?.getBoundingClientRect?.().width
|
|
1000
|
+
: undefined;
|
|
1001
|
+
}
|
|
1002
|
+
/** Attaches the overlay. */
|
|
1003
|
+
attachOverlay() {
|
|
1004
|
+
if (!this._overlayRef) {
|
|
1005
|
+
this._createOverlay();
|
|
1006
|
+
}
|
|
1007
|
+
const ref = this._overlayRef;
|
|
1008
|
+
// Update the overlay size, in case the directive's inputs have changed
|
|
1009
|
+
ref.getConfig().hasBackdrop = this.overlayConfig()?.hasBackdrop;
|
|
1010
|
+
ref.updateSize({ width: this._getWidth() });
|
|
1011
|
+
if (!ref.hasAttached()) {
|
|
1012
|
+
ref.attach(this._templatePortal);
|
|
1013
|
+
}
|
|
1014
|
+
if (this.overlayConfig()?.hasBackdrop) {
|
|
1015
|
+
this._backdropSubscription = ref
|
|
1016
|
+
.backdropClick()
|
|
1017
|
+
.subscribe((event) => this.backdropClick.emit(event));
|
|
1018
|
+
}
|
|
1019
|
+
else {
|
|
1020
|
+
this._backdropSubscription.unsubscribe();
|
|
1021
|
+
}
|
|
1022
|
+
this._positionSubscription.unsubscribe();
|
|
1023
|
+
// Only subscribe to `positionChanges` if requested, because putting
|
|
1024
|
+
// together all the information for it can be expensive.
|
|
1025
|
+
if (this.positionChange.observers.length > 0) {
|
|
1026
|
+
this._positionSubscription = this._position.positionChanges.pipe(takeWhile(() => this.positionChange.observers.length > 0)).subscribe((position) => {
|
|
1027
|
+
this._ngZone.run(() => this.positionChange.emit(position));
|
|
1028
|
+
if (this.positionChange.observers.length === 0) {
|
|
1029
|
+
this._positionSubscription.unsubscribe();
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
this.open.set(true);
|
|
1034
|
+
}
|
|
1035
|
+
/** Detaches the overlay. */
|
|
1036
|
+
detachOverlay() {
|
|
1037
|
+
this._overlayRef?.detach();
|
|
1038
|
+
this._backdropSubscription.unsubscribe();
|
|
1039
|
+
this._positionSubscription.unsubscribe();
|
|
1040
|
+
this.open.set(false);
|
|
1041
|
+
}
|
|
1042
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CdkConnectedOverlay, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1043
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.14", type: CdkConnectedOverlay, isStandalone: true, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: { origin: { classPropertyName: "origin", publicName: "origin", isSignal: true, isRequired: true, transformFunction: null }, positions: { classPropertyName: "positions", publicName: "positions", isSignal: true, isRequired: false, transformFunction: null }, offsetX: { classPropertyName: "offsetX", publicName: "offsetX", isSignal: true, isRequired: false, transformFunction: null }, offsetY: { classPropertyName: "offsetY", publicName: "offsetY", isSignal: true, isRequired: false, transformFunction: null }, overlayConfig: { classPropertyName: "overlayConfig", publicName: "overlayConfig", isSignal: true, isRequired: false, transformFunction: null }, viewportMargin: { classPropertyName: "viewportMargin", publicName: "viewportMargin", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, disableClose: { classPropertyName: "disableClose", publicName: "disableClose", isSignal: true, isRequired: false, transformFunction: null }, transformOriginSelector: { classPropertyName: "transformOriginSelector", publicName: "transformOriginSelector", isSignal: true, isRequired: false, transformFunction: null }, lockPosition: { classPropertyName: "lockPosition", publicName: "lockPosition", isSignal: true, isRequired: false, transformFunction: null }, flexibleDimensions: { classPropertyName: "flexibleDimensions", publicName: "flexibleDimensions", isSignal: true, isRequired: false, transformFunction: null }, growAfterOpen: { classPropertyName: "growAfterOpen", publicName: "growAfterOpen", isSignal: true, isRequired: false, transformFunction: null }, push: { classPropertyName: "push", publicName: "push", isSignal: true, isRequired: false, transformFunction: null }, matchWidth: { classPropertyName: "matchWidth", publicName: "matchWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", backdropClick: "backdropClick", positionChange: "positionChange", attach: "attach", detach: "detach", overlayKeydown: "overlayKeydown", overlayOutsideClick: "overlayOutsideClick" }, exportAs: ["cdkConnectedOverlay"], usesOnChanges: true, ngImport: i0 });
|
|
1044
|
+
}
|
|
1045
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: CdkConnectedOverlay, decorators: [{
|
|
1046
|
+
type: Directive,
|
|
1047
|
+
args: [{
|
|
1048
|
+
selector: '[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]',
|
|
1049
|
+
exportAs: 'cdkConnectedOverlay',
|
|
1050
|
+
standalone: true,
|
|
1051
|
+
}]
|
|
1052
|
+
}], propDecorators: { origin: [{ type: i0.Input, args: [{ isSignal: true, alias: "origin", required: true }] }], positions: [{ type: i0.Input, args: [{ isSignal: true, alias: "positions", required: false }] }], offsetX: [{ type: i0.Input, args: [{ isSignal: true, alias: "offsetX", required: false }] }], offsetY: [{ type: i0.Input, args: [{ isSignal: true, alias: "offsetY", required: false }] }], overlayConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayConfig", required: false }] }], viewportMargin: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportMargin", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], disableClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableClose", required: false }] }], transformOriginSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformOriginSelector", required: false }] }], lockPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "lockPosition", required: false }] }], flexibleDimensions: [{ type: i0.Input, args: [{ isSignal: true, alias: "flexibleDimensions", required: false }] }], growAfterOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "growAfterOpen", required: false }] }], push: [{ type: i0.Input, args: [{ isSignal: true, alias: "push", required: false }] }], matchWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "matchWidth", required: false }] }], backdropClick: [{
|
|
1053
|
+
type: Output
|
|
1054
|
+
}], positionChange: [{
|
|
1055
|
+
type: Output
|
|
1056
|
+
}], attach: [{
|
|
1057
|
+
type: Output
|
|
1058
|
+
}], detach: [{
|
|
1059
|
+
type: Output
|
|
1060
|
+
}], overlayKeydown: [{
|
|
1061
|
+
type: Output
|
|
1062
|
+
}], overlayOutsideClick: [{
|
|
1063
|
+
type: Output
|
|
1064
|
+
}] } });
|
|
1065
|
+
|
|
1066
|
+
class PickerRefFCC extends BaseControl {
|
|
1067
|
+
static index = 0;
|
|
1068
|
+
SelectorlessOutlet = SelectorlessOutlet;
|
|
1069
|
+
static __version = 2;
|
|
1070
|
+
templateRef = viewChild.required('templateRef');
|
|
1071
|
+
PiyingView = PiyingView;
|
|
1072
|
+
trigger = input(...(ngDevMode ? [undefined, { debugName: "trigger" }] : []));
|
|
1073
|
+
content = input(...(ngDevMode ? [undefined, { debugName: "content" }] : []));
|
|
1074
|
+
changeClose = input(...(ngDevMode ? [undefined, { debugName: "changeClose" }] : []));
|
|
1075
|
+
isOpen$ = signal(false, ...(ngDevMode ? [{ debugName: "isOpen$" }] : []));
|
|
1076
|
+
overlayConfig = input(...(ngDevMode ? [undefined, { debugName: "overlayConfig" }] : []));
|
|
1077
|
+
position$ = signal('', ...(ngDevMode ? [{ debugName: "position$" }] : []));
|
|
1078
|
+
parentPyOptions = inject(PI_INPUT_OPTIONS_TOKEN, { optional: true });
|
|
1079
|
+
triggerInput$$ = computed(() => {
|
|
1080
|
+
return {
|
|
1081
|
+
model: this.value$,
|
|
1082
|
+
schema: this.trigger,
|
|
1083
|
+
options: computed(() => ({
|
|
1084
|
+
...this.parentPyOptions(),
|
|
1085
|
+
context: {
|
|
1086
|
+
...this.parentPyOptions().context,
|
|
1087
|
+
pickerValue: this.value$,
|
|
1088
|
+
},
|
|
1089
|
+
})),
|
|
1090
|
+
selectorless: true,
|
|
1091
|
+
};
|
|
1092
|
+
}, ...(ngDevMode ? [{ debugName: "triggerInput$$" }] : []));
|
|
1093
|
+
// content应该是model
|
|
1094
|
+
contentInput$$ = computed(() => {
|
|
1095
|
+
return {
|
|
1096
|
+
schema: this.content,
|
|
1097
|
+
options: this.parentPyOptions,
|
|
1098
|
+
selectorless: true,
|
|
1099
|
+
model: this.value$,
|
|
1100
|
+
};
|
|
1101
|
+
}, ...(ngDevMode ? [{ debugName: "contentInput$$" }] : []));
|
|
1102
|
+
contentOutput$$ = computed(() => {
|
|
1103
|
+
return {
|
|
1104
|
+
modelChange: (value) => {
|
|
1105
|
+
this.valueAndTouchedChange(value);
|
|
1106
|
+
if (this.changeClose()) {
|
|
1107
|
+
this.isOpen$.set(false);
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
};
|
|
1111
|
+
}, ...(ngDevMode ? [{ debugName: "contentOutput$$" }] : []));
|
|
1112
|
+
openRef() {
|
|
1113
|
+
this.isOpen$.set(true);
|
|
1114
|
+
}
|
|
1115
|
+
outsideClick() {
|
|
1116
|
+
this.isOpen$.set(false);
|
|
1117
|
+
}
|
|
1118
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: PickerRefFCC, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1119
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: PickerRefFCC, isStandalone: true, selector: "app-picker-ref", inputs: { trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, changeClose: { classPropertyName: "changeClose", publicName: "changeClose", isSignal: true, isRequired: false, transformFunction: null }, overlayConfig: { classPropertyName: "overlayConfig", publicName: "overlayConfig", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1120
|
+
{
|
|
1121
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1122
|
+
useExisting: forwardRef(() => PickerRefFCC),
|
|
1123
|
+
multi: true,
|
|
1124
|
+
},
|
|
1125
|
+
], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <div cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\" [attributes]=\"attr()\" (click)=\"openRef()\">\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"triggerInput$$()\"\n ></ng-container>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [origin]=\"trigger\"\n [open]=\"isOpen$()\"\n [overlayConfig]=\"overlayConfig()\"\n (detach)=\"isOpen$.set(false)\"\n (overlayOutsideClick)=\"outsideClick()\"\n >\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"contentInput$$()\"\n [selectlessOutletOutputs]=\"contentOutput$$()\"\n ></ng-container>\n </ng-template>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: AttributesDirective, selector: "[attributes]", inputs: ["attributes", "excludes"] }, { kind: "directive", type: SelectorlessOutlet, selector: "[selectlessOutlet]", inputs: ["selectlessOutlet", "selectlessOutletInputs", "selectlessOutletOutputs", "selectlessOutletDirectives", "selectlessOutletInjector", "selectlessOutletEnvironmentInjector"], exportAs: ["selectlessOutlet"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["origin", "positions", "offsetX", "offsetY", "overlayConfig", "viewportMargin", "open", "disableClose", "transformOriginSelector", "lockPosition", "flexibleDimensions", "growAfterOpen", "push", "matchWidth"], outputs: ["openChange", "backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1126
|
+
}
|
|
1127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: PickerRefFCC, decorators: [{
|
|
1128
|
+
type: Component,
|
|
1129
|
+
args: [{ selector: 'app-picker-ref', imports: [
|
|
1130
|
+
FormsModule,
|
|
1131
|
+
AttributesDirective,
|
|
1132
|
+
CssPrefixPipe,
|
|
1133
|
+
MergeClassPipe,
|
|
1134
|
+
StrOrTemplateComponent,
|
|
1135
|
+
SelectorlessOutlet,
|
|
1136
|
+
CdkConnectedOverlay,
|
|
1137
|
+
CdkOverlayOrigin,
|
|
1138
|
+
PurePipe,
|
|
1139
|
+
], providers: [
|
|
1140
|
+
{
|
|
1141
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1142
|
+
useExisting: forwardRef(() => PickerRefFCC),
|
|
1143
|
+
multi: true,
|
|
1144
|
+
},
|
|
1145
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #templateRef let-attr=\"attributes\">\n <div cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\" [attributes]=\"attr()\" (click)=\"openRef()\">\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"triggerInput$$()\"\n ></ng-container>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [origin]=\"trigger\"\n [open]=\"isOpen$()\"\n [overlayConfig]=\"overlayConfig()\"\n (detach)=\"isOpen$.set(false)\"\n (overlayOutsideClick)=\"outsideClick()\"\n >\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"contentInput$$()\"\n [selectlessOutletOutputs]=\"contentOutput$$()\"\n ></ng-container>\n </ng-template>\n</ng-template>\n" }]
|
|
1146
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], changeClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "changeClose", required: false }] }], overlayConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayConfig", required: false }] }] } });
|
|
1147
|
+
|
|
1148
|
+
class OptionListFCC extends BaseControl {
|
|
1149
|
+
static __version = 2;
|
|
1150
|
+
StrOrTemplateComponent = StrOrTemplateComponent;
|
|
1151
|
+
PiyingView = PiyingView;
|
|
1152
|
+
templateRef = viewChild.required('templateRef');
|
|
1153
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options", transform: (input) => input ?? [] }] : [{
|
|
1154
|
+
transform: (input) => input ?? [],
|
|
1155
|
+
}]));
|
|
1156
|
+
optionTemplate = input(...(ngDevMode ? [undefined, { debugName: "optionTemplate" }] : []));
|
|
1157
|
+
optionConvert = input(DefaultOptionConvert, ...(ngDevMode ? [{ debugName: "optionConvert", transform: (input) => ({ ...DefaultOptionConvert, ...input }) }] : [{
|
|
1158
|
+
transform: (input) => ({ ...DefaultOptionConvert, ...input }),
|
|
1159
|
+
}]));
|
|
1160
|
+
// listFilter=computed(() => {
|
|
1161
|
+
// return this.field$$().props()['filter']
|
|
1162
|
+
// })
|
|
1163
|
+
transformOption = transformOption;
|
|
1164
|
+
optionInput = (content) => {
|
|
1165
|
+
return {
|
|
1166
|
+
content: signal(content),
|
|
1167
|
+
};
|
|
1168
|
+
};
|
|
1169
|
+
selectOption(item) {
|
|
1170
|
+
this.valueAndTouchedChange(item.value);
|
|
1171
|
+
}
|
|
1172
|
+
parentPyOptions = inject(PI_INPUT_OPTIONS_TOKEN, { optional: true });
|
|
1173
|
+
getInput$$ = (schema) => {
|
|
1174
|
+
return {
|
|
1175
|
+
schema: schema,
|
|
1176
|
+
options: this.parentPyOptions,
|
|
1177
|
+
selectorless: true,
|
|
1178
|
+
};
|
|
1179
|
+
};
|
|
1180
|
+
activateClass = (a, b) => {
|
|
1181
|
+
return a === b ? 'menu-active' : '';
|
|
1182
|
+
};
|
|
1183
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: OptionListFCC, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1184
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: OptionListFCC, isStandalone: true, selector: "app-option-list", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, optionConvert: { classPropertyName: "optionConvert", publicName: "optionConvert", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1185
|
+
{
|
|
1186
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1187
|
+
useExisting: forwardRef(() => OptionListFCC),
|
|
1188
|
+
multi: true,
|
|
1189
|
+
},
|
|
1190
|
+
], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #liGroup let-item>\n <!-- todo open\u6D4B\u8BD5 -->\n <details open>\n <summary>{{ item.label }}</summary>\n <ul>\n @for (child of item.children; track $index) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"\n ></ng-container>\n }\n </ul>\n </details>\n</ng-template>\n<ng-template #itemTemplate let-option>\n @let rOption = transformOption | pure: option : optionConvert();\n @let template = optionTemplate()?.[rOption.type];\n @if (template) {\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"getInput$$ | pure: template\"\n ></ng-container>\n } @else if (rOption.type === 'option') {\n <li (click)=\"selectOption(rOption)\">\n <button [class]=\"activateClass | pure: rOption.value : value$()\">\n <ng-template\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"optionInput | pure: rOption.label\"\n ></ng-template>\n </button>\n </li>\n } @else if (rOption.type === 'group') {\n <li>\n <details open>\n <summary>\n <ng-template\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"optionInput | pure: rOption.label\"\n ></ng-template>\n </summary>\n <ul>\n @for (child of rOption.children; track $index) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"\n ></ng-container>\n }\n </ul>\n </details>\n </li>\n }\n</ng-template>\n\n<ng-template #templateRef let-attr=\"attributes\">\n <ul class=\"menu\">\n @for (option of options(); track $index) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: option }\"></ng-container>\n }\n </ul>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: SelectorlessOutlet, selector: "[selectlessOutlet]", inputs: ["selectlessOutlet", "selectlessOutletInputs", "selectlessOutletOutputs", "selectlessOutletDirectives", "selectlessOutletInjector", "selectlessOutletEnvironmentInjector"], exportAs: ["selectlessOutlet"] }, { kind: "pipe", type: PurePipe, name: "pure" }] });
|
|
1191
|
+
}
|
|
1192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: OptionListFCC, decorators: [{
|
|
1193
|
+
type: Component,
|
|
1194
|
+
args: [{ selector: 'app-option-list', imports: [
|
|
1195
|
+
FormsModule,
|
|
1196
|
+
AttributesDirective,
|
|
1197
|
+
NgTemplateOutlet,
|
|
1198
|
+
NgClass,
|
|
1199
|
+
CssPrefixPipe,
|
|
1200
|
+
MergeClassPipe,
|
|
1201
|
+
TwPrefixPipe,
|
|
1202
|
+
StrOrTemplateComponent,
|
|
1203
|
+
SelectorlessOutlet,
|
|
1204
|
+
PurePipe,
|
|
1205
|
+
], providers: [
|
|
1206
|
+
{
|
|
1207
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1208
|
+
useExisting: forwardRef(() => OptionListFCC),
|
|
1209
|
+
multi: true,
|
|
1210
|
+
},
|
|
1211
|
+
], template: "<ng-template #liGroup let-item>\n <!-- todo open\u6D4B\u8BD5 -->\n <details open>\n <summary>{{ item.label }}</summary>\n <ul>\n @for (child of item.children; track $index) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"\n ></ng-container>\n }\n </ul>\n </details>\n</ng-template>\n<ng-template #itemTemplate let-option>\n @let rOption = transformOption | pure: option : optionConvert();\n @let template = optionTemplate()?.[rOption.type];\n @if (template) {\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"getInput$$ | pure: template\"\n ></ng-container>\n } @else if (rOption.type === 'option') {\n <li (click)=\"selectOption(rOption)\">\n <button [class]=\"activateClass | pure: rOption.value : value$()\">\n <ng-template\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"optionInput | pure: rOption.label\"\n ></ng-template>\n </button>\n </li>\n } @else if (rOption.type === 'group') {\n <li>\n <details open>\n <summary>\n <ng-template\n [selectlessOutlet]=\"StrOrTemplateComponent\"\n [selectlessOutletInputs]=\"optionInput | pure: rOption.label\"\n ></ng-template>\n </summary>\n <ul>\n @for (child of rOption.children; track $index) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate; context: { $implicit: child }\"\n ></ng-container>\n }\n </ul>\n </details>\n </li>\n }\n</ng-template>\n\n<ng-template #templateRef let-attr=\"attributes\">\n <ul class=\"menu\">\n @for (option of options(); track $index) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: option }\"></ng-container>\n }\n </ul>\n</ng-template>\n" }]
|
|
1212
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionTemplate", required: false }] }], optionConvert: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionConvert", required: false }] }] } });
|
|
1213
|
+
|
|
1214
|
+
class ListTemplateNFCC {
|
|
1215
|
+
static __version = 2;
|
|
1216
|
+
StrOrTemplateComponent = StrOrTemplateComponent;
|
|
1217
|
+
PiyingView = PiyingView;
|
|
1218
|
+
templateRef = viewChild.required('templateRef');
|
|
1219
|
+
template = input.required(...(ngDevMode ? [{ debugName: "template" }] : []));
|
|
1220
|
+
list = input([], ...(ngDevMode ? [{ debugName: "list" }] : []));
|
|
1221
|
+
parentPyOptions = inject(PI_INPUT_OPTIONS_TOKEN, { optional: true });
|
|
1222
|
+
field = inject(PI_VIEW_FIELD_TOKEN);
|
|
1223
|
+
templateInput$$ = (data) => {
|
|
1224
|
+
return {
|
|
1225
|
+
schema: this.template,
|
|
1226
|
+
options: computed(() => ({
|
|
1227
|
+
...this.parentPyOptions(),
|
|
1228
|
+
context: {
|
|
1229
|
+
...this.parentPyOptions().context,
|
|
1230
|
+
getParent: () => this.field(),
|
|
1231
|
+
getItem: () => data,
|
|
1232
|
+
},
|
|
1233
|
+
})),
|
|
1234
|
+
selectorless: true,
|
|
1235
|
+
};
|
|
1236
|
+
};
|
|
1237
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ListTemplateNFCC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1238
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: ListTemplateNFCC, isStandalone: true, selector: "app-list-template", inputs: { template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: true, transformFunction: null }, list: { classPropertyName: "list", publicName: "list", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n @for (child of list(); track $index) {\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"templateInput$$ | pure: child\"\n ></ng-container>\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: SelectorlessOutlet, selector: "[selectlessOutlet]", inputs: ["selectlessOutlet", "selectlessOutletInputs", "selectlessOutletOutputs", "selectlessOutletDirectives", "selectlessOutletInjector", "selectlessOutletEnvironmentInjector"], exportAs: ["selectlessOutlet"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "pipe", type: PurePipe, name: "pure" }] });
|
|
1239
|
+
}
|
|
1240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ListTemplateNFCC, decorators: [{
|
|
1241
|
+
type: Component,
|
|
1242
|
+
args: [{ selector: 'app-list-template', imports: [
|
|
1243
|
+
AttributesDirective,
|
|
1244
|
+
NgClass,
|
|
1245
|
+
CssPrefixPipe,
|
|
1246
|
+
SelectorlessOutlet,
|
|
1247
|
+
StrOrTemplateComponent,
|
|
1248
|
+
RouterLink,
|
|
1249
|
+
RouterLinkActive,
|
|
1250
|
+
NgTemplateOutlet,
|
|
1251
|
+
MatIconModule,
|
|
1252
|
+
MergeClassPipe,
|
|
1253
|
+
JsonPipe,
|
|
1254
|
+
MergeClassPipe,
|
|
1255
|
+
PurePipe,
|
|
1256
|
+
], template: "<ng-template #templateRef let-attr=\"attributes\">\n @for (child of list(); track $index) {\n <ng-container\n [selectlessOutlet]=\"PiyingView\"\n [selectlessOutletInputs]=\"templateInput$$ | pure: child\"\n ></ng-container>\n }\n</ng-template>\n" }]
|
|
1257
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: true }] }], list: [{ type: i0.Input, args: [{ isSignal: true, alias: "list", required: false }] }] } });
|
|
1258
|
+
|
|
1259
|
+
var component_index = /*#__PURE__*/Object.freeze({
|
|
1260
|
+
__proto__: null,
|
|
1261
|
+
ListTemplateNFCC: ListTemplateNFCC,
|
|
1262
|
+
MenuTreeNFCC: MenuTreeNFCC,
|
|
1263
|
+
OptionListFCC: OptionListFCC,
|
|
1264
|
+
PaginationNFCC: PaginationNFCC,
|
|
1265
|
+
PickerRefFCC: PickerRefFCC,
|
|
1266
|
+
TableNFCC: TableNFCC,
|
|
1267
|
+
TableRowFGC: TableRowFGC
|
|
1268
|
+
});
|
|
1269
|
+
|
|
1270
|
+
class FilterOptionNFCC {
|
|
1271
|
+
static __version = 2;
|
|
1272
|
+
templateRef = viewChild.required('templateRef');
|
|
1273
|
+
#field = inject(PI_VIEW_FIELD_TOKEN);
|
|
1274
|
+
content = this.#field().props()['seachContent'];
|
|
1275
|
+
stopKeyboardListen(event) {
|
|
1276
|
+
event.stopPropagation();
|
|
1277
|
+
}
|
|
1278
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: FilterOptionNFCC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1279
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: FilterOptionNFCC, isStandalone: true, selector: "app-filter-option", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-attr=\"attributes\">\n <input\n type=\"text\"\n [attributes]=\"attr?.()\"\n [excludes]=\"['class']\"\n [class]=\"attr?.().class | mergeClass: 'input' | cssPrefix\"\n [(ngModel)]=\"content\"\n (keydown)=\"stopKeyboardListen($event)\"\n />\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: AttributesDirective, selector: "[attributes]", inputs: ["attributes", "excludes"] }, { kind: "pipe", type: CssPrefixPipe, name: "cssPrefix" }, { kind: "pipe", type: MergeClassPipe, name: "mergeClass" }] });
|
|
1280
|
+
}
|
|
1281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: FilterOptionNFCC, decorators: [{
|
|
1282
|
+
type: Component,
|
|
1283
|
+
args: [{ selector: 'app-filter-option', imports: [MatIcon, FormsModule, CssPrefixPipe, MergeClassPipe, AttributesDirective, FormsModule], template: "<ng-template #templateRef let-attr=\"attributes\">\n <input\n type=\"text\"\n [attributes]=\"attr?.()\"\n [excludes]=\"['class']\"\n [class]=\"attr?.().class | mergeClass: 'input' | cssPrefix\"\n [(ngModel)]=\"content\"\n (keydown)=\"stopKeyboardListen($event)\"\n />\n</ng-template>\n" }]
|
|
1284
|
+
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
1285
|
+
|
|
1286
|
+
class OptionListLocalFilterWC {
|
|
1287
|
+
static __version = 2;
|
|
1288
|
+
templateRef = viewChild.required('templateRef');
|
|
1289
|
+
searchContent = signal('', ...(ngDevMode ? [{ debugName: "searchContent" }] : []));
|
|
1290
|
+
fileterOption = { type: 'local-filter' };
|
|
1291
|
+
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
1292
|
+
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
1293
|
+
constructor() {
|
|
1294
|
+
this.field$$().props.update((a) => {
|
|
1295
|
+
return { ...a, searchContent: this.searchContent };
|
|
1296
|
+
});
|
|
1297
|
+
const localFilterDefine = this.props$$()['filterDefine'] ?? v.pipe(NFCSchema, setComponent(FilterOptionNFCC));
|
|
1298
|
+
this.field$$().inputs.update((a) => {
|
|
1299
|
+
return {
|
|
1300
|
+
...a,
|
|
1301
|
+
optionTemplate: {
|
|
1302
|
+
...a?.['optionTemplate'],
|
|
1303
|
+
'local-filter': v.pipe(localFilterDefine, actions.props.patch({ seachContent: this.searchContent })),
|
|
1304
|
+
},
|
|
1305
|
+
options: [],
|
|
1306
|
+
};
|
|
1307
|
+
});
|
|
1308
|
+
const filterWith = this.field$$().props()['filterWith'] ??
|
|
1309
|
+
((list, content) => list.filter((item) => item.includes(content)));
|
|
1310
|
+
effect(() => {
|
|
1311
|
+
const content = this.searchContent();
|
|
1312
|
+
const list = this.field$$().props()['options'];
|
|
1313
|
+
let filterList = list;
|
|
1314
|
+
if (content) {
|
|
1315
|
+
filterList = filterWith(list, content);
|
|
1316
|
+
}
|
|
1317
|
+
untracked(() => {
|
|
1318
|
+
this.field$$().inputs.update((a) => {
|
|
1319
|
+
return {
|
|
1320
|
+
...a,
|
|
1321
|
+
options: [this.fileterOption, ...filterList],
|
|
1322
|
+
};
|
|
1323
|
+
});
|
|
1324
|
+
});
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: OptionListLocalFilterWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1328
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: OptionListLocalFilterWC, isStandalone: true, selector: "app-local-filter", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }] });
|
|
1329
|
+
}
|
|
1330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: OptionListLocalFilterWC, decorators: [{
|
|
1331
|
+
type: Component,
|
|
1332
|
+
args: [{
|
|
1333
|
+
selector: 'app-local-filter',
|
|
1334
|
+
template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`,
|
|
1335
|
+
imports: [InsertFieldDirective],
|
|
1336
|
+
}]
|
|
1337
|
+
}], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
1338
|
+
|
|
1339
|
+
var wrapper_index = /*#__PURE__*/Object.freeze({
|
|
1340
|
+
__proto__: null,
|
|
1341
|
+
CheckboxTablehWC: CheckboxTableWC,
|
|
1342
|
+
OptionListLocalFilterWC: OptionListLocalFilterWC,
|
|
1343
|
+
SortHeaderWC: SortHeaderWC,
|
|
1344
|
+
SortTablehWC: SortTablehWC,
|
|
1345
|
+
TableCheckboxAllWC: TableCheckboxAllWC,
|
|
1346
|
+
TableCheckboxOneWC: TableCheckboxOneWC,
|
|
1347
|
+
TableResourceWC: TableResourceWC,
|
|
1348
|
+
TableStatusWC: TableStatusWC
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* Generated bundle index. Do not edit.
|
|
1353
|
+
*/
|
|
1354
|
+
|
|
1355
|
+
export { CheckboxTableWC, ExactMatchOptions, ExpandRowDirective, component_index as ExtComponentGroup, wrapper_index as ExtWrapperGroup, ListTemplateNFCC, MenuTreeNFCC, OptionListFCC, OptionListLocalFilterWC, PaginationNFCC, PickerRefFCC, SortHeaderWC, SortTablehWC, SubsetMatchOptions, TableCheckboxAllWC, TableCheckboxOneWC, TableNFCC, TableResourceWC, TableRowFGC, TableStatusService, TableStatusWC, wrapper_index$1 as WrapperGroup, createDefaultColDefine, createDefaultColDefineFn, createRowDefine, inputSortDirective };
|
|
1356
|
+
//# sourceMappingURL=piying-lib-angular-daisyui-extension.mjs.map
|