@steedos-widgets/amis-lib 3.6.0-beta.3 → 3.6.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
@@ -382,8 +382,8 @@ const Router = {
382
382
  /*
383
383
  * @Author: baozhoutao@steedos.com
384
384
  * @Date: 2022-07-20 16:29:22
385
- * @LastEditors: liaodaxue
386
- * @LastEditTime: 2023-09-11 17:19:53
385
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
386
+ * @LastEditTime: 2023-12-28 14:59:08
387
387
  * @Description:
388
388
  */
389
389
 
@@ -440,6 +440,21 @@ function getLookupListView(refObjectConfig) {
440
440
  return listView;
441
441
  }
442
442
 
443
+
444
+ /**
445
+ * 获取可比较的amis版本号
446
+ * @returns 只返回前两位版本,第三位忽略,比如3.6.3返回3.6
447
+ */
448
+ function getComparableAmisVersion() {
449
+ let amis = (window.amisRequire && window.amisRequire('amis')) || window.Amis;
450
+ let amisVersion = amis && amis.version;
451
+ if(amisVersion){
452
+ let comparableVersions = amisVersion.split(".");
453
+ let comparableVersion = parseFloat(comparableVersions[0].toString() + "." + comparableVersions[1].toString());
454
+ return comparableVersion;
455
+ }
456
+ }
457
+
443
458
  /*
444
459
  * @Author: baozhoutao@steedos.com
445
460
  * @Date: 2022-05-23 09:53:08
@@ -2168,8 +2183,8 @@ async function getTableColumns(fields, options){
2168
2183
  const href = Router.getObjectDetailPath({
2169
2184
  ...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
2170
2185
  });
2171
- columns[1].type = "tpl";
2172
- columns[1].tpl = `<a href="${href}">\${${columns[1].name}}</a>`;
2186
+ columns[0].type = "tpl";
2187
+ columns[0].tpl = `<a href="${href}">\${${columns[0].name}}</a>`;
2173
2188
  }
2174
2189
  return columns;
2175
2190
  }
@@ -10852,7 +10867,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
10852
10867
  sendOn.push(`this.${fName}`);
10853
10868
  });
10854
10869
  if(depend_on.length > 0){
10855
- apiInfo.url = `${apiInfo.url}?${depend_on.join('&')}`;
10870
+ apiInfo.url = `${apiInfo.url}&${depend_on.join('&')}`;
10856
10871
  apiInfo.sendOn = `${sendOn.join(' && ')}`;
10857
10872
  }
10858
10873
  }
@@ -10960,6 +10975,13 @@ async function lookupToAmisSelect(field, readonly, ctx){
10960
10975
  autoComplete: apiInfo,
10961
10976
  searchable: true,
10962
10977
  };
10978
+ let amisVersion = getComparableAmisVersion();
10979
+ if(amisVersion >= 3.6){
10980
+ // amis 3.6中不加source会造成子表组件中弹出行编辑窗口的lookup字段有时不请求接口(概率现象,同一个地方反复操作有时请求有时不请求)
10981
+ // 但是同时配置autoComplete和source会多请求一次接口
10982
+ // TODO:应该想办法把是否字段在子表组件内,即ctx.isInputTable,如果不在子表组件内不需要加source
10983
+ data.source = apiInfo;
10984
+ }
10963
10985
  //删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
10964
10986
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
10965
10987
  <span role='img' aria-label='smile' class='anticon anticon-smile'>
@@ -11319,9 +11341,9 @@ const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
11319
11341
  // const Lookup = require('./lookup');
11320
11342
 
11321
11343
  function getBaseFields(readonly){
11322
- let calssName = 'm-1';
11344
+ let className = 'm-0';
11323
11345
  if(readonly){
11324
- calssName = `${calssName}`;
11346
+ className = `${className}`;
11325
11347
  }
11326
11348
  return [
11327
11349
  {
@@ -11329,7 +11351,7 @@ function getBaseFields(readonly){
11329
11351
  label: "创建人",
11330
11352
  type: "static",
11331
11353
  labelClassName: 'text-left',
11332
- className: calssName,
11354
+ className: className,
11333
11355
  tpl: getCreatedInfoTpl()
11334
11356
  },
11335
11357
  {
@@ -11337,7 +11359,7 @@ function getBaseFields(readonly){
11337
11359
  label: "修改人",
11338
11360
  type: "static",
11339
11361
  labelClassName: 'text-left',
11340
- className: calssName,
11362
+ className: className,
11341
11363
  tpl: getModifiedInfoTpl()
11342
11364
  }
11343
11365
  ]
@@ -12033,9 +12055,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
12033
12055
  }
12034
12056
  if(!_$1.isEmpty(convertData)){
12035
12057
  if(field.is_wide || convertData.type === 'group'){
12036
- convertData.className = 'col-span-2 m-1';
12058
+ convertData.className = 'col-span-2 m-0';
12037
12059
  }else {
12038
- convertData.className = 'm-1';
12060
+ convertData.className = 'm-0';
12039
12061
  }
12040
12062
  if(readonly){
12041
12063
  convertData.className = `${convertData.className} border-b`;
@@ -12441,7 +12463,7 @@ async function getFormBody(permissionFields, formFields, ctx){
12441
12463
  * @Author: 殷亮辉 yinlianghui@hotoa.com
12442
12464
  * @Date: 2023-11-15 09:50:22
12443
12465
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12444
- * @LastEditTime: 2023-12-27 13:50:26
12466
+ * @LastEditTime: 2023-12-28 15:54:36
12445
12467
  */
12446
12468
 
12447
12469
  /**
@@ -12922,6 +12944,11 @@ async function getButtonActions(props, mode) {
12922
12944
  let dialogId = getComponentId("dialog", props.id);
12923
12945
  let buttonNextId = getComponentId("button_next", props.id);
12924
12946
  let formPaginationId = getComponentId("form_pagination", props.id);
12947
+ let parentFormData = "${__super.__super.__super.__super || {}}";
12948
+ let amisVersion = getComparableAmisVersion();
12949
+ if(amisVersion < 3.6){
12950
+ parentFormData = "${__super.__super || {}}";
12951
+ }
12925
12952
  if (mode == "new" || mode == "edit") {
12926
12953
  // let actionShowNewDialog = {
12927
12954
  // "actionType": "dialog",
@@ -13063,7 +13090,8 @@ async function getButtonActions(props, mode) {
13063
13090
  // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
13064
13091
  // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
13065
13092
  // "__parentForm": "${__super.__super || {}}",
13066
- "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
13093
+ // "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
13094
+ "__parentForm": mode == "new" ? "$$" : parentFormData,
13067
13095
  "global": "${global}",
13068
13096
  "uiSchema": "${uiSchema}",
13069
13097
  "index": "${index}",
@@ -13156,7 +13184,7 @@ async function getButtonActions(props, mode) {
13156
13184
  // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
13157
13185
  // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
13158
13186
  // "__parentForm": "${__super.__super || {}}",
13159
- "__parentForm": "${__super.__super || {}}",
13187
+ "__parentForm": parentFormData,
13160
13188
  "global": "${global}",
13161
13189
  "uiSchema": "${uiSchema}",
13162
13190
  "index": "${index}",