@steedos-widgets/amis-object 1.2.36 → 1.2.38

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.
@@ -3854,7 +3854,7 @@ async function getFieldsTemplate(fields, display){
3854
3854
  if(displayFields.length > 0){
3855
3855
  return `${fieldsName.join(',')},${expandFieldsQuery},_display:_ui{${displayFields.join(',')}}`;
3856
3856
  }
3857
- return `${fieldsName.join(' ')},${expandFieldsQuery}`
3857
+ return ___default.trimEnd(`${fieldsName.join(' ')},${expandFieldsQuery}`, ",")
3858
3858
  }
3859
3859
 
3860
3860
  function getRecordPermissionsTemplate(){
@@ -6523,8 +6523,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6523
6523
  }
6524
6524
  if(!event.data.isLookup){
6525
6525
  // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
6526
- const listViewId = event.data.listViewId;
6527
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
6526
+ const listName = event.data.listName;
6527
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
6528
6528
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6529
6529
  if(localListViewProps){
6530
6530
  localListViewProps = JSON.parse(localListViewProps);
@@ -6550,13 +6550,13 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6550
6550
  const dataProviderInited = `
6551
6551
  const objectName = data.objectName;
6552
6552
  const isLookup = data.isLookup;
6553
- const listViewId = data.listViewId;
6553
+ const listName = data.listName;
6554
6554
  let searchableFieldsStoreKey = location.pathname + "/searchable_fields/";
6555
6555
  if(isLookup){
6556
6556
  searchableFieldsStoreKey += "lookup/" + objectName;
6557
6557
  }
6558
6558
  else{
6559
- searchableFieldsStoreKey += (listViewId || "");
6559
+ searchableFieldsStoreKey += (listName || "");
6560
6560
  }
6561
6561
  let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
6562
6562
  if(defaultSearchableFields){
@@ -6583,7 +6583,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6583
6583
  setData({ showFieldsFilter: false });
6584
6584
  }
6585
6585
  else{
6586
- const listViewPropsStoreKey = location.pathname + "/crud/" + (data.listViewId || "");
6586
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
6587
6587
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6588
6588
  if(localListViewProps){
6589
6589
  localListViewProps = JSON.parse(localListViewProps);
@@ -6613,7 +6613,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6613
6613
  const listName = data.listName;
6614
6614
  const objectName = data.objectName;
6615
6615
  const isLookup = data.isLookup;
6616
- const listViewId = data.listViewId;
6617
6616
  const value = data.fields;
6618
6617
  const scope = event.context.scoped;
6619
6618
  // 这里的filterForm不是name为"listview-filter-form"的内部form,而是crud自带的filter form
@@ -6629,7 +6628,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6629
6628
  searchableFieldsStoreKey += "lookup/" + objectName;
6630
6629
  }
6631
6630
  else{
6632
- searchableFieldsStoreKey += (listViewId || "");
6631
+ searchableFieldsStoreKey += (listName || "");
6633
6632
  }
6634
6633
  sessionStorage.setItem(searchableFieldsStoreKey, value);
6635
6634
 
@@ -6687,7 +6686,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6687
6686
  }
6688
6687
 
6689
6688
  // 列表视图crud支持本地缓存,所以需要进一步清除浏览器本地缓存里面用户在可搜索项中移除的字段值
6690
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
6689
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
6691
6690
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6692
6691
  if(localListViewProps){
6693
6692
  localListViewProps = JSON.parse(localListViewProps);
@@ -8563,18 +8562,27 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8563
8562
 
8564
8563
  }
8565
8564
 
8566
- function getObjectFooterToolbar(mainObject, formFactor) {
8565
+ function getObjectFooterToolbar(mainObject, formFactor, options) {
8567
8566
  if (formFactor === 'SMALL') {
8568
8567
  return [
8569
8568
  "load-more",
8570
8569
  ]
8571
8570
  }
8572
8571
  else {
8573
- return [
8574
- "switch-per-page",
8575
- "statistics",
8576
- "pagination"
8577
- ]
8572
+ if(options && options.isRelated){
8573
+ return [
8574
+ "statistics",
8575
+ "pagination"
8576
+ ]
8577
+
8578
+ }
8579
+ else {
8580
+ return [
8581
+ "switch-per-page",
8582
+ "statistics",
8583
+ "pagination"
8584
+ ]
8585
+ }
8578
8586
  }
8579
8587
  }
8580
8588
 
@@ -11429,8 +11437,8 @@ async function getTableApi(mainObject, fields, options){
11429
11437
  const data = _.cloneDeep(api.data);
11430
11438
  try{
11431
11439
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11432
- const listViewId = api.data.listViewId;
11433
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
11440
+ const listName = api.data.listName;
11441
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
11434
11442
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
11435
11443
  if(localListViewProps){
11436
11444
  localListViewProps = JSON.parse(localListViewProps);
@@ -11630,8 +11638,8 @@ async function getTableApi(mainObject, fields, options){
11630
11638
 
11631
11639
  try{
11632
11640
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11633
- const listViewId = api.body.listViewId;
11634
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
11641
+ const listName = api.body.listName;
11642
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
11635
11643
  /**
11636
11644
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
11637
11645
  * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
@@ -12796,6 +12804,7 @@ async function getObjectCRUD(objectSchema, fields, options){
12796
12804
  // headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
12797
12805
  headerToolbarClassName: "px-4 py-2 border-gray-300 bg-gray-100 border-solid border-b",
12798
12806
  footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
12807
+ ...options,
12799
12808
  disableStatistics: options.queryCount === false
12800
12809
  }),
12801
12810
  filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
@@ -13600,7 +13609,7 @@ async function getRelatedListSchema(
13600
13609
  * @Author: baozhoutao@steedos.com
13601
13610
  * @Date: 2022-07-05 15:55:39
13602
13611
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
13603
- * @LastEditTime: 2023-08-01 14:50:23
13612
+ * @LastEditTime: 2023-08-04 12:27:48
13604
13613
  * @Description:
13605
13614
  */
13606
13615
 
@@ -13865,7 +13874,7 @@ async function getListSchema(
13865
13874
  * 本次存储代码段
13866
13875
  */
13867
13876
  try {
13868
- const listViewPropsStoreKey = location.pathname + "/crud/" + (ctx.listViewId || "");
13877
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewName || "");
13869
13878
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
13870
13879
  /**
13871
13880
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。