@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.esm.js CHANGED
@@ -487,7 +487,7 @@ function getNameTpl(field, ctx){
487
487
 
488
488
  function getRelatedFieldTpl(field, ctx){
489
489
  let tpl = '';
490
- if(!field.reference_to && (field.optionsFunction || field._optionsFunction)){
490
+ if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
491
491
  if(field.isTableField){
492
492
  return `\${${field.name}}`
493
493
  }else {
@@ -5108,7 +5108,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
5108
5108
  "trigger": "click",
5109
5109
  "icon": "fa fa-cog",
5110
5110
  "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
5111
- "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
5111
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
5112
5112
  "align": "right",
5113
5113
  "visibleOn": "${!isLookup}",
5114
5114
  "buttons": [
@@ -5152,7 +5152,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
5152
5152
  "type": "dropdown-button",
5153
5153
  "icon": "fa fa-table-columns",
5154
5154
  "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
5155
- "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
5155
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
5156
5156
  "align": "right",
5157
5157
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
5158
5158
  "buttons": [
@@ -5814,6 +5814,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
5814
5814
  }
5815
5815
  }
5816
5816
 
5817
+ if(${referenceTo?.objectName === "space_users"} && ${field.reference_to_field === "user"}){
5818
+ if(filters.length > 0){
5819
+ filters = [ ["user_accepted", "=", true], "and", filters ]
5820
+ }else{
5821
+ filters = [["user_accepted", "=", true]];
5822
+ }
5823
+ }
5824
+
5817
5825
 
5818
5826
  if(allowSearchFields){
5819
5827
  allowSearchFields.forEach(function(key){
@@ -6146,6 +6154,14 @@ async function lookupToAmisSelect(field, readonly, ctx){
6146
6154
  filters.push(fieldFilters);
6147
6155
  }
6148
6156
 
6157
+ if(${referenceTo?.objectName === "space_users"} && ${field.reference_to_field === "user"}){
6158
+ if(filters.length > 0){
6159
+ filters = [ ["user_accepted", "=", true], "and", filters ]
6160
+ }else{
6161
+ filters = [["user_accepted", "=", true]];
6162
+ }
6163
+ }
6164
+
6149
6165
  const inFilterForm = ${ctx.inFilterForm};
6150
6166
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
6151
6167
 
@@ -6185,6 +6201,18 @@ async function lookupToAmisSelect(field, readonly, ctx){
6185
6201
  payload.data.options = options;
6186
6202
  return payload;
6187
6203
  `;
6204
+ }else if(field.options){
6205
+ apiInfo.adaptor = `
6206
+ var options = ${JSON.stringify(field.options)}
6207
+ if(api.data.$term){
6208
+ options = _.filter(options, function(o) {
6209
+ var label = o.label;
6210
+ return label.toLowerCase().indexOf(api.data.$term.toLowerCase()) > -1;
6211
+ });
6212
+ }
6213
+ payload.data.options = options;
6214
+ return payload;
6215
+ `;
6188
6216
  }
6189
6217
 
6190
6218
  const data = {
@@ -6264,11 +6292,6 @@ async function lookupToAmis(field, readonly, ctx){
6264
6292
  // ids人员点选模式
6265
6293
  return await lookupToAmisIdsPicker(field, readonly, ctx);
6266
6294
  }
6267
- if(!field.filters || field.filters.length == 0){
6268
- field.filters = [["user_accepted", "=", true]];
6269
- }else {
6270
- field.filters = [ ["user_accepted", "=", true], "and", field.filters ];
6271
- }
6272
6295
  // 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
6273
6296
  // return await lookupToAmisSelectUser(field, readonly, ctx);
6274
6297
  }
@@ -6756,13 +6779,13 @@ function getSelectFieldOptions(field){
6756
6779
  _$1.each(field.options, (item)=>{
6757
6780
  switch (dataType) {
6758
6781
  case 'number':
6759
- options.push({label: item.label, value: Number(item.value)});
6782
+ options.push({label: item.label, value: Number(item.value), icon: item.icon});
6760
6783
  break;
6761
6784
  case 'text':
6762
- options.push({label: item.label, value: String(item.value)});
6785
+ options.push({label: item.label, value: String(item.value), icon: item.icon});
6763
6786
  break;
6764
6787
  case 'boolean':
6765
- options.push({label: item.label, value: item.value === 'false' ? false : true});
6788
+ options.push({label: item.label, value: item.value === 'false' ? false : true, icon: item.icon});
6766
6789
  break;
6767
6790
  }
6768
6791
  });
@@ -6824,6 +6847,17 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6824
6847
  labelField: 'label',
6825
6848
  valueField: 'value'
6826
6849
  };
6850
+ const select_menuTpl = `<span class='flex items-center mt-0.5'>
6851
+ <span role='img' aria-label='smile' class='anticon anticon-smile'>
6852
+ <span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
6853
+ <svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
6854
+ <use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
6855
+ </svg>
6856
+ </span>
6857
+ </span>
6858
+ <span class='pl-1.5'>\${label}</span>
6859
+ </span>`;
6860
+ convertData.menuTpl = "${icon ? `"+select_menuTpl+"` : label}";
6827
6861
  if(field.multiple){
6828
6862
  convertData.multiple = true;
6829
6863
  convertData.extractValue = true;
@@ -7555,7 +7589,7 @@ async function getTableColumns(fields, options){
7555
7589
  type: "switch",
7556
7590
  name: field.name,
7557
7591
  label: field.label,
7558
- width: field.width,
7592
+ width: field.width || defaultWidth,
7559
7593
  toggled: field.toggled,
7560
7594
  static: true,
7561
7595
  className:"whitespace-nowrap",
@@ -7576,6 +7610,10 @@ async function getTableColumns(fields, options){
7576
7610
  }
7577
7611
  else if(field.type === 'select'){
7578
7612
  const map = getSelectMap(field.options);
7613
+ let className = "";
7614
+ if(field.wrap === false){
7615
+ className += " whitespace-nowrap";
7616
+ }
7579
7617
  columns.push(Object.assign({}, {
7580
7618
  type: "mapping",
7581
7619
  name: field.name,
@@ -7584,7 +7622,7 @@ async function getTableColumns(fields, options){
7584
7622
  sortable: field.sortable,
7585
7623
  width: field.width || defaultWidth,
7586
7624
  toggled: field.toggled,
7587
- className:"whitespace-nowrap",
7625
+ className,
7588
7626
  static: true,
7589
7627
  quickEdit: quickEditSchema
7590
7628
  }, field.amis, {name: field.name}));
@@ -8223,7 +8261,10 @@ async function getTableApi(mainObject, fields, options){
8223
8261
  if(item[key]){
8224
8262
  if(field._optionsFunction){
8225
8263
  const optionsFunction = eval("(" + field._optionsFunction+ ")")(item);
8226
- item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return _.includes(item[key], option.value)}), 'label').join(' ');
8264
+ item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return item[key] == option.value}), 'label').join(' ');
8265
+ }else if(field.options){
8266
+ const options = field.options;
8267
+ item[key + '__label'] = _.map(_.filter(options, function(option){return item[key] == option.value}), 'label').join(' ');
8227
8268
  }
8228
8269
  }
8229
8270
  })
@@ -13592,5 +13633,5 @@ const getInstanceInfo = async ({ instanceId, box }) => {
13592
13633
  };
13593
13634
  };
13594
13635
 
13595
- export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn$1 as getButtonVisibleOn, getButtons, getCalendarSchema, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLookupSapceUserTreeSchema, getNotifications, getObjectDetailButtons, getObjectDetailButtonsSchemas, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectListViewButtonsSchemas, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListButtonsSchemas, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getPage, getRecord, getRecordDetailHeaderSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getTableSchema, getTenantId, getUISchema, getUISchemaSync, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
13636
+ export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn$1 as getButtonVisibleOn, getButtons, getCalendarSchema, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLookupSapceUserTreeSchema, getNotifications, getObjectDetailButtons, getObjectDetailButtonsSchemas, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectListViewButtonsSchemas, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListButtonsSchemas, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getPage, getRecord, getRecordDetailHeaderSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getReferenceTo, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getTableSchema, getTenantId, getUISchema, getUISchemaSync, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
13596
13637
  //# sourceMappingURL=index.esm.js.map