@steedos-widgets/amis-lib 1.1.3 → 1.1.4-beta.2

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
@@ -832,7 +832,7 @@
832
832
  ${getScriptForSimplifiedValueForFileFields(fields)}
833
833
  let query = \`mutation{record: \${objectName}__insert(doc: {__saveData}){_id}}\`;
834
834
  if(formData.recordId && formData.recordId !='new'){
835
- query = \`mutation{record: \${objectName}__update(id: "\${formData._id}", doc: {__saveData}){_id}}\`;
835
+ query = \`mutation{record: \${objectName}__update(id: "\${formData.recordId}", doc: {__saveData}){_id}}\`;
836
836
  };
837
837
  delete formData._id;
838
838
  let __saveData = JSON.stringify(JSON.stringify(formData));
@@ -1572,8 +1572,8 @@
1572
1572
  /*
1573
1573
  * @Author: 殷亮辉 yinlianghui@hotoa.com
1574
1574
  * @Date: 2023-03-22 09:31:21
1575
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1576
- * @LastEditTime: 2023-03-27 16:03:34
1575
+ * @LastEditors: Please set LastEditors
1576
+ * @LastEditTime: 2023-03-28 14:06:47
1577
1577
  */
1578
1578
  const getSchema$2 = (uiSchema)=>{
1579
1579
  return {
@@ -1634,7 +1634,7 @@
1634
1634
  "data": {
1635
1635
  "objectName": "${_master.objectName}"
1636
1636
  },
1637
- "expression": "${_master.objectName}"
1637
+ "expression": `\${_master.objectName != '${uiSchema.name}' && _master.objectName}`
1638
1638
  }
1639
1639
  ]
1640
1640
  }
@@ -2058,7 +2058,7 @@
2058
2058
  if(visible.trim().startsWith('function')){
2059
2059
  return `${visible}.apply({
2060
2060
  object: uiSchema
2061
- }, [objectName, _id, recordPermissions, data])`
2061
+ }, [objectName, _id, record.recordPermissions, data])`
2062
2062
  }
2063
2063
  return visible;
2064
2064
  }
@@ -3979,6 +3979,10 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
3979
3979
  }
3980
3980
  }
3981
3981
 
3982
+ const enable_tree = ${refObjectConfig.enable_tree};
3983
+ if(enable_tree){
3984
+ pageSize = 10000;
3985
+ }
3982
3986
  api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
3983
3987
  return api;
3984
3988
  `;
@@ -4052,7 +4056,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
4052
4056
  new_button.align = "right";
4053
4057
  pickerSchema.headerToolbar.push(new_button);
4054
4058
  }
4055
- pickerSchema.footerToolbar = getObjectFooterToolbar();
4059
+ pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
4056
4060
  if(ctx.filterVisible !== false){
4057
4061
  let filterLoopCount = ctx.filterLoopCount || 0;
4058
4062
  filterLoopCount++;
@@ -4146,7 +4150,10 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
4146
4150
  apiInfo = {
4147
4151
  method: "post",
4148
4152
  url: getApi$2(),
4149
- data: {query: '{objects(filters: ["_id", "=", "-1"]){_id}}', $: "$$"}
4153
+ data: {query: '{objects(filters: ["_id", "=", "-1"]){_id}}', $: "$$"},
4154
+ "headers": {
4155
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
4156
+ }
4150
4157
  };
4151
4158
  }
4152
4159
 
@@ -5439,7 +5446,28 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
5439
5446
  if(defaultData && _.isObject(defaultData) && !_.isArray(defaultData)){
5440
5447
  defaultValues = Object.assign({}, defaultValues, defaultData)
5441
5448
  }
5442
- initialValues = defaultValues;
5449
+ if(uiSchema.form){
5450
+ try{
5451
+ var objectFormConfig = JSON.parse(uiSchema.form);
5452
+ initialValues = objectFormConfig.initialValues;
5453
+ if(initialValues){
5454
+ initialValues = new Function("return " + initialValues)();
5455
+ }
5456
+ if(typeof initialValues === "function"){
5457
+ initialValues = initialValues.apply({doc: defaultValues || {} })
5458
+ }
5459
+ }
5460
+ catch(ex){
5461
+ console.warn(ex);
5462
+ }
5463
+ }
5464
+ if(_.isObject(initialValues)){
5465
+ // uiSchema.form.initialValues为函数且执行后为json,则优先取initialValues中的默认值
5466
+ initialValues = Object.assign({}, defaultValues, initialValues);
5467
+ }
5468
+ else{
5469
+ initialValues = defaultValues;
5470
+ }
5443
5471
  }
5444
5472
  // data下的变量需要在保存接口(getSaveApi)中被删除。
5445
5473
  payload.data = {
@@ -5878,7 +5906,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
5878
5906
  "data": {
5879
5907
  "objectName": "${_master.objectName}"
5880
5908
  },
5881
- "expression": "${_master.objectName}"
5909
+ "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
5882
5910
  }
5883
5911
  ]
5884
5912
  }
@@ -5895,7 +5923,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
5895
5923
  const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, formInitProps } = ctx;
5896
5924
  const fields = ___default["default"].values(objectSchema.fields);
5897
5925
  const formFields = getFormFields(objectSchema, ctx);
5898
- const serviceId = `detail_${recordId}`;
5926
+ const serviceId = `service_detail_page`;
5899
5927
  return {
5900
5928
  type: 'service',
5901
5929
  name: `page_readonly_${recordId}`,
@@ -6225,7 +6253,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6225
6253
  // return 'false';
6226
6254
  // }
6227
6255
  if(visible.trim().startsWith('function')){
6228
- return `${visible}(objectName, _id, recordPermissions, data)`
6256
+ return `${visible}(objectName, _id, record.recordPermissions, data)`
6229
6257
  }
6230
6258
  return visible;
6231
6259
  }