@steedos-widgets/amis-lib 1.2.39-beta.1 → 1.2.39

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
@@ -5238,19 +5238,19 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
5238
5238
  `;
5239
5239
 
5240
5240
 
5241
- function getObjectHeaderToolbar(mainObject, fields, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
5241
+ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true, isLookup = false } = {}){
5242
5242
  // console.log(`getObjectHeaderToolbar====>`, filterVisible)
5243
5243
  // console.log(`getObjectHeaderToolbar`, mainObject)
5244
5244
  const searchableFieldsLabel = [];
5245
5245
  _.each(fields, function (field) {
5246
- if (field.searchable) {
5246
+ if (field.searchable && SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1) {
5247
5247
  searchableFieldsLabel.push(field.label);
5248
5248
  }
5249
5249
  });
5250
5250
  const listViewPropsStoreKey = location.pathname + "/crud";
5251
5251
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
5252
5252
  let crudKeywords = "";
5253
- if(localListViewProps){
5253
+ if(localListViewProps && !isLookup){
5254
5254
  localListViewProps = JSON.parse(localListViewProps);
5255
5255
  crudKeywords = (localListViewProps && localListViewProps.__keywords) || "";
5256
5256
  }
@@ -5310,7 +5310,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {showDisplayAs =
5310
5310
  ],
5311
5311
  "size":8,
5312
5312
  "animation": true,
5313
- "visibleOn": "${isFieldsFilterEmpty == false}"
5313
+ "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5314
5314
  },
5315
5315
  "align": "right",
5316
5316
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
@@ -5325,7 +5325,27 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {showDisplayAs =
5325
5325
  }
5326
5326
  }
5327
5327
  } : {},
5328
- getDisplayAsButton(mainObject?.name)
5328
+ getDisplayAsButton(mainObject?.name),
5329
+ {
5330
+ "type": "tooltip-wrapper",
5331
+ "align": "right",
5332
+ "title": "",
5333
+ "content": "可搜索字段:" + searchableFieldsLabel.join(","),
5334
+ "placement": "bottom",
5335
+ "tooltipTheme": "dark",
5336
+ "trigger": "click",
5337
+ // "className": "mr-1",
5338
+ "body": [
5339
+ {
5340
+ "type": "search-box",
5341
+ "name": "__keywords",
5342
+ "placeholder": "请输入关键字",
5343
+ "value": crudKeywords,
5344
+ "clearable": true,
5345
+ "clearAndSubmit": true
5346
+ }
5347
+ ]
5348
+ },
5329
5349
  ]
5330
5350
  }else {
5331
5351
  return [
@@ -5358,7 +5378,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {showDisplayAs =
5358
5378
  ],
5359
5379
  "size":8,
5360
5380
  "animation": true,
5361
- "visibleOn": "${isFieldsFilterEmpty == false}"
5381
+ "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5362
5382
  },
5363
5383
  "align": "right",
5364
5384
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
@@ -5389,7 +5409,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {showDisplayAs =
5389
5409
  "type": "tooltip-wrapper",
5390
5410
  "align": "right",
5391
5411
  "title": "",
5392
- "content": "可模糊搜索字段:" + searchableFieldsLabel.join(","),
5412
+ "content": "可搜索字段:" + searchableFieldsLabel.join(","),
5393
5413
  "placement": "bottom",
5394
5414
  "tooltipTheme": "dark",
5395
5415
  "trigger": "click",
@@ -5755,8 +5775,8 @@ function getLookupSapceUserTreeSchema(){
5755
5775
  "style": {
5756
5776
  "max-height": "100%",
5757
5777
  "position": "absolute",
5758
- "left": "-220px",
5759
- "width": "210px",
5778
+ "left": "-330px",
5779
+ "width": "320px",
5760
5780
  "bottom": 0,
5761
5781
  "top": "0",
5762
5782
  "overflow": "auto",
@@ -5822,7 +5842,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5822
5842
  })){
5823
5843
  i++;
5824
5844
  tableFields.push(field);
5825
- if(field.searchable){
5845
+ if(field.searchable && SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1){
5826
5846
  searchableFields.push(field.name);
5827
5847
  }
5828
5848
  }
@@ -6041,13 +6061,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
6041
6061
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
6042
6062
  headerToolbarItems = getLookupSapceUserTreeSchema();
6043
6063
  pickerSchema["style"] = {
6044
- "margin-left":"220px",
6064
+ "margin-left":"330px",
6045
6065
  "min-height": "300px"
6046
6066
  };
6047
6067
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
6048
6068
  }
6049
6069
 
6050
- pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
6070
+ pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true });
6051
6071
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
6052
6072
  if (isAllowCreate) {
6053
6073
  const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
@@ -6770,6 +6790,7 @@ const getAmisFileSchema = (steedosField, readonly)=>{
6770
6790
  return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
6771
6791
  };
6772
6792
 
6793
+ const SEARCHABLE_FIELD_TYPES = ["text", "textarea", "autonumber", "url", "email"];
6773
6794
  const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
6774
6795
  // const Lookup = require('./lookup');
6775
6796
 
@@ -7544,6 +7565,7 @@ if (typeof window != 'undefined') {
7544
7565
 
7545
7566
  var index = /*#__PURE__*/Object.freeze({
7546
7567
  __proto__: null,
7568
+ SEARCHABLE_FIELD_TYPES: SEARCHABLE_FIELD_TYPES,
7547
7569
  OMIT_FIELDS: OMIT_FIELDS,
7548
7570
  getBaseFields: getBaseFields,
7549
7571
  getAmisFieldType: getAmisFieldType,
@@ -8331,7 +8353,7 @@ async function getTableApi(mainObject, fields, options){
8331
8353
  baseFilters = filter;
8332
8354
  }
8333
8355
  _$1.each(fields,function(field){
8334
- if(field.searchable){
8356
+ if(field.searchable && SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1){
8335
8357
  searchableFields.push(field.name);
8336
8358
  }
8337
8359
  });