kwikid-forms 0.2.2 → 0.2.5

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.
@@ -2067,6 +2067,13 @@
2067
2067
  kwikidToolkit.logMethod
2068
2068
  ], Converter.prototype, "convertFormConfig", null);
2069
2069
 
2070
+ var EFormsListStatus;
2071
+ (function (EFormsListStatus) {
2072
+ EFormsListStatus["COMPLETED"] = "completed";
2073
+ EFormsListStatus["EDITABLE"] = "editable";
2074
+ EFormsListStatus["LOCKED"] = "locked";
2075
+ })(EFormsListStatus || (EFormsListStatus = {}));
2076
+
2070
2077
  var EActionKey;
2071
2078
  (function (EActionKey) {
2072
2079
  EActionKey["SET_VALUE"] = "SET_VALUE";
@@ -3489,9 +3496,16 @@
3489
3496
  return item.key;
3490
3497
  };
3491
3498
  KwikIDFormViewComponent.prototype.handleOnClickViewForms = function (e) {
3492
- this.onClickViewForms.emit({
3493
- clicked: true
3494
- });
3499
+ if (this.formConfig.status === EFormsListStatus.COMPLETED) {
3500
+ this.onClickViewForms.emit({
3501
+ clicked: true
3502
+ });
3503
+ }
3504
+ else if (window.confirm("Your data will be lost if you leave this page! Continue?")) {
3505
+ this.onClickViewForms.emit({
3506
+ clicked: true
3507
+ });
3508
+ }
3495
3509
  };
3496
3510
  KwikIDFormViewComponent.prototype.handleOnClickSaveForm = function (e) {
3497
3511
  return __awaiter(this, void 0, void 0, function () {
@@ -4166,7 +4180,12 @@
4166
4180
  this.formsListLength = 0;
4167
4181
  this.isAllFormsCompleted = true;
4168
4182
  }
4183
+ KwikIDFormsListComponent.prototype.setSelectedForm = function (selected_form) {
4184
+ this.selectedForm = selected_form;
4185
+ };
4169
4186
  KwikIDFormsListComponent.prototype.ngOnInit = function () {
4187
+ var _a, _b;
4188
+ this.setSelectedForm((_b = (_a = this.activeFormConfig) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : "");
4170
4189
  this.formsList = this.filterHiddenForms(this.formsList);
4171
4190
  this.formsListLength = this.findFormsListLength(this.formsList);
4172
4191
  this.isAllFormsCompleted = this.checkIsAllFormsCompleted(this.formsList);
@@ -4185,6 +4204,13 @@
4185
4204
  }
4186
4205
  if (verifyChange("isMobileView")) {
4187
4206
  this.isMobileView = changes.isMobileView.currentValue;
4207
+ if (!this.isMobileView) {
4208
+ this.setSelectedForm("");
4209
+ }
4210
+ }
4211
+ if (verifyChange("activeFormConfig")) {
4212
+ this.activeFormConfig = changes.activeFormConfig.currentValue;
4213
+ this.setSelectedForm(this.activeFormConfig.key);
4188
4214
  }
4189
4215
  };
4190
4216
  KwikIDFormsListComponent.prototype.filterHiddenForms = function (formsList) {
@@ -4216,7 +4242,7 @@
4216
4242
  return _formsList.length;
4217
4243
  };
4218
4244
  KwikIDFormsListComponent.prototype.checkIsAllFormsCompleted = function (formsList) {
4219
- var e_1, _a;
4245
+ var e_1, _c;
4220
4246
  var isAllFormsCompleted = true;
4221
4247
  try {
4222
4248
  for (var formsList_1 = __values(formsList), formsList_1_1 = formsList_1.next(); !formsList_1_1.done; formsList_1_1 = formsList_1.next()) {
@@ -4234,14 +4260,16 @@
4234
4260
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
4235
4261
  finally {
4236
4262
  try {
4237
- if (formsList_1_1 && !formsList_1_1.done && (_a = formsList_1.return)) _a.call(formsList_1);
4263
+ if (formsList_1_1 && !formsList_1_1.done && (_c = formsList_1.return)) _c.call(formsList_1);
4238
4264
  }
4239
4265
  finally { if (e_1) throw e_1.error; }
4240
4266
  }
4241
4267
  return isAllFormsCompleted;
4242
4268
  };
4243
4269
  KwikIDFormsListComponent.prototype.handleOnClickSetActiveForm = function (selectedForm) {
4244
- if (this.selectedForm !== selectedForm ||
4270
+ console.log(this.isMobileView, this.selectedForm);
4271
+ if (this.isMobileView ||
4272
+ (!this.isMobileView && this.selectedForm !== selectedForm) ||
4245
4273
  (this.isAllFormsCompleted && !this.showFormFields)) {
4246
4274
  this.selectedForm = selectedForm;
4247
4275
  this.onClickSetActiveForm.emit(selectedForm);
@@ -4299,13 +4327,6 @@
4299
4327
  type: i0.Output
4300
4328
  }], ngOnChanges: [], filterHiddenForms: [], findFormsListLength: [], checkIsAllFormsCompleted: [], handleOnClickSetActiveForm: [], handleOnSubmitForms: [] } });
4301
4329
 
4302
- var EFormsListStatus;
4303
- (function (EFormsListStatus) {
4304
- EFormsListStatus["COMPLETED"] = "completed";
4305
- EFormsListStatus["EDITABLE"] = "editable";
4306
- EFormsListStatus["LOCKED"] = "locked";
4307
- })(EFormsListStatus || (EFormsListStatus = {}));
4308
-
4309
4330
  var ERendererActionKey;
4310
4331
  (function (ERendererActionKey) {
4311
4332
  ERendererActionKey["SET_VALUE"] = "SET_VALUE";