@mtna/web-form-angular 1.0.6-SNAPSHOT.3 → 1.0.6-SNAPSHOT.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.
@@ -3264,8 +3264,6 @@
3264
3264
  return coreTs.isType(something, 'className') && something.className === 'FormStep';
3265
3265
  }
3266
3266
 
3267
- var MTNA_WF_API_TOKEN = new i0.InjectionToken('mtnaWfApiConfig');
3268
-
3269
3267
  var CUSTOM_MAT_DATE_FORMAT = {
3270
3268
  parse: {
3271
3269
  dateInput: 'YYYY/MM/DD',
@@ -6020,20 +6018,24 @@
6020
6018
  }]
6021
6019
  }] });
6022
6020
 
6023
- var MtnaWfApiService = /** @class */ (function () {
6024
- function MtnaWfApiService(apiConfig, http) {
6025
- this.apiConfig = apiConfig;
6026
- this.http = http;
6027
- this.API_URL = "" + this.apiConfig.baseUrl;
6028
- this.FORM_URL = this.API_URL + "/form";
6029
- this.TEMPLATE_URL = this.API_URL + "/template";
6030
- this.NEW_TEMPLATE_URL = this.TEMPLATE_URL + "/new";
6031
- this.NEW_SECTION_URL = this.TEMPLATE_URL + "/section";
6032
- this.ITEMS_URL = this.TEMPLATE_URL + "/items";
6033
- this.ITEM_INSTANCE_URL = this.TEMPLATE_URL + "/item";
6034
- this.TEMPLATE_SAVE_URL = this.TEMPLATE_URL + "/save";
6035
- this.TEMPLATE_DELETE_URL = this.TEMPLATE_URL + "/delete";
6036
- this.ALL_TEMPLATES_URL = this.API_URL + "/templates";
6021
+ var MtnaWfApiService = /** @class */ (function (_super) {
6022
+ __extends(MtnaWfApiService, _super);
6023
+ function MtnaWfApiService(apiConfig, http, logger) {
6024
+ var _this = _super.call(this, apiConfig, http, logger) || this;
6025
+ _this.apiConfig = apiConfig;
6026
+ _this.http = http;
6027
+ _this.logger = logger;
6028
+ _this.API_URL = "" + _this.BASE_URL;
6029
+ _this.FORM_URL = _this.API_URL + "/form";
6030
+ _this.TEMPLATE_URL = _this.API_URL + "/template";
6031
+ _this.NEW_TEMPLATE_URL = _this.TEMPLATE_URL + "/new";
6032
+ _this.NEW_SECTION_URL = _this.TEMPLATE_URL + "/section";
6033
+ _this.ITEMS_URL = _this.TEMPLATE_URL + "/items";
6034
+ _this.ITEM_INSTANCE_URL = _this.TEMPLATE_URL + "/item";
6035
+ _this.TEMPLATE_SAVE_URL = _this.TEMPLATE_URL + "/save";
6036
+ _this.TEMPLATE_DELETE_URL = _this.TEMPLATE_URL + "/delete";
6037
+ _this.ALL_TEMPLATES_URL = _this.API_URL + "/templates";
6038
+ return _this;
6037
6039
  }
6038
6040
  /**
6039
6041
  * Download a web form
@@ -6048,8 +6050,8 @@
6048
6050
  * @param formInstanceId template ID of the mtna form
6049
6051
  * @param itemId repeatableTemplateId of the requesting RepeatableItem
6050
6052
  */
6051
- MtnaWfApiService.prototype.getRepeatableItem = function (formInstanceId, itemId) {
6052
- return this.http.get(this.FORM_URL + "/" + formInstanceId + "/new/item/" + itemId);
6053
+ MtnaWfApiService.prototype.getRepeatableItem = function (templateId, itemTemplateId) {
6054
+ return this.http.get(this.FORM_URL + "/" + templateId + "/item/" + itemTemplateId);
6053
6055
  };
6054
6056
  MtnaWfApiService.prototype.getNewTemplate = function () {
6055
6057
  return this.http.get(this.NEW_TEMPLATE_URL);
@@ -6079,8 +6081,8 @@
6079
6081
  return this.http.post(this.ITEM_INSTANCE_URL + "/convert", templateItem);
6080
6082
  };
6081
6083
  return MtnaWfApiService;
6082
- }());
6083
- MtnaWfApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaWfApiService, deps: [{ token: MTNA_WF_API_TOKEN }, { token: i1__namespace$3.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
6084
+ }(i1$2.BaseUrlService));
6085
+ MtnaWfApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaWfApiService, deps: [{ token: i1$2.MTNA_API_CONFIG }, { token: i1__namespace$3.HttpClient }, { token: i1__namespace$1.MtnaLogger }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
6084
6086
  MtnaWfApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaWfApiService, providedIn: 'root' });
6085
6087
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaWfApiService, decorators: [{
6086
6088
  type: i0.Injectable,
@@ -6088,8 +6090,8 @@
6088
6090
  }], ctorParameters: function () {
6089
6091
  return [{ type: undefined, decorators: [{
6090
6092
  type: i0.Inject,
6091
- args: [MTNA_WF_API_TOKEN]
6092
- }] }, { type: i1__namespace$3.HttpClient }];
6093
+ args: [i1$2.MTNA_API_CONFIG]
6094
+ }] }, { type: i1__namespace$3.HttpClient }, { type: i1__namespace$1.MtnaLogger }];
6093
6095
  } });
