ngx-rs-ant 0.9.5 → 0.9.8

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.
@@ -895,12 +895,12 @@ class DataGridComponent {
895
895
  this.reload();
896
896
  }
897
897
  reload() {
898
- this.dxDataGrid.instance?.state(null);
898
+ this.columns.length = 0;
899
899
  this.service.getMetadataByView(this.tenant, this.className, this.view || '').subscribe((response) => {
900
- this.columns = [];
900
+ const columns = [];
901
901
  for (let field of response.data.columns) {
902
902
  if (field.type === 'FILE') {
903
- this.columns.push({
903
+ columns.push({
904
904
  dataField: field.name,
905
905
  caption: field.caption,
906
906
  dataType: 'string',
@@ -924,7 +924,7 @@ class DataGridComponent {
924
924
  format: this.typeMap[field.dataType].format,
925
925
  visible: field.visible
926
926
  };
927
- this.columns.push(column);
927
+ columns.push(column);
928
928
  switch (field.dataType) {
929
929
  case 'BOOLEAN':
930
930
  column.allowHeaderFiltering = false;
@@ -974,12 +974,26 @@ class DataGridComponent {
974
974
  };
975
975
  break;
976
976
  case 'STRING':
977
+ column.headerFilter.dataSource = (options) => {
978
+ options.dataSource.postProcess = (data) => {
979
+ data.unshift({
980
+ key: '',
981
+ value: null,
982
+ text: '(空白)'
983
+ });
984
+ data.push({
985
+ key: '__',
986
+ value: '__',
987
+ text: '__',
988
+ visible: false
989
+ });
990
+ };
991
+ };
977
992
  if (field.config.constraint.multiple) {
978
993
  column.width = 120;
979
994
  }
980
995
  switch (field.config.constraint.type) {
981
996
  case 'USER':
982
- column.dataField = '__' + field.name + '\u0001User_displayName';
983
997
  column.headerFilter.dataSource = {
984
998
  store: new CustomStore({
985
999
  load: () => {
@@ -988,22 +1002,46 @@ class DataGridComponent {
988
1002
  }),
989
1003
  paginate: true
990
1004
  };
991
- column.calculateFilterExpression = function (filterValue, selectedFilterOperation, target) {
992
- if (target === 'headerFilter') {
1005
+ if (field.config.constraint.multiple) {
1006
+ column.allowFiltering = false;
1007
+ column.lookup = {
1008
+ dataSource: {
1009
+ store: new CustomStore({
1010
+ load: () => {
1011
+ return lastValueFrom(this.service.getUserColumnDataSource(this.className, this.view, field.name));
1012
+ }
1013
+ }),
1014
+ paginate: true
1015
+ },
1016
+ valueExpr: 'value',
1017
+ displayExpr: 'text'
1018
+ };
1019
+ column.calculateFilterExpression = function (filterValue, selectedFilterOperation, target) {
993
1020
  if (this.defaultCalculateFilterExpression) {
994
- this.dataField = '__' + field.name + '\u0001User_username';
995
- return this.defaultCalculateFilterExpression.apply(this, [filterValue, selectedFilterOperation, target]);
1021
+ return this.defaultCalculateFilterExpression.apply(this, [filterValue, 'contains', target]);
996
1022
  }
997
- }
998
- return [
999
- [column.name, selectedFilterOperation, filterValue],
1000
- 'or',
1001
- ['__' + field.name + '\u0001User_username', selectedFilterOperation, filterValue]
1002
- ];
1003
- };
1023
+ return '';
1024
+ };
1025
+ column.cellTemplate = 'multipleValueCellTemplate';
1026
+ }
1027
+ else {
1028
+ column.dataField = '__' + field.name + '\u0001User_displayName';
1029
+ column.calculateFilterExpression = function (filterValue, selectedFilterOperation, target) {
1030
+ if (target === 'headerFilter') {
1031
+ if (this.defaultCalculateFilterExpression) {
1032
+ this.dataField = '__' + field.name + '\u0001User_username';
1033
+ return this.defaultCalculateFilterExpression.apply(this, [filterValue, selectedFilterOperation, target]);
1034
+ }
1035
+ }
1036
+ return [
1037
+ [column.name, selectedFilterOperation, filterValue],
1038
+ 'or',
1039
+ ['__' + field.name + '\u0001User_username', selectedFilterOperation, filterValue]
1040
+ ];
1041
+ };
1042
+ }
1004
1043
  break;
1005
1044
  case 'UNIT':
1006
- column.dataField = '__' + field.name + '\u0001Role_displayName';
1007
1045
  column.headerFilter.dataSource = {
1008
1046
  store: new CustomStore({
1009
1047
  load: () => {
@@ -1012,19 +1050,44 @@ class DataGridComponent {
1012
1050
  }),
1013
1051
  paginate: true
1014
1052
  };
1015
- column.calculateFilterExpression = function (filterValue, selectedFilterOperation, target) {
1016
- if (target === 'headerFilter') {
1053
+ if (field.config.constraint.multiple) {
1054
+ column.allowFiltering = false;
1055
+ column.lookup = {
1056
+ dataSource: {
1057
+ store: new CustomStore({
1058
+ load: () => {
1059
+ return lastValueFrom(this.service.getUnitColumnDataSource(this.className, this.view, field.name));
1060
+ }
1061
+ }),
1062
+ paginate: true
1063
+ },
1064
+ valueExpr: 'value',
1065
+ displayExpr: 'text'
1066
+ };
1067
+ column.calculateFilterExpression = function (filterValue, selectedFilterOperation, target) {
1017
1068
  if (this.defaultCalculateFilterExpression) {
1018
- this.dataField = '__' + field.name + '\u0001Role_name';
1019
- return this.defaultCalculateFilterExpression.apply(this, [filterValue, selectedFilterOperation, target]);
1069
+ return this.defaultCalculateFilterExpression.apply(this, [filterValue, 'contains', target]);
1020
1070
  }
1021
- }
1022
- return [
1023
- [column.name, selectedFilterOperation, filterValue],
1024
- 'or',
1025
- ['__' + field.name + '\u0001Role_name', selectedFilterOperation, filterValue]
1026
- ];
1027
- };
1071
+ return '';
1072
+ };
1073
+ column.cellTemplate = 'multipleValueCellTemplate';
1074
+ }
1075
+ else {
1076
+ column.dataField = '__' + field.name + '\u0001Role_displayName';
1077
+ column.calculateFilterExpression = function (filterValue, selectedFilterOperation, target) {
1078
+ if (target === 'headerFilter') {
1079
+ if (this.defaultCalculateFilterExpression) {
1080
+ this.dataField = '__' + field.name + '\u0001Role_name';
1081
+ return this.defaultCalculateFilterExpression.apply(this, [filterValue, selectedFilterOperation, target]);
1082
+ }
1083
+ }
1084
+ return [
1085
+ [column.name, selectedFilterOperation, filterValue],
1086
+ 'or',
1087
+ ['__' + field.name + '\u0001Role_name', selectedFilterOperation, filterValue]
1088
+ ];
1089
+ };
1090
+ }
1028
1091
  break;
1029
1092
  case 'CUSTOM':
1030
1093
  column.headerFilter.dataSource = {
@@ -1068,7 +1131,7 @@ class DataGridComponent {
1068
1131
  }
1069
1132
  }
1070
1133
  else if (field.type === 'RELATION') {
1071
- this.columns.push({
1134
+ columns.push({
1072
1135
  dataField: field.name,
1073
1136
  caption: field.caption,
1074
1137
  dataType: 'string',
@@ -1080,8 +1143,9 @@ class DataGridComponent {
1080
1143
  }
1081
1144
  }
1082
1145
  if (this.customColumnFn) {
1083
- this.customColumnFn(this.columns);
1146
+ this.customColumnFn(columns);
1084
1147
  }
1148
+ this.columns = columns;
1085
1149
  });
1086
1150
  this.dataSource = new CustomStore({
1087
1151
  key: 'oid',