cat-qw-lib 0.25.1 → 0.25.3

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.
@@ -414,6 +414,7 @@ var BaseStore_1;
414
414
  let BaseStore = class BaseStore extends EntityStore {
415
415
  static { BaseStore_1 = this; }
416
416
  static storeName = 'base';
417
+ missingFields = [];
417
418
  recordChange$;
418
419
  onDocumentAccept$;
419
420
  onDailogClose$;
@@ -541,13 +542,17 @@ class BaseControlComponent {
541
542
  textArea;
542
543
  static allAttributes = [];
543
544
  query;
545
+ destroy$ = new Subject();
544
546
  ngOnInit() {
545
547
  this.addToAttributeList();
546
- this.baseQuery.getIsFormSubmitted().subscribe((res) => {
548
+ this.baseQuery.getIsFormSubmitted()
549
+ .pipe(takeUntil(this.destroy$))
550
+ .subscribe((res) => {
547
551
  if (res) {
548
552
  [this.textboxField, this.dropdown, this.textArea]
549
553
  .filter(control => control && control.control)
550
554
  .forEach(control => control.control.markAsTouched());
555
+ this.baseStore.setIsFormSubmitted(false);
551
556
  }
552
557
  });
553
558
  }
@@ -583,6 +588,10 @@ class BaseControlComponent {
583
588
  getValue() {
584
589
  return this.record[this.attributeModel.name];
585
590
  }
591
+ ngOnDestroy() {
592
+ this.destroy$.next();
593
+ this.destroy$.complete();
594
+ }
586
595
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseControlComponent, deps: [{ token: BaseStore }, { token: BaseQuery }], target: i0.ɵɵFactoryTarget.Component });
587
596
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.4", type: BaseControlComponent, isStandalone: true, selector: "app-base-control", inputs: { store: "store", record: "record", attributeModel: "attributeModel", error: "error" }, outputs: { onInput: "onInput", onEnterKeydown: "onEnterKeydown", onBtnClick: "onBtnClick" }, providers: [BaseStore], viewQueries: [{ propertyName: "textboxField", first: true, predicate: ["textboxField"], descendants: true }, { propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true }, { propertyName: "textArea", first: true, predicate: ["textArea"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<p>base-control works!</p>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
588
597
  }
@@ -1140,21 +1149,26 @@ class BaseFormComponent {
1140
1149
  const validateRecords = this.validatorService
1141
1150
  ? this.validatorService.handleValidateRecords(this.record)
1142
1151
  : true;
1152
+ debugger;
1153
+ console.log(this.baseStore?.missingFields);
1154
+ if (this.baseStore)
1155
+ this.baseStore.missingFields = [];
1143
1156
  if (this.baseQuery) {
1144
1157
  this.baseQuery.getAttributeModelList().subscribe((attributeModels) => {
1145
- let missingFields = [];
1146
1158
  attributeModels.forEach(attr => {
1147
1159
  if (attr.isRequired) {
1148
1160
  const value = this.record[attr.name];
1149
1161
  if (value === undefined || value === null || (typeof value === SHARED.STRING && value.trim() === SHARED.EMPTY)) {
1150
- missingFields.push(attr.displayText || attr.name);
1162
+ if (this.baseStore)
1163
+ this.baseStore.missingFields.push(attr.displayText || attr.name);
1151
1164
  }
1152
1165
  }
1153
1166
  });
1154
- if (missingFields.length > 0) {
1167
+ console.log(this.baseStore?.missingFields);
1168
+ if (this.baseStore && this.baseStore.missingFields.length > 0) {
1155
1169
  if (this.baseStore)
1156
1170
  this.baseStore.setIsFormSubmitted(new Date());
1157
- console.error(ERROR.MISSING_REQUIRED_FIELD, missingFields);
1171
+ console.error(ERROR.MISSING_REQUIRED_FIELD, this.baseStore.missingFields);
1158
1172
  }
1159
1173
  else {
1160
1174
  if (!this.currentState?.isApiValidated) {
@@ -1197,6 +1211,8 @@ class BaseFormComponent {
1197
1211
  });
1198
1212
  }
1199
1213
  handleCancel() {
1214
+ if (this.baseStore)
1215
+ this.baseStore.missingFields = [];
1200
1216
  this.onCancel.emit();
1201
1217
  }
1202
1218
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseFormComponent, deps: [{ token: BaseService }, { token: ValidatorService }, { token: i3$4.Router }, { token: i3$4.ActivatedRoute }, { token: BaseStore }, { token: BaseQuery }], target: i0.ɵɵFactoryTarget.Component });
@@ -2187,7 +2203,7 @@ class WidgetItemModel extends BaseModel {
2187
2203
  name;
2188
2204
  dictionaryItemID;
2189
2205
  dictionaryID;
2190
- isMain;
2206
+ isMain = true;
2191
2207
  isEditable;
2192
2208
  linkedWidgetID;
2193
2209
  isActive = true;
@@ -2240,6 +2256,7 @@ class WidgetAdminFormComponent extends BaseFormComponent {
2240
2256
  this.baseStore = baseStore;
2241
2257
  this.baseQuery = baseQuery;
2242
2258
  this.record = new WidgetModel();
2259
+ this.record.isActive = true;
2243
2260
  this.widgetItem = new WidgetItemModel();
2244
2261
  }
2245
2262
  ngOnInit() {
@@ -2453,7 +2470,7 @@ class QueueAdminFormComponent extends BaseFormComponent {
2453
2470
  rules: [],
2454
2471
  };
2455
2472
  ngOnInit() {
2456
- this.init();
2473
+ this.service.initList();
2457
2474
  const id = this.activatedRoute
2458
2475
  ? this.activatedRoute.snapshot.params[SHARED.ID]
2459
2476
  : "";