@piying-lib/angular-daisyui 1.0.11 → 1.0.12

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,9 +1,8 @@
1
- import { NgTemplateOutlet, NgClass, JsonPipe } from '@angular/common';
1
+ import { NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
3
  import { viewChild, input, inject, computed, Component, model, InjectionToken, Injector, untracked, signal, Injectable, HostListener, Directive, effect, resource, ElementRef, linkedSignal, NgZone, EventEmitter, TemplateRef, ViewContainerRef, Output, forwardRef, ChangeDetectionStrategy } from '@angular/core';
4
- import { SelectorlessOutlet } from '@cyia/ngx-common/directive';
5
4
  import { StrOrTemplateComponent, isSchema, computedWithPrev, DefaultOptionConvert, transformOption } from '@piying-lib/angular-core';
6
- import { CssPrefixPipe, MergeClassPipe, TwPrefixPipe } from '@piying-lib/angular-daisyui/pipe';
5
+ import { CssPrefixPipe, MergeClassPipe } from '@piying-lib/angular-daisyui/pipe';
7
6
  import { ThemeService, CheckboxService } from '@piying-lib/angular-daisyui/service';
8
7
  import { AttributesDirective, PI_VIEW_FIELD_TOKEN, PiyingViewGroupBase, InsertFieldDirective, BaseControl, PiyingView, PI_INPUT_OPTIONS_TOKEN } from '@piying/view-angular';
9
8
  import { RouterLink, RouterLinkActive } from '@angular/router';
@@ -13,6 +12,7 @@ import * as i1$1 from '@angular/forms';
13
12
  import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
14
13
  import { PurePipe } from '@cyia/ngx-common/pipe';
15
14
  import clsx from 'clsx';
15
+ import { SelectorlessOutlet } from '@cyia/ngx-common/directive';
16
16
  import * as v from 'valibot';
17
17
  import { setComponent, NFCSchema, actions } from '@piying/view-angular-core';
18
18
  import { ThWC, TdWC } from '@piying-lib/angular-daisyui/wrapper';
@@ -45,16 +45,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
45
45
  type: Component,
46
46
  args: [{ selector: 'app-menu-tree', imports: [
47
47
  AttributesDirective,
48
- NgClass,
49
48
  CssPrefixPipe,
50
- SelectorlessOutlet,
51
- StrOrTemplateComponent,
52
49
  RouterLink,
53
50
  RouterLinkActive,
54
51
  NgTemplateOutlet,
55
52
  MatIconModule,
56
53
  MergeClassPipe,
57
- JsonPipe,
58
54
  MergeClassPipe,
59
55
  ], 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" }]
60
56
  }], 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 }] }] } });
@@ -165,18 +161,7 @@ class PaginationNFCC {
165
161
  }
166
162
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: PaginationNFCC, decorators: [{
167
163
  type: Component,
168
- args: [{ selector: 'app-pagination', imports: [
169
- AttributesDirective,
170
- MatIcon,
171
- NgTemplateOutlet,
172
- NgClass,
173
- CssPrefixPipe,
174
- StrOrTemplateComponent,
175
- SelectorlessOutlet,
176
- PurePipe,
177
- FormsModule,
178
- MergeClassPipe,
179
- ], 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" }]
164
+ 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" }]
180
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 }] }] } });
181
166
 
182
167
  class TableRowFGC extends PiyingViewGroupBase {
@@ -185,15 +170,7 @@ class TableRowFGC extends PiyingViewGroupBase {
185
170
  }
186
171
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableRowFGC, decorators: [{
187
172
  type: Component,
188
- args: [{ selector: 'tr', imports: [
189
- AttributesDirective,
190
- NgTemplateOutlet,
191
- PurePipe,
192
- SelectorlessOutlet,
193
- StrOrTemplateComponent,
194
- JsonPipe,
195
- FormsModule,
196
- ], providers: [], template: "@for (field of children$$(); track $index) {\n <ng-container\n *ngTemplateOutlet=\"fieldTemplateRef(); context: { $implicit: field }\"\n ></ng-container>\n}\n" }]
173
+ args: [{ selector: 'tr', imports: [NgTemplateOutlet, FormsModule], providers: [], template: "@for (field of children$$(); track $index) {\n <ng-container\n *ngTemplateOutlet=\"fieldTemplateRef(); context: { $implicit: field }\"\n ></ng-container>\n}\n" }]
197
174
  }] });
198
175
 
199
176
  const TABLE_STATUS_TOKEN = new InjectionToken('TABLE_STATUS');
