mmhglobal-dynamicform 2.6.3 → 2.6.4
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.
- package/README.md +6 -0
- package/esm2020/lib/sfquerybuilder/sfquerybuilder.component.mjs +174 -94
- package/esm2020/lib/zudf/zudf.component.mjs +10 -4
- package/fesm2015/mmhglobal-dynamicform.mjs +186 -96
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +182 -96
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/lib/sfquerybuilder/sfquerybuilder.component.d.ts +2 -0
- package/lib/zudf/zudf.component.d.ts +2 -2
- package/package.json +1 -1
|
@@ -11768,11 +11768,11 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11768
11768
|
* @param group The ZGroup object to which the field elements will be added.
|
|
11769
11769
|
* @param jsonString The JSON string representing the field elements.
|
|
11770
11770
|
*/
|
|
11771
|
-
renderFieldElementByJsonString(group, jsonString) {
|
|
11771
|
+
renderFieldElementByJsonString(group, jsonString, fieldElementName = '') {
|
|
11772
11772
|
// Parse the JSON string into an array of field elements.
|
|
11773
11773
|
const fieldElementMasterCodeJsonArray = JSON.parse(jsonString);
|
|
11774
11774
|
// Render the field elements.
|
|
11775
|
-
this.renderFieldElement(fieldElementMasterCodeJsonArray);
|
|
11775
|
+
this.renderFieldElement(fieldElementMasterCodeJsonArray, fieldElementName);
|
|
11776
11776
|
}
|
|
11777
11777
|
//#region Display model
|
|
11778
11778
|
/**
|
|
@@ -11865,7 +11865,7 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11865
11865
|
* Renders field elements as form controls in a new form group.
|
|
11866
11866
|
* @param {any} fieldElements - The field elements to be rendered.
|
|
11867
11867
|
*/
|
|
11868
|
-
renderFieldElement(fieldElements) {
|
|
11868
|
+
renderFieldElement(fieldElements, fieldElementName = '') {
|
|
11869
11869
|
this.clearZModel();
|
|
11870
11870
|
if (fieldElements) {
|
|
11871
11871
|
this.loadedFieldsSequence = {};
|
|
@@ -11908,6 +11908,12 @@ class ZudfComponent extends ContainerFieldBase {
|
|
|
11908
11908
|
}
|
|
11909
11909
|
});
|
|
11910
11910
|
}
|
|
11911
|
+
// need to call back field element "<field name>_loaded"
|
|
11912
|
+
if (fieldElementName != '') {
|
|
11913
|
+
if (this.group[fieldElementName + '_loaded']) {
|
|
11914
|
+
this.group[fieldElementName + '_loaded'](this.group);
|
|
11915
|
+
}
|
|
11916
|
+
}
|
|
11911
11917
|
// To consider: Trigger the "onchange" event or perform any other necessary actions here
|
|
11912
11918
|
});
|
|
11913
11919
|
}
|
|
@@ -12743,8 +12749,11 @@ class SfquerybuilderComponent {
|
|
|
12743
12749
|
this.inOperators = ['in', 'notin'];
|
|
12744
12750
|
this.dropdownOperators = [
|
|
12745
12751
|
this.equalOperator,
|
|
12752
|
+
this.notequalOperator,
|
|
12746
12753
|
this.inOperator,
|
|
12747
|
-
this.notinOperator
|
|
12754
|
+
this.notinOperator,
|
|
12755
|
+
this.isnullOperator,
|
|
12756
|
+
this.isnotnullOperator
|
|
12748
12757
|
];
|
|
12749
12758
|
this.stringOperators = [
|
|
12750
12759
|
this.equalOperator,
|
|
@@ -12763,7 +12772,9 @@ class SfquerybuilderComponent {
|
|
|
12763
12772
|
this.greaterthanOperator,
|
|
12764
12773
|
this.greaterthanorequalOperator,
|
|
12765
12774
|
this.lessthanOperator,
|
|
12766
|
-
this.lessthanorequalOperator
|
|
12775
|
+
this.lessthanorequalOperator,
|
|
12776
|
+
this.isnullOperator,
|
|
12777
|
+
this.isnotnullOperator
|
|
12767
12778
|
];
|
|
12768
12779
|
this.dateOperators = [
|
|
12769
12780
|
this.equalOperator,
|
|
@@ -12771,16 +12782,26 @@ class SfquerybuilderComponent {
|
|
|
12771
12782
|
this.greaterthanOperator,
|
|
12772
12783
|
this.greaterthanorequalOperator,
|
|
12773
12784
|
this.lessthanOperator,
|
|
12774
|
-
this.lessthanorequalOperator
|
|
12785
|
+
this.lessthanorequalOperator,
|
|
12786
|
+
this.isnullOperator,
|
|
12787
|
+
this.isnotnullOperator
|
|
12788
|
+
];
|
|
12789
|
+
this.booleanOperators = [
|
|
12790
|
+
this.equalOperator,
|
|
12791
|
+
this.notequalOperator,
|
|
12792
|
+
this.isnullOperator,
|
|
12793
|
+
this.isnotnullOperator
|
|
12775
12794
|
];
|
|
12776
12795
|
this.selectionComponentList = [];
|
|
12777
12796
|
}
|
|
12778
12797
|
ngOnInit() {
|
|
12779
12798
|
ZComponentHelper.setComponentProperties(this);
|
|
12780
12799
|
ZComponentHelper.registerComponent(this);
|
|
12781
|
-
of(true).pipe(switchMap$1(
|
|
12800
|
+
of(true).pipe(switchMap$1(_ => {
|
|
12782
12801
|
return this.beforeLoadField(this.data);
|
|
12783
|
-
}),
|
|
12802
|
+
}), tap$1(data => {
|
|
12803
|
+
this.data = data;
|
|
12804
|
+
}), switchMap$1(_ => {
|
|
12784
12805
|
return this.loadQueryBuilder();
|
|
12785
12806
|
})).subscribe(() => {
|
|
12786
12807
|
// Where to update operator syntax
|
|
@@ -12802,67 +12823,78 @@ class SfquerybuilderComponent {
|
|
|
12802
12823
|
}
|
|
12803
12824
|
this.fields = this.fieldService.getFormFieldCode(this.data.Value, "FormField", null, null);
|
|
12804
12825
|
try {
|
|
12826
|
+
let isGrouped = true;
|
|
12805
12827
|
return this.fields.pipe(tap$1((data) => {
|
|
12828
|
+
// if [isGrouped = true] include grouping name as prefix
|
|
12829
|
+
if (data.length > 1) {
|
|
12830
|
+
isGrouped = false;
|
|
12831
|
+
}
|
|
12806
12832
|
data.forEach(async (field) => {
|
|
12807
|
-
|
|
12808
|
-
if (field.Type == 'category' || field.Type == 'multiselect') {
|
|
12809
|
-
this.sdFilter.push({
|
|
12810
|
-
field: field.Value,
|
|
12811
|
-
label: field.Name,
|
|
12812
|
-
type: 'string',
|
|
12813
|
-
operators: this.dropdownOperators,
|
|
12814
|
-
template: await this.generateColumnSelection(field),
|
|
12815
|
-
});
|
|
12816
|
-
}
|
|
12817
|
-
else if (field.Type === 'string') {
|
|
12818
|
-
this.sdFilter.push({
|
|
12819
|
-
field: field.Value,
|
|
12820
|
-
label: field.Name,
|
|
12821
|
-
operators: this.stringOperators,
|
|
12822
|
-
type: 'string'
|
|
12823
|
-
});
|
|
12824
|
-
}
|
|
12825
|
-
else if (field.Type === 'date') {
|
|
12826
|
-
this.sdFilter.push({
|
|
12827
|
-
field: field.Value,
|
|
12828
|
-
label: field.Name,
|
|
12829
|
-
operators: this.dateOperators,
|
|
12830
|
-
type: 'date'
|
|
12831
|
-
});
|
|
12832
|
-
}
|
|
12833
|
-
else if (field.Type === 'number') {
|
|
12834
|
-
this.sdFilter.push({
|
|
12835
|
-
field: field.Value,
|
|
12836
|
-
label: field.Name,
|
|
12837
|
-
operators: this.integerOperators,
|
|
12838
|
-
type: 'number'
|
|
12839
|
-
});
|
|
12840
|
-
}
|
|
12841
|
-
else if (field.Value === 'boolean') {
|
|
12842
|
-
this.sdFilter.push({
|
|
12843
|
-
field: field.Value,
|
|
12844
|
-
label: field.Name,
|
|
12845
|
-
type: 'boolean',
|
|
12846
|
-
template: await this.generateColumnCheckbox(field.Name, false)
|
|
12847
|
-
});
|
|
12848
|
-
}
|
|
12849
|
-
else {
|
|
12850
|
-
this.sdFilter.push({
|
|
12851
|
-
field: field.Value,
|
|
12852
|
-
label: field.Name,
|
|
12853
|
-
type: 'string',
|
|
12854
|
-
operators: this.stringOperators,
|
|
12855
|
-
});
|
|
12856
|
-
}
|
|
12833
|
+
this.renderComponentType(field, isGrouped);
|
|
12857
12834
|
}); //end foreach
|
|
12858
12835
|
this.issfLoaded = true;
|
|
12859
12836
|
}));
|
|
12837
|
+
return of(true);
|
|
12860
12838
|
}
|
|
12861
12839
|
catch (error) {
|
|
12862
12840
|
console.error("error: ", error);
|
|
12863
12841
|
return of(false);
|
|
12864
12842
|
}
|
|
12865
12843
|
}
|
|
12844
|
+
async renderComponentType(field, isGrouped, fieldTitle) {
|
|
12845
|
+
let componentLabel = field.SubType ? field.Label : field.Label ?? field.Name;
|
|
12846
|
+
componentLabel = !isGrouped && !ZComponentHelper.isNullUndefinedEmpty(fieldTitle) ? "[" + fieldTitle + "] " + field.Label : !ZComponentHelper.isNullUndefinedEmpty(field.Label) ? field.Label : field.Name;
|
|
12847
|
+
let componentField = !ZComponentHelper.isNullUndefinedEmpty(fieldTitle) ? fieldTitle + "_" + field.Value : field.Value;
|
|
12848
|
+
if (field.Type === 'category' || field.Type === 'multiselect' || field.Type === 'zuiselectmultiple') {
|
|
12849
|
+
this.sdFilter.push({
|
|
12850
|
+
field: componentField,
|
|
12851
|
+
label: componentLabel,
|
|
12852
|
+
type: 'string',
|
|
12853
|
+
operators: this.dropdownOperators,
|
|
12854
|
+
template: await this.generateColumnSelection(field),
|
|
12855
|
+
});
|
|
12856
|
+
}
|
|
12857
|
+
else if (field.Type === 'date') {
|
|
12858
|
+
this.sdFilter.push({
|
|
12859
|
+
field: componentField,
|
|
12860
|
+
label: componentLabel,
|
|
12861
|
+
operators: this.dateOperators,
|
|
12862
|
+
type: 'date'
|
|
12863
|
+
});
|
|
12864
|
+
}
|
|
12865
|
+
else if (field.Type === 'number') {
|
|
12866
|
+
this.sdFilter.push({
|
|
12867
|
+
field: componentField,
|
|
12868
|
+
label: componentLabel,
|
|
12869
|
+
operators: this.integerOperators,
|
|
12870
|
+
type: 'number'
|
|
12871
|
+
});
|
|
12872
|
+
}
|
|
12873
|
+
else if (field.Value === 'boolean') {
|
|
12874
|
+
this.sdFilter.push({
|
|
12875
|
+
field: componentField,
|
|
12876
|
+
label: componentLabel,
|
|
12877
|
+
type: 'boolean',
|
|
12878
|
+
operators: this.booleanOperators,
|
|
12879
|
+
template: await this.generateColumnCheckbox(field.Name, false)
|
|
12880
|
+
});
|
|
12881
|
+
}
|
|
12882
|
+
else if (field.Type === 'kcard') {
|
|
12883
|
+
if (field.Value.length > 0) {
|
|
12884
|
+
field.Value.forEach(async (item) => {
|
|
12885
|
+
this.renderComponentType(item, isGrouped, field.Title);
|
|
12886
|
+
});
|
|
12887
|
+
}
|
|
12888
|
+
}
|
|
12889
|
+
else {
|
|
12890
|
+
this.sdFilter.push({
|
|
12891
|
+
field: componentField,
|
|
12892
|
+
label: componentLabel,
|
|
12893
|
+
operators: this.stringOperators,
|
|
12894
|
+
type: 'string'
|
|
12895
|
+
});
|
|
12896
|
+
}
|
|
12897
|
+
}
|
|
12866
12898
|
//#region checkbox
|
|
12867
12899
|
generateColumnCheckbox(label, value) {
|
|
12868
12900
|
return {
|
|
@@ -12894,7 +12926,8 @@ class SfquerybuilderComponent {
|
|
|
12894
12926
|
if (this.data['Filters']) {
|
|
12895
12927
|
this.filters = ZComponentHelper.getGroupEvalValue.call(this, this.data['Filters'], this.group);
|
|
12896
12928
|
}
|
|
12897
|
-
return createElement('input', { attrs: { 'type': 'text', 'style': 'display: none' } });
|
|
12929
|
+
//return createElement('input', { attrs: { 'type': 'text', 'style': 'display: none' } });
|
|
12930
|
+
return createElement('input', { attrs: { 'type': 'text' } });
|
|
12898
12931
|
},
|
|
12899
12932
|
// Destroy the custom component
|
|
12900
12933
|
destroy: (args) => {
|
|
@@ -12932,49 +12965,102 @@ class SfquerybuilderComponent {
|
|
|
12932
12965
|
const selectionComponent = this.generateSelectionComponent(args, optionList);
|
|
12933
12966
|
selectionComponent.appendTo('#' + args.elements.id);
|
|
12934
12967
|
}
|
|
12968
|
+
// manual dropdown or zudf manual dropdown
|
|
12969
|
+
else if (fieldElementData['SelectOptions'] && Array.isArray(fieldElementData['SelectOptions'])) {
|
|
12970
|
+
// convert to property name used in the component rendering
|
|
12971
|
+
const optionList = [];
|
|
12972
|
+
fieldElementData['SelectOptions'].forEach((item) => {
|
|
12973
|
+
optionList.push({
|
|
12974
|
+
text: item['text'],
|
|
12975
|
+
value: item['value']
|
|
12976
|
+
});
|
|
12977
|
+
});
|
|
12978
|
+
const selectionComponent = this.generateSelectionComponent(args, optionList);
|
|
12979
|
+
selectionComponent.appendTo('#' + args.elements.id);
|
|
12980
|
+
}
|
|
12981
|
+
// zudf ResourceURL / Common Master dropdown
|
|
12935
12982
|
else {
|
|
12936
12983
|
const selectOptions = fieldElementData['SelectOptions'];
|
|
12937
12984
|
const selectOptionsResourceURL = selectOptions['ResourceURL'];
|
|
12938
|
-
|
|
12939
|
-
if (
|
|
12940
|
-
|
|
12941
|
-
if (this.
|
|
12942
|
-
|
|
12985
|
+
// ResourceURL dropdown
|
|
12986
|
+
if (selectOptionsResourceURL) {
|
|
12987
|
+
const prefixResourceURLChecking = selectOptionsResourceURL + '_' + args.elements.id;
|
|
12988
|
+
if (!this.loadedDropdownOptions.includes(prefixResourceURLChecking)) {
|
|
12989
|
+
this.loadedDropdownOptions.push(prefixResourceURLChecking);
|
|
12990
|
+
if (this.filters) {
|
|
12991
|
+
selectOptions['Filters'] = this.filters;
|
|
12992
|
+
}
|
|
12993
|
+
const param = Object.assign({}, DefaultPageSettingParams);
|
|
12994
|
+
param.pageSize = selectOptions['PageSize'];
|
|
12995
|
+
param.columns = selectOptions['Columns'];
|
|
12996
|
+
param.filters += selectOptions['Filters'];
|
|
12997
|
+
param.sortColumnName = selectOptions['SortColumnName'];
|
|
12998
|
+
param.sortOrder = selectOptions['SortOrder'];
|
|
12999
|
+
// Need delay 400ms if not 3rd segment (value) will not be rendered.
|
|
13000
|
+
this.webApiService.httpPost$(this.resourceApiService.getPageUrl(selectOptionsResourceURL), param).pipe(delay(400), map((resp) => {
|
|
13001
|
+
const optionList = [];
|
|
13002
|
+
resp.dataSet.forEach((item) => {
|
|
13003
|
+
optionList.push({
|
|
13004
|
+
text: item[selectOptions['Name']],
|
|
13005
|
+
value: item[selectOptions['Value']]
|
|
13006
|
+
});
|
|
13007
|
+
});
|
|
13008
|
+
const selectionComponent = this.generateSelectionComponent(args, optionList);
|
|
13009
|
+
selectionComponent.appendTo('#' + args.elements.id);
|
|
13010
|
+
//const xxx = document.getElementById(args.elements.id);
|
|
13011
|
+
////xxx.appendChild(inputElement);
|
|
13012
|
+
//xxx.style.display = 'block';
|
|
13013
|
+
//#region used for updateSelectionOption
|
|
13014
|
+
const existingIndex = this.selectionComponentList.findIndex((item) => item.componentId === args.elements.id);
|
|
13015
|
+
if (existingIndex !== -1) {
|
|
13016
|
+
// Object with the same componentId exists, replace resourceUrl
|
|
13017
|
+
this.selectionComponentList[existingIndex].resourceUrl = selectOptionsResourceURL;
|
|
13018
|
+
}
|
|
13019
|
+
else {
|
|
13020
|
+
// Object with componentId doesn't exist, push a new object
|
|
13021
|
+
this.selectionComponentList.push({
|
|
13022
|
+
resourceUrl: selectOptionsResourceURL,
|
|
13023
|
+
componentId: args.elements.id
|
|
13024
|
+
});
|
|
13025
|
+
}
|
|
13026
|
+
//#endregion
|
|
13027
|
+
})).subscribe();
|
|
12943
13028
|
}
|
|
12944
|
-
|
|
12945
|
-
|
|
12946
|
-
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
this.webApiService.httpPost$(this.resourceApiService.getPageUrl(selectOptionsResourceURL), param).pipe(delay(300), map((resp) => {
|
|
13029
|
+
}
|
|
13030
|
+
// zudf Common Master dropdown
|
|
13031
|
+
else if (fieldElementData.zudfDataSourceType && fieldElementData.zudfDataSourceType === "resource") {
|
|
13032
|
+
// extract zudf_dropdown from session storage
|
|
13033
|
+
const zudf_dropdown = sessionStorage.getItem("zudf_dropdown") ? JSON.parse(sessionStorage.getItem("zudf_dropdown")) : null;
|
|
13034
|
+
if (zudf_dropdown) {
|
|
12951
13035
|
const optionList = [];
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
value
|
|
12956
|
-
|
|
13036
|
+
zudf_dropdown.forEach(res => {
|
|
13037
|
+
const name = res.text.split("Options")[0];
|
|
13038
|
+
if (fieldElementData.Label === name) {
|
|
13039
|
+
res.value.forEach(val => {
|
|
13040
|
+
optionList.push({
|
|
13041
|
+
text: val['Name'],
|
|
13042
|
+
value: val['Id']
|
|
13043
|
+
});
|
|
13044
|
+
});
|
|
13045
|
+
}
|
|
12957
13046
|
});
|
|
12958
13047
|
const selectionComponent = this.generateSelectionComponent(args, optionList);
|
|
12959
13048
|
selectionComponent.appendTo('#' + args.elements.id);
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
}
|
|
12976
|
-
//#endregion
|
|
12977
|
-
})).subscribe();
|
|
13049
|
+
}
|
|
13050
|
+
}
|
|
13051
|
+
// User List dropdown
|
|
13052
|
+
else if (fieldElementData.zudfDataSourceType && fieldElementData.zudfDataSourceType === "user") {
|
|
13053
|
+
const optionList = [];
|
|
13054
|
+
const userList = JSON.parse(sessionStorage?.getItem("userList") ?? 'null');
|
|
13055
|
+
//const arrayTest = userList.map(({ SelectionName, Id }) => ({ text: SelectionName, value: Id }));
|
|
13056
|
+
userList.forEach((item) => {
|
|
13057
|
+
optionList.push({
|
|
13058
|
+
text: item['SelectionName'],
|
|
13059
|
+
value: item['Id']
|
|
13060
|
+
});
|
|
13061
|
+
});
|
|
13062
|
+
const selectionComponent = this.generateSelectionComponent(args, optionList);
|
|
13063
|
+
selectionComponent.appendTo('#' + args.elements.id);
|
|
12978
13064
|
}
|
|
12979
13065
|
}
|
|
12980
13066
|
} //end write
|
|
@@ -13076,10 +13162,10 @@ class SfquerybuilderComponent {
|
|
|
13076
13162
|
const callFunc = eval('this.' + beforeLoadField);
|
|
13077
13163
|
if (typeof callFunc === "function") {
|
|
13078
13164
|
const newFunc = callFunc.bind(this);
|
|
13079
|
-
return newFunc(event, this);
|
|
13165
|
+
return newFunc(event, this, fieldElementData);
|
|
13080
13166
|
}
|
|
13081
13167
|
}
|
|
13082
|
-
return of(
|
|
13168
|
+
return of(fieldElementData);
|
|
13083
13169
|
}
|
|
13084
13170
|
}
|
|
13085
13171
|
SfquerybuilderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SfquerybuilderComponent, deps: [{ token: i2.FieldService }, { token: i2.ResourceApiService }, { token: i2.WebApiService }], target: i0.ɵɵFactoryTarget.Component });
|