@steedos-widgets/amis-lib 1.3.0-beta.10 → 1.3.0-beta.11

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
@@ -400,7 +400,7 @@ function getContrastColor(bgColor) {
400
400
  * @Author: baozhoutao@steedos.com
401
401
  * @Date: 2022-05-23 09:53:08
402
402
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
403
- * @LastEditTime: 2023-08-03 18:07:54
403
+ * @LastEditTime: 2023-08-29 15:04:39
404
404
  * @Description:
405
405
  */
406
406
 
@@ -504,7 +504,7 @@ function getRelatedFieldTpl(field, ctx){
504
504
  linkTarget = "target='_blank'";
505
505
  }
506
506
 
507
- const onlyDisplayLabel = ctx.onlyDisplayLabel;
507
+ const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
508
508
 
509
509
  let fieldDataStrTpl = `data._display.${field.name}`;
510
510
 
@@ -515,7 +515,7 @@ function getRelatedFieldTpl(field, ctx){
515
515
  if(_.isString(field.reference_to) || !field.reference_to){
516
516
  if(field.multiple){
517
517
  let labelTpl = `<%=item.label%>`;
518
- if(!onlyDisplayLabel){
518
+ if(!onlyDisplayLookLabel){
519
519
  const href = Router.getObjectDetailPath({
520
520
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
521
521
  });
@@ -533,7 +533,7 @@ function getRelatedFieldTpl(field, ctx){
533
533
  objectNameTpl = `\${${field.name}.objectName}`;
534
534
  recordIdTpl = `\${${field.name}.value}`;
535
535
  }
536
- if(!onlyDisplayLabel){
536
+ if(!onlyDisplayLookLabel){
537
537
  const href = Router.getObjectDetailPath({
538
538
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
539
539
  });
@@ -545,7 +545,7 @@ function getRelatedFieldTpl(field, ctx){
545
545
 
546
546
  }else {
547
547
  let labelTpl = `<%=item.label%>`;
548
- if(!onlyDisplayLabel){
548
+ if(!onlyDisplayLookLabel){
549
549
  const href = Router.getObjectDetailPath({
550
550
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
551
551
  });
@@ -598,7 +598,7 @@ function getLocationTpl(field){
598
598
  }
599
599
 
600
600
  async function getFieldTpl (field, options){
601
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLabel){
601
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
602
602
  return getNameTpl(field, options)
603
603
  }
604
604
  switch (field.type) {
@@ -3052,6 +3052,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3052
3052
  return {
3053
3053
  "type": "button",
3054
3054
  "icon": "fa fa-angle-down",
3055
+ "className": "mr-0",
3055
3056
  "onEvent": {
3056
3057
  "click": {
3057
3058
  "actions": [
@@ -3103,7 +3104,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3103
3104
  name: button.name,
3104
3105
  objectName: button.objectName,
3105
3106
  visibleOn: getButtonVisibleOn$1(button),
3106
- className: `button_${button.name}`
3107
+ className: `button_${button.name} mr-0`
3107
3108
  }
3108
3109
  });
3109
3110
  }
@@ -6020,13 +6021,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
6020
6021
  }
6021
6022
 
6022
6023
  let pickerSchema = null;
6023
- if(ctx.formFactor === 'SMALL'){
6024
- pickerSchema = await getListSchema$1(tableFields, {
6025
- top: top,
6026
- ...ctx,
6027
- actions: false
6028
- });
6029
- }else {
6024
+ {
6030
6025
  pickerSchema = await getTableSchema$1(tableFields, {
6031
6026
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
6032
6027
  top: top,
@@ -6395,6 +6390,7 @@ async function lookupToAmis(field, readonly, ctx){
6395
6390
  }
6396
6391
 
6397
6392
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
6393
+ ctx.onlyDisplayLookLabel = true;
6398
6394
  if(ctx.idsDependOn){
6399
6395
  // ids人员点选模式
6400
6396
  return await lookupToAmisIdsPicker(field, readonly, ctx);
@@ -6498,6 +6494,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6498
6494
  pickerSchema = await getTableSchema$1(tableFields, {
6499
6495
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
6500
6496
  top: top,
6497
+ isLookup: true,
6501
6498
  ...ctx
6502
6499
  });
6503
6500
 
@@ -6540,8 +6537,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
6540
6537
  /*
6541
6538
  * @Author: baozhoutao@steedos.com
6542
6539
  * @Date: 2023-01-13 17:27:54
6543
- * @LastEditors: liaodaxue
6544
- * @LastEditTime: 2023-07-27 17:33:54
6540
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
6541
+ * @LastEditTime: 2023-08-28 17:45:38
6545
6542
  * @Description:
6546
6543
  */
6547
6544
 
@@ -6603,14 +6600,29 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
6603
6600
 
6604
6601
  const getHtmlFieldSchema = (field, readonly, ctx)=>{
6605
6602
  if(readonly){
6603
+ // return {
6604
+ // "type": "control",
6605
+ // "label": field.label,
6606
+ // "body": {
6607
+ // "type": "html",
6608
+ // "name": field.name
6609
+ // }
6610
+ // }
6606
6611
  return {
6607
- "type": "control",
6608
- "label": field.label,
6609
- "body": {
6610
- "type": "html",
6611
- "name": field.name
6612
- }
6612
+ "type": "input-rich-text",
6613
+ "receiver": "${context.rootUrl}/s3/images",
6614
+ "name": field.name,
6615
+ "options": {
6616
+ "plugins": [
6617
+ "autoresize"
6618
+ ],
6619
+ // "max_height": 2000,
6620
+ "statusbar": false,
6621
+ "readonly": true,
6622
+ "toolbar": false,
6623
+ "menubar": false
6613
6624
  }
6625
+ }
6614
6626
  }else {
6615
6627
  return {
6616
6628
  "type": "input-rich-text",
@@ -8093,7 +8105,7 @@ async function getMobileTableColumns(fields, options){
8093
8105
  let tpl = "";
8094
8106
  if(field.is_name || field.name === options.labelFieldName){
8095
8107
  nameField = field;
8096
- options.onlyDisplayLabel = true;
8108
+ options.onlyDisplayLookLabel = true;
8097
8109
  tpl = await getFieldTpl(field, options);
8098
8110
  }
8099
8111
  else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
@@ -8102,7 +8114,7 @@ async function getMobileTableColumns(fields, options){
8102
8114
  }
8103
8115
  else {
8104
8116
  if(field.type === 'lookup' || field.type === 'master_detail'){
8105
- options.onlyDisplayLabel = true;
8117
+ options.onlyDisplayLookLabel = true;
8106
8118
  }
8107
8119
  tpl = await getFieldTpl(field, options);
8108
8120
  }
@@ -8304,7 +8316,12 @@ async function getTableSchema$1(fields, options){
8304
8316
  options = {};
8305
8317
  }
8306
8318
  let columns = [];
8307
- if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
8319
+ let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
8320
+ if(isLookup){
8321
+ // 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
8322
+ useMobileColumns = false;
8323
+ }
8324
+ if(useMobileColumns){
8308
8325
  columns = await getMobileTableColumns(fields, options);
8309
8326
  }
8310
8327
  else {
@@ -8324,7 +8341,7 @@ async function getTableSchema$1(fields, options){
8324
8341
  columns: columns,
8325
8342
  syncLocation: false,
8326
8343
  keepItemSelectionOnPageChange: true,
8327
- checkOnItemClick: false,
8344
+ checkOnItemClick: isLookup ? true : false,
8328
8345
  labelTpl: `\${${options.labelFieldName}}`,
8329
8346
  autoFillHeight: false, // 自动高度效果不理想,先关闭
8330
8347
  columnsTogglable: false,
@@ -10291,7 +10308,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
10291
10308
  * @Author: baozhoutao@steedos.com
10292
10309
  * @Date: 2022-07-05 15:55:39
10293
10310
  * @LastEditors: liaodaxue
10294
- * @LastEditTime: 2023-08-21 14:50:21
10311
+ * @LastEditTime: 2023-08-28 14:55:23
10295
10312
  * @Description:
10296
10313
  */
10297
10314
 
@@ -10437,11 +10454,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10437
10454
  // }
10438
10455
  const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
10439
10456
  const componentId = `steedos-record-related-list-${relatedObjectName}`;
10457
+ const isMobile = window.innerWidth < 768;
10458
+ let headerToolbar = [];
10459
+ if(!isMobile){
10460
+ headerToolbar.push("bulkActions");
10461
+ }
10440
10462
  const options = {
10441
10463
  globalFilter,
10442
10464
  defaults: {
10443
10465
  listSchema: {
10444
- headerToolbar:["bulkActions"],
10466
+ headerToolbar,
10445
10467
  columnsTogglable: false,
10446
10468
  onEvent: {
10447
10469
  [`@data.changed.${relatedObjectName}`]: {