@@ -286,7 +263,7 @@ class TableNFCC {
286
263
  })
287
264
  .filter(Boolean);
288
265
  if (colList.length) {
289
- let items = row.define.items;
266
+ const items = row.define.items;
290
267
  items.length = 0;
291
268
  row.define.items.push(...colList);
292
269
  return row.define;
@@ -340,11 +317,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
340
317
  type: Component,
341
318
  args: [{ selector: 'app-table', imports: [
342
319
  AttributesDirective,
343
- NgTemplateOutlet,
344
320
  PurePipe,
345
321
  SelectorlessOutlet,
346
- StrOrTemplateComponent,
347
- JsonPipe,
348
322
  FormsModule,
349
323
  CssPrefixPipe,
350
324
  MergeClassPipe,
@@ -490,7 +464,7 @@ class TableResourceWC {
490
464
  }),
491
465
  loader: async (res) => {
492
466
  const { params } = res;
493
- let dataResult = await params.data;
467
+ const dataResult = await params.data;
494
468
  return dataResult(res).then((data) => {
495
469
  return dataConvert(data);
496
470
  });
@@ -731,7 +705,7 @@ class TableCheckboxAllWC {
731
705
  return this.props$$()['key'];
732
706
  }, ...(ngDevMode ? [{ debugName: "#key$$" }] : []));
733
707
  toggle() {
734
- this.#checkboxService.toggle(this.#key$$(), this.props$$()['item$']());
708
+ this.#checkboxService.selectAll(this.#key$$());
735
709
  }
736
710
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableCheckboxAllWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
737
711
  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"] }] });
@@ -1194,13 +1168,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
1194
1168
  args: [{ selector: 'app-picker-ref', imports: [
1195
1169
  FormsModule,
1196
1170
  AttributesDirective,
1197
- CssPrefixPipe,
1198
- MergeClassPipe,
1199
- StrOrTemplateComponent,
1200
1171
  SelectorlessOutlet,
1201
1172
  CdkConnectedOverlay,
1202
1173
  CdkOverlayOrigin,
1203
- PurePipe,
1204
1174
  ], providers: [
1205
1175
  {
1206
1176
  provide: NG_VALUE_ACCESSOR,
@@ -1256,18 +1226,7 @@ class OptionListFCC extends BaseControl {
1256
1226
  }
1257
1227
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: OptionListFCC, decorators: [{
1258
1228
  type: Component,
1259
- args: [{ selector: 'app-option-list', imports: [
1260
- FormsModule,
1261
- AttributesDirective,
1262
- NgTemplateOutlet,
1263
- NgClass,
1264
- CssPrefixPipe,
1265
- MergeClassPipe,
1266
- TwPrefixPipe,
1267
- StrOrTemplateComponent,
1268
- SelectorlessOutlet,
1269
- PurePipe,
1270
- ], providers: [
1229
+ args: [{ selector: 'app-option-list', imports: [FormsModule, NgTemplateOutlet, SelectorlessOutlet, PurePipe], providers: [
1271
1230
  {
1272
1231
  provide: NG_VALUE_ACCESSOR,
1273
1232
  useExisting: forwardRef(() => OptionListFCC),
@@ -1304,21 +1263,7 @@ class ListTemplateNFCC {
1304
1263
  }
1305
1264
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ListTemplateNFCC, decorators: [{
1306
1265
  type: Component,
1307
- args: [{ selector: 'app-list-template', imports: [
1308
- AttributesDirective,
1309
- NgClass,
1310
- CssPrefixPipe,
1311
- SelectorlessOutlet,
1312
- StrOrTemplateComponent,
1313
- RouterLink,
1314
- RouterLinkActive,
1315
- NgTemplateOutlet,
1316
- MatIconModule,
1317
- MergeClassPipe,
1318
- JsonPipe,
1319
- MergeClassPipe,
1320
- PurePipe,
1321
- ], 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" }]
1266
+ args: [{ selector: 'app-list-template', imports: [SelectorlessOutlet, MatIconModule, PurePipe], 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" }]
1322
1267
  }], 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 }] }] } });
1323
1268
 
1324
1269
  var component_index = /*#__PURE__*/Object.freeze({
@@ -1346,7 +1291,7 @@ class FilterOptionNFCC {
1346
1291
  }
1347
1292
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: FilterOptionNFCC, decorators: [{
1348
1293
  type: Component,
1349
- 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" }]
1294
+ args: [{ selector: 'app-filter-option', imports: [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" }]
1350
1295
  }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
1351
1296
 
1352
1297
  class OptionListLocalFilterWC {