@steedos-widgets/amis-lib 1.1.4-beta.1 → 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
@@ -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
 
@@ -5428,6 +5435,17 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
5428
5435
  }
5429
5436
  else{
5430
5437
  var uiSchema = api.body.uiSchema;
5438
+ var defaultData = api.body.defaultData;
5439
+ var defaultValues = {};
5440
+ _.each(uiSchema?.fields, function(field){
5441
+ var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
5442
+ if(value){
5443
+ defaultValues[field.name] = value;
5444
+ }
5445
+ });
5446
+ if(defaultData && _.isObject(defaultData) && !_.isArray(defaultData)){
5447
+ defaultValues = Object.assign({}, defaultValues, defaultData)
5448
+ }
5431
5449
  if(uiSchema.form){
5432
5450
  try{
5433
5451
  var objectFormConfig = JSON.parse(uiSchema.form);
@@ -5436,24 +5454,13 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
5436
5454
  initialValues = new Function("return " + initialValues)();
5437
5455
  }
5438
5456
  if(typeof initialValues === "function"){
5439
- initialValues = initialValues();
5457
+ initialValues = initialValues.apply({doc: defaultValues || {} })
5440
5458
  }
5441
5459
  }
5442
5460
  catch(ex){
5443
5461
  console.warn(ex);
5444
5462
  }
5445
5463
  }
5446
- var defaultData = api.body.defaultData;
5447
- var defaultValues = {};
5448
- _.each(uiSchema?.fields, function(field){
5449
- var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
5450
- if(value){
5451
- defaultValues[field.name] = value;
5452
- }
5453
- });
5454
- if(defaultData && _.isObject(defaultData) && !_.isArray(defaultData)){
5455
- defaultValues = Object.assign({}, defaultValues, defaultData)
5456
- }
5457
5464
  if(_.isObject(initialValues)){
5458
5465
  // uiSchema.form.initialValues为函数且执行后为json,则优先取initialValues中的默认值
5459
5466
  initialValues = Object.assign({}, defaultValues, initialValues);
@@ -5899,7 +5906,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
5899
5906
  "data": {
5900
5907
  "objectName": "${_master.objectName}"
5901
5908
  },
5902
- "expression": "${_master.objectName}"
5909
+ "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
5903
5910
  }
5904
5911
  ]
5905
5912
  }
@@ -5916,7 +5923,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
5916
5923
  const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, formInitProps } = ctx;
5917
5924
  const fields = ___default["default"].values(objectSchema.fields);
5918
5925
  const formFields = getFormFields(objectSchema, ctx);
5919
- const serviceId = `detail_${recordId}`;
5926
+ const serviceId = `service_detail_page`;
5920
5927
  return {
5921
5928
  type: 'service',
5922
5929
  name: `page_readonly_${recordId}`,
@@ -6246,7 +6253,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6246
6253
  // return 'false';
6247
6254
  // }
6248
6255
  if(visible.trim().startsWith('function')){
6249
- return `${visible}(objectName, _id, recordPermissions, data)`
6256
+ return `${visible}(objectName, _id, record.recordPermissions, data)`
6250
6257
  }
6251
6258
  return visible;
6252
6259
  }