@steedos-widgets/sortable 6.3.0-beta.15 → 6.3.0-beta.17

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.
@@ -54495,6 +54495,29 @@ function getAmisStaticFieldType(type, readonly, options){
54495
54495
  }
54496
54496
  }
54497
54497
 
54498
+ /*
54499
+ * @Author: baozhoutao@steedos.com
54500
+ * @Date: 2022-07-13 15:18:03
54501
+ * @LastEditors: baozhoutao@steedos.com
54502
+ * @LastEditTime: 2023-04-11 10:34:26
54503
+ * @Description:
54504
+ */
54505
+
54506
+ async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
54507
+ const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
54508
+ const page = await fetchAPI(api);
54509
+ if (page && page.schema) {
54510
+ page.schema = JSON.parse(page.schema);
54511
+ if(page.schema.data){
54512
+ delete page.schema.data.recordId;
54513
+ delete page.schema.data.objectName;
54514
+ delete page.schema.data.context;
54515
+ delete page.schema.data.global;
54516
+ }
54517
+ return page;
54518
+ }
54519
+ }
54520
+
54498
54521
  /*
54499
54522
  * @Author: baozhoutao@steedos.com
54500
54523
  * @Date: 2022-10-28 14:15:09
@@ -54518,9 +54541,74 @@ const getAmisFieldType$1 = (steedosField, readonly)=>{
54518
54541
  return getAmisStaticFieldType(steedosField.type === 'avatar' ? 'image' : steedosField.type, readonly, {multiple: steedosField.multiple});
54519
54542
  };
54520
54543
 
54521
- const getAmisFileReadonlySchema = (steedosField)=>{
54544
+ async function getLookupLinkOnClick(field, options) {
54545
+ const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
54546
+
54547
+ const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
54548
+ "recordId": "${value}",
54549
+ "data": {
54550
+ ...recordPage.schema.data,
54551
+ "_inDrawer": true, // 用于判断是否在抽屉中
54552
+ "recordLoaded": false, // 重置数据加载状态
54553
+ "objectName": options.objectName,
54554
+ }
54555
+ }) : {
54556
+ "type": "steedos-record-detail",
54557
+ "objectApiName": options.objectName,
54558
+ "recordId": "${value}",
54559
+ "showBackButton": false,
54560
+ "showButtons": true,
54561
+ "data": {
54562
+ "_inDrawer": true, // 用于判断是否在抽屉中
54563
+ "recordLoaded": false, // 重置数据加载状态
54564
+ }
54565
+ };
54566
+ return {
54567
+ "click": {
54568
+ "actions": [
54569
+ // {
54570
+ // "type": "custom",
54571
+ // "script": `
54572
+ // let fileRecordId = url.match(${regFileRecordId})[2];
54573
+ // console.log('fileRecordId:',fileRecordId);
54574
+ // event.data.recordId = fileRecordId;
54575
+ // `,
54576
+ // },
54577
+ {
54578
+ "actionType": "drawer",
54579
+ "drawer": {
54580
+ "type": "drawer",
54581
+ "title": " ",
54582
+ "headerClassName": "hidden",
54583
+ "size": "lg",
54584
+ "bodyClassName": "p-0 m-0 bg-gray-100",
54585
+ "closeOnEsc": true,
54586
+ "closeOnOutside": true,
54587
+ "resizable": true,
54588
+ "actions": [],
54589
+ "body": [
54590
+ drawerRecordDetailSchema
54591
+ ],
54592
+ "className": "steedos-record-detail-drawer app-popover"
54593
+ },
54594
+ "preventDefault": true
54595
+ }
54596
+ ]
54597
+ }
54598
+ }
54599
+ }
54600
+
54601
+ const getAmisFileReadonlySchema = async (steedosField,ctx)=>{
54522
54602
  const type = steedosField.type;
54603
+ const { appId, formFactor } = ctx.amisData || {};
54523
54604
  const amisFieldType = getAmisFieldType$1(steedosField, true);
54605
+
54606
+ let lookupATagClick = 'onclick="return false;"';
54607
+
54608
+ if(window.innerWidth < 768){
54609
+ lookupATagClick = "";
54610
+ }
54611
+
54524
54612
  if(_.includes(['avatar','image'], type)){
54525
54613
  return {
54526
54614
  type: amisFieldType,
@@ -54555,13 +54643,34 @@ const getAmisFileReadonlySchema = (steedosField)=>{
54555
54643
  }
54556
54644
  }
54557
54645
  } : {
54558
- type: amisFieldType,
54559
- tpl: `
54560
- <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
54561
- <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
54562
- <% fileData.forEach(function(item) { %>
54563
- <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
54564
- <% });} %>`
54646
+ // type: amisFieldType,
54647
+ // tpl: `
54648
+ // <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
54649
+ // <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
54650
+ // <% fileData.forEach(function(item) { %>
54651
+ // <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
54652
+ // <% });} %>`
54653
+ "type": "control",
54654
+ "body": {
54655
+ type: 'each',
54656
+ placeholder: "",
54657
+ // className: `steedos-field-lookup-each flex flex-wrap gap-2`,
54658
+ source: `\${_display.${steedosField.name}|asArray}`,
54659
+ items: {
54660
+ type: 'static',
54661
+ labelClassName: "hidden",
54662
+ label: false,
54663
+ className: 'm-0',
54664
+ tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
54665
+ // tpl: "<%= item.name >",
54666
+ // onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
54667
+ onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick(steedosField, {
54668
+ appId,
54669
+ objectName: "cfs_files_filerecord",
54670
+ formFactor
54671
+ })
54672
+ }
54673
+ }
54565
54674
  }
54566
54675
  }
54567
54676
  };
@@ -54623,8 +54732,8 @@ const getAmisFileEditSchema = (steedosField)=>{
54623
54732
  return convertData;
54624
54733
  };
54625
54734
 
54626
- const getAmisFileSchema = (steedosField, readonly)=>{
54627
- return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
54735
+ const getAmisFileSchema = async (steedosField, readonly, ctx)=>{
54736
+ return readonly ? await getAmisFileReadonlySchema(steedosField,ctx) : getAmisFileEditSchema(steedosField);
54628
54737
  };
54629
54738
 
54630
54739
  var frontend_field_group_generalization$1 = "General";
@@ -55019,29 +55128,6 @@ instance
55019
55128
  }
55020
55129
  });
55021
55130
 
55022
- /*
55023
- * @Author: baozhoutao@steedos.com
55024
- * @Date: 2022-07-13 15:18:03
55025
- * @LastEditors: baozhoutao@steedos.com
55026
- * @LastEditTime: 2023-04-11 10:34:26
55027
- * @Description:
55028
- */
55029
-
55030
- async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
55031
- const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
55032
- const page = await fetchAPI(api);
55033
- if (page && page.schema) {
55034
- page.schema = JSON.parse(page.schema);
55035
- if(page.schema.data){
55036
- delete page.schema.data.recordId;
55037
- delete page.schema.data.objectName;
55038
- delete page.schema.data.context;
55039
- delete page.schema.data.global;
55040
- }
55041
- return page;
55042
- }
55043
- }
55044
-
55045
55131
  async function getQuickEditSchema(object, columnField, options){
55046
55132
  let field = object.fields[columnField.name];
55047
55133
  //判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
@@ -59934,8 +60020,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
59934
60020
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
59935
60021
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
59936
60022
  // lookup字段配置过滤条件就强制不显示新建按钮
59937
- let isHasFilters = (field.filters || field.filtersFunction || field._filtersFunction) ? true : false;
59938
- if (isAllowCreate && isCreate && !isHasFilters) {
60023
+ let hasFilters = !lodash.exports.isEmpty(field.filters) || !!field.filtersFunction || !!field._filtersFunction;
60024
+ if (isAllowCreate && isCreate && !hasFilters) {
59939
60025
  const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
59940
60026
  new_button.align = "right";
59941
60027
  // 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
@@ -61269,13 +61355,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
61269
61355
  };
61270
61356
  break;
61271
61357
  case 'avatar':
61272
- convertData = getAmisFileSchema(field, readonly);
61358
+ convertData = await getAmisFileSchema(field, readonly, ctx);
61273
61359
  break;
61274
61360
  case 'image':
61275
- convertData = getAmisFileSchema(field, readonly);
61361
+ convertData = await getAmisFileSchema(field, readonly, ctx);
61276
61362
  break;
61277
61363
  case 'file':
61278
- convertData = getAmisFileSchema(field, readonly);
61364
+ convertData = await getAmisFileSchema(field, readonly, ctx);
61279
61365
  break;
61280
61366
  case 'formula':
61281
61367
  if(readonly){