ng-zorro-antd-cron-expression.mjs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. import { NgTemplateOutlet, DatePipe } from '@angular/common';
  2. import * as i0 from '@angular/core';
  3. import { EventEmitter, booleanAttribute, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, forwardRef, NgModule } from '@angular/core';
  4. import * as i2 from '@angular/forms';
  5. import { FormsModule, Validators, NG_ASYNC_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';
  6. import { of } from 'rxjs';
  7. import { takeUntil } from 'rxjs/operators';
  8. import { parseExpression } from 'cron-parser';
  9. import { NzDestroyService } from 'ng-zorro-antd/core/services';
  10. import * as i1 from 'ng-zorro-antd/input';
  11. import { NzInputModule } from 'ng-zorro-antd/input';
  12. import * as i1$1 from 'ng-zorro-antd/icon';
  13. import { NzIconModule } from 'ng-zorro-antd/icon';
  14. import * as i2$1 from 'ng-zorro-antd/i18n';
  15. /**
  16. * Use of this source code is governed by an MIT-style license that can be
  17. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  18. */
  19. /**
  20. * Use of this source code is governed by an MIT-style license that can be
  21. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  22. */
  23. class NzCronExpressionInputComponent {
  24. value = '0';
  25. label = 'second';
  26. disabled = false;
  27. focusEffect = new EventEmitter();
  28. blurEffect = new EventEmitter();
  29. getValue = new EventEmitter();
  30. focusInputEffect(event) {
  31. this.focusEffect.emit(this.label);
  32. event.target.select();
  33. }
  34. blurInputEffect() {
  35. this.blurEffect.emit();
  36. }
  37. setValue() {
  38. this.getValue.emit({ label: this.label, value: this.value });
  39. }
  40. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  41. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.2", type: NzCronExpressionInputComponent, isStandalone: true, selector: "nz-cron-expression-input", inputs: { value: "value", label: "label", disabled: ["disabled", "disabled", booleanAttribute] }, outputs: { focusEffect: "focusEffect", blurEffect: "blurEffect", getValue: "getValue" }, exportAs: ["nzCronExpressionInput"], ngImport: i0, template: `
  42. <div class="ant-cron-expression-input">
  43. <input
  44. nz-input
  45. [(ngModel)]="value"
  46. [name]="label"
  47. [disabled]="disabled"
  48. (focus)="focusInputEffect($event)"
  49. (blur)="blurInputEffect()"
  50. (ngModelChange)="setValue()"
  51. />
  52. </div>
  53. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzInputModule }, { kind: "directive", type: i1.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "nzStepperless", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  54. }
  55. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionInputComponent, decorators: [{
  56. type: Component,
  57. args: [{
  58. changeDetection: ChangeDetectionStrategy.OnPush,
  59. encapsulation: ViewEncapsulation.None,
  60. selector: 'nz-cron-expression-input',
  61. exportAs: 'nzCronExpressionInput',
  62. template: `
  63. <div class="ant-cron-expression-input">
  64. <input
  65. nz-input
  66. [(ngModel)]="value"
  67. [name]="label"
  68. [disabled]="disabled"
  69. (focus)="focusInputEffect($event)"
  70. (blur)="blurInputEffect()"
  71. (ngModelChange)="setValue()"
  72. />
  73. </div>
  74. `,
  75. imports: [NzInputModule, FormsModule]
  76. }]
  77. }], propDecorators: { value: [{
  78. type: Input
  79. }], label: [{
  80. type: Input
  81. }], disabled: [{
  82. type: Input,
  83. args: [{ transform: booleanAttribute }]
  84. }], focusEffect: [{
  85. type: Output
  86. }], blurEffect: [{
  87. type: Output
  88. }], getValue: [{
  89. type: Output
  90. }] } });
  91. /**
  92. * Use of this source code is governed by an MIT-style license that can be
  93. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  94. */
  95. class NzCronExpressionLabelComponent {
  96. type = 'second';
  97. locale;
  98. labelFocus = null;
  99. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  100. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: NzCronExpressionLabelComponent, isStandalone: true, selector: "nz-cron-expression-label", inputs: { type: "type", locale: "locale", labelFocus: "labelFocus" }, exportAs: ["nzCronExpressionLabel"], ngImport: i0, template: `
  101. <div class="ant-cron-expression-label" [class.ant-cron-expression-label-foucs]="labelFocus === type">
  102. <label>
  103. {{ locale[type] }}
  104. </label>
  105. </div>
  106. `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  107. }
  108. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionLabelComponent, decorators: [{
  109. type: Component,
  110. args: [{
  111. changeDetection: ChangeDetectionStrategy.OnPush,
  112. encapsulation: ViewEncapsulation.None,
  113. selector: 'nz-cron-expression-label',
  114. exportAs: 'nzCronExpressionLabel',
  115. template: `
  116. <div class="ant-cron-expression-label" [class.ant-cron-expression-label-foucs]="labelFocus === type">
  117. <label>
  118. {{ locale[type] }}
  119. </label>
  120. </div>
  121. `
  122. }]
  123. }], propDecorators: { type: [{
  124. type: Input
  125. }], locale: [{
  126. type: Input
  127. }], labelFocus: [{
  128. type: Input
  129. }] } });
  130. /**
  131. * Use of this source code is governed by an MIT-style license that can be
  132. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  133. */
  134. class NzCronExpressionPreviewComponent {
  135. cdr;
  136. TimeList = [];
  137. visible = true;
  138. locale;
  139. nzSemantic = null;
  140. loadMorePreview = new EventEmitter();
  141. isExpand = true;
  142. constructor(cdr) {
  143. this.cdr = cdr;
  144. }
  145. setExpand() {
  146. this.isExpand = !this.isExpand;
  147. this.cdr.markForCheck();
  148. }
  149. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionPreviewComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
  150. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzCronExpressionPreviewComponent, isStandalone: true, selector: "nz-cron-expression-preview", inputs: { TimeList: "TimeList", visible: ["visible", "visible", booleanAttribute], locale: "locale", nzSemantic: "nzSemantic" }, outputs: { loadMorePreview: "loadMorePreview" }, exportAs: ["nzCronExpressionPreview"], ngImport: i0, template: ` <div class="ant-collapse ant-collapse-borderless ant-cron-expression-preview">
  151. <div class="ant-cron-expression-preview-dateTime" [class.ant-cron-expression-preview-dateTime-center]="!isExpand">
  152. @if (visible) {
  153. @if (!nzSemantic) {
  154. {{ TimeList[0] | date: 'YYYY-MM-dd HH:mm:ss' }}
  155. } @else {
  156. <ng-template [ngTemplateOutlet]="nzSemantic" />
  157. }
  158. } @else {
  159. {{ locale.cronError }}
  160. }
  161. </div>
  162. @if (visible && !isExpand) {
  163. <div class="ant-cron-expression-preview-content">
  164. <ul class="ant-cron-expression-preview-list">
  165. @for (item of TimeList; track item) {
  166. <li>
  167. {{ item | date: 'YYYY-MM-dd HH:mm:ss' }}
  168. </li>
  169. }
  170. <li><a (click)="loadMorePreview.emit()">···</a></li>
  171. </ul>
  172. </div>
  173. }
  174. <ul class="ant-cron-expression-preview-icon">
  175. @if (isExpand) {
  176. <li><nz-icon nzType="down" nzTheme="outline" (click)="setExpand()" /></li>
  177. } @else {
  178. <li><nz-icon nzType="up" nzTheme="outline" (click)="setExpand()" /></li>
  179. }
  180. </ul>
  181. </div>`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1$1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  182. }
  183. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionPreviewComponent, decorators: [{
  184. type: Component,
  185. args: [{
  186. changeDetection: ChangeDetectionStrategy.OnPush,
  187. encapsulation: ViewEncapsulation.None,
  188. selector: 'nz-cron-expression-preview',
  189. exportAs: 'nzCronExpressionPreview',
  190. template: ` <div class="ant-collapse ant-collapse-borderless ant-cron-expression-preview">
  191. <div class="ant-cron-expression-preview-dateTime" [class.ant-cron-expression-preview-dateTime-center]="!isExpand">
  192. @if (visible) {
  193. @if (!nzSemantic) {
  194. {{ TimeList[0] | date: 'YYYY-MM-dd HH:mm:ss' }}
  195. } @else {
  196. <ng-template [ngTemplateOutlet]="nzSemantic" />
  197. }
  198. } @else {
  199. {{ locale.cronError }}
  200. }
  201. </div>
  202. @if (visible && !isExpand) {
  203. <div class="ant-cron-expression-preview-content">
  204. <ul class="ant-cron-expression-preview-list">
  205. @for (item of TimeList; track item) {
  206. <li>
  207. {{ item | date: 'YYYY-MM-dd HH:mm:ss' }}
  208. </li>
  209. }
  210. <li><a (click)="loadMorePreview.emit()">···</a></li>
  211. </ul>
  212. </div>
  213. }
  214. <ul class="ant-cron-expression-preview-icon">
  215. @if (isExpand) {
  216. <li><nz-icon nzType="down" nzTheme="outline" (click)="setExpand()" /></li>
  217. } @else {
  218. <li><nz-icon nzType="up" nzTheme="outline" (click)="setExpand()" /></li>
  219. }
  220. </ul>
  221. </div>`,
  222. imports: [NgTemplateOutlet, DatePipe, NzIconModule]
  223. }]
  224. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { TimeList: [{
  225. type: Input
  226. }], visible: [{
  227. type: Input,
  228. args: [{ transform: booleanAttribute }]
  229. }], locale: [{
  230. type: Input
  231. }], nzSemantic: [{
  232. type: Input
  233. }], loadMorePreview: [{
  234. type: Output
  235. }] } });
  236. /**
  237. * Use of this source code is governed by an MIT-style license that can be
  238. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  239. */
  240. function labelsOfType(type) {
  241. if (type === 'spring') {
  242. return ['second', 'minute', 'hour', 'day', 'month', 'week'];
  243. }
  244. return ['minute', 'hour', 'day', 'month', 'week'];
  245. }
  246. class NzCronExpressionComponent {
  247. formBuilder;
  248. cdr;
  249. i18n;
  250. nzSize = 'default';
  251. nzType = 'linux';
  252. nzCollapseDisable = false;
  253. nzExtra = null;
  254. nzSemantic = null;
  255. nzBorderless = false;
  256. nzDisabled = false;
  257. locale;
  258. focus = false;
  259. labelFocus = null;
  260. labels = labelsOfType(this.nzType);
  261. interval;
  262. nextTimeList = [];
  263. isNzDisableFirstChange = true;
  264. destroy$ = inject(NzDestroyService);
  265. validateForm;
  266. onChange = () => { };
  267. onTouch = () => null;
  268. convertFormat(value) {
  269. const values = value.split(' ');
  270. const valueObject = this.labels.reduce((obj, label, idx) => {
  271. obj[label] = values[idx];
  272. return obj;
  273. }, {});
  274. this.validateForm.patchValue(valueObject);
  275. }
  276. writeValue(value) {
  277. if (value) {
  278. this.convertFormat(value);
  279. }
  280. }
  281. registerOnChange(fn) {
  282. this.onChange = fn;
  283. }
  284. registerOnTouched(fn) {
  285. this.onTouch = fn;
  286. }
  287. validate() {
  288. if (this.validateForm.valid) {
  289. return of(null);
  290. }
  291. else {
  292. return of({ error: true });
  293. }
  294. }
  295. setDisabledState(isDisabled) {
  296. this.nzDisabled = (this.isNzDisableFirstChange && this.nzDisabled) || isDisabled;
  297. this.isNzDisableFirstChange = false;
  298. this.cdr.markForCheck();
  299. }
  300. constructor(formBuilder, cdr, i18n) {
  301. this.formBuilder = formBuilder;
  302. this.cdr = cdr;
  303. this.i18n = i18n;
  304. this.validateForm = this.formBuilder.nonNullable.group({
  305. second: ['0', Validators.required],
  306. minute: ['*', Validators.required],
  307. hour: ['*', Validators.required],
  308. day: ['*', Validators.required],
  309. month: ['*', Validators.required],
  310. week: ['*', Validators.required]
  311. }, { validators: this.checkValid });
  312. }
  313. ngOnInit() {
  314. this.i18n.localeChange.pipe(takeUntil(this.destroy$)).subscribe(() => {
  315. this.locale = this.i18n.getLocaleData('CronExpression');
  316. this.cdr.markForCheck();
  317. });
  318. this.cronFormType();
  319. this.previewDate(this.validateForm.value);
  320. this.validateForm.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(value => {
  321. this.onChange(Object.values(value).join(' '));
  322. this.previewDate(value);
  323. this.cdr.markForCheck();
  324. });
  325. }
  326. ngOnChanges(changes) {
  327. const { nzType } = changes;
  328. if (nzType) {
  329. this.labels = labelsOfType(this.nzType);
  330. this.cronFormType();
  331. }
  332. }
  333. cronFormType() {
  334. if (this.nzType === 'spring') {
  335. this.validateForm.controls.second.enable();
  336. }
  337. else {
  338. this.validateForm.controls.second.disable();
  339. }
  340. }
  341. previewDate(value) {
  342. try {
  343. this.interval = parseExpression(Object.values(value).join(' '));
  344. this.nextTimeList = [
  345. this.interval.next().toDate(),
  346. this.interval.next().toDate(),
  347. this.interval.next().toDate(),
  348. this.interval.next().toDate(),
  349. this.interval.next().toDate()
  350. ];
  351. }
  352. catch {
  353. return;
  354. }
  355. }
  356. loadMorePreview() {
  357. this.nextTimeList = [
  358. ...this.nextTimeList,
  359. this.interval.next().toDate(),
  360. this.interval.next().toDate(),
  361. this.interval.next().toDate(),
  362. this.interval.next().toDate(),
  363. this.interval.next().toDate()
  364. ];
  365. this.cdr.markForCheck();
  366. }
  367. focusEffect(value) {
  368. this.focus = true;
  369. this.labelFocus = value;
  370. this.cdr.markForCheck();
  371. }
  372. blurEffect() {
  373. this.focus = false;
  374. this.labelFocus = null;
  375. this.cdr.markForCheck();
  376. }
  377. getValue(item) {
  378. this.validateForm.controls[item.label].patchValue(item.value);
  379. this.cdr.markForCheck();
  380. }
  381. checkValid = (control) => {
  382. if (control.value) {
  383. try {
  384. const cron = [];
  385. this.labels.forEach(label => {
  386. cron.push(control.value[label]);
  387. });
  388. parseExpression(cron.join(' '));
  389. }
  390. catch {
  391. return { error: true };
  392. }
  393. }
  394. return null;
  395. };
  396. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionComponent, deps: [{ token: i2.FormBuilder }, { token: i0.ChangeDetectorRef }, { token: i2$1.NzI18nService }], target: i0.ɵɵFactoryTarget.Component });
  397. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzCronExpressionComponent, isStandalone: true, selector: "nz-cron-expression", inputs: { nzSize: "nzSize", nzType: "nzType", nzCollapseDisable: ["nzCollapseDisable", "nzCollapseDisable", booleanAttribute], nzExtra: "nzExtra", nzSemantic: "nzSemantic", nzBorderless: ["nzBorderless", "nzBorderless", booleanAttribute], nzDisabled: ["nzDisabled", "nzDisabled", booleanAttribute] }, providers: [
  398. {
  399. provide: NG_ASYNC_VALIDATORS,
  400. useExisting: forwardRef(() => NzCronExpressionComponent),
  401. multi: true
  402. },
  403. {
  404. provide: NG_VALUE_ACCESSOR,
  405. useExisting: forwardRef(() => NzCronExpressionComponent),
  406. multi: true
  407. },
  408. NzDestroyService
  409. ], exportAs: ["nzCronExpression"], usesOnChanges: true, ngImport: i0, template: `
  410. <div class="ant-cron-expression">
  411. <div class="ant-cron-expression-content">
  412. <div
  413. class="ant-input ant-cron-expression-input-group"
  414. [class.ant-input-lg]="nzSize === 'large'"
  415. [class.ant-input-sm]="nzSize === 'small'"
  416. [class.ant-input-borderless]="nzBorderless"
  417. [class.ant-cron-expression-input-group-focus]="focus && !nzBorderless"
  418. [class.ant-input-status-error]="!validateForm.valid && !nzBorderless"
  419. [class.ant-cron-expression-input-group-error-focus]="!validateForm.valid && focus && !nzBorderless"
  420. [class.ant-input-disabled]="nzDisabled"
  421. >
  422. @for (label of labels; track label) {
  423. <nz-cron-expression-input
  424. [value]="this.validateForm.controls[label].value"
  425. [label]="label"
  426. [disabled]="nzDisabled"
  427. (focusEffect)="focusEffect($event)"
  428. (blurEffect)="blurEffect()"
  429. (getValue)="getValue($event)"
  430. />
  431. }
  432. </div>
  433. <div
  434. class="ant-cron-expression-label-group"
  435. [class.ant-input-lg]="nzSize === 'large'"
  436. [class.ant-cron-expression-label-group-default]="nzSize === 'default'"
  437. [class.ant-input-sm]="nzSize === 'small'"
  438. >
  439. @for (label of labels; track label) {
  440. <nz-cron-expression-label [type]="label" [labelFocus]="labelFocus" [locale]="locale" />
  441. }
  442. </div>
  443. @if (!nzCollapseDisable) {
  444. <nz-cron-expression-preview
  445. [TimeList]="nextTimeList"
  446. [visible]="validateForm.valid"
  447. [locale]="locale"
  448. [nzSemantic]="nzSemantic"
  449. (loadMorePreview)="loadMorePreview()"
  450. />
  451. }
  452. </div>
  453. @if (nzExtra) {
  454. <div class="ant-cron-expression-map">
  455. <ng-template [ngTemplateOutlet]="nzExtra" />
  456. </div>
  457. }
  458. </div>
  459. `, isInline: true, dependencies: [{ kind: "component", type: NzCronExpressionInputComponent, selector: "nz-cron-expression-input", inputs: ["value", "label", "disabled"], outputs: ["focusEffect", "blurEffect", "getValue"], exportAs: ["nzCronExpressionInput"] }, { kind: "component", type: NzCronExpressionLabelComponent, selector: "nz-cron-expression-label", inputs: ["type", "locale", "labelFocus"], exportAs: ["nzCronExpressionLabel"] }, { kind: "component", type: NzCronExpressionPreviewComponent, selector: "nz-cron-expression-preview", inputs: ["TimeList", "visible", "locale", "nzSemantic"], outputs: ["loadMorePreview"], exportAs: ["nzCronExpressionPreview"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  460. }
  461. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionComponent, decorators: [{
  462. type: Component,
  463. args: [{
  464. changeDetection: ChangeDetectionStrategy.OnPush,
  465. encapsulation: ViewEncapsulation.None,
  466. selector: 'nz-cron-expression',
  467. exportAs: 'nzCronExpression',
  468. template: `
  469. <div class="ant-cron-expression">
  470. <div class="ant-cron-expression-content">
  471. <div
  472. class="ant-input ant-cron-expression-input-group"
  473. [class.ant-input-lg]="nzSize === 'large'"
  474. [class.ant-input-sm]="nzSize === 'small'"
  475. [class.ant-input-borderless]="nzBorderless"
  476. [class.ant-cron-expression-input-group-focus]="focus && !nzBorderless"
  477. [class.ant-input-status-error]="!validateForm.valid && !nzBorderless"
  478. [class.ant-cron-expression-input-group-error-focus]="!validateForm.valid && focus && !nzBorderless"
  479. [class.ant-input-disabled]="nzDisabled"
  480. >
  481. @for (label of labels; track label) {
  482. <nz-cron-expression-input
  483. [value]="this.validateForm.controls[label].value"
  484. [label]="label"
  485. [disabled]="nzDisabled"
  486. (focusEffect)="focusEffect($event)"
  487. (blurEffect)="blurEffect()"
  488. (getValue)="getValue($event)"
  489. />
  490. }
  491. </div>
  492. <div
  493. class="ant-cron-expression-label-group"
  494. [class.ant-input-lg]="nzSize === 'large'"
  495. [class.ant-cron-expression-label-group-default]="nzSize === 'default'"
  496. [class.ant-input-sm]="nzSize === 'small'"
  497. >
  498. @for (label of labels; track label) {
  499. <nz-cron-expression-label [type]="label" [labelFocus]="labelFocus" [locale]="locale" />
  500. }
  501. </div>
  502. @if (!nzCollapseDisable) {
  503. <nz-cron-expression-preview
  504. [TimeList]="nextTimeList"
  505. [visible]="validateForm.valid"
  506. [locale]="locale"
  507. [nzSemantic]="nzSemantic"
  508. (loadMorePreview)="loadMorePreview()"
  509. />
  510. }
  511. </div>
  512. @if (nzExtra) {
  513. <div class="ant-cron-expression-map">
  514. <ng-template [ngTemplateOutlet]="nzExtra" />
  515. </div>
  516. }
  517. </div>
  518. `,
  519. providers: [
  520. {
  521. provide: NG_ASYNC_VALIDATORS,
  522. useExisting: forwardRef(() => NzCronExpressionComponent),
  523. multi: true
  524. },
  525. {
  526. provide: NG_VALUE_ACCESSOR,
  527. useExisting: forwardRef(() => NzCronExpressionComponent),
  528. multi: true
  529. },
  530. NzDestroyService
  531. ],
  532. imports: [
  533. NzCronExpressionInputComponent,
  534. NzCronExpressionLabelComponent,
  535. NzCronExpressionPreviewComponent,
  536. NgTemplateOutlet
  537. ]
  538. }]
  539. }], ctorParameters: () => [{ type: i2.FormBuilder }, { type: i0.ChangeDetectorRef }, { type: i2$1.NzI18nService }], propDecorators: { nzSize: [{
  540. type: Input
  541. }], nzType: [{
  542. type: Input
  543. }], nzCollapseDisable: [{
  544. type: Input,
  545. args: [{ transform: booleanAttribute }]
  546. }], nzExtra: [{
  547. type: Input
  548. }], nzSemantic: [{
  549. type: Input
  550. }], nzBorderless: [{
  551. type: Input,
  552. args: [{ transform: booleanAttribute }]
  553. }], nzDisabled: [{
  554. type: Input,
  555. args: [{ transform: booleanAttribute }]
  556. }] } });
  557. /**
  558. * Use of this source code is governed by an MIT-style license that can be
  559. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  560. */
  561. class NzCronExpressionModule {
  562. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  563. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionModule, imports: [NzCronExpressionComponent,
  564. NzCronExpressionLabelComponent,
  565. NzCronExpressionInputComponent,
  566. NzCronExpressionPreviewComponent], exports: [NzCronExpressionComponent] });
  567. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionModule, imports: [NzCronExpressionComponent,
  568. NzCronExpressionInputComponent,
  569. NzCronExpressionPreviewComponent] });
  570. }
  571. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCronExpressionModule, decorators: [{
  572. type: NgModule,
  573. args: [{
  574. imports: [
  575. NzCronExpressionComponent,
  576. NzCronExpressionLabelComponent,
  577. NzCronExpressionInputComponent,
  578. NzCronExpressionPreviewComponent
  579. ],
  580. exports: [NzCronExpressionComponent]
  581. }]
  582. }] });
  583. /**
  584. * Use of this source code is governed by an MIT-style license that can be
  585. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  586. */
  587. /**
  588. * Generated bundle index. Do not edit.
  589. */
  590. export { NzCronExpressionComponent, NzCronExpressionModule };
  591. //# sourceMappingURL=ng-zorro-antd-cron-expression.mjs.map