@steedos-widgets/amis-lib 6.3.0-beta.3 → 6.3.0-beta.4

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
@@ -8896,10 +8896,6 @@ async function getObjectCRUD(objectSchema, fields, options){
8896
8896
  }
8897
8897
  }
8898
8898
  `;
8899
- let autoFillHeight = true;
8900
- if(options.isRelated || window.innerWidth < 768){
8901
- autoFillHeight = false;
8902
- }
8903
8899
 
8904
8900
  body = Object.assign({}, table, {
8905
8901
  type: 'crud',
@@ -8910,7 +8906,7 @@ async function getObjectCRUD(objectSchema, fields, options){
8910
8906
  keepItemSelectionOnPageChange: true,
8911
8907
  api: await getTableApi(objectSchema, fields, options),
8912
8908
  hiddenOn: options.tableHiddenOn,
8913
- autoFillHeight,
8909
+ // autoFillHeight,//autoFillHeight按amis规范默认为false,需要配置此属性时在各个组件层配置,比如列表视图组件那边传入此属性为true
8914
8910
  className: `flex-auto ${crudClassName || ""}`,
8915
8911
  // 这里不可以用动态className,因为它会把样式类加到.antd-Crud和.antd-Table.antd-Crud-body这两层div中,而子表列表中crudClassName中有hidden样式类会造成所有子表都不显示的bug
8916
8912
  // className: {
@@ -9176,7 +9172,7 @@ async function getObjectForm(objectSchema, ctx){
9176
9172
 
9177
9173
  async function getObjectDetail(objectSchema, recordId, ctx){
9178
9174
  const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
9179
- formDataFilter, onFormDataFilter, amisData, env } = ctx;
9175
+ formDataFilter, onFormDataFilter, amisData, env, enableInitApi } = ctx;
9180
9176
  const fields = ___default.values(objectSchema.fields);
9181
9177
  const formFields = getFormFields$1(objectSchema, ctx);
9182
9178
  const serviceId = `service_detail_page`;
@@ -9243,6 +9239,16 @@ async function getObjectDetail(objectSchema, recordId, ctx){
9243
9239
  // }
9244
9240
  };
9245
9241
 
9242
+ if(enableInitApi){
9243
+ amisSchema.api = await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx);
9244
+ // 开启初始化api请求时,如果不把recordLoaded默认设置为false,recordLoaded值会取RecordServic组件中的recordLoaded值
9245
+ // 这会造成表单内steedos field组件lookup字段中props.data取到的是RecordServic组件
9246
+ amisSchema.data = {
9247
+ ...amisSchema.data,
9248
+ recordLoaded: false
9249
+ };
9250
+ }
9251
+
9246
9252
  amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
9247
9253
  // console.log('getObjectDetail=====>', amisSchema);
9248
9254
  return amisSchema;
@@ -9734,7 +9740,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
9734
9740
  * @Author: baozhoutao@steedos.com
9735
9741
  * @Date: 2022-07-05 15:55:39
9736
9742
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
9737
- * @LastEditTime: 2024-02-23 16:37:06
9743
+ * @LastEditTime: 2024-04-25 19:01:52
9738
9744
  * @Description:
9739
9745
  */
9740
9746
 
@@ -9999,37 +10005,41 @@ async function getListSchema(
9999
10005
  * 本次存储代码段
10000
10006
  */
10001
10007
  try {
10002
- const listViewPropsStoreKey = location.pathname + "/crud";
10003
- let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
10004
- /**
10005
- * localListViewProps规范来自crud请求api中api.data.$self参数值的。
10006
- * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
10007
- * __searchable__...:顶部放大镜搜索条件
10008
- * filter:右侧过滤器
10009
- * perPage:每页条数
10010
- * page:当前页码
10011
- * orderBy:排序字段
10012
- * orderDir:排序方向
10013
- */
10014
- if (localListViewProps) {
10015
- localListViewProps = JSON.parse(localListViewProps);
10016
- // localListViewProps.perPage = 3;
10017
- let listSchema = {};
10018
- if(localListViewProps.orderBy){
10019
- listSchema.orderBy = localListViewProps.orderBy;
10020
- }
10021
- if(localListViewProps.orderDir){
10022
- listSchema.orderDir = localListViewProps.orderDir;
10023
- }
10008
+ const listViewPropsStoreKey = location.pathname + "/crud";
10009
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
10010
+ /**
10011
+ * localListViewProps规范来自crud请求api中api.data.$self参数值的。
10012
+ * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
10013
+ * __searchable__...:顶部放大镜搜索条件
10014
+ * filter:右侧过滤器
10015
+ * perPage:每页条数
10016
+ * page:当前页码
10017
+ * orderBy:排序字段
10018
+ * orderDir:排序方向
10019
+ */
10020
+ if (localListViewProps) {
10021
+ localListViewProps = JSON.parse(localListViewProps);
10022
+ // localListViewProps.perPage = 3;
10023
+ let listSchema = {};
10024
+ if (localListViewProps.orderBy) {
10025
+ listSchema.orderBy = localListViewProps.orderBy;
10026
+ }
10027
+ if (localListViewProps.orderDir) {
10028
+ listSchema.orderDir = localListViewProps.orderDir;
10029
+ }
10024
10030
 
10025
- if(localListViewProps.perPage){
10026
- listSchema.perPage = localListViewProps.perPage;
10031
+ if (localListViewProps.perPage) {
10032
+ listSchema.perPage = localListViewProps.perPage;
10033
+ }
10034
+ if (window.innerWidth > 768) {
10035
+ // 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight
10036
+ listSchema.autoFillHeight = true;
10037
+ }
10038
+ defaults.listSchema = defaultsDeep$1({}, listSchema, defaults.listSchema || {});
10027
10039
  }
10028
- defaults.listSchema = defaultsDeep$1({}, listSchema, defaults.listSchema || {});
10029
- }
10030
10040
  }
10031
10041
  catch (ex) {
10032
- console.error("本地存储中crud参数解析异常:", ex);
10042
+ console.error("本地存储中crud参数解析异常:", ex);
10033
10043
  }
10034
10044
 
10035
10045
  ctx.defaults = defaults;
@@ -10336,6 +10346,10 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
10336
10346
  data: {
10337
10347
  "_master.objectName": "${objectName}",
10338
10348
  "_master.recordId": "${recordId}",
10349
+ // 微页面设计器中用RecordServic组件包裹一个ObjectForm只读组件时,如果这里不把recordLoaded默认设置为false
10350
+ // recordLoaded值会取父作用域中已经被设置为true的值(比如父级有RecordServic组件,在加载完数据后,父作用域中recordLoaded值为true)
10351
+ // 这会造成表单内steedos field组件lookup字段中props.data取到的是父作用域中的数据
10352
+ "recordLoaded": false,
10339
10353
  ...(props.data || {})
10340
10354
  },
10341
10355
  "style": {