@steedos-widgets/sortable 6.3.0-beta.16 → 6.3.0-beta.18

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的单元格编辑
@@ -57190,21 +57276,11 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
57190
57276
  };
57191
57277
  }
57192
57278
 
57193
-
57194
- /**
57195
- * 列表视图顶部放大镜过滤条件栏amisSchema
57196
- * @param {*} objectSchema 对象UISchema
57197
- * @returns amisSchema
57198
- */
57199
- async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ctx) {
57200
- const fieldsFilterBarSchema = await getObjectFieldsFilterBarSchema(objectSchema, ctx);
57201
- return fieldsFilterBarSchema;
57202
- }
57203
-
57204
57279
  const getNewListviewButtonSchema = ()=>{
57205
57280
  return {
57206
57281
  "type": "button",
57207
57282
  "label": instance.t('frontend_listview_control_new_label'),
57283
+ "className": "steedos-listview-new-button",
57208
57284
  "onEvent": {
57209
57285
  "click": {
57210
57286
  "weight": 0,
@@ -57411,6 +57487,17 @@ function fieldsExtend$5(){
57411
57487
  }
57412
57488
  }
57413
57489
 
57490
+
57491
+ /**
57492
+ * 列表视图顶部放大镜过滤条件栏amisSchema
57493
+ * @param {*} objectSchema 对象UISchema
57494
+ * @returns amisSchema
57495
+ */
57496
+ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ctx) {
57497
+ const fieldsFilterBarSchema = await getObjectFieldsFilterBarSchema(objectSchema, ctx);
57498
+ return fieldsFilterBarSchema;
57499
+ }
57500
+
57414
57501
  const getCopyListviewButtonSchema = ()=>{
57415
57502
  return {
57416
57503
  "type": "button",
@@ -61269,13 +61356,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
61269
61356
  };
61270
61357
  break;
61271
61358
  case 'avatar':
61272
- convertData = getAmisFileSchema(field, readonly);
61359
+ convertData = await getAmisFileSchema(field, readonly, ctx);
61273
61360
  break;
61274
61361
  case 'image':
61275
- convertData = getAmisFileSchema(field, readonly);
61362
+ convertData = await getAmisFileSchema(field, readonly, ctx);
61276
61363
  break;
61277
61364
  case 'file':
61278
- convertData = getAmisFileSchema(field, readonly);
61365
+ convertData = await getAmisFileSchema(field, readonly, ctx);
61279
61366
  break;
61280
61367
  case 'formula':
61281
61368
  if(readonly){