@piying-lib/angular-daisyui 1.0.10 → 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,6 +263,8 @@ class TableNFCC {
286
263
  })
287
264
  .filter(Boolean);
288
265
  if (colList.length) {
266
+ const items = row.define.items;
267
+ items.length = 0;
289
268
  row.define.items.push(...colList);
290
269
  return row.define;
291
270
  }
@@ -338,11 +317,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
338
317
  type: Component,
339
318
  args: [{ selector: 'app-table', imports: [
340
319
  AttributesDirective,
341
- NgTemplateOutlet,
342
320
  PurePipe,
343
321
  SelectorlessOutlet,
344
- StrOrTemplateComponent,
345
- JsonPipe,
346
322
  FormsModule,
347
323
  CssPrefixPipe,
348
324
  MergeClassPipe,
@@ -488,7 +464,7 @@ class TableResourceWC {
488
464
  }),
489
465
  loader: async (res) => {
490
466
  const { params } = res;
491
- let dataResult = await params.data;
467
+ const dataResult = await params.data;
492
468
  return dataResult(res).then((data) => {
493
469
  return dataConvert(data);
494
470
  });
@@ -729,7 +705,7 @@ class TableCheckboxAllWC {
729
705
  return this.props$$()['key'];
730
706
  }, ...(ngDevMode ? [{ debugName: "#key$$" }] : []));
731
707
  toggle() {
732
- this.#checkboxService.toggle(this.#key$$(), this.props$$()['item$']());
708
+ this.#checkboxService.selectAll(this.#key$$());
733
709
  }
734
710
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TableCheckboxAllWC, deps: [], target: i0.ɵɵFactoryTarget.Component });
735
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"] }] });
@@ -1192,13 +1168,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
1192
1168
  args: [{ selector: 'app-picker-ref', imports: [
1193
1169
  FormsModule,
1194
1170
  AttributesDirective,
1195
- CssPrefixPipe,
1196
- MergeClassPipe,
1197
- StrOrTemplateComponent,
1198
1171
  SelectorlessOutlet,
1199
1172
  CdkConnectedOverlay,
1200
1173
  CdkOverlayOrigin,
1201
- PurePipe,
1202
1174
  ], providers: [
1203
1175
  {
1204
1176
  provide: NG_VALUE_ACCESSOR,
@@ -1254,18 +1226,7 @@ class OptionListFCC extends BaseControl {
1254
1226
  }
1255
1227
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: OptionListFCC, decorators: [{
1256
1228
  type: Component,
1257
- args: [{ selector: 'app-option-list', imports: [
1258
- FormsModule,
1259
- AttributesDirective,
1260
- NgTemplateOutlet,
1261
- NgClass,
1262
- CssPrefixPipe,
1263
- MergeClassPipe,
1264
- TwPrefixPipe,
1265
- StrOrTemplateComponent,
1266
- SelectorlessOutlet,
1267
- PurePipe,
1268
- ], providers: [
1229
+ args: [{ selector: 'app-option-list', imports: [FormsModule, NgTemplateOutlet, SelectorlessOutlet, PurePipe], providers: [
1269
1230
  {
1270
1231
  provide: NG_VALUE_ACCESSOR,
1271
1232
  useExisting: forwardRef(() => OptionListFCC),
@@ -1302,21 +1263,7 @@ class ListTemplateNFCC {
1302
1263
  }
1303
1264
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ListTemplateNFCC, decorators: [{
1304
1265
  type: Component,
1305
- args: [{ selector: 'app-list-template', imports: [
1306
- AttributesDirective,
1307
- NgClass,
1308
- CssPrefixPipe,
1309
- SelectorlessOutlet,
1310
- StrOrTemplateComponent,
1311
- RouterLink,
1312
- RouterLinkActive,
1313
- NgTemplateOutlet,
1314
- MatIconModule,
1315
- MergeClassPipe,
1316
- JsonPipe,
1317
- MergeClassPipe,
1318
- PurePipe,
1319
- ], 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" }]
1320
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 }] }] } });
1321
1268
 
1322
1269
  var component_index = /*#__PURE__*/Object.freeze({
@@ -1344,7 +1291,7 @@ class FilterOptionNFCC {
1344
1291
  }
1345
1292
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: FilterOptionNFCC, decorators: [{
1346
1293
  type: Component,
1347
- 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" }]
1348
1295
  }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
1349
1296
 
1350
1297
  class OptionListLocalFilterWC {