6094
6096
 
6095
6097
  /**
@@ -6376,7 +6378,7 @@
6376
6378
  }
6377
6379
  else {
6378
6380
  this.apiService
6379
- .getRepeatableItem(this._mtnaForm.instanceId, change.id)
6381
+ .getRepeatableItem(this._mtnaForm.templateId, change.templateId)
6380
6382
  .pipe(operators.take(1))
6381
6383
  .subscribe(function (newItem) {
6382
6384
  var newFormControl = _this.serializeMtnaFormItem(newItem);
@@ -6464,18 +6466,18 @@
6464
6466
  if (!!this.itemToggleQue && !!this.itemToggleQue.length) {
6465
6467
  // The form needs time to rerender, so we push this loop to the end of the stack
6466
6468
  setTimeout(function () {
6467
- var e_1, _b;
6469
+ var e_1, _c;
6468
6470
  if (_this.itemToggleQue) {
6469
6471
  try {
6470
- for (var _c = __values(_this.itemToggleQue), _d = _c.next(); !_d.done; _d = _c.next()) {
6471
- var change = _d.value;
6472
+ for (var _d = __values(_this.itemToggleQue), _e = _d.next(); !_e.done; _e = _d.next()) {
6473
+ var change = _e.value;
6472
6474
  _this.uiService.toggleFormItems(change.enabledItems, change.disabledItems, !!change.enable, change.enablerId, true);
6473
6475
  }
6474
6476
  }
6475
6477
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
6476
6478
  finally {
6477
6479
  try {
6478
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
6480
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
6479
6481
  }
6480
6482
  finally { if (e_1) throw e_1.error; }
6481
6483
  }
@@ -6633,15 +6635,16 @@
6633
6635
  * @param change The change that recently occurred in the mtnaForm
6634
6636
  */
