@steedos-widgets/amis-lib 1.2.30 → 1.2.31

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/dist/index.umd.js CHANGED
@@ -511,7 +511,7 @@
511
511
 
512
512
  function getRelatedFieldTpl(field, ctx){
513
513
  let tpl = '';
514
- if(!field.reference_to && (field.optionsFunction || field._optionsFunction)){
514
+ if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
515
515
  if(field.isTableField){
516
516
  return `\${${field.name}}`
517
517
  }else {
@@ -5132,7 +5132,7 @@
5132
5132
  "trigger": "click",
5133
5133
  "icon": "fa fa-cog",
5134
5134
  "tooltip": i18next__default["default"].t('frontend_button_listview_control_tooltip'),
5135
- "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
5135
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
5136
5136
  "align": "right",
5137
5137
  "visibleOn": "${!isLookup}",
5138
5138
  "buttons": [
@@ -5176,7 +5176,7 @@
5176
5176
  "type": "dropdown-button",
5177
5177
  "icon": "fa fa-table-columns",
5178
5178
  "tooltip": `${i18next__default["default"].t('frontend_display_as')} ${displayAsLabel}`,
5179
- "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
5179
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
5180
5180
  "align": "right",
5181
5181
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
5182
5182
  "buttons": [
@@ -5838,6 +5838,14 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
5838
5838
  }
5839
5839
  }
5840
5840
 
5841
+ if(${referenceTo?.objectName === "space_users"} && ${field.reference_to_field === "user"}){
5842
+ if(filters.length > 0){
5843
+ filters = [ ["user_accepted", "=", true], "and", filters ]
5844
+ }else{
5845
+ filters = [["user_accepted", "=", true]];
5846
+ }
5847
+ }
5848
+
5841
5849
 
5842
5850
  if(allowSearchFields){
5843
5851
  allowSearchFields.forEach(function(key){
@@ -6170,6 +6178,14 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
6170
6178
  filters.push(fieldFilters);
6171
6179
  }
6172
6180
 
6181
+ if(${referenceTo?.objectName === "space_users"} && ${field.reference_to_field === "user"}){
6182
+ if(filters.length > 0){
6183
+ filters = [ ["user_accepted", "=", true], "and", filters ]
6184
+ }else{
6185
+ filters = [["user_accepted", "=", true]];
6186
+ }
6187
+ }
6188
+
6173
6189
  const inFilterForm = ${ctx.inFilterForm};
6174
6190
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
6175
6191
 
@@ -6209,6 +6225,18 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
6209
6225
  payload.data.options = options;
6210
6226
  return payload;
6211
6227
  `;
6228
+ }else if(field.options){
6229
+ apiInfo.adaptor = `
6230
+ var options = ${JSON.stringify(field.options)}
6231
+ if(api.data.$term){
6232
+ options = _.filter(options, function(o) {
6233
+ var label = o.label;
6234
+ return label.toLowerCase().indexOf(api.data.$term.toLowerCase()) > -1;
6235
+ });
6236
+ }
6237
+ payload.data.options = options;
6238
+ return payload;
6239
+ `;
6212
6240
  }
6213
6241
 
6214
6242
  const data = {
@@ -6288,11 +6316,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
6288
6316
  // ids人员点选模式
6289
6317
  return await lookupToAmisIdsPicker(field, readonly, ctx);
6290
6318
  }
6291
- if(!field.filters || field.filters.length == 0){
6292
- field.filters = [["user_accepted", "=", true]];
6293
- }else {
6294
- field.filters = [ ["user_accepted", "=", true], "and", field.filters ];
6295
- }
6296
6319
  // 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
6297
6320
  // return await lookupToAmisSelectUser(field, readonly, ctx);
6298
6321
  }
@@ -6780,13 +6803,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
6780
6803
  ___namespace.each(field.options, (item)=>{
6781
6804
  switch (dataType) {
6782
6805
  case 'number':
6783
- options.push({label: item.label, value: Number(item.value)});
6806
+ options.push({label: item.label, value: Number(item.value), icon: item.icon});
6784
6807
  break;
6785
6808
  case 'text':
6786
- options.push({label: item.label, value: String(item.value)});
6809
+ options.push({label: item.label, value: String(item.value), icon: item.icon});
6787
6810
  break;
6788
6811
  case 'boolean':
6789
- options.push({label: item.label, value: item.value === 'false' ? false : true});
6812
+ options.push({label: item.label, value: item.value === 'false' ? false : true, icon: item.icon});
6790
6813
  break;
6791
6814
  }
6792
6815
  });
@@ -6848,6 +6871,17 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
6848
6871
  labelField: 'label',
6849
6872
  valueField: 'value'
6850
6873
  };
6874
+ const select_menuTpl = `<span class='flex items-center mt-0.5'>
6875
+ <span role='img' aria-label='smile' class='anticon anticon-smile'>
6876
+ <span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
6877
+ <svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
6878
+ <use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
6879
+ </svg>
6880
+ </span>
6881
+ </span>
6882
+ <span class='pl-1.5'>\${label}</span>
6883
+ </span>`;
6884
+ convertData.menuTpl = "${icon ? `"+select_menuTpl+"` : label}";
6851
6885
  if(field.multiple){
6852
6886
  convertData.multiple = true;
6853
6887
  convertData.extractValue = true;
@@ -7579,7 +7613,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
7579
7613
  type: "switch",
7580
7614
  name: field.name,
7581
7615
  label: field.label,
7582
- width: field.width,
7616
+ width: field.width || defaultWidth,
7583
7617
  toggled: field.toggled,
7584
7618
  static: true,
7585
7619
  className:"whitespace-nowrap",
@@ -7600,6 +7634,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
7600
7634
  }
7601
7635
  else if(field.type === 'select'){
7602
7636
  const map = getSelectMap(field.options);
7637
+ let className = "";
7638
+ if(field.wrap === false){
7639
+ className += " whitespace-nowrap";
7640
+ }
7603
7641
  columns.push(Object.assign({}, {
7604
7642
  type: "mapping",
7605
7643
  name: field.name,
@@ -7608,7 +7646,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
7608
7646
  sortable: field.sortable,
7609
7647
  width: field.width || defaultWidth,
7610
7648
  toggled: field.toggled,
7611
- className:"whitespace-nowrap",
7649
+ className,
7612
7650
  static: true,
7613
7651
  quickEdit: quickEditSchema
7614
7652
  }, field.amis, {name: field.name}));
@@ -8247,7 +8285,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
8247
8285
  if(item[key]){
8248
8286
  if(field._optionsFunction){
8249
8287
  const optionsFunction = eval("(" + field._optionsFunction+ ")")(item);
8250
- item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return _.includes(item[key], option.value)}), 'label').join(' ');
8288
+ item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return item[key] == option.value}), 'label').join(' ');
8289
+ }else if(field.options){
8290
+ const options = field.options;
8291
+ item[key + '__label'] = _.map(_.filter(options, function(option){return item[key] == option.value}), 'label').join(' ');
8251
8292
  }
8252
8293
  }
8253
8294
  })
@@ -13692,6 +13733,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
13692
13733
  exports.getRecordPageInitSchema = getRecordPageInitSchema;
13693
13734
  exports.getRecordPermissions = getRecordPermissions;
13694
13735
  exports.getRecordServiceSchema = getRecordServiceSchema;
13736
+ exports.getReferenceTo = getReferenceTo;
13695
13737
  exports.getRelatedFieldValue = getRelatedFieldValue;
13696
13738
  exports.getRelatedListSchema = getRelatedListSchema;
13697
13739
  exports.getRelatedsCount = getRelatedsCount;