@steedos-widgets/amis-object 1.2.40 → 1.2.41

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.
@@ -3845,7 +3845,7 @@
3845
3845
  let expandFieldsQuery = "";
3846
3846
  if(expandFields.length > 0){
3847
3847
  ___default__namespace.each(expandFields, function(field){
3848
- expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}:${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3848
+ expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3849
3849
  });
3850
3850
  }
3851
3851
 
@@ -6607,7 +6607,7 @@
6607
6607
  });
6608
6608
  // 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
6609
6609
  if(!_.isEmpty(omitedEmptyFormValue)){
6610
- let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
6610
+ let crudService = SteedosUI.getRef(data.$scopeId).parent.getComponentById("service_listview_" + data.objectName)
6611
6611
  crudService && crudService.setData({isFieldsFilterEmpty: false});
6612
6612
  // setData({ showFieldsFilter: true });//自动展开搜索栏
6613
6613
  }
@@ -12516,6 +12516,39 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
12516
12516
  });
12517
12517
  `;
12518
12518
 
12519
+ const onEventClickScript = `
12520
+ const data = event.data;
12521
+ const eventData = data.event;
12522
+ const appId = data.appId;
12523
+ const objectName = data.objectName;
12524
+ const eventId = data.event && data.event.id;
12525
+ doAction({
12526
+ "actionType": "link",
12527
+ "args": {
12528
+ "link": "/app/" + appId + "/" + objectName + "/view/" + eventId
12529
+ }
12530
+ });
12531
+ // doAction({
12532
+ // "actionType": "dialog",
12533
+ // "dialog": {
12534
+ // "type": "dialog",
12535
+ // "title": "",
12536
+ // "body": [
12537
+ // {
12538
+ // "type": "steedos-record-detail",
12539
+ // "objectApiName": "\${objectName}",
12540
+ // "recordId": data.event && data.event.id
12541
+ // }
12542
+ // ],
12543
+ // "closeOnEsc": false,
12544
+ // "closeOnOutside": false,
12545
+ // "showCloseButton": true,
12546
+ // "size": "lg",
12547
+ // "actions": []
12548
+ // }
12549
+ // });
12550
+ `;
12551
+
12519
12552
  const recordId = "${event.id}";
12520
12553
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
12521
12554
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
@@ -12561,11 +12594,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
12561
12594
  "weight": 0,
12562
12595
  "actions": [
12563
12596
  {
12564
- "actionType": "link",
12565
- "args": {
12566
- "link": "/app/${appId}/${objectName}/view/${event.id}"
12567
- }
12568
- }
12597
+ "actionType": "custom",
12598
+ "script": onEventClickScript
12599
+ },
12600
+ // amis 升级到 3.2后,以下的"actionType": "link"方式拿不到appId和objectName了
12601
+ // {
12602
+ // "actionType": "link",
12603
+ // "args": {
12604
+ // "link": "/app/${appId}/${objectName}/view/${event.id}"
12605
+ // }
12606
+ // }
12569
12607
  ]
12570
12608
  },
12571
12609
  "eventAdd": {
@@ -13732,8 +13770,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
13732
13770
  /*
13733
13771
  * @Author: baozhoutao@steedos.com
13734
13772
  * @Date: 2022-07-05 15:55:39
13735
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
13736
- * @LastEditTime: 2023-08-04 12:27:48
13773
+ * @LastEditors: baozhoutao@steedos.com
13774
+ * @LastEditTime: 2023-08-17 18:03:51
13737
13775
  * @Description:
13738
13776
  */
13739
13777
 
@@ -14104,7 +14142,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
14104
14142
  if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && ___default.isString(filedInfo.reference_to) ){
14105
14143
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
14106
14144
  const rfFieldInfo = rfUiSchema.fields[displayName];
14107
- fields.push(Object.assign({}, rfFieldInfo, {name: column, expand: true, expandInfo: {fieldName, displayName}}));
14145
+ fields.push(Object.assign({}, rfFieldInfo, {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}}));
14108
14146
  }
14109
14147
  }else {
14110
14148
  if(uiSchema.fields[column]){
@@ -14120,7 +14158,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
14120
14158
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
14121
14159
  const rfFieldInfo = rfUiSchema.fields[displayName];
14122
14160
  fields.push(Object.assign({}, rfFieldInfo,
14123
- {name: column.field, expand: true, expandInfo: {fieldName, displayName}},
14161
+ {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}},
14124
14162
  {
14125
14163
  width: column.width,
14126
14164
  wrap: column.wrap, // wrap = true 是没效果的
@@ -18678,7 +18716,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
18678
18716
  schemaApi: {
18679
18717
  "method": "get",
18680
18718
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
18681
- "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
18719
+ "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
18682
18720
  "headers": {
18683
18721
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18684
18722
  }