@piying-lib/angular-daisyui 1.0.23 → 1.1.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { viewChild, input, inject, computed, Component, model, InjectionToken, Injector, untracked, signal,
|
|
3
|
+
import { viewChild, input, inject, computed, Component, model, output, InjectionToken, Injector, untracked, signal, Injectable, ElementRef, HostListener, Directive, effect, resource, NgZone, EventEmitter, TemplateRef, ViewContainerRef, Output, forwardRef, ChangeDetectionStrategy } from '@angular/core';
|
|
4
4
|
import { StrOrTemplateComponent, isSchema, computedWithPrev, DefaultOptionConvert, transformOption } from '@piying-lib/angular-core';
|
|
5
5
|
import { CssPrefixPipe, MergeClassPipe, TwPrefixPipe } from '@piying-lib/angular-daisyui/pipe';
|
|
6
6
|
import { ThemeService } from '@piying-lib/angular-daisyui/service';
|
|
@@ -16,9 +16,9 @@ import { SelectorlessOutlet } from '@cyia/ngx-common/directive';
|
|
|
16
16
|
import * as v from 'valibot';
|
|
17
17
|
import { setComponent, NFCSchema, actions, PI_VIEW_FIELD_TOKEN as PI_VIEW_FIELD_TOKEN$1 } from '@piying/view-angular-core';
|
|
18
18
|
import { ThWC, TdWC } from '@piying-lib/angular-daisyui/wrapper';
|
|
19
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
20
19
|
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
21
|
-
import { BehaviorSubject,
|
|
20
|
+
import { BehaviorSubject, shareReplay, map, filter, Subject, tap, switchMap, Subscription } from 'rxjs';
|
|
21
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
22
22
|
import { Directionality } from '@angular/cdk/bidi';
|
|
23
23
|
import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
24
24
|
import { createRepositionScrollStrategy, createOverlayRef, OverlayConfig, createFlexibleConnectedPositionStrategy } from '@angular/cdk/overlay';
|
|
@@ -79,6 +79,8 @@ class PaginationNFCC {
|
|
|
79
79
|
sizeOptions = input(...(ngDevMode ? [undefined, { debugName: "sizeOptions" }] : []));
|
|
80
80
|
optionsLabel = input(...(ngDevMode ? [undefined, { debugName: "optionsLabel" }] : []));
|
|
81
81
|
value = model.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
82
|
+
// todo 临时兼容
|
|
83
|
+
valueChange = output();
|
|
82
84
|
count = input.required(...(ngDevMode ? [{ debugName: "count" }] : []));
|
|
83
85
|
#theme = inject(ThemeService);
|
|
84
86
|
wrapperClass$ = computed(() => {
|
|
@@ -144,6 +146,7 @@ class PaginationNFCC {
|
|
|
144
146
|
this.updatePageToProps();
|
|
145
147
|
}
|
|
146
148
|
updatePageToProps() {
|
|
149
|
+
this.valueChange.emit(this.value());
|
|
147
150
|
const field = this.#field?.();
|
|
148
151
|
if (!field) {
|
|
149
152
|
console.warn(`❌piying-view🗄️`);
|
|
@@ -157,12 +160,12 @@ class PaginationNFCC {
|
|
|
157
160
|
});
|
|
158
161
|
}
|
|
159
162
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: PaginationNFCC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
160
|
-
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
|
+
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", valueChange: "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" }] });
|
|
161
164
|
}
|
|
162
165
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: PaginationNFCC, decorators: [{
|
|
163
166
|
type: Component,
|
|
164
167
|
args: [{ selector: 'app-pagination', imports: [AttributesDirective, PurePipe, FormsModule, MergeClassPipe], 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" }]
|
|
165
|
-
}], 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 }] }] } });
|
|
168
|
+
}], 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"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], count: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: true }] }] } });
|
|
166
169
|
|
|
167
170
|
class TableRowFGC extends PiyingViewGroupBase {
|
|
168
171
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableRowFGC, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -326,225 +329,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
326
329
|
], 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" }]
|
|
327
330
|
}], 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 }] }] } });
|
|
328
331
|
|
|
329
|
-
function dataConvert(data) {
|
|
330
|
-
if (data.length === 2 && typeof data[0] === 'number' && Array.isArray(data[1])) {
|
|
331
|
-
return data;
|
|
332
|
-
}
|
|
333
|
-
return [data.length, data];
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
function defaultCompare(key) {
|
|
337
|
-
return (a, b) => {
|
|
338
|
-
return a[key] > b[key] ? 1 : -1;
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
function localData(data, options) {
|
|
342
|
-
const result = dataConvert(data);
|
|
343
|
-
return async (res) => {
|
|
344
|
-
let list = result[1];
|
|
345
|
-
if (options?.filterFn) {
|
|
346
|
-
list = list.filter((item) => options.filterFn(item, res.params.params?.['filter']));
|
|
347
|
-
}
|
|
348
|
-
const direction = res.params.params?.['direction'];
|
|
349
|
-
if (direction) {
|
|
350
|
-
for (const item of direction) {
|
|
351
|
-
const compareFn = options?.sortCompareMap
|
|
352
|
-
? options.sortCompareMap[item.key]
|
|
353
|
-
: defaultCompare(item.key);
|
|
354
|
-
list = list.sort((a, b) => {
|
|
355
|
-
const result = compareFn(a, b);
|
|
356
|
-
return item.value === 1 ? result : -result;
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
const page = res.params.params?.['page'];
|
|
361
|
-
if (page) {
|
|
362
|
-
const start = page.index * page.size;
|
|
363
|
-
list = list.slice(start, start + page.size);
|
|
364
|
-
}
|
|
365
|
-
return [result[0], list];
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
class TableStatusService {
|
|
370
|
-
#sm = new BehaviorSubject(undefined);
|
|
371
|
-
updateIndex$ = signal(0, ...(ngDevMode ? [{ debugName: "updateIndex$" }] : []));
|
|
372
|
-
#field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
373
|
-
#expand$$ = computed(() => {
|
|
374
|
-
return this.#field$$().props()['expandSelectModel'];
|
|
375
|
-
}, ...(ngDevMode ? [{ debugName: "#expand$$" }] : []));
|
|
376
|
-
constructor() {
|
|
377
|
-
effect(() => {
|
|
378
|
-
this.setSelectionModel(this.#expand$$());
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
toggleExpand(value) {
|
|
382
|
-
this.#sm.value.toggle(value);
|
|
383
|
-
}
|
|
384
|
-
selectExpand(value) {
|
|
385
|
-
this.#sm.value.select(value);
|
|
386
|
-
}
|
|
387
|
-
deselectExpand(value) {
|
|
388
|
-
this.#sm.value.deselect(value);
|
|
389
|
-
}
|
|
390
|
-
clearExpand() {
|
|
391
|
-
this.#sm.value.clear();
|
|
392
|
-
}
|
|
393
|
-
needUpdate() {
|
|
394
|
-
this.updateIndex$.update((a) => ++a);
|
|
395
|
-
}
|
|
396
|
-
setSelectionModel(input = {}) {
|
|
397
|
-
this.#sm.next(new SelectionModel(input._multiple, input.initiallySelectedValues, input._emitChanges, input.compareWith));
|
|
398
|
-
}
|
|
399
|
-
selectionModel$$ = this.#sm.pipe(filter(Boolean), switchMap((sm) => sm.changed), map(() => {
|
|
400
|
-
return this.#sm.value;
|
|
401
|
-
}), takeUntilDestroyed(), shareReplay(1));
|
|
402
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
403
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusService });
|
|
404
|
-
}
|
|
405
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableStatusService, decorators: [{
|
|
406
|
-
type: Injectable
|
|
407
|
-
}], ctorParameters: () => [] });
|
|
408
|
-
|
|
409
|
-
class ExpandRowDirective {
|
|
410
|
-
#field = inject(PI_VIEW_FIELD_TOKEN);
|
|
411
|
-
#status = inject(TableStatusService);
|
|
412
|
-
a(event) {
|
|
413
|
-
if (event.target instanceof HTMLInputElement) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
this.#status.toggleExpand(this.#field().context['item$']());
|
|
417
|
-
}
|
|
418
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ExpandRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
419
|
-
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 });
|
|
420
|
-
}
|
|
421
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ExpandRowDirective, decorators: [{
|
|
422
|
-
type: Directive,
|
|
423
|
-
args: [{
|
|
424
|
-
selector: 'app-expand',
|
|
425
|
-
}]
|
|
426
|
-
}], propDecorators: { a: [{
|
|
427
|
-
type: HostListener,
|
|
428
|
-
args: ['click', ['$event']]
|
|
429
|
-
}] } });
|
|
430
|
-
|
|
431
|
-
class TableResourceWC {
|
|
432
|
-
static __version = 2;
|
|
433
|
-
templateRef = viewChild.required('templateRef');
|
|
434
|
-
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
435
|
-
#status = inject(TableStatusService);
|
|
436
|
-
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
437
|
-
#localSearchOptions$$ = computed(() => this.props$$()['localSearchOptions'], ...(ngDevMode ? [{ debugName: "#localSearchOptions$$" }] : []));
|
|
438
|
-
#data$$ = computed(() => this.field$$().props()['data'], ...(ngDevMode ? [{ debugName: "#data$$" }] : []));
|
|
439
|
-
rawData$$ = computed(() => {
|
|
440
|
-
const data = this.#data$$();
|
|
441
|
-
this.#status.updateIndex$();
|
|
442
|
-
return Array.isArray(data) || !data
|
|
443
|
-
? Promise.resolve(localData(data ?? [], this.#localSearchOptions$$()))
|
|
444
|
-
: data().then((value) => {
|
|
445
|
-
if (Array.isArray(value) || !value) {
|
|
446
|
-
return localData(value ?? [], this.#localSearchOptions$$());
|
|
447
|
-
}
|
|
448
|
-
return value;
|
|
449
|
-
});
|
|
450
|
-
}, ...(ngDevMode ? [{ debugName: "rawData$$" }] : []));
|
|
451
|
-
queryParams$$ = computed(() => {
|
|
452
|
-
return this.field$$().props()['queryParams'];
|
|
453
|
-
}, ...(ngDevMode ? [{ debugName: "queryParams$$" }] : []));
|
|
454
|
-
data$ = resource({
|
|
455
|
-
params: computed(() => {
|
|
456
|
-
const params = this.queryParams$$();
|
|
457
|
-
return {
|
|
458
|
-
data: this.rawData$$(),
|
|
459
|
-
params,
|
|
460
|
-
};
|
|
461
|
-
}),
|
|
462
|
-
loader: async (res) => {
|
|
463
|
-
const { params } = res;
|
|
464
|
-
const dataResult = await params.data;
|
|
465
|
-
return dataResult(res).then((data) => {
|
|
466
|
-
return dataConvert(data);
|
|
467
|
-
});
|
|
468
|
-
},
|
|
469
|
-
});
|
|
470
|
-
list$$ = computedWithPrev((value) => {
|
|
471
|
-
return this.data$.value()?.[1] ?? value;
|
|
472
|
-
});
|
|
473
|
-
count$$ = computedWithPrev((value) => {
|
|
474
|
-
return this.data$.value()?.[0] ?? value;
|
|
475
|
-
});
|
|
476
|
-
constructor() {
|
|
477
|
-
this.field$$().inputs.update((inputs) => {
|
|
478
|
-
return {
|
|
479
|
-
...inputs,
|
|
480
|
-
data: this.list$$,
|
|
481
|
-
};
|
|
482
|
-
});
|
|
483
|
-
this.field$$().props.update((props) => {
|
|
484
|
-
return {
|
|
485
|
-
...props,
|
|
486
|
-
count$$: this.count$$,
|
|
487
|
-
status: this.#status,
|
|
488
|
-
};
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableResourceWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
492
|
-
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"] }] });
|
|
493
|
-
}
|
|
494
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableResourceWC, decorators: [{
|
|
495
|
-
type: Component,
|
|
496
|
-
args: [{
|
|
497
|
-
selector: 'app-table-resource',
|
|
498
|
-
template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`,
|
|
499
|
-
imports: [InsertFieldDirective],
|
|
500
|
-
}]
|
|
501
|
-
}], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
502
|
-
|
|
503
|
-
const SortMultiToken = new InjectionToken('SortMultiToken');
|
|
504
332
|
class SortService {
|
|
505
|
-
direction$ =
|
|
506
|
-
|
|
333
|
+
#direction$ = new BehaviorSubject({});
|
|
334
|
+
#restore$ = new BehaviorSubject({});
|
|
335
|
+
#restore$$ = this.#restore$.pipe(takeUntilDestroyed(), shareReplay());
|
|
336
|
+
value$$ = this.#direction$.pipe(map((value) => (this.sortList() ?? Object.keys(value))
|
|
337
|
+
.map((key) => {
|
|
338
|
+
return value[key] ? { key: key, value: value[key] } : undefined;
|
|
339
|
+
})
|
|
340
|
+
.filter(Boolean)), takeUntilDestroyed(), shareReplay(1));
|
|
341
|
+
multiple = signal(true, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
342
|
+
sortList = signal([], ...(ngDevMode ? [{ debugName: "sortList" }] : []));
|
|
343
|
+
setInit(object) {
|
|
344
|
+
this.#restore$.next(object);
|
|
345
|
+
this.#direction$.next(object);
|
|
346
|
+
}
|
|
507
347
|
update(key, direction) {
|
|
508
|
-
if (this.multiple) {
|
|
509
|
-
this
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
348
|
+
if (this.multiple()) {
|
|
349
|
+
let data = this.#direction$.value;
|
|
350
|
+
if (direction === 0) {
|
|
351
|
+
data = { ...data };
|
|
352
|
+
delete data[key];
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
data = {
|
|
516
356
|
...data,
|
|
517
357
|
[key]: direction,
|
|
518
358
|
};
|
|
519
|
-
}
|
|
359
|
+
}
|
|
360
|
+
this.#direction$.next(data);
|
|
520
361
|
}
|
|
521
362
|
else {
|
|
363
|
+
let data = this.#direction$.value;
|
|
522
364
|
if (direction === 0) {
|
|
523
|
-
if (key in
|
|
524
|
-
this
|
|
365
|
+
if (key in data) {
|
|
366
|
+
this.#direction$.next({});
|
|
367
|
+
return;
|
|
525
368
|
}
|
|
526
369
|
}
|
|
527
370
|
else {
|
|
528
|
-
Object.keys(this
|
|
371
|
+
Object.keys(this.#direction$.value).forEach((k) => {
|
|
529
372
|
if (k === key) {
|
|
530
373
|
return;
|
|
531
374
|
}
|
|
532
|
-
this.#restore$.next({ key:
|
|
375
|
+
this.#restore$.next({ [key]: 0 });
|
|
533
376
|
});
|
|
534
|
-
this
|
|
377
|
+
this.#direction$.next({
|
|
535
378
|
[key]: direction,
|
|
536
379
|
});
|
|
537
380
|
}
|
|
538
381
|
}
|
|
539
|
-
this.#update(this.direction$());
|
|
540
|
-
}
|
|
541
|
-
#update;
|
|
542
|
-
setUpdate(fn) {
|
|
543
|
-
this.#update = fn;
|
|
544
382
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
return this.#restore$.pipe(filter((a) => a.key === key));
|
|
383
|
+
listenChange(key) {
|
|
384
|
+
return this.#restore$$.pipe(map((item) => item[key]), filter(Boolean));
|
|
548
385
|
}
|
|
549
386
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
550
387
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortService });
|
|
@@ -555,14 +392,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
555
392
|
|
|
556
393
|
class inputSortDirective {
|
|
557
394
|
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
|
|
558
|
-
inputSort =
|
|
395
|
+
inputSort = signal(0, ...(ngDevMode ? [{ debugName: "inputSort" }] : []));
|
|
559
396
|
#el = inject(ElementRef).nativeElement;
|
|
560
397
|
#sort = inject(SortService);
|
|
561
|
-
ngOnChanges() {
|
|
562
|
-
const result = this.inputSort();
|
|
563
|
-
this.#changeElProps(result);
|
|
564
|
-
this.#sort.update(this.key(), result);
|
|
565
|
-
}
|
|
566
398
|
#changeElProps(value) {
|
|
567
399
|
switch (value) {
|
|
568
400
|
case 0:
|
|
@@ -579,7 +411,7 @@ class inputSortDirective {
|
|
|
579
411
|
}
|
|
580
412
|
}
|
|
581
413
|
ngOnInit() {
|
|
582
|
-
this.#sort.
|
|
414
|
+
this.#sort.listenChange(this.key()).subscribe((value) => {
|
|
583
415
|
this.inputSort.set(value);
|
|
584
416
|
this.#changeElProps(value);
|
|
585
417
|
});
|
|
@@ -589,16 +421,18 @@ class inputSortDirective {
|
|
|
589
421
|
const value = ++a;
|
|
590
422
|
return value === 2 ? -1 : value;
|
|
591
423
|
});
|
|
424
|
+
this.#sort.update(this.key(), this.inputSort());
|
|
425
|
+
this.#changeElProps(this.inputSort());
|
|
592
426
|
}
|
|
593
427
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: inputSortDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
594
|
-
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 }
|
|
428
|
+
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 } }, host: { listeners: { "change": "chagne()" } }, ngImport: i0 });
|
|
595
429
|
}
|
|
596
430
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: inputSortDirective, decorators: [{
|
|
597
431
|
type: Directive,
|
|
598
432
|
args: [{
|
|
599
433
|
selector: '[inputSort]',
|
|
600
434
|
}]
|
|
601
|
-
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }],
|
|
435
|
+
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], chagne: [{
|
|
602
436
|
type: HostListener,
|
|
603
437
|
args: ['change']
|
|
604
438
|
}] } });
|
|
@@ -611,14 +445,8 @@ class SortHeaderWC {
|
|
|
611
445
|
key$$ = computed(() => {
|
|
612
446
|
return this.props$$()['key'];
|
|
613
447
|
}, ...(ngDevMode ? [{ debugName: "key$$" }] : []));
|
|
614
|
-
#direction$$ = computed(() => {
|
|
615
|
-
return this.props$$()['direction'];
|
|
616
|
-
}, ...(ngDevMode ? [{ debugName: "#direction$$", equal: () => false }] : [{ equal: () => false }]));
|
|
617
|
-
index$ = linkedSignal(() => {
|
|
618
|
-
return this.#direction$$() ?? 0;
|
|
619
|
-
}, ...(ngDevMode ? [{ debugName: "index$" }] : []));
|
|
620
448
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortHeaderWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
621
|
-
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 <div class=\"flex items-center\">\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\"
|
|
449
|
+
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 <div class=\"flex items-center\">\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 [key]=\"key$$()\" />\n\n <div [class]=\"'swap-indeterminate' | cssPrefix\"></div>\n <div [class]=\"'swap-on' | mergeClass: 'flex' | twPrefix\">\n <mat-icon>arrow_upward</mat-icon>\n </div>\n <div [class]=\"'swap-off' | cssPrefix | mergeClass: 'flex' | twPrefix\">\n <mat-icon>arrow_downward</mat-icon>\n </div>\n </label>\n </div>\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"] }, { kind: "directive", type: InsertFieldDirective, selector: "[insertField]", exportAs: ["insertField"] }, { kind: "pipe", type: CssPrefixPipe, name: "cssPrefix" }, { kind: "pipe", type: MergeClassPipe, name: "mergeClass" }, { kind: "pipe", type: TwPrefixPipe, name: "twPrefix" }] });
|
|
622
450
|
}
|
|
623
451
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortHeaderWC, decorators: [{
|
|
624
452
|
type: Component,
|
|
@@ -631,42 +459,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
631
459
|
inputSortDirective,
|
|
632
460
|
InsertFieldDirective,
|
|
633
461
|
TwPrefixPipe,
|
|
634
|
-
], template: "<ng-template #templateRef let-attr=\"attributes\">\n <div class=\"flex items-center\">\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\"
|
|
462
|
+
], template: "<ng-template #templateRef let-attr=\"attributes\">\n <div class=\"flex items-center\">\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 [key]=\"key$$()\" />\n\n <div [class]=\"'swap-indeterminate' | cssPrefix\"></div>\n <div [class]=\"'swap-on' | mergeClass: 'flex' | twPrefix\">\n <mat-icon>arrow_upward</mat-icon>\n </div>\n <div [class]=\"'swap-off' | cssPrefix | mergeClass: 'flex' | twPrefix\">\n <mat-icon>arrow_downward</mat-icon>\n </div>\n </label>\n </div>\n</ng-template>\n" }]
|
|
635
463
|
}], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
636
464
|
|
|
637
|
-
class SortTablehWC {
|
|
638
|
-
static __version = 2;
|
|
639
|
-
templateRef = viewChild.required('templateRef');
|
|
640
|
-
#sort = inject(SortService);
|
|
641
|
-
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
642
|
-
props$$ = computed(() => this.field$$().props(), ...(ngDevMode ? [{ debugName: "props$$" }] : []));
|
|
643
|
-
constructor() {
|
|
644
|
-
this.#sort.setUpdate((value) => {
|
|
645
|
-
this.field$$().props.update((data) => {
|
|
646
|
-
return {
|
|
647
|
-
...data,
|
|
648
|
-
sortQueryParams: (this.props$$()['sortList'] ?? Object.keys(value))
|
|
649
|
-
.map((key) => {
|
|
650
|
-
return value[key] ? { key: key, value: value[key] } : undefined;
|
|
651
|
-
})
|
|
652
|
-
.filter(Boolean),
|
|
653
|
-
};
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortTablehWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
658
|
-
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"] }] });
|
|
659
|
-
}
|
|
660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: SortTablehWC, decorators: [{
|
|
661
|
-
type: Component,
|
|
662
|
-
args: [{
|
|
663
|
-
selector: 'app-sort-table',
|
|
664
|
-
template: `<ng-template #templateRef> <ng-container insertField></ng-container></ng-template>`,
|
|
665
|
-
providers: [SortService, { provide: SortMultiToken, useValue: false }],
|
|
666
|
-
imports: [InsertFieldDirective],
|
|
667
|
-
}]
|
|
668
|
-
}], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
|
|
669
|
-
|
|
670
465
|
const defaultKey = 'default';
|
|
671
466
|
class CheckboxService {
|
|
672
467
|
#selectModelMap = new Map();
|
|
@@ -740,7 +535,11 @@ class CheckboxService {
|
|
|
740
535
|
event$.next(checked);
|
|
741
536
|
}
|
|
742
537
|
listenAllSelect(key = defaultKey) {
|
|
743
|
-
|
|
538
|
+
let result = this.#allEvent.get(key);
|
|
539
|
+
if (!result) {
|
|
540
|
+
throw new Error('CheckboxService not call init');
|
|
541
|
+
}
|
|
542
|
+
return result;
|
|
744
543
|
}
|
|
745
544
|
getSelected(key = defaultKey) {
|
|
746
545
|
return this.#selectModelMap.get(key).selected;
|
|
@@ -817,18 +616,121 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
817
616
|
var wrapper_index$1 = /*#__PURE__*/Object.freeze({
|
|
818
617
|
__proto__: null,
|
|
819
618
|
SortHeaderWC: SortHeaderWC,
|
|
820
|
-
SortTablehWC: SortTablehWC,
|
|
821
619
|
TableCheckboxAllWC: TableCheckboxAllWC,
|
|
822
|
-
TableCheckboxOneWC: TableCheckboxOneWC
|
|
823
|
-
TableResourceWC: TableResourceWC
|
|
620
|
+
TableCheckboxOneWC: TableCheckboxOneWC
|
|
824
621
|
});
|
|
825
622
|
|
|
623
|
+
class TableExpandService {
|
|
624
|
+
#sm = new BehaviorSubject(undefined);
|
|
625
|
+
toggleExpand(value) {
|
|
626
|
+
this.#sm.value.toggle(value);
|
|
627
|
+
}
|
|
628
|
+
selectExpand(value) {
|
|
629
|
+
this.#sm.value.select(value);
|
|
630
|
+
}
|
|
631
|
+
deselectExpand(value) {
|
|
632
|
+
this.#sm.value.deselect(value);
|
|
633
|
+
}
|
|
634
|
+
clearExpand() {
|
|
635
|
+
this.#sm.value.clear();
|
|
636
|
+
}
|
|
637
|
+
init(input = {}) {
|
|
638
|
+
this.#sm.next(new SelectionModel(input._multiple, input.initiallySelectedValues, input._emitChanges, input.compareWith));
|
|
639
|
+
}
|
|
640
|
+
selectionModel$$ = this.#sm.pipe(tap((value) => {
|
|
641
|
+
if (!value) {
|
|
642
|
+
throw new Error(`TableStatusService not call init`);
|
|
643
|
+
}
|
|
644
|
+
}), switchMap((sm) => sm.changed), map(() => {
|
|
645
|
+
return this.#sm.value;
|
|
646
|
+
}), takeUntilDestroyed(), shareReplay(1));
|
|
647
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableExpandService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
648
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableExpandService });
|
|
649
|
+
}
|
|
650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableExpandService, decorators: [{
|
|
651
|
+
type: Injectable
|
|
652
|
+
}] });
|
|
653
|
+
|
|
654
|
+
class ExpandRowDirective {
|
|
655
|
+
#field = inject(PI_VIEW_FIELD_TOKEN);
|
|
656
|
+
#status = inject(TableExpandService);
|
|
657
|
+
a(event) {
|
|
658
|
+
if (event.target instanceof HTMLInputElement) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
this.#status.toggleExpand(this.#field().context['item$']());
|
|
662
|
+
}
|
|
663
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ExpandRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
664
|
+
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 });
|
|
665
|
+
}
|
|
666
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ExpandRowDirective, decorators: [{
|
|
667
|
+
type: Directive,
|
|
668
|
+
args: [{
|
|
669
|
+
selector: 'app-expand',
|
|
670
|
+
}]
|
|
671
|
+
}], propDecorators: { a: [{
|
|
672
|
+
type: HostListener,
|
|
673
|
+
args: ['click', ['$event']]
|
|
674
|
+
}] } });
|
|
675
|
+
|
|
676
|
+
class TableResourceService {
|
|
677
|
+
#requestFn$ = signal(undefined, ...(ngDevMode ? [{ debugName: "#requestFn$" }] : []));
|
|
678
|
+
#queryParams$ = signal({}, ...(ngDevMode ? [{ debugName: "#queryParams$" }] : []));
|
|
679
|
+
#data$ = resource({
|
|
680
|
+
params: computed(() => {
|
|
681
|
+
const params = this.#queryParams$();
|
|
682
|
+
let requestFn = this.#requestFn$();
|
|
683
|
+
this.#updateIndex$();
|
|
684
|
+
return {
|
|
685
|
+
requestFn,
|
|
686
|
+
params,
|
|
687
|
+
index: this.#updateIndex$(),
|
|
688
|
+
};
|
|
689
|
+
}),
|
|
690
|
+
loader: async (res) => {
|
|
691
|
+
if (!res.params.requestFn) {
|
|
692
|
+
return [0, []];
|
|
693
|
+
}
|
|
694
|
+
return res.params.requestFn(res.params.params);
|
|
695
|
+
},
|
|
696
|
+
});
|
|
697
|
+
list$$ = computedWithPrev((value) => {
|
|
698
|
+
return this.#data$.value()?.[1] ?? value ?? [];
|
|
699
|
+
});
|
|
700
|
+
count$$ = computedWithPrev((value) => {
|
|
701
|
+
return this.#data$.value()?.[0] ?? value ?? 0;
|
|
702
|
+
});
|
|
703
|
+
isLoading$$ = computed(() => {
|
|
704
|
+
return this.#data$.isLoading();
|
|
705
|
+
}, ...(ngDevMode ? [{ debugName: "isLoading$$" }] : []));
|
|
706
|
+
#updateIndex$ = signal(0, ...(ngDevMode ? [{ debugName: "#updateIndex$" }] : []));
|
|
707
|
+
needUpdate() {
|
|
708
|
+
this.#updateIndex$.update((a) => ++a);
|
|
709
|
+
}
|
|
710
|
+
setRequest(fn) {
|
|
711
|
+
this.#requestFn$.set(fn);
|
|
712
|
+
}
|
|
713
|
+
setParams(key, value) {
|
|
714
|
+
this.#queryParams$.update((data) => {
|
|
715
|
+
return {
|
|
716
|
+
...data,
|
|
717
|
+
[key]: value,
|
|
718
|
+
};
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableResourceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
722
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableResourceService });
|
|
723
|
+
}
|
|
724
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableResourceService, decorators: [{
|
|
725
|
+
type: Injectable
|
|
726
|
+
}] });
|
|
727
|
+
|
|
826
728
|
class TableExpandOneTableCell {
|
|
827
729
|
static __version = 2;
|
|
828
730
|
templateRef = viewChild.required('templateRef');
|
|
829
731
|
field$$ = inject(PI_VIEW_FIELD_TOKEN);
|
|
830
732
|
// props$$ = computed(() => this.field$$().props());
|
|
831
|
-
#service = inject(
|
|
733
|
+
#service = inject(TableExpandService);
|
|
832
734
|
#expand$$ = toSignal(this.#service.selectionModel$$);
|
|
833
735
|
isExpand$$ = computed(() => {
|
|
834
736
|
const sm = this.#expand$$();
|
|
@@ -1430,15 +1332,13 @@ var wrapper_index = /*#__PURE__*/Object.freeze({
|
|
|
1430
1332
|
__proto__: null,
|
|
1431
1333
|
OptionListLocalFilterWC: OptionListLocalFilterWC,
|
|
1432
1334
|
SortHeaderWC: SortHeaderWC,
|
|
1433
|
-
SortTablehWC: SortTablehWC,
|
|
1434
1335
|
TableCheckboxAllWC: TableCheckboxAllWC,
|
|
1435
|
-
TableCheckboxOneWC: TableCheckboxOneWC
|
|
1436
|
-
TableResourceWC: TableResourceWC
|
|
1336
|
+
TableCheckboxOneWC: TableCheckboxOneWC
|
|
1437
1337
|
});
|
|
1438
1338
|
|
|
1439
1339
|
/**
|
|
1440
1340
|
* Generated bundle index. Do not edit.
|
|
1441
1341
|
*/
|
|
1442
1342
|
|
|
1443
|
-
export { CheckboxService, ExactMatchOptions, ExpandRowDirective, component_index as ExtComponentGroup, wrapper_index as ExtWrapperGroup, ListTemplateNFCC, MenuTreeNFCC, OptionListFCC, OptionListLocalFilterWC, PaginationNFCC, PickerRefFCC, SortHeaderWC,
|
|
1343
|
+
export { CheckboxService, ExactMatchOptions, ExpandRowDirective, component_index as ExtComponentGroup, wrapper_index as ExtWrapperGroup, ListTemplateNFCC, MenuTreeNFCC, OptionListFCC, OptionListLocalFilterWC, PaginationNFCC, PickerRefFCC, SortHeaderWC, SortService, SubsetMatchOptions, TableCheckboxAllWC, TableCheckboxOneWC, TableExpandOneTableCell, TableExpandService, TableNFCC, TableResourceService, TableRowFGC, wrapper_index$1 as WrapperGroup, createDefaultColDefine, createDefaultColDefineFn, createRowDefine, inputSortDirective };
|
|
1444
1344
|
//# sourceMappingURL=piying-lib-angular-daisyui-extension.mjs.map
|