@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.
@@ -3819,7 +3819,7 @@ async function getFieldsTemplate(fields, display){
3819
3819
  let expandFieldsQuery = "";
3820
3820
  if(expandFields.length > 0){
3821
3821
  ___default.each(expandFields, function(field){
3822
- expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}:${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3822
+ expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3823
3823
  });
3824
3824
  }
3825
3825
 
@@ -6581,7 +6581,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6581
6581
  });
6582
6582
  // 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
6583
6583
  if(!_.isEmpty(omitedEmptyFormValue)){
6584
- let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
6584
+ let crudService = SteedosUI.getRef(data.$scopeId).parent.getComponentById("service_listview_" + data.objectName)
6585
6585
  crudService && crudService.setData({isFieldsFilterEmpty: false});
6586
6586
  // setData({ showFieldsFilter: true });//自动展开搜索栏
6587
6587
  }
@@ -12490,6 +12490,39 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
12490
12490
  });
12491
12491
  `;
12492
12492
 
12493
+ const onEventClickScript = `
12494
+ const data = event.data;
12495
+ const eventData = data.event;
12496
+ const appId = data.appId;
12497
+ const objectName = data.objectName;
12498
+ const eventId = data.event && data.event.id;
12499
+ doAction({
12500
+ "actionType": "link",
12501
+ "args": {
12502
+ "link": "/app/" + appId + "/" + objectName + "/view/" + eventId
12503
+ }
12504
+ });
12505
+ // doAction({
12506
+ // "actionType": "dialog",
12507
+ // "dialog": {
12508
+ // "type": "dialog",
12509
+ // "title": "",
12510
+ // "body": [
12511
+ // {
12512
+ // "type": "steedos-record-detail",
12513
+ // "objectApiName": "\${objectName}",
12514
+ // "recordId": data.event && data.event.id
12515
+ // }
12516
+ // ],
12517
+ // "closeOnEsc": false,
12518
+ // "closeOnOutside": false,
12519
+ // "showCloseButton": true,
12520
+ // "size": "lg",
12521
+ // "actions": []
12522
+ // }
12523
+ // });
12524
+ `;
12525
+
12493
12526
  const recordId = "${event.id}";
12494
12527
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
12495
12528
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
@@ -12535,11 +12568,16 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
12535
12568
  "weight": 0,
12536
12569
  "actions": [
12537
12570
  {
12538
- "actionType": "link",
12539
- "args": {
12540
- "link": "/app/${appId}/${objectName}/view/${event.id}"
12541
- }
12542
- }
12571
+ "actionType": "custom",
12572
+ "script": onEventClickScript
12573
+ },
12574
+ // amis 升级到 3.2后,以下的"actionType": "link"方式拿不到appId和objectName了
12575
+ // {
12576
+ // "actionType": "link",
12577
+ // "args": {
12578
+ // "link": "/app/${appId}/${objectName}/view/${event.id}"
12579
+ // }
12580
+ // }
12543
12581
  ]
12544
12582
  },
12545
12583
  "eventAdd": {
@@ -13706,8 +13744,8 @@ async function getRelatedListSchema(
13706
13744
  /*
13707
13745
  * @Author: baozhoutao@steedos.com
13708
13746
  * @Date: 2022-07-05 15:55:39
13709
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
13710
- * @LastEditTime: 2023-08-04 12:27:48
13747
+ * @LastEditors: baozhoutao@steedos.com
13748
+ * @LastEditTime: 2023-08-17 18:03:51
13711
13749
  * @Description:
13712
13750
  */
13713
13751
 
@@ -14078,7 +14116,7 @@ async function getTableSchema(
14078
14116
  if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to) ){
14079
14117
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
14080
14118
  const rfFieldInfo = rfUiSchema.fields[displayName];
14081
- fields.push(Object.assign({}, rfFieldInfo, {name: column, expand: true, expandInfo: {fieldName, displayName}}));
14119
+ fields.push(Object.assign({}, rfFieldInfo, {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}}));
14082
14120
  }
14083
14121
  }else {
14084
14122
  if(uiSchema.fields[column]){
@@ -14094,7 +14132,7 @@ async function getTableSchema(
14094
14132
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
14095
14133
  const rfFieldInfo = rfUiSchema.fields[displayName];
14096
14134
  fields.push(Object.assign({}, rfFieldInfo,
14097
- {name: column.field, expand: true, expandInfo: {fieldName, displayName}},
14135
+ {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}},
14098
14136
  {
14099
14137
  width: column.width,
14100
14138
  wrap: column.wrap, // wrap = true 是没效果的
@@ -18652,7 +18690,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
18652
18690
  schemaApi: {
18653
18691
  "method": "get",
18654
18692
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
18655
- "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 "),
18693
+ "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 "),
18656
18694
  "headers": {
18657
18695
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18658
18696
  }