@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.
@@ -3847,7 +3847,7 @@ async function getFieldsTemplate(fields, display){
3847
3847
  let expandFieldsQuery = "";
3848
3848
  if(expandFields.length > 0){
3849
3849
  ___default__namespace.each(expandFields, function(field){
3850
- expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}:${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3850
+ expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3851
3851
  });
3852
3852
  }
3853
3853
 
@@ -6609,7 +6609,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6609
6609
  });
6610
6610
  // 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
6611
6611
  if(!_.isEmpty(omitedEmptyFormValue)){
6612
- let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
6612
+ let crudService = SteedosUI.getRef(data.$scopeId).parent.getComponentById("service_listview_" + data.objectName)
6613
6613
  crudService && crudService.setData({isFieldsFilterEmpty: false});
6614
6614
  // setData({ showFieldsFilter: true });//自动展开搜索栏
6615
6615
  }
@@ -12518,6 +12518,39 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
12518
12518
  });
12519
12519
  `;
12520
12520
 
12521
+ const onEventClickScript = `
12522
+ const data = event.data;
12523
+ const eventData = data.event;
12524
+ const appId = data.appId;
12525
+ const objectName = data.objectName;
12526
+ const eventId = data.event && data.event.id;
12527
+ doAction({
12528
+ "actionType": "link",
12529
+ "args": {
12530
+ "link": "/app/" + appId + "/" + objectName + "/view/" + eventId
12531
+ }
12532
+ });
12533
+ // doAction({
12534
+ // "actionType": "dialog",
12535
+ // "dialog": {
12536
+ // "type": "dialog",
12537
+ // "title": "",
12538
+ // "body": [
12539
+ // {
12540
+ // "type": "steedos-record-detail",
12541
+ // "objectApiName": "\${objectName}",
12542
+ // "recordId": data.event && data.event.id
12543
+ // }
12544
+ // ],
12545
+ // "closeOnEsc": false,
12546
+ // "closeOnOutside": false,
12547
+ // "showCloseButton": true,
12548
+ // "size": "lg",
12549
+ // "actions": []
12550
+ // }
12551
+ // });
12552
+ `;
12553
+
12521
12554
  const recordId = "${event.id}";
12522
12555
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
12523
12556
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
@@ -12563,11 +12596,16 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
12563
12596
  "weight": 0,
12564
12597
  "actions": [
12565
12598
  {
12566
- "actionType": "link",
12567
- "args": {
12568
- "link": "/app/${appId}/${objectName}/view/${event.id}"
12569
- }
12570
- }
12599
+ "actionType": "custom",
12600
+ "script": onEventClickScript
12601
+ },
12602
+ // amis 升级到 3.2后,以下的"actionType": "link"方式拿不到appId和objectName了
12603
+ // {
12604
+ // "actionType": "link",
12605
+ // "args": {
12606
+ // "link": "/app/${appId}/${objectName}/view/${event.id}"
12607
+ // }
12608
+ // }
12571
12609
  ]
12572
12610
  },
12573
12611
  "eventAdd": {
@@ -13734,8 +13772,8 @@ async function getRelatedListSchema(
13734
13772
  /*
13735
13773
  * @Author: baozhoutao@steedos.com
13736
13774
  * @Date: 2022-07-05 15:55:39
13737
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
13738
- * @LastEditTime: 2023-08-04 12:27:48
13775
+ * @LastEditors: baozhoutao@steedos.com
13776
+ * @LastEditTime: 2023-08-17 18:03:51
13739
13777
  * @Description:
13740
13778
  */
13741
13779
 
@@ -14106,7 +14144,7 @@ async function getTableSchema(
14106
14144
  if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && ___default.isString(filedInfo.reference_to) ){
14107
14145
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
14108
14146
  const rfFieldInfo = rfUiSchema.fields[displayName];
14109
- fields.push(Object.assign({}, rfFieldInfo, {name: column, expand: true, expandInfo: {fieldName, displayName}}));
14147
+ fields.push(Object.assign({}, rfFieldInfo, {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}}));
14110
14148
  }
14111
14149
  }else {
14112
14150
  if(uiSchema.fields[column]){
@@ -14122,7 +14160,7 @@ async function getTableSchema(
14122
14160
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
14123
14161
  const rfFieldInfo = rfUiSchema.fields[displayName];
14124
14162
  fields.push(Object.assign({}, rfFieldInfo,
14125
- {name: column.field, expand: true, expandInfo: {fieldName, displayName}},
14163
+ {name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: {fieldName, displayName}},
14126
14164
  {
14127
14165
  width: column.width,
14128
14166
  wrap: column.wrap, // wrap = true 是没效果的
@@ -18680,7 +18718,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
18680
18718
  schemaApi: {
18681
18719
  "method": "get",
18682
18720
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
18683
- "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 "),
18721
+ "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 "),
18684
18722
  "headers": {
18685
18723
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18686
18724
  }