@steedos-widgets/amis-lib 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.
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _$1 from 'lodash';
2
- import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, includes, get, isBoolean, omitBy, isNil, toArray, mergeWith, map, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, startsWith } from 'lodash';
2
+ import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, includes, trimEnd, get, isBoolean, omitBy, isNil, toArray, mergeWith, map, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, startsWith } from 'lodash';
3
3
  import i18next from 'i18next';
4
4
  export { default as i18next } from 'i18next';
5
5
  import { initReactI18next } from 'react-i18next';
@@ -685,7 +685,7 @@ async function getFieldsTemplate(fields, display){
685
685
  if(displayFields.length > 0){
686
686
  return `${fieldsName.join(',')},${expandFieldsQuery},_display:_ui{${displayFields.join(',')}}`;
687
687
  }
688
- return `${fieldsName.join(' ')},${expandFieldsQuery}`
688
+ return trimEnd(`${fieldsName.join(' ')},${expandFieldsQuery}`, ",")
689
689
  }
690
690
 
691
691
  function getRecordPermissionsTemplate(){
@@ -3354,8 +3354,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3354
3354
  }
3355
3355
  if(!event.data.isLookup){
3356
3356
  // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
3357
- const listViewId = event.data.listViewId;
3358
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
3357
+ const listName = event.data.listName;
3358
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
3359
3359
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3360
3360
  if(localListViewProps){
3361
3361
  localListViewProps = JSON.parse(localListViewProps);
@@ -3381,13 +3381,13 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3381
3381
  const dataProviderInited = `
3382
3382
  const objectName = data.objectName;
3383
3383
  const isLookup = data.isLookup;
3384
- const listViewId = data.listViewId;
3384
+ const listName = data.listName;
3385
3385
  let searchableFieldsStoreKey = location.pathname + "/searchable_fields/";
3386
3386
  if(isLookup){
3387
3387
  searchableFieldsStoreKey += "lookup/" + objectName;
3388
3388
  }
3389
3389
  else{
3390
- searchableFieldsStoreKey += (listViewId || "");
3390
+ searchableFieldsStoreKey += (listName || "");
3391
3391
  }
3392
3392
  let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
3393
3393
  if(defaultSearchableFields){
@@ -3414,7 +3414,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3414
3414
  setData({ showFieldsFilter: false });
3415
3415
  }
3416
3416
  else{
3417
- const listViewPropsStoreKey = location.pathname + "/crud/" + (data.listViewId || "");
3417
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
3418
3418
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3419
3419
  if(localListViewProps){
3420
3420
  localListViewProps = JSON.parse(localListViewProps);
@@ -3444,7 +3444,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3444
3444
  const listName = data.listName;
3445
3445
  const objectName = data.objectName;
3446
3446
  const isLookup = data.isLookup;
3447
- const listViewId = data.listViewId;
3448
3447
  const value = data.fields;
3449
3448
  const scope = event.context.scoped;
3450
3449
  // 这里的filterForm不是name为"listview-filter-form"的内部form,而是crud自带的filter form
@@ -3460,7 +3459,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3460
3459
  searchableFieldsStoreKey += "lookup/" + objectName;
3461
3460
  }
3462
3461
  else{
3463
- searchableFieldsStoreKey += (listViewId || "");
3462
+ searchableFieldsStoreKey += (listName || "");
3464
3463
  }
3465
3464
  sessionStorage.setItem(searchableFieldsStoreKey, value);
3466
3465
 
@@ -3518,7 +3517,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3518
3517
  }
3519
3518
 
3520
3519
  // 列表视图crud支持本地缓存,所以需要进一步清除浏览器本地缓存里面用户在可搜索项中移除的字段值
3521
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
3520
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
3522
3521
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3523
3522
  if(localListViewProps){
3524
3523
  localListViewProps = JSON.parse(localListViewProps);
@@ -5394,18 +5393,27 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
5394
5393
 
5395
5394
  }
5396
5395
 
5397
- function getObjectFooterToolbar(mainObject, formFactor) {
5396
+ function getObjectFooterToolbar(mainObject, formFactor, options) {
5398
5397
  if (formFactor === 'SMALL') {
5399
5398
  return [
5400
5399
  "load-more",
5401
5400
  ]
5402
5401
  }
5403
5402
  else {
5404
- return [
5405
- "switch-per-page",
5406
- "statistics",
5407
- "pagination"
5408
- ]
5403
+ if(options && options.isRelated){
5404
+ return [
5405
+ "statistics",
5406
+ "pagination"
5407
+ ]
5408
+
5409
+ }
5410
+ else {
5411
+ return [
5412
+ "switch-per-page",
5413
+ "statistics",
5414
+ "pagination"
5415
+ ]
5416
+ }
5409
5417
  }
5410
5418
  }
5411
5419
 
@@ -8260,8 +8268,8 @@ async function getTableApi(mainObject, fields, options){
8260
8268
  const data = _.cloneDeep(api.data);
8261
8269
  try{
8262
8270
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
8263
- const listViewId = api.data.listViewId;
8264
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
8271
+ const listName = api.data.listName;
8272
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
8265
8273
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
8266
8274
  if(localListViewProps){
8267
8275
  localListViewProps = JSON.parse(localListViewProps);
@@ -8461,8 +8469,8 @@ async function getTableApi(mainObject, fields, options){
8461
8469
 
8462
8470
  try{
8463
8471
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
8464
- const listViewId = api.body.listViewId;
8465
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
8472
+ const listName = api.body.listName;
8473
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
8466
8474
  /**
8467
8475
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
8468
8476
  * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
@@ -9627,6 +9635,7 @@ async function getObjectCRUD(objectSchema, fields, options){
9627
9635
  // headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
9628
9636
  headerToolbarClassName: "px-4 py-2 border-gray-300 bg-gray-100 border-solid border-b",
9629
9637
  footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
9638
+ ...options,
9630
9639
  disableStatistics: options.queryCount === false
9631
9640
  }),
9632
9641
  filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
@@ -10431,7 +10440,7 @@ async function getRelatedListSchema(
10431
10440
  * @Author: baozhoutao@steedos.com
10432
10441
  * @Date: 2022-07-05 15:55:39
10433
10442
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10434
- * @LastEditTime: 2023-08-01 14:50:23
10443
+ * @LastEditTime: 2023-08-04 12:27:48
10435
10444
  * @Description:
10436
10445
  */
10437
10446
 
@@ -10696,7 +10705,7 @@ async function getListSchema(
10696
10705
  * 本次存储代码段
10697
10706
  */
10698
10707
  try {
10699
- const listViewPropsStoreKey = location.pathname + "/crud/" + (ctx.listViewId || "");
10708
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewName || "");
10700
10709
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
10701
10710
  /**
10702
10711
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。