@steedos-widgets/amis-lib 1.3.2-beta.6 → 1.3.3

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
@@ -5319,12 +5319,22 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
5319
5319
  // return [
5320
5320
  // "load-more",
5321
5321
  // ]
5322
- return [
5323
- {
5324
- "type": "pagination",
5325
- "maxButtons": 5
5326
- }
5327
- ]
5322
+ if(options.displayAs === 'split'){
5323
+ return [
5324
+ "switch-per-page",
5325
+ {
5326
+ "type": "pagination",
5327
+ "maxButtons": 5
5328
+ }
5329
+ ]
5330
+ }else {
5331
+ return [
5332
+ {
5333
+ "type": "pagination",
5334
+ "maxButtons": 5
5335
+ }
5336
+ ]
5337
+ }
5328
5338
  }
5329
5339
  else {
5330
5340
  if(options && options.isRelated){
@@ -5950,8 +5960,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
5950
5960
 
5951
5961
  let pickerSchema = null;
5952
5962
  {
5963
+ let labelFieldName = refObjectConfig.NAME_FIELD_KEY || 'name';
5964
+ // organizations 对象的历史遗留问题, fullname 被标记为了 名称字段. 在此处特殊处理.
5965
+ if(refObjectConfig.name === 'organizations'){
5966
+ labelFieldName = 'name';
5967
+ }
5953
5968
  pickerSchema = await getTableSchema$1(tableFields, {
5954
- labelFieldName: refObjectConfig.NAME_FIELD_KEY,
5969
+ labelFieldName,
5955
5970
  top: top,
5956
5971
  isLookup: true,
5957
5972
  ...ctx
@@ -5996,12 +6011,12 @@ async function lookupToAmisPicker(field, readonly, ctx){
5996
6011
 
5997
6012
  pickerSchema.onEvent[`@data.changed.${refObjectConfig.name}`] = {
5998
6013
  "actions": [
5999
- {
6000
- "actionType": "reload"
6001
- },
6002
- {
6003
- "actionType": "custom",
6004
- "script": `
6014
+ {
6015
+ "actionType": "reload"
6016
+ },
6017
+ {
6018
+ "actionType": "custom",
6019
+ "script": `
6005
6020
  const masterRecord = event.data._master && event.data._master.record;
6006
6021
  const fieldConfig = ${JSON.stringify(field)};
6007
6022
  let reference_to = fieldConfig.reference_to;
@@ -6050,9 +6065,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
6050
6065
  }
6051
6066
  });
6052
6067
  `
6053
- }
6068
+ }
6054
6069
  ]
6055
- };
6070
+ };
6056
6071
  }
6057
6072
 
6058
6073
  if(field.pickerSchema){
@@ -6324,7 +6339,9 @@ async function lookupToAmis(field, readonly, ctx){
6324
6339
  }
6325
6340
 
6326
6341
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
6327
- ctx.onlyDisplayLookLabel = true;
6342
+ ctx = Object.assign({}, ctx, {
6343
+ onlyDisplayLookLabel: true
6344
+ });
6328
6345
  if(ctx.idsDependOn){
6329
6346
  // ids人员点选模式
6330
6347
  return await lookupToAmisIdsPicker(field, readonly, ctx);
@@ -7839,7 +7856,9 @@ async function getTableColumns(fields, options){
7839
7856
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
7840
7857
  let className = "";
7841
7858
  if(field.wrap != true){
7842
- className += " whitespace-nowrap";
7859
+ className += " whitespace-nowrap ";
7860
+ }else {
7861
+ className += " break-all ";
7843
7862
  }
7844
7863
  let columnItem;
7845
7864
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
@@ -7967,7 +7986,8 @@ async function getTableColumns(fields, options){
7967
7986
  }
7968
7987
  }
7969
7988
  // columns.push(getOperation(fields));
7970
- if(!_$1.some(columns, { name: options.labelFieldName })){
7989
+ if(!options.isLookup && !_$1.some(columns, { name: options.labelFieldName })){
7990
+ // 没有名称字段时显示序号字段为链接,lookup弹出的picker不需要此功能
7971
7991
  const href = Router.getObjectDetailPath({
7972
7992
  ...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
7973
7993
  });
@@ -8066,7 +8086,9 @@ async function getMobileTableColumns(fields, options){
8066
8086
  let tpl = "";
8067
8087
  if(field.is_name || field.name === options.labelFieldName){
8068
8088
  nameField = field;
8069
- options.onlyDisplayLookLabel = true;
8089
+ options = Object.assign({}, options, {
8090
+ onlyDisplayLookLabel: true
8091
+ });
8070
8092
  tpl = await getFieldTpl(field, options);
8071
8093
  }
8072
8094
  else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
@@ -8075,7 +8097,9 @@ async function getMobileTableColumns(fields, options){
8075
8097
  }
8076
8098
  else {
8077
8099
  if(field.type === 'lookup' || field.type === 'master_detail'){
8078
- options.onlyDisplayLookLabel = true;
8100
+ options = Object.assign({}, options, {
8101
+ onlyDisplayLookLabel: true
8102
+ });
8079
8103
  }
8080
8104
  tpl = await getFieldTpl(field, options);
8081
8105
  }
@@ -9595,7 +9619,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
9595
9619
  * @Author: baozhoutao@steedos.com
9596
9620
  * @Date: 2022-05-26 16:02:08
9597
9621
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
9598
- * @LastEditTime: 2023-09-05 15:42:26
9622
+ * @LastEditTime: 2023-09-15 15:36:17
9599
9623
  * @Description:
9600
9624
  */
9601
9625
 
@@ -9685,6 +9709,25 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
9685
9709
  if (sectionFieldsVisibleOn.length > 0 && fieldSetBody.length === sectionFieldsVisibleOn.length) {
9686
9710
  section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
9687
9711
  }
9712
+
9713
+ const fieldGroups = ctx.fieldGroups;
9714
+ const group = fieldGroups && fieldGroups.find(function(groupItem){
9715
+ return groupItem.group_name == sectionName;
9716
+ });
9717
+ let groupVisibleOn = group && group.visible_on;
9718
+ if (groupVisibleOn) {
9719
+ if (groupVisibleOn.startsWith("{{")) {
9720
+ groupVisibleOn = `${groupVisibleOn.substring(2, groupVisibleOn.length - 2).replace(/formData./g, 'data.')}`;
9721
+ } else {
9722
+ groupVisibleOn = `${groupVisibleOn.replace(/formData./g, 'data.')}`;
9723
+ }
9724
+ if (section.visibleOn) {
9725
+ section.visibleOn = `${section.visibleOn + " && " + groupVisibleOn}`;
9726
+ }
9727
+ else {
9728
+ section.visibleOn = groupVisibleOn;
9729
+ }
9730
+ }
9688
9731
  return section
9689
9732
  };
9690
9733
 
@@ -10077,7 +10120,7 @@ async function getObjectForm(objectSchema, ctx){
10077
10120
  submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
10078
10121
  api: await getSaveApi(objectSchema, recordId, fields, ctx),
10079
10122
  initFetch: recordId != 'new',
10080
- body: await getFormBody(fields, formFields, ctx),
10123
+ body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
10081
10124
  panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
10082
10125
  bodyClassName: 'p-0',
10083
10126
  className: 'steedos-amis-form',
@@ -10152,7 +10195,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
10152
10195
  "formData": "$$"
10153
10196
  },
10154
10197
  wrapWithPanel: false,
10155
- body: await getFormBody(map(fields, (field)=>{field.readonly = true; return field;}), map(formFields, (field)=>{field.readonly = true; return field;}), Object.assign({}, ctx, {showSystemFields: true})),
10198
+ body: await getFormBody(map(fields, (field)=>{field.readonly = true; return field;}), map(formFields, (field)=>{field.readonly = true; return field;}), Object.assign({}, ctx, {showSystemFields: true,fieldGroups: objectSchema.field_groups})),
10156
10199
  className: 'steedos-amis-form bg-white',
10157
10200
  actions: [], // 不显示表单默认的提交按钮
10158
10201
  onEvent: {