@steedos-widgets/amis-object 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.
@@ -689,6 +689,9 @@ fieldset.antd-Collapse > legend{
689
689
  .whitespace-nowrap {
690
690
  white-space: nowrap
691
691
  }
692
+ .break-all {
693
+ word-break: break-all
694
+ }
692
695
  .rounded {
693
696
  border-radius: 0.25rem
694
697
  }
@@ -1426,6 +1429,9 @@ fieldset.antd-Collapse > legend{
1426
1429
  .steedos-object-form .steedos-markdown .antd-Tabs-pane.is-active {
1427
1430
  display: block;
1428
1431
  }
1432
+ .antd-Select-popover .antd-Select-menu .antd-Select-option .antd-Checkbox--checkbox > span {
1433
+ vertical-align: text-top;
1434
+ }
1429
1435
  }
1430
1436
 
1431
1437
  @media (max-width: 767px) {
@@ -8460,12 +8460,22 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
8460
8460
  // return [
8461
8461
  // "load-more",
8462
8462
  // ]
8463
- return [
8464
- {
8465
- "type": "pagination",
8466
- "maxButtons": 5
8467
- }
8468
- ]
8463
+ if(options.displayAs === 'split'){
8464
+ return [
8465
+ "switch-per-page",
8466
+ {
8467
+ "type": "pagination",
8468
+ "maxButtons": 5
8469
+ }
8470
+ ]
8471
+ }else {
8472
+ return [
8473
+ {
8474
+ "type": "pagination",
8475
+ "maxButtons": 5
8476
+ }
8477
+ ]
8478
+ }
8469
8479
  }
8470
8480
  else {
8471
8481
  if(options && options.isRelated){
@@ -9091,8 +9101,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
9091
9101
 
9092
9102
  let pickerSchema = null;
9093
9103
  {
9104
+ let labelFieldName = refObjectConfig.NAME_FIELD_KEY || 'name';
9105
+ // organizations 对象的历史遗留问题, fullname 被标记为了 名称字段. 在此处特殊处理.
9106
+ if(refObjectConfig.name === 'organizations'){
9107
+ labelFieldName = 'name';
9108
+ }
9094
9109
  pickerSchema = await getTableSchema$1(tableFields, {
9095
- labelFieldName: refObjectConfig.NAME_FIELD_KEY,
9110
+ labelFieldName,
9096
9111
  top: top,
9097
9112
  isLookup: true,
9098
9113
  ...ctx
@@ -9137,12 +9152,12 @@ async function lookupToAmisPicker(field, readonly, ctx){
9137
9152
 
9138
9153
  pickerSchema.onEvent[`@data.changed.${refObjectConfig.name}`] = {
9139
9154
  "actions": [
9140
- {
9141
- "actionType": "reload"
9142
- },
9143
- {
9144
- "actionType": "custom",
9145
- "script": `
9155
+ {
9156
+ "actionType": "reload"
9157
+ },
9158
+ {
9159
+ "actionType": "custom",
9160
+ "script": `
9146
9161
  const masterRecord = event.data._master && event.data._master.record;
9147
9162
  const fieldConfig = ${JSON.stringify(field)};
9148
9163
  let reference_to = fieldConfig.reference_to;
@@ -9191,9 +9206,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
9191
9206
  }
9192
9207
  });
9193
9208
  `
9194
- }
9209
+ }
9195
9210
  ]
9196
- };
9211
+ };
9197
9212
  }
9198
9213
 
9199
9214
  if(field.pickerSchema){
@@ -9465,7 +9480,9 @@ async function lookupToAmis(field, readonly, ctx){
9465
9480
  }
9466
9481
 
9467
9482
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
9468
- ctx.onlyDisplayLookLabel = true;
9483
+ ctx = Object.assign({}, ctx, {
9484
+ onlyDisplayLookLabel: true
9485
+ });
9469
9486
  if(ctx.idsDependOn){
9470
9487
  // ids人员点选模式
9471
9488
  return await lookupToAmisIdsPicker(field, readonly, ctx);
@@ -10980,7 +10997,9 @@ async function getTableColumns$1(fields, options){
10980
10997
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
10981
10998
  let className = "";
10982
10999
  if(field.wrap != true){
10983
- className += " whitespace-nowrap";
11000
+ className += " whitespace-nowrap ";
11001
+ }else {
11002
+ className += " break-all ";
10984
11003
  }
10985
11004
  let columnItem;
10986
11005
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
@@ -11108,7 +11127,8 @@ async function getTableColumns$1(fields, options){
11108
11127
  }
11109
11128
  }
11110
11129
  // columns.push(getOperation(fields));
11111
- if(!_$1.some(columns, { name: options.labelFieldName })){
11130
+ if(!options.isLookup && !_$1.some(columns, { name: options.labelFieldName })){
11131
+ // 没有名称字段时显示序号字段为链接,lookup弹出的picker不需要此功能
11112
11132
  const href = Router$1.getObjectDetailPath({
11113
11133
  ...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
11114
11134
  });
@@ -11207,7 +11227,9 @@ async function getMobileTableColumns(fields, options){
11207
11227
  let tpl = "";
11208
11228
  if(field.is_name || field.name === options.labelFieldName){
11209
11229
  nameField = field;
11210
- options.onlyDisplayLookLabel = true;
11230
+ options = Object.assign({}, options, {
11231
+ onlyDisplayLookLabel: true
11232
+ });
11211
11233
  tpl = await getFieldTpl(field, options);
11212
11234
  }
11213
11235
  else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
@@ -11216,7 +11238,9 @@ async function getMobileTableColumns(fields, options){
11216
11238
  }
11217
11239
  else {
11218
11240
  if(field.type === 'lookup' || field.type === 'master_detail'){
11219
- options.onlyDisplayLookLabel = true;
11241
+ options = Object.assign({}, options, {
11242
+ onlyDisplayLookLabel: true
11243
+ });
11220
11244
  }
11221
11245
  tpl = await getFieldTpl(field, options);
11222
11246
  }
@@ -12736,7 +12760,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
12736
12760
  * @Author: baozhoutao@steedos.com
12737
12761
  * @Date: 2022-05-26 16:02:08
12738
12762
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12739
- * @LastEditTime: 2023-09-05 15:42:26
12763
+ * @LastEditTime: 2023-09-15 15:36:17
12740
12764
  * @Description:
12741
12765
  */
12742
12766
 
@@ -12826,6 +12850,25 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
12826
12850
  if (sectionFieldsVisibleOn.length > 0 && fieldSetBody.length === sectionFieldsVisibleOn.length) {
12827
12851
  section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
12828
12852
  }
12853
+
12854
+ const fieldGroups = ctx.fieldGroups;
12855
+ const group = fieldGroups && fieldGroups.find(function(groupItem){
12856
+ return groupItem.group_name == sectionName;
12857
+ });
12858
+ let groupVisibleOn = group && group.visible_on;
12859
+ if (groupVisibleOn) {
12860
+ if (groupVisibleOn.startsWith("{{")) {
12861
+ groupVisibleOn = `${groupVisibleOn.substring(2, groupVisibleOn.length - 2).replace(/formData./g, 'data.')}`;
12862
+ } else {
12863
+ groupVisibleOn = `${groupVisibleOn.replace(/formData./g, 'data.')}`;
12864
+ }
12865
+ if (section.visibleOn) {
12866
+ section.visibleOn = `${section.visibleOn + " && " + groupVisibleOn}`;
12867
+ }
12868
+ else {
12869
+ section.visibleOn = groupVisibleOn;
12870
+ }
12871
+ }
12829
12872
  return section
12830
12873
  };
12831
12874
 
@@ -13218,7 +13261,7 @@ async function getObjectForm(objectSchema, ctx){
13218
13261
  submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
13219
13262
  api: await getSaveApi(objectSchema, recordId, fields, ctx),
13220
13263
  initFetch: recordId != 'new',
13221
- body: await getFormBody(fields, formFields, ctx),
13264
+ body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
13222
13265
  panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
13223
13266
  bodyClassName: 'p-0',
13224
13267
  className: 'steedos-amis-form',
@@ -13293,7 +13336,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
13293
13336
  "formData": "$$"
13294
13337
  },
13295
13338
  wrapWithPanel: false,
13296
- body: await getFormBody(map(fields, (field)=>{field.readonly = true; return field;}), map(formFields, (field)=>{field.readonly = true; return field;}), Object.assign({}, ctx, {showSystemFields: true})),
13339
+ 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})),
13297
13340
  className: 'steedos-amis-form bg-white',
13298
13341
  actions: [], // 不显示表单默认的提交按钮
13299
13342
  onEvent: {
@@ -18352,8 +18395,8 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
18352
18395
  /*
18353
18396
  * @Author: baozhoutao@steedos.com
18354
18397
  * @Date: 2022-09-01 14:44:57
18355
- * @LastEditors: baozhoutao@steedos.com
18356
- * @LastEditTime: 2023-05-08 15:05:32
18398
+ * @LastEditors: liaodaxue
18399
+ * @LastEditTime: 2023-09-19 11:12:17
18357
18400
  * @Description:
18358
18401
  */
18359
18402
  var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -18576,10 +18619,8 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
18576
18619
  "click": {
18577
18620
  "actions": [
18578
18621
  {
18579
- "actionType": "link",
18580
- "args": {
18581
- "link": "${path}"
18582
- }
18622
+ "actionType": "custom",
18623
+ "script": "\nconst path = context.props.data.path;\ndoAction({\n actionType: 'url',\n args: {\n \"url\": path,\n \"blank\": false\n }\n});"
18583
18624
  },
18584
18625
  {
18585
18626
  "actionType": "broadcast",
@@ -19802,7 +19843,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
19802
19843
  Router$1.setTabDisplayAs(objectApiName, _display);
19803
19844
  }
19804
19845
  recordSchema = {};
19805
- return [4 /*yield*/, getPage({ type: 'record', appId: appId, objectName: objectApiName, formFactor: defaultFormFactor })];
19846
+ return [4 /*yield*/, getPage({ type: 'record', appId: appId, objectName: objectApiName, formFactor: defaultFormFactor || data.formFactor })];
19806
19847
  case 1:
19807
19848
  recordPage = _a.sent();
19808
19849
  recordSchema = recordPage ? recordPage.schema : {