@steedos-widgets/amis-lib 1.1.11 → 1.1.12

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
@@ -5489,12 +5489,12 @@ setTimeout(()=>{
5489
5489
  if(uiSchema.form){
5490
5490
  try{
5491
5491
  var objectFormConfig = JSON.parse(uiSchema.form);
5492
- initialValues = objectFormConfig.initialValues;
5493
- if(initialValues){
5494
- initialValues = new Function("return " + initialValues)();
5492
+ var formInitialValuesFun = objectFormConfig.initialValues;
5493
+ if(formInitialValuesFun){
5494
+ formInitialValuesFun = new Function("return " + formInitialValuesFun)();
5495
5495
  }
5496
- if(typeof initialValues === "function"){
5497
- initialValues = initialValues.apply({doc: defaultValues || {} })
5496
+ if(typeof formInitialValuesFun === "function"){
5497
+ initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global})
5498
5498
  }
5499
5499
  }
5500
5500
  catch(ex){
@@ -5511,12 +5511,15 @@ setTimeout(()=>{
5511
5511
  }
5512
5512
  // data下的变量需要在保存接口(getSaveApi)中被删除。
5513
5513
  payload.data = {
5514
- initialValues,
5515
- editFormInited: true
5514
+ ...initialValues
5516
5515
  }
5517
5516
  ${options.initApiAdaptor || ''}
5518
5517
  return payload;
5519
5518
  `,
5519
+ responseData: {
5520
+ initialValues: "$$",
5521
+ editFormInited: true
5522
+ },
5520
5523
  data: data,
5521
5524
  headers: {
5522
5525
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
@@ -6473,13 +6476,17 @@ setTimeout(()=>{
6473
6476
  let valueField = mainObject.key_field || '_id';
6474
6477
  const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
6475
6478
  api.data.$term = "$term";
6479
+ api.data.term = "$term";
6476
6480
  api.data.$self = "$$";
6481
+ api.data.self = "$$";
6477
6482
  api.data.filter = "$filter";
6478
6483
  api.data.loaded = "${loaded}";
6479
6484
  api.data.listViewId = "${listViewId}";
6480
6485
  api.requestAdaptor = `
6481
6486
  // selfData 中的数据由 CRUD 控制. selfData中,只能获取到 CRUD 给定的data. 无法从数据链中获取数据.
6482
6487
  let selfData = JSON.parse(JSON.stringify(api.data.$self));
6488
+ // 保留一份初始data,以供自定义发送适配器中获取原始数据。
6489
+ const data = _.cloneDeep(api.data);
6483
6490
  try{
6484
6491
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
6485
6492
  const listViewId = api.data.listViewId;
@@ -6639,28 +6646,8 @@ setTimeout(()=>{
6639
6646
 
6640
6647
  if(enable_tree){
6641
6648
  const records = payload.data.rows;
6642
- const treeRecords = [];
6643
- const getChildren = (records, childrenIds)=>{
6644
- if(!childrenIds){
6645
- return;
6646
- }
6647
- const children = _.filter(records, (record)=>{
6648
- return _.includes(childrenIds, record._id)
6649
- });
6650
- _.each(children, (item)=>{
6651
- if(item.children){
6652
- item.children = getChildren(records, item.children)
6653
- }
6654
- })
6655
- return children;
6656
- }
6657
-
6658
- _.each(records, (record)=>{
6659
- if(!record.parent){
6660
- treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));
6661
- }
6662
- });
6663
- payload.data.rows = treeRecords;
6649
+ const getTreeOptions = SteedosUI.getTreeOptions
6650
+ payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
6664
6651
  }
6665
6652
 
6666
6653
 
@@ -7353,7 +7340,7 @@ setTimeout(()=>{
7353
7340
  * @Author: baozhoutao@steedos.com
7354
7341
  * @Date: 2022-07-05 15:55:39
7355
7342
  * @LastEditors: Please set LastEditors
7356
- * @LastEditTime: 2023-04-13 09:20:21
7343
+ * @LastEditTime: 2023-04-18 19:13:30
7357
7344
  * @Description:
7358
7345
  */
7359
7346
 
@@ -7450,7 +7437,7 @@ setTimeout(()=>{
7450
7437
  mainRelated[arr[0]] = arr[1];
7451
7438
  }
7452
7439
  }else {
7453
- const details = mainObjectUiSchema.details || [];
7440
+ const details = _$1.union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
7454
7441
  for (const detail of details) {
7455
7442
  const arr = detail.split(".");
7456
7443
  mainRelated[arr[0]] = arr[1];