@steedos-widgets/amis-lib 1.2.6-beta.18 → 1.2.6-beta.20

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.
package/dist/index.umd.js CHANGED
@@ -2683,6 +2683,35 @@
2683
2683
  // }
2684
2684
  // }
2685
2685
  // listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
2686
+ `;
2687
+ const onResetScript = `
2688
+ const scope = event.context.scoped;
2689
+ var filterForm = scope.parent.parent.getComponents().find(function(n){
2690
+ return n.props.type === "form";
2691
+ });
2692
+ var filterFormValues = filterForm.getValues();
2693
+ var listView = scope.parent.parent.parent.getComponents().find(function(n){
2694
+ return n.props.type === "crud";
2695
+ });
2696
+ const removedValues = {};
2697
+ for(var k in filterFormValues){
2698
+ if(/^__searchable__/.test(k)){
2699
+ removedValues[k] = "";
2700
+ }
2701
+ }
2702
+ if(!event.data.isLookup){
2703
+ // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
2704
+ const listViewId = event.data.listViewId;
2705
+ const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
2706
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
2707
+ if(localListViewProps){
2708
+ localListViewProps = JSON.parse(localListViewProps);
2709
+ for(var k in localListViewProps){
2710
+ removedValues[k] = "";
2711
+ }
2712
+ }
2713
+ }
2714
+ listView.handleFilterSubmit(removedValues);
2686
2715
  `;
2687
2716
  const dataProviderInited = `
2688
2717
  const objectName = data.objectName;
@@ -2877,6 +2906,21 @@
2877
2906
  }
2878
2907
  }
2879
2908
  },