6635
6637
  MtnaWfManagerService.prototype._modifyFormItemConditions = function (form, change) {
6636
- var e_2, _b;
6638
+ var e_2, _c;
6639
+ var _a, _b;
6637
6640
  var newForm = form;
6638
6641
  if (change.conditionChanges) {
6639
6642
  var formItems = {};
6640
6643
  var _loop_1 = function (cc) {
6641
- var e_3, _e;
6644
+ var e_3, _f;
6642
6645
  try {
6643
- for (var _f = (e_3 = void 0, __values(__spreadArray(__spreadArray([], __read(cc.enabledItems)), __read(cc.disabledItems)))), _g = _f.next(); !_g.done; _g = _f.next()) {
6644
- var toggledId = _g.value;
6646
+ for (var _g = (e_3 = void 0, __values(__spreadArray(__spreadArray([], __read(cc.enabledItems)), __read(cc.disabledItems)))), _h = _g.next(); !_h.done; _h = _g.next()) {
6647
+ var toggledId = _h.value;
6645
6648
  var formItem = formItems[toggledId];
6646
6649
  var formItemComponent = this_1.uiService.getItem(toggledId);
6647
6650
  if (!formItem && (formItemComponent === null || formItemComponent === void 0 ? void 0 : formItemComponent.item)) {
@@ -6652,7 +6655,8 @@
6652
6655
  var itemIds = change.actionType === 'ADD'
6653
6656
  ? __spreadArray(__spreadArray([], __read(itemConditionItemIds)), [cc.enablerId]) : itemConditionItemIds.filter(function (i) { return i !== cc.enablerId; });
6654
6657
  var newItem = Object.assign(Object.assign({}, formItem), { condition: Object.assign(Object.assign({}, formItem.condition), { itemIds: itemIds }) });
6655
- var newChange = new webFormTs.MtnaWfFormItemChange(newItem.instanceId, (formItemComponent === null || formItemComponent === void 0 ? void 0 : formItemComponent.parentIds) || [], 'REPLACE');
6658
+ var templateId = (_b = (_a = formItem) === null || _a === void 0 ? void 0 : _a.templateId) !== null && _b !== void 0 ? _b : newItem.instanceId;
6659
+ var newChange = new webFormTs.MtnaWfFormItemChange(newItem.instanceId, templateId, (formItemComponent === null || formItemComponent === void 0 ? void 0 : formItemComponent.parentIds) || [], 'REPLACE');
6656
6660
  newForm = this_1._modifyFormItem(newForm, newChange, newItem);
6657
6661
  formItems[toggledId] = newItem;
6658
6662
  }
@@ -6661,7 +6665,7 @@
6661
6665
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
6662
6666
  finally {
6663
6667
  try {
6664
- if (_g && !_g.done && (_e = _f.return)) _e.call(_f);
6668
+ if (_h && !_h.done && (_f = _g.return)) _f.call(_g);
6665
6669
  }
6666
6670
  finally { if (e_3) throw e_3.error; }
6667
6671
  }
@@ -6671,15 +6675,15 @@
6671
6675
  };
6672
6676
  var this_1 = this;
6673
6677
  try {
6674
- for (var _c = __values(change.conditionChanges), _d = _c.next(); !_d.done; _d = _c.next()) {
6675
- var cc = _d.value;
6678
+ for (var _d = __values(change.conditionChanges), _e = _d.next(); !_e.done; _e = _d.next()) {
6679
+ var cc = _e.value;
6676
6680
  _loop_1(cc);
6677
6681
  }
6678
6682
  }
6679
6683
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
6680
6684
  finally {
6681
6685
  try {
6682
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
6686
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
6683
6687
  }
6684
6688
  finally { if (e_2) throw e_2.error; }
6685
6689
  }
@@ -6692,7 +6696,7 @@
6692
6696
  * @param idMap map of the item's internal instanceIds
6693
6697
  */
6694
6698
  MtnaWfManagerService.prototype._buildInternalIdsMap = function (item, idMap) {
6695
- var e_4, _b;
6699
+ var e_4, _c;
6696
6700
  idMap[item.instanceId] = true;
6697
6701
  if (coreTs.isType(item, 'items')) {
6698
6702
  var items = item.items;
@@ -6705,7 +6709,7 @@
6705
6709
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
6706
6710
  finally {
6707
6711
  try {
6708
- if (items_1_1 && !items_1_1.done && (_b = items_1.return)) _b.call(items_1);
6712
+ if (items_1_1 && !items_1_1.done && (_c = items_1.return)) _c.call(items_1);
6709
6713
  }
6710
6714
  finally { if (e_4) throw e_4.error; }
6711
6715
  }
@@ -6727,7 +6731,7 @@
6727
6731
  * @param action Whether the item was added or removed
6728
6732
  */
6729
6733
  MtnaWfManagerService.prototype._buildConditionChangeArray = function (item, changes, internalIdMap, action) {
6730
- var e_5, _b, e_6, _c;
6734
+ var e_5, _c, e_6, _d;
6731
6735
  if (webFormTs.isOptionItemImpl(item)) {
6732
6736
  var enable = !!action && action === 'ADD' ? item.option.selected || item.value === item.option.option.id : false;
6733
6737
  this._pushConditionToArray(item.instanceId, item.option.enabledItems, item.option.disabledItems, changes, internalIdMap, enable);
@@ -6740,15 +6744,15 @@
6740
6744
  };
6741
6745
  var this_2 = this;
6742
6746
  try {
6743
- for (var _d = __values(item.options), _e = _d.next(); !_e.done; _e = _d.next()) {
6744
- var option = _e.value;
6747
+ for (var _e = __values(item.options), _f = _e.next(); !_f.done; _f = _e.next()) {
6748
+ var option = _f.value;
6745
6749
  _loop_2(option);
6746
6750
  }
6747
6751
  }
6748
6752
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
6749
6753
  finally {
6750
6754
  try {
6751
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
6755
+ if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
6752
6756
  }
6753
6757
  finally { if (e_5) throw e_5.error; }
6754
6758
  }
@@ -6765,7 +6769,7 @@
6765
6769
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
6766
6770
  finally {
6767
6771
  try {
6768
- if (items_2_1 && !items_2_1.done && (_c = items_2.return)) _c.call(items_2);
6772
+ if (items_2_1 && !items_2_1.done && (_d = items_2.return)) _d.call(items_2);
6769
6773
  }
6770
6774
  finally { if (e_6) throw e_6.error; }
6771
6775
  }
@@ -6823,7 +6827,7 @@
6823
6827
  * Revalidate form controls that previously had errors or have new errors now.
6824
6828
  */
6825
6829
  MtnaWfManagerService.prototype._updateServerSideErrors = function () {
6826
- var e_7, _b, e_8, _c;
6830
+ var e_7, _c, e_8, _d;
6827
6831
  var _a;
6828
6832
  // Keep track of IDs for each control that needs to be revalidated
6829
6833
  var controlIdsToRevalidate = new Set();
@@ -6839,8 +6843,8 @@
6839
6843
  this._formItemValidationResults = {};
6840
6844
  if ((_a = this._mtnaForm) === null || _a === void 0 ? void 0 : _a.validationResult) {
6841
6845
  try {
6842
- for (var _d = __values(this._mtnaForm.validationResult.formItemValidationResults), _e = _d.next(); !_e.done; _e = _d.next()) {
6843
- var result = _e.value;
6846
+ for (var _e = __values(this._mtnaForm.validationResult.formItemValidationResults), _f = _e.next(); !_f.done; _f = _e.next()) {
6847
+ var result = _f.value;
6844
6848
  if (result.validationStatus === 'ERRORS') {
6845
6849
  // Store errors so that the validationResultValidator can validate each control
6846
6850
  this._formItemValidationResults[result.id] = result;
@@ -6852,7 +6856,7 @@
6852
6856
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
6853
6857
  finally {
6854
6858
  try {
6855
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
6859
+ if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
6856
6860
  }
6857
6861
  finally { if (e_7) throw e_7.error; }
6858
6862
  }
@@ -6872,7 +6876,7 @@
6872
6876
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
6873
6877
  finally {
6874
6878
  try {
6875
- if (controlIdsToRevalidate_1_1 && !controlIdsToRevalidate_1_1.done && (_c = controlIdsToRevalidate_1.return)) _c.call(controlIdsToRevalidate_1);
6879
+ if (controlIdsToRevalidate_1_1 && !controlIdsToRevalidate_1_1.done && (_d = controlIdsToRevalidate_1.return)) _d.call(controlIdsToRevalidate_1);
6876
6880
  }
6877
6881
  finally { if (e_8) throw e_8.error; }
6878
6882
  }
@@ -6912,11 +6916,15 @@
6912
6916
  type: i0.Injectable
6913
6917
  }] });
6914
6918
 
6915
- var MtnaTemplateTransformationService = /** @class */ (function () {
6916
- function MtnaTemplateTransformationService(apiConfig, http) {
6917
- this.apiConfig = apiConfig;
6918
- this.http = http;
6919
- this.API_URL = this.apiConfig.baseUrl + "/api";
6919
+ var MtnaTemplateTransformationService = /** @class */ (function (_super) {
6920
+ __extends(MtnaTemplateTransformationService, _super);
6921
+ function MtnaTemplateTransformationService(apiConfig, http, logger) {
6922
+ var _this = _super.call(this, apiConfig, http, logger) || this;
6923
+ _this.apiConfig = apiConfig;
6924
+ _this.http = http;
6925
+ _this.logger = logger;
6926
+ _this.API_URL = "" + _this.BASE_URL;
6927
+ return _this;
6920
6928
  }
6921
6929
  MtnaTemplateTransformationService.prototype.convertTemplateToForm = function (request) {
6922
6930
  // return this.http.post<Form>(`${this.API_URL}/template/convert`, request);
@@ -6924,8 +6932,8 @@
6924
6932
  return rxjs.of(undefined);
6925
6933
  };
6926
6934
  return MtnaTemplateTransformationService;
6927
- }());
6928
- MtnaTemplateTransformationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaTemplateTransformationService, deps: [{ token: MTNA_WF_API_TOKEN }, { token: i1__namespace$3.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
6935
+ }(i1$2.BaseUrlService));
6936
+ MtnaTemplateTransformationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaTemplateTransformationService, deps: [{ token: i1$2.MTNA_API_CONFIG }, { token: i1__namespace$3.HttpClient }, { token: i1__namespace$1.MtnaLogger }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
6929
6937
  MtnaTemplateTransformationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaTemplateTransformationService, providedIn: 'root' });
6930
6938
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MtnaTemplateTransformationService, decorators: [{
6931
6939
  type: i0.Injectable,
@@ -6933,8 +6941,8 @@
6933
6941
  }], ctorParameters: function () {
6934
6942
  return [{ type: undefined, decorators: [{
6935
6943
  type: i0.Inject,
6936
- args: [MTNA_WF_API_TOKEN]
6937
- }] }, { type: i1__namespace$3.HttpClient }];
6944
+ args: [i1$2.MTNA_API_CONFIG]
6945
+ }] }, { type: i1__namespace$3.HttpClient }, { type: i1__namespace$1.MtnaLogger }];
6938
6946
  } });
6939
6947
 
6940
6948
  var _BaseFormComponent = i1$2.mixinDestroyNotifier(/** @class */ (function () {
@@ -8791,11 +8799,11 @@
8791
8799
  return _this;
8792
8800
  }
8793
8801
  MtnaWfRepeatableItemContainerComponent.prototype.addItem = function () {
8794
- this.manager.changeMtnaFormItem(new webFormTs.MtnaWfFormItemChange(this.item.repeatableTemplateId, this.parentIds, 'ADD'));
8802
+ this.manager.changeMtnaFormItem(new webFormTs.MtnaWfFormItemChange(this.item.repeatableTemplateId, this.item.repeatableTemplateId, this.parentIds, 'ADD'));
8795
8803
  };
8796
8804
  MtnaWfRepeatableItemContainerComponent.prototype.removeItem = function (item) {
8797
8805
  var conditionChanges = this.manager.generateConditionChangeArray(item, 'REMOVE');
8798
- this.manager.changeMtnaFormItem(new webFormTs.MtnaWfFormItemChange(item.instanceId, this.parentIds, 'REMOVE', conditionChanges));
8806
+ this.manager.changeMtnaFormItem(new webFormTs.MtnaWfFormItemChange(item.instanceId, item.templateId, this.parentIds, 'REMOVE', conditionChanges));
8799
8807
  };
8800
8808
  return MtnaWfRepeatableItemContainerComponent;
8801
8809
  }(MtnaWfBaseParentValueItem));
@@ -12489,7 +12497,6 @@
12489
12497
  exports.I18nTextResponseItemTemplateMapper = I18nTextResponseItemTemplateMapper;
12490
12498
  exports.ISO_8601_DATE_DISPLAY_VALUE = ISO_8601_DATE_DISPLAY_VALUE;
12491
12499
  exports.LONG_DATE_DISPLAY_VALUE = LONG_DATE_DISPLAY_VALUE;
12492
- exports.MTNA_WF_API_TOKEN = MTNA_WF_API_TOKEN;
12493
12500
  exports.MTNA_WF_DEFAULT_YEAR_RANGE = MTNA_WF_DEFAULT_YEAR_RANGE;
12494
12501
  exports.MTNA_WF_EXPAND_COLLAPSE = MTNA_WF_EXPAND_COLLAPSE;
12495
12502
  exports.MTNA_WF_FORM_ITEM_VALIDATION_RESULT_ERROR_NAME = MTNA_WF_FORM_ITEM_VALIDATION_RESULT_ERROR_NAME;