@steedos-widgets/amis-object 1.2.35 → 1.2.36

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.
@@ -3568,8 +3568,8 @@ function getContrastColor(bgColor) {
3568
3568
  /*
3569
3569
  * @Author: baozhoutao@steedos.com
3570
3570
  * @Date: 2022-05-23 09:53:08
3571
- * @LastEditors: liaodaxue
3572
- * @LastEditTime: 2023-07-28 16:26:31
3571
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
3572
+ * @LastEditTime: 2023-08-03 18:07:54
3573
3573
  * @Description:
3574
3574
  */
3575
3575
 
@@ -3651,7 +3651,11 @@ function getNameTplUrl(field, ctx){
3651
3651
 
3652
3652
  function getNameTpl(field, ctx){
3653
3653
  const href = getNameTplUrl(field, ctx);
3654
- return `<a href="${href}">\${${field.name}}</a>`
3654
+ let linkTarget = "";
3655
+ if(ctx && ctx.isLookup){
3656
+ linkTarget = "target='_blank'";
3657
+ }
3658
+ return `<a href="${href}" ${linkTarget}>\${${field.name}}</a>`
3655
3659
  }
3656
3660
 
3657
3661
  function getRelatedFieldTpl(field, ctx){
@@ -3664,6 +3668,11 @@ function getRelatedFieldTpl(field, ctx){
3664
3668
  }
3665
3669
  }
3666
3670
 
3671
+ let linkTarget = "";
3672
+ if(ctx && ctx.isLookup){
3673
+ linkTarget = "target='_blank'";
3674
+ }
3675
+
3667
3676
  const onlyDisplayLabel = ctx.onlyDisplayLabel;
3668
3677
 
3669
3678
  let fieldDataStrTpl = `data._display.${field.name}`;
@@ -3679,7 +3688,7 @@ function getRelatedFieldTpl(field, ctx){
3679
3688
  const href = Router$1.getObjectDetailPath({
3680
3689
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
3681
3690
  });
3682
- labelTpl = `<a href="${href}"><%=item.label%></a>`;
3691
+ labelTpl = `<a href="${href}" ${linkTarget}><%=item.label%></a>`;
3683
3692
  }
3684
3693
  tpl = `
3685
3694
  <% if (${fieldDataStrTpl} && ${fieldDataStrTpl}.length) { %><% ${fieldDataStrTpl}.forEach(function(item,index) { %> <% if(index>0 && index<${fieldDataStrTpl}.length){ %> , <% } %> ${labelTpl} <% }); %><% } %>
@@ -3697,7 +3706,7 @@ function getRelatedFieldTpl(field, ctx){
3697
3706
  const href = Router$1.getObjectDetailPath({
3698
3707
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
3699
3708
  });
3700
- labelTpl = `<a href="${href}">${labelTpl}</a>`;
3709
+ labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
3701
3710
  }
3702
3711
  tpl = labelTpl;
3703
3712
  }
@@ -3709,7 +3718,7 @@ function getRelatedFieldTpl(field, ctx){
3709
3718
  const href = Router$1.getObjectDetailPath({
3710
3719
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
3711
3720
  });
3712
- labelTpl = `<a href="${href}"><%=item.label%></a>`;
3721
+ labelTpl = `<a href="${href}" ${linkTarget}><%=item.label%></a>`;
3713
3722
  }
3714
3723
  tpl = `
3715
3724
  <% if (${fieldDataStrTpl} && ${fieldDataStrTpl}.length) { %><% ${fieldDataStrTpl}.forEach(function(item) { %> ${labelTpl} <% }); %><% } %>
@@ -6420,12 +6429,6 @@ async function getObjectFieldsFilterFormSchema(ctx) {
6420
6429
  if (
6421
6430
  field && window.isFieldTypeSearchable(field.type)
6422
6431
  ) {
6423
- delete field.defaultValue;
6424
- delete field.required;
6425
- delete field.is_wide;
6426
- delete field.readonly;
6427
- delete field.hidden;
6428
- delete field.omit;
6429
6432
  var ctx = ${JSON.stringify(ctx)};
6430
6433
  const amisField = window.getFieldSearchable(field, fields, ctx);
6431
6434
  return amisField;
@@ -6580,9 +6583,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6580
6583
  setData({ showFieldsFilter: false });
6581
6584
  }
6582
6585
  else{
6583
- console.log("===listViewPropsStoreKey=data==", data);
6584
6586
  const listViewPropsStoreKey = location.pathname + "/crud/" + (data.listViewId || "");
6585
- console.log("===listViewPropsStoreKey=122==", listViewPropsStoreKey);
6586
6587
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6587
6588
  if(localListViewProps){
6588
6589
  localListViewProps = JSON.parse(localListViewProps);
@@ -8905,6 +8906,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
8905
8906
  return ;
8906
8907
  }
8907
8908
  const refObjectConfig = await getUISchema(referenceTo.objectName);
8909
+
8910
+ ctx.idFieldName = refObjectConfig.idFieldName;
8911
+ ctx.objectName = refObjectConfig.name;
8912
+
8908
8913
  const tableFields = [];
8909
8914
  let i = 0;
8910
8915
  const searchableFields = [];
@@ -9272,7 +9277,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
9272
9277
  if(readonly){
9273
9278
  data.tpl = await getLookupTpl(field, ctx);
9274
9279
  }
9275
-
9276
9280
  return data;
9277
9281
  }
9278
9282
 
@@ -10602,6 +10606,24 @@ async function getFieldSearchable(perField, permissionFields, ctx){
10602
10606
  _field.multiple = true;
10603
10607
  _field.is_wide = false;
10604
10608
  _field.defaultValue = undefined;
10609
+ _field.required = false;
10610
+ _field.hidden = false;
10611
+ _field.omit = false;
10612
+
10613
+ if(_field.amis){
10614
+ delete _field.amis.static;
10615
+ delete _field.amis.staticOn;
10616
+ delete _field.amis.disabled;
10617
+ delete _field.amis.disabledOn;
10618
+ delete _field.amis.required;
10619
+ delete _field.amis.requiredOn;
10620
+ delete _field.amis.visible;
10621
+ delete _field.amis.visibleOn;
10622
+ delete _field.amis.hidden;
10623
+ delete _field.amis.hiddenOn;
10624
+ delete _field.amis.autoFill;
10625
+ }
10626
+
10605
10627
  const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
10606
10628
  if(amisField){
10607
10629
  return amisField;
@@ -10879,6 +10901,7 @@ async function getTableColumns$1(fields, options){
10879
10901
  if(field.wrap != true){
10880
10902
  className += " whitespace-nowrap";
10881
10903
  }
10904
+ let columnItem;
10882
10905
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
10883
10906
  const previewFileScript = `
10884
10907
  var data = event.data;
@@ -10886,12 +10909,11 @@ async function getTableColumns$1(fields, options){
10886
10909
  var file_id = data._id;
10887
10910
  SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});
10888
10911
  `;
10889
- columns.push({
10912
+ columnItem = {
10890
10913
  "type": "button",
10891
10914
  "label": `<%=data.versions ? data.name : "${field.label}"%>`,
10892
10915
  className,
10893
10916
  "level": "link",
10894
- "quickEdit": quickEditSchema,
10895
10917
  "onEvent": {
10896
10918
  "click": {
10897
10919
  "actions": [
@@ -10917,9 +10939,9 @@ async function getTableColumns$1(fields, options){
10917
10939
  ]
10918
10940
  }
10919
10941
  }
10920
- });
10942
+ };
10921
10943
  }else if(field.type === 'toggle'){
10922
- columns.push(Object.assign({}, {
10944
+ columnItem = Object.assign({}, {
10923
10945
  type: "switch",
10924
10946
  name: field.name,
10925
10947
  label: field.label,
@@ -10927,24 +10949,22 @@ async function getTableColumns$1(fields, options){
10927
10949
  toggled: field.toggled,
10928
10950
  static: true,
10929
10951
  className,
10930
- quickEdit: quickEditSchema
10931
- }, field.amis, {name: field.name}));
10952
+ }, field.amis, {name: field.name});
10932
10953
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
10933
- columns.push(Object.assign({}, {
10954
+ columnItem = Object.assign({}, {
10934
10955
  type: "switch",
10935
10956
  name: field.name,
10936
10957
  label: field.label,
10937
10958
  width: getFieldWidth(field.width),
10938
10959
  toggled: field.toggled,
10939
- quickEdit: quickEditSchema,
10940
10960
  static: true,
10941
10961
  className,
10942
10962
  ...getAmisFileReadonlySchema(field)
10943
- }, field.amis, {name: field.name}));
10963
+ }, field.amis, {name: field.name});
10944
10964
  }
10945
10965
  else if(field.type === 'select'){
10946
10966
  const map = getSelectMap(field.options);
10947
- columns.push(Object.assign({}, {
10967
+ columnItem = Object.assign({}, {
10948
10968
  type: "mapping",
10949
10969
  name: field.name,
10950
10970
  label: field.label,
@@ -10954,8 +10974,7 @@ async function getTableColumns$1(fields, options){
10954
10974
  toggled: field.toggled,
10955
10975
  className,
10956
10976
  static: true,
10957
- quickEdit: quickEditSchema
10958
- }, field.amis, {name: field.name}));
10977
+ }, field.amis, {name: field.name});
10959
10978
  }
10960
10979
  else {
10961
10980
  const tpl = await getFieldTpl(field, options);
@@ -10975,7 +10994,7 @@ async function getTableColumns$1(fields, options){
10975
10994
  className += 'min-w-56';
10976
10995
  }
10977
10996
  if(!field.hidden && !field.extra){
10978
- columns.push(Object.assign({}, {
10997
+ columnItem = Object.assign({}, {
10979
10998
  name: field.name,
10980
10999
  label: field.label,
10981
11000
  sortable: field.sortable,
@@ -10986,13 +11005,18 @@ async function getTableColumns$1(fields, options){
10986
11005
  toggled: field.toggled,
10987
11006
  className,
10988
11007
  static: true,
10989
- quickEdit: quickEditSchema,
10990
11008
  options: field.type === 'html' ? {html: true} : null
10991
11009
  // toggled: true
10992
- }, field.amis, {name: field.name}));
11010
+ }, field.amis, {name: field.name});
10993
11011
  }
10994
11012
  }
10995
-
11013
+ if(columnItem){
11014
+ if(quickEditSchema){
11015
+ columnItem.quickEdit = quickEditSchema;
11016
+ columnItem.quickEditEnabledOn = "${is_system !== true}";
11017
+ }
11018
+ columns.push(columnItem);
11019
+ }
10996
11020
  }
10997
11021
  // columns.push(getOperation(fields));
10998
11022
  if(!___default__namespace.some(columns, { name: options.labelFieldName })){
@@ -11298,6 +11322,7 @@ async function getTableOperation(ctx){
11298
11322
  }
11299
11323
 
11300
11324
  async function getTableSchema$1(fields, options){
11325
+ let isLookup = options && options.isLookup;
11301
11326
  if(!options){
11302
11327
  options = {};
11303
11328
  }
@@ -11307,7 +11332,9 @@ async function getTableSchema$1(fields, options){
11307
11332
  }
11308
11333
  else {
11309
11334
  columns = await getTableColumns$1(fields, options);
11310
- columns.push(await getTableOperation(options));
11335
+ if(!isLookup){
11336
+ columns.push(await getTableOperation(options));
11337
+ }
11311
11338
  }
11312
11339
  return {
11313
11340
  mode: "table",
@@ -19279,14 +19306,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
19279
19306
  /*
19280
19307
  * @Author: baozhoutao@steedos.com
19281
19308
  * @Date: 2023-01-14 16:41:24
19282
- * @LastEditors: baozhoutao@steedos.com
19283
- * @LastEditTime: 2023-07-31 10:22:56
19309
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
19310
+ * @LastEditTime: 2023-08-03 13:32:08
19284
19311
  * @Description:
19285
19312
  */
19286
19313
  var getSelectFlowSchema = function (id, props) {
19287
19314
  var label = props.label, data = props.data, name = props.name, required = props.required, _a = props.action, action = _a === void 0 ? "query" : _a, _b = props.distributeInstanceId, distributeInstanceId = _b === void 0 ? "" : _b, _c = props.distributeStepId, distributeStepId = _c === void 0 ? "" : _c, _d = props.mode, mode = _d === void 0 ? "input-tree" : _d, className = props.className, onEvent = props.onEvent, _e = props.multiple, multiple = _e === void 0 ? false : _e, delimiter = props.delimiter, joinValues = props.joinValues, extractValue = props.extractValue, searchable = props.searchable, _f = props.showIcon, showIcon = _f === void 0 ? true : _f, _g = props.showRadio, showRadio = _g === void 0 ? false : _g, showOutline = props.showOutline, initiallyOpen = props.initiallyOpen, unfoldedLevel = props.unfoldedLevel, treeContainerClassName = props.treeContainerClassName, _h = props.amis, amis = _h === void 0 ? {} : _h;
19288
19315
  // console.log(`=====onEvent`, onEvent)
19289
- return __assign$2({ type: mode, id: id, label: label, name: name, options: [], multiple: multiple, delimiter: delimiter, joinValues: joinValues, extractValue: extractValue, searchable: searchable, showOutline: showOutline, initiallyOpen: initiallyOpen, unfoldedLevel: unfoldedLevel, className: "overflow-y-auto " + className, required: required, treeContainerClassName: treeContainerClassName, heightAuto: true, menuTpl: mode === 'input-tree' ? {
19316
+ return __assign$2({ type: mode, id: id, label: label, name: name, options: [], multiple: multiple, delimiter: delimiter, joinValues: joinValues, extractValue: extractValue, searchable: searchable, showOutline: showOutline, initiallyOpen: initiallyOpen, unfoldedLevel: unfoldedLevel,
19317
+ // className: `overflow-y-auto ` + className,
19318
+ className: className, required: required, treeContainerClassName: treeContainerClassName, heightAuto: true, menuTpl: mode === 'input-tree' ? {
19290
19319
  type: "tpl",
19291
19320
  tpl: "<div class='flex'><span>${label}</span><span class='rounded p-1 text-xs text-center w-14 ${value == 'startFlows' ? '' : 'hidden'}'><button class='antd-Button antd-Button--link m-none p-none'>设置</button></span></div>",
19292
19321
  onEvent: {