2909
+ {
2910
+ "type": "button",
2911
+ "label": "重置",
2912
+ "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
2913
+ "onEvent": {
2914
+ "click": {
2915
+ "actions": [
2916
+ {
2917
+ "actionType": "custom",
2918
+ "script": onResetScript
2919
+ }
2920
+ ]
2921
+ }
2922
+ }
2923
+ },
2880
2924
  {
2881
2925
  "type": "button",
2882
2926
  "label": "设置搜索项",
@@ -3697,7 +3741,7 @@ setTimeout(()=>{
3697
3741
  "list_view": "${uiSchema.list_views[listName]}",
3698
3742
  "appId": "${appId}",
3699
3743
  "global": "${global}",
3700
- "objectName": "${objectName}",
3744
+ "targetObjectName": "${objectName}",
3701
3745
  },
3702
3746
  "body": [
3703
3747
  {
@@ -3737,7 +3781,7 @@ setTimeout(()=>{
3737
3781
  {
3738
3782
  "args": {
3739
3783
  // 直接使用recordId不能拿到数据,只能通过result里面拿数据
3740
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3784
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
3741
3785
  "blank": false
3742
3786
  },
3743
3787
  "actionType": "url",
@@ -3778,7 +3822,7 @@ setTimeout(()=>{
3778
3822
  "data": {
3779
3823
  "&": "$$",
3780
3824
  "listName": "${listName}",
3781
- "objectName": "${objectName}",
3825
+ "targetObjectName": "${objectName}",
3782
3826
  "list_view": "${uiSchema.list_views[listName]}",
3783
3827
  "appId": "${appId}",
3784
3828
  "global": "${global}"
@@ -3821,7 +3865,7 @@ setTimeout(()=>{
3821
3865
  "actions": [
3822
3866
  {
3823
3867
  "args": {
3824
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3868
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
3825
3869
  "blank": false
3826
3870
  },
3827
3871
  "actionType": "url",
@@ -3857,7 +3901,7 @@ setTimeout(()=>{
3857
3901
  "type": "dialog",
3858
3902
  "title": "重命名 列表视图",
3859
3903
  "data": {
3860
- "objectName": "${objectName}",
3904
+ "targetObjectName": "${objectName}",
3861
3905
  "recordId": "${uiSchema.list_views[listName]._id}",
3862
3906
  "appId": "${appId}"
3863
3907
  },
@@ -3878,7 +3922,7 @@ setTimeout(()=>{
3878
3922
  "actions": [
3879
3923
  {
3880
3924
  "args": {
3881
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${name}",
3925
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
3882
3926
  "blank": false
3883
3927
  },
3884
3928
  "actionType": "url",
@@ -3952,6 +3996,7 @@ setTimeout(()=>{
3952
3996
  "type": "dialog",
3953
3997
  "title": "过滤设置",
3954
3998
  "data": {
3999
+ "targetObjectName": "${objectName}",
3955
4000
  "objectName": "${objectName}",
3956
4001
  "recordId": "${uiSchema.list_views[listName]._id}",
3957
4002
  "listName": "${listName}",
@@ -3977,7 +4022,7 @@ setTimeout(()=>{
3977
4022
  "actions": [
3978
4023
  {
3979
4024
  "args": {
3980
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4025
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
3981
4026
  "blank": false
3982
4027
  },
3983
4028
  "actionType": "url",
@@ -4015,6 +4060,7 @@ setTimeout(()=>{
4015
4060
  "title": "显示的列",
4016
4061
  "data": {
4017
4062
  "&": "$$",
4063
+ "targetObjectName": "${objectName}",
4018
4064
  "objectName": "${objectName}",
4019
4065
  "recordId": "${uiSchema.list_views[listName]._id}",
4020
4066
  "listName": "${listName}",
@@ -4040,7 +4086,7 @@ setTimeout(()=>{
4040
4086
  "actions": [
4041
4087
  {
4042
4088
  "args": {
4043
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4089
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4044
4090
  "blank": false
4045
4091
  },
4046
4092
  "actionType": "url"
@@ -4076,6 +4122,7 @@ setTimeout(()=>{
4076
4122
  "title": "弹框标题",
4077
4123
  "data": {
4078
4124
  "&": "$$",
4125
+ "targetObjectName": "${objectName}",
4079
4126
  "objectName": "${objectName}",
4080
4127
  "recordId": "${uiSchema.list_views[listName]._id}",
4081
4128
  "listName": "${listName}",
@@ -4101,7 +4148,7 @@ setTimeout(()=>{
4101
4148
  "actions": [
4102
4149
  {
4103
4150
  "args": {
4104
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4151
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
4105
4152
  "blank": false
4106
4153
  },
4107
4154
  "actionType": "url"
@@ -5002,11 +5049,12 @@ setTimeout(()=>{
5002
5049
  autoComplete: apiInfo,
5003
5050
  searchable: true,
5004
5051
  };
5052
+ //删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
5005
5053
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
5006
5054
  <span role='img' aria-label='smile' class='anticon anticon-smile'>
5007
5055
  <span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
5008
5056
  <svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
5009
- <use xlink:href='\${context.rootUrl}/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
5057
+ <use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
5010
5058
  </svg>
5011
5059
  </span>
5012
5060
  </span>
@@ -7051,8 +7099,9 @@ setTimeout(()=>{
7051
7099
  const url = getNameTplUrl(nameField, options);
7052
7100
 
7053
7101
  const columnLines = getMobileLines(tpls);
7054
-
7055
- columns.push({
7102
+
7103
+
7104
+ let column = {
7056
7105
  name: nameField.name,
7057
7106
  label: nameField.label,
7058
7107
  sortable: nameField.sortable,
@@ -7061,13 +7110,66 @@ setTimeout(()=>{
7061
7110
  actionType: "link",
7062
7111
  link: url,
7063
7112
  innerClassName: "steedos-listview-item block text-gray-500",
7064
- body:{
7113
+ body: {
7065
7114
  "type": "wrapper",
7066
7115
  "body": columnLines,
7067
7116
  "size": "none",
7068
7117
  "className": "p-1"
7069
7118
  }
7070
- });
7119
+ };
7120
+
7121
+ if(options.objectName === 'cms_files'){
7122
+ if(window.Meteor?.isCordova){
7123
+ column = {
7124
+ ...column,
7125
+ actionType: "",
7126
+ link: "",
7127
+ onEvent: {
7128
+ "click": {
7129
+ "actions": [
7130
+ {
7131
+ "script": `
7132
+ let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
7133
+ Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
7134
+ `,
7135
+ "actionType": "custom"
7136
+ }
7137
+ ],
7138
+ "weight": 0
7139
+ }
7140
+ }
7141
+ };
7142
+ }else {
7143
+ column = {
7144
+ ...column,
7145
+ actionType: "",
7146
+ link: "",
7147
+ onEvent: {
7148
+ "click": {
7149
+ "actions": [
7150
+ {
7151
+ "args": {
7152
+ "api": {
7153
+ "url": url,
7154
+ "method": "get",
7155
+ "headers": {
7156
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7157
+ }
7158
+ }
7159
+ },
7160
+ "actionType": "download"
7161
+ }
7162
+ ],
7163
+ "weight": 0
7164
+ }
7165
+ }
7166
+ };
7167
+ }
7168
+
7169
+ }
7170
+
7171
+ columns.push(column);
7172
+
7071
7173
 
7072
7174
  return columns;
7073
7175
  }
@@ -8158,7 +8260,7 @@ setTimeout(()=>{
8158
8260
  * @Author: baozhoutao@steedos.com
8159
8261
  * @Date: 2022-07-05 15:55:39
8160
8262
  * @LastEditors: Please set LastEditors
8161
- * @LastEditTime: 2023-04-20 11:43:14
8263
+ * @LastEditTime: 2023-05-08 16:34:25
8162
8264
  * @Description:
8163
8265
  */
8164
8266
 
@@ -8412,7 +8514,7 @@ setTimeout(()=>{
8412
8514
  }
8413
8515
  function getRelatedListProps(uiSchema, listViewName, ctx) {
8414
8516
  if (ctx.columns) {
8415
- const sort = getListViewSort(ctx.sort);
8517
+ const sort = getListViewSort({sort: ctx.sort});
8416
8518
  let { filters , filtersFunction} = ctx;
8417
8519
  if(!filtersFunction && filters){
8418
8520
  filtersFunction = str2function(