tg-controls_cli 0.0.54 → 0.0.55

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.
@@ -34661,7 +34661,7 @@ if (typeof window !== 'undefined') {
34661
34661
  // Indicate to webpack that this file can be concatenated
34662
34662
  /* harmony default export */ var setPublicPath = (null);
34663
34663
 
34664
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e56dfd6a-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/DynamicForm.vue?vue&type=template&id=52479728&
34664
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e56dfd6a-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/DynamicForm.vue?vue&type=template&id=c56e874e&
34665
34665
  var render = function render() {
34666
34666
  var _vm = this,
34667
34667
  _c = _vm._self._c;
@@ -34680,7 +34680,7 @@ var render = function render() {
34680
34680
  }
34681
34681
  }
34682
34682
  }, [_vm._l(_vm.schema, function (group, parentIndex) {
34683
- return _c('div', {
34683
+ return _vm.CheckIfAnyFieldVisibleInGroup(group.Data) ? _c('div', {
34684
34684
  key: parentIndex,
34685
34685
  staticClass: "row"
34686
34686
  }, [_c('div', {
@@ -34757,7 +34757,7 @@ var render = function render() {
34757
34757
  }
34758
34758
  }], null, true)
34759
34759
  })], 1)])])]) : _vm._e()]);
34760
- })], 2);
34760
+ })], 2) : _vm._e();
34761
34761
  }), _vm.buttons != false ? _c('div', {
34762
34762
  staticClass: "row"
34763
34763
  }, [_vm.mandatorytext != false ? _c('div', {
@@ -34820,7 +34820,7 @@ var render = function render() {
34820
34820
  };
34821
34821
  var staticRenderFns = [];
34822
34822
 
34823
- // CONCATENATED MODULE: ./src/components/DynamicForm.vue?vue&type=template&id=52479728&
34823
+ // CONCATENATED MODULE: ./src/components/DynamicForm.vue?vue&type=template&id=c56e874e&
34824
34824
 
34825
34825
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
34826
34826
  var es_array_push = __webpack_require__("14d9");
@@ -40766,6 +40766,79 @@ var SlotField_component = normalizeComponent(
40766
40766
  UpdateKeyValue: function (val) {
40767
40767
  this.keyForComponentUpdate++;
40768
40768
  },
40769
+ updateProperty: function (fieldName, property, value) {
40770
+ var valueToUpdate = null;
40771
+ var props = [];
40772
+ if (property.includes(".")) {
40773
+ props = property.split(".");
40774
+ } else {
40775
+ props.push(property);
40776
+ }
40777
+ this.schema.forEach(function (g, gi) {
40778
+ g.Data.forEach(function (f, fi) {
40779
+ if (f.name == fieldName) {
40780
+ var schema = f; // a moving reference to internal objects within obj
40781
+ var pList = props;
40782
+ var len = pList.length;
40783
+ for (var i = 0; i < len - 1; i++) {
40784
+ var elem = pList[i];
40785
+ if (!schema[elem]) schema[elem] = {};
40786
+ schema = schema[elem];
40787
+ }
40788
+ f[pList[len - 1]] = value;
40789
+ // valueToUpdate = f;
40790
+ // for(var i = 0; i < props.length; i++){
40791
+ // valueToUpdate = valueToUpdate[props[i]];
40792
+ // if(f.hasOwnProperty(props[i]) && i == (props.length - 1)){
40793
+ // valueToUpdate = value;
40794
+ // }
40795
+ // }
40796
+ }
40797
+ });
40798
+ });
40799
+ },
40800
+
40801
+ getPropertyValue: function (fieldName, property) {
40802
+ var props = [];
40803
+ if (property.includes(".")) {
40804
+ props = property.split(".");
40805
+ } else {
40806
+ props.push(property);
40807
+ }
40808
+ var returnValue = null;
40809
+ this.schema.forEach(function (g, gi) {
40810
+ g.Data.forEach(function (f, fi) {
40811
+ if (f.name == fieldName) {
40812
+ returnValue = f;
40813
+ for (var i = 0; i < props.length; i++) {
40814
+ returnValue = returnValue[props[i]];
40815
+ if (returnValue && i == props.length - 1) {
40816
+ returnValue = returnValue;
40817
+ break;
40818
+ }
40819
+ }
40820
+ }
40821
+ });
40822
+ });
40823
+ return returnValue;
40824
+ },
40825
+ CheckIfAnyFieldVisibleInGroup: function (groupFields) {
40826
+ let returnValue = true;
40827
+ if (groupFields.length > 0) {
40828
+ let Arr = groupFields.filter(x => {
40829
+ var _x$visibility;
40830
+ return ((_x$visibility = x.visibility) !== null && _x$visibility !== void 0 ? _x$visibility : true) == true;
40831
+ });
40832
+ if (Arr.length > 0) {
40833
+ returnValue = true;
40834
+ } else {
40835
+ returnValue = false;
40836
+ }
40837
+ } else {
40838
+ returnValue = false;
40839
+ }
40840
+ return returnValue;
40841
+ },
40769
40842
  isShowBasedOnDependentField: function (field) {
40770
40843
  let ths = this;
40771
40844
  if (field && field.config && field.config.options) {
@@ -40778,79 +40851,122 @@ var SlotField_component = normalizeComponent(
40778
40851
  if (depedentField.value && depedentField.value != null && depedentField.value != "") {
40779
40852
  let showJson = JSON.parse(showWhen);
40780
40853
  let selectedValues = [];
40781
- if (showJson.value) {
40782
- if (!isNaN(depedentField.value)) {
40783
- selectedValues.push(depedentField.value);
40784
- if (showJson.value.includes(depedentField.value)) {
40785
- ths.updateFieldInfoOptions(valueMapping, selectedValues, field);
40854
+ let jsonValue = showJson.value;
40855
+ let depedentFieldValue = depedentField.value;
40856
+ if (showJson.first_value) {
40857
+ jsonValue = showJson.first_value;
40858
+ let getSelectedValue = depedentField.config.options.filter(x => {
40859
+ return x.value == depedentField.value;
40860
+ });
40861
+ depedentFieldValue = getSelectedValue[0].first_value;
40862
+ //depedentFieldValue = (showJson.first_value)?depedentField.first_value:depedentField.value;
40863
+ }
40864
+
40865
+ if (jsonValue) {
40866
+ if (typeof depedentFieldValue == "number" || typeof depedentFieldValue == "string") {
40867
+ selectedValues.push(depedentFieldValue);
40868
+ if (jsonValue.length > 0) {
40869
+ if (jsonValue.includes(depedentFieldValue)) {
40870
+ ths.updateFieldInfoOptions(valueMapping, selectedValues, field);
40871
+ field.visibility = true;
40872
+ } else {
40873
+ field.visibility = false;
40874
+ field.value = "";
40875
+ }
40876
+ } else {
40786
40877
  field.visibility = true;
40878
+ if (typeof field.DependentFieldValue == 'undefined' || field.DependentFieldValue[0] != selectedValues[0]) {
40879
+ field.DependentFieldValue = selectedValues;
40880
+ if (field && field.config && field.config.onChange) {
40881
+ field.config.onChange("FILL_DEPENDENT", field, selectedValues);
40882
+ }
40883
+ }
40787
40884
  }
40788
40885
  } else {
40789
40886
  var checkIfExists = [];
40790
40887
  try {
40791
- if (depedentField.value.length && depedentField.value.length > 0) {
40792
- depedentField.value.forEach(function (g, gi) {
40888
+ if (depedentFieldValue.length && depedentFieldValue.length > 0) {
40889
+ depedentFieldValue.forEach(function (g, gi) {
40793
40890
  selectedValues.push(g.value);
40794
40891
  if (checkIfExists.length == 0) {
40795
- checkIfExists = showJson.value.filter(x => {
40892
+ checkIfExists = jsonValue.filter(x => {
40796
40893
  return x == g.value;
40797
40894
  });
40798
40895
  }
40799
40896
  });
40800
40897
  } else {
40801
40898
  selectedValues.push(depedentField.value.value);
40802
- checkIfExists = showJson.value.filter(x => {
40803
- return x == depedentField.value.value;
40899
+ checkIfExists = jsonValue.filter(x => {
40900
+ return x == depedentFieldValue.value;
40804
40901
  });
40805
40902
  }
40806
40903
  ths.updateFieldInfoOptions(valueMapping, selectedValues, field);
40807
40904
  } catch (e) {
40808
40905
  selectedValues.push(depedentField.value.value);
40809
40906
  ths.updateFieldInfoOptions(valueMapping, selectedValues, field);
40810
- checkIfExists = showJson.value.filter(x => {
40811
- return x == depedentField.value.value;
40907
+ checkIfExists = jsonValue.filter(x => {
40908
+ return x == depedentFieldValue.value;
40812
40909
  });
40813
40910
  }
40814
- if (checkIfExists.length > 0) {
40815
- field.visibility = true;
40816
- } else {
40817
- field.config.OptionsForBind = [];
40818
- field.visibility = false;
40911
+ if (valueMapping.length > 0) {
40912
+ if (checkIfExists.length > 0) {
40913
+ field.visibility = true;
40914
+ } else {
40915
+ field.config.OptionsForBind = [];
40916
+ field.visibility = false;
40917
+ field.value = "";
40918
+ }
40819
40919
  }
40820
40920
  }
40821
40921
  } else {
40822
40922
  field.visibility = true;
40823
40923
  }
40824
40924
  } else {
40825
- field.config.OptionsForBind = [];
40826
- field.visibility = false;
40925
+ let showJson = JSON.parse(showWhen);
40926
+ //if(showJson.value.length > 0 || (valueMapping.length == 0 && field.astype != "SelectField" && field.astype != "RadioField" && field.astype != "CheckBoxField" && field.astype != "MultiSelectField")) {
40927
+ if (showJson.isFillOnly != true) {
40928
+ field.config.OptionsForBind = [];
40929
+ field.visibility = false;
40930
+ field.value = "";
40931
+ }
40932
+ //}
40827
40933
  }
40828
40934
  }
40829
40935
  },
40936
+
40830
40937
  updateFieldInfoOptions: function (valueMapping, selectedValues, field) {
40831
- let getSelectedMapping = [];
40832
- selectedValues.forEach(function (g, i) {
40833
- valueMapping.forEach(function (x) {
40834
- if (x.value == g) {
40835
- getSelectedMapping.push(x);
40836
- }
40837
- });
40838
- });
40839
- if (getSelectedMapping.length > 0) {
40840
- let values = [];
40841
- this.$set(field.config, 'OptionsForBind', []);
40842
- getSelectedMapping.forEach(function (y) {
40843
- let dependentValues = y.dependent;
40844
- field.config.options.forEach((x, i) => {
40845
- let checkIfExists = values.filter(q => {
40846
- return q.value == x.value;
40847
- });
40848
- if (dependentValues.includes(x.value) && checkIfExists.length == 0) {
40849
- values.push(x);
40938
+ if (valueMapping.length > 0) {
40939
+ let getSelectedMapping = [];
40940
+ selectedValues.forEach(function (g, i) {
40941
+ valueMapping.forEach(function (x) {
40942
+ if (x.value == g) {
40943
+ getSelectedMapping.push(x);
40850
40944
  }
40851
40945
  });
40852
40946
  });
40853
- this.$set(field.config, 'OptionsForBind', values);
40947
+ if (getSelectedMapping.length > 0) {
40948
+ let values = [];
40949
+ this.$set(field.config, 'OptionsForBind', []);
40950
+ getSelectedMapping.forEach(function (y) {
40951
+ let dependentValues = y.dependent;
40952
+ field.config.options.forEach((x, i) => {
40953
+ let checkIfExists = values.filter(q => {
40954
+ return q.value == x.value;
40955
+ });
40956
+ if ((dependentValues.includes(x.value) || dependentValues.length == 0) && checkIfExists.length == 0) {
40957
+ values.push(x);
40958
+ }
40959
+ });
40960
+ });
40961
+ this.$set(field.config, 'OptionsForBind', values);
40962
+ }
40963
+ } else {
40964
+ if (typeof field.DependentFieldValue == 'undefined' || field.DependentFieldValue[0] != selectedValues[0]) {
40965
+ field.DependentFieldValue = selectedValues;
40966
+ if (field && field.config && field.config.onChange) {
40967
+ field.config.onChange("FILL_DEPENDENT", field, selectedValues);
40968
+ }
40969
+ }
40854
40970
  }
40855
40971
  },
40856
40972
  ConvertDynamicFormObjToCustomFieldObj: function (formSchema) {
@@ -40869,6 +40985,51 @@ var SlotField_component = normalizeComponent(
40869
40985
  });
40870
40986
  return returnObj;
40871
40987
  },
40988
+ MakeArray: function (value, type) {
40989
+ var array = [];
40990
+ var arr = String(value).split(',');
40991
+ if (type == "radio" || type == "checkbox") {
40992
+ if (arr.length > 0) {
40993
+ for (let item of arr) {
40994
+ if (item.split("|").length > 1) {
40995
+ var person = {
40996
+ name: item.split("|")[0].trim(),
40997
+ value: item.split("|")[1].trim()
40998
+ };
40999
+ array.push(person);
41000
+ } else {
41001
+ var person = {
41002
+ name: item.trim(),
41003
+ value: item.trim()
41004
+ };
41005
+ array.push(person);
41006
+ }
41007
+ }
41008
+ }
41009
+ } else {
41010
+ if (arr.length > 0) {
41011
+ for (let item of arr) {
41012
+ var person = {
41013
+ name: item.trim(),
41014
+ value: item.trim()
41015
+ };
41016
+ array.push(person);
41017
+ }
41018
+ }
41019
+ }
41020
+ return array;
41021
+ },
41022
+ MakeNormalArray: function (value) {
41023
+ if (value) {
41024
+ try {
41025
+ return JSON.parse(value);
41026
+ } catch (ex) {
41027
+ return value;
41028
+ }
41029
+ } else {
41030
+ value = [];
41031
+ }
41032
+ },
40872
41033
  ConvertCustomFieldIntoDynamicFormObj: function (fieldData) {
40873
41034
  let layoutData = [];
40874
41035
  var ths = this;
@@ -40883,11 +41044,12 @@ var SlotField_component = normalizeComponent(
40883
41044
  return x.group_id == groupId && (x.form_field_visibility == 'YES' || x.form_field_visibility == 'NO' && x.system_is_required == true);
40884
41045
  });
40885
41046
  if (fieldObj.length > 0) {
41047
+ var _field$group_display_;
40886
41048
  let obj = {
40887
41049
  layoutType: field.layout_type,
40888
41050
  groupId: groupId,
40889
41051
  visibility: true,
40890
- group_name: field.group_name,
41052
+ group_name: (_field$group_display_ = field.group_display_name) !== null && _field$group_display_ !== void 0 ? _field$group_display_ : field.group_name,
40891
41053
  Data: []
40892
41054
  };
40893
41055
  fieldObj.forEach(function (fieldItem, fieldItemIndex) {
@@ -40896,7 +41058,7 @@ var SlotField_component = normalizeComponent(
40896
41058
  options = ths.MakeArray(fieldItem.select_options, fieldItem.dt_code);
40897
41059
  } else if (fieldItem.dt_code == "select" && fieldItem.picklist_options == 'Lookup') {
40898
41060
  options = ths.MakeNormalArray(fieldItem.select_options);
40899
- } else if (fieldItem.dt_code == "select" && fieldItem.picklist_options != 'Lookup' && fieldItem.picklist_options != null) {
41061
+ } else if ((fieldItem.dt_code == "select" || fieldItem.dt_code == "radio" || fieldItem.dt_code == "checkbox") && fieldItem.picklist_options != 'Lookup' && fieldItem.picklist_options != null) {
40900
41062
  options = ths.MakeArray(fieldItem.picklist_options, fieldItem.dt_code);
40901
41063
  }
40902
41064
  let validationRules = {};
@@ -40920,7 +41082,8 @@ var SlotField_component = normalizeComponent(
40920
41082
  options: options,
40921
41083
  dependentOn: fieldItem.dependent_on,
40922
41084
  showWhen: fieldItem.show_when,
40923
- valueMapping: fieldItem.value_mapping
41085
+ valueMapping: fieldItem.value_mapping,
41086
+ fieldCode: fieldItem.field_code
40924
41087
  },
40925
41088
  mode: mode,
40926
41089
  visibility: fieldItem.form_field_visibility == 'YES',
@@ -40928,6 +41091,16 @@ var SlotField_component = normalizeComponent(
40928
41091
  };
40929
41092
  obj.Data.push(fieldObj);
40930
41093
  });
41094
+ if (obj.Data.length > 0) {
41095
+ let checkIfAnyField = obj.Data.filter(x => {
41096
+ return x.visibility == true || x.config.dependentOn != null && x.visibility == false;
41097
+ });
41098
+ if (checkIfAnyField.length == 0) {
41099
+ obj.visibility = false;
41100
+ }
41101
+ } else if (obj.Data.length == 0) {
41102
+ obj.visibility = false;
41103
+ }
40931
41104
  layoutData.push(obj);
40932
41105
  }
40933
41106
  }