@steedos-widgets/amis-object 1.2.35-beta.2 → 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.
@@ -3540,8 +3540,8 @@ function getContrastColor(bgColor) {
3540
3540
  /*
3541
3541
  * @Author: baozhoutao@steedos.com
3542
3542
  * @Date: 2022-05-23 09:53:08
3543
- * @LastEditors: liaodaxue
3544
- * @LastEditTime: 2023-07-28 16:26:31
3543
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
3544
+ * @LastEditTime: 2023-08-03 18:07:54
3545
3545
  * @Description:
3546
3546
  */
3547
3547
 
@@ -3623,7 +3623,11 @@ function getNameTplUrl(field, ctx){
3623
3623
 
3624
3624
  function getNameTpl(field, ctx){
3625
3625
  const href = getNameTplUrl(field, ctx);
3626
- return `<a href="${href}">\${${field.name}}</a>`
3626
+ let linkTarget = "";
3627
+ if(ctx && ctx.isLookup){
3628
+ linkTarget = "target='_blank'";
3629
+ }
3630
+ return `<a href="${href}" ${linkTarget}>\${${field.name}}</a>`
3627
3631
  }
3628
3632
 
3629
3633
  function getRelatedFieldTpl(field, ctx){
@@ -3636,6 +3640,11 @@ function getRelatedFieldTpl(field, ctx){
3636
3640
  }
3637
3641
  }
3638
3642
 
3643
+ let linkTarget = "";
3644
+ if(ctx && ctx.isLookup){
3645
+ linkTarget = "target='_blank'";
3646
+ }
3647
+
3639
3648
  const onlyDisplayLabel = ctx.onlyDisplayLabel;
3640
3649
 
3641
3650
  let fieldDataStrTpl = `data._display.${field.name}`;
@@ -3651,7 +3660,7 @@ function getRelatedFieldTpl(field, ctx){
3651
3660
  const href = Router$1.getObjectDetailPath({
3652
3661
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
3653
3662
  });
3654
- labelTpl = `<a href="${href}"><%=item.label%></a>`;
3663
+ labelTpl = `<a href="${href}" ${linkTarget}><%=item.label%></a>`;
3655
3664
  }
3656
3665
  tpl = `
3657
3666
  <% if (${fieldDataStrTpl} && ${fieldDataStrTpl}.length) { %><% ${fieldDataStrTpl}.forEach(function(item,index) { %> <% if(index>0 && index<${fieldDataStrTpl}.length){ %> , <% } %> ${labelTpl} <% }); %><% } %>
@@ -3669,7 +3678,7 @@ function getRelatedFieldTpl(field, ctx){
3669
3678
  const href = Router$1.getObjectDetailPath({
3670
3679
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
3671
3680
  });
3672
- labelTpl = `<a href="${href}">${labelTpl}</a>`;
3681
+ labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
3673
3682
  }
3674
3683
  tpl = labelTpl;
3675
3684
  }
@@ -3681,7 +3690,7 @@ function getRelatedFieldTpl(field, ctx){
3681
3690
  const href = Router$1.getObjectDetailPath({
3682
3691
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
3683
3692
  });
3684
- labelTpl = `<a href="${href}"><%=item.label%></a>`;
3693
+ labelTpl = `<a href="${href}" ${linkTarget}><%=item.label%></a>`;
3685
3694
  }
3686
3695
  tpl = `
3687
3696
  <% if (${fieldDataStrTpl} && ${fieldDataStrTpl}.length) { %><% ${fieldDataStrTpl}.forEach(function(item) { %> ${labelTpl} <% }); %><% } %>
@@ -6392,12 +6401,6 @@ async function getObjectFieldsFilterFormSchema(ctx) {
6392
6401
  if (
6393
6402
  field && window.isFieldTypeSearchable(field.type)
6394
6403
  ) {
6395
- delete field.defaultValue;
6396
- delete field.required;
6397
- delete field.is_wide;
6398
- delete field.readonly;
6399
- delete field.hidden;
6400
- delete field.omit;
6401
6404
  var ctx = ${JSON.stringify(ctx)};
6402
6405
  const amisField = window.getFieldSearchable(field, fields, ctx);
6403
6406
  return amisField;
@@ -6493,7 +6496,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6493
6496
  if(!event.data.isLookup){
6494
6497
  // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
6495
6498
  const listViewId = event.data.listViewId;
6496
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
6499
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
6497
6500
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6498
6501
  if(localListViewProps){
6499
6502
  localListViewProps = JSON.parse(localListViewProps);
@@ -6525,7 +6528,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6525
6528
  searchableFieldsStoreKey += "lookup/" + objectName;
6526
6529
  }
6527
6530
  else{
6528
- searchableFieldsStoreKey += listViewId;
6531
+ searchableFieldsStoreKey += (listViewId || "");
6529
6532
  }
6530
6533
  let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
6531
6534
  if(defaultSearchableFields){
@@ -6552,7 +6555,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6552
6555
  setData({ showFieldsFilter: false });
6553
6556
  }
6554
6557
  else{
6555
- const listViewPropsStoreKey = location.pathname + "/crud/" + data.listViewId ;
6558
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (data.listViewId || "");
6556
6559
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6557
6560
  if(localListViewProps){
6558
6561
  localListViewProps = JSON.parse(localListViewProps);
@@ -6598,7 +6601,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6598
6601
  searchableFieldsStoreKey += "lookup/" + objectName;
6599
6602
  }
6600
6603
  else{
6601
- searchableFieldsStoreKey += listViewId;
6604
+ searchableFieldsStoreKey += (listViewId || "");
6602
6605
  }
6603
6606
  sessionStorage.setItem(searchableFieldsStoreKey, value);
6604
6607
 
@@ -6656,7 +6659,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6656
6659
  }
6657
6660
 
6658
6661
  // 列表视图crud支持本地缓存,所以需要进一步清除浏览器本地缓存里面用户在可搜索项中移除的字段值
6659
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
6662
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
6660
6663
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6661
6664
  if(localListViewProps){
6662
6665
  localListViewProps = JSON.parse(localListViewProps);
@@ -6775,7 +6778,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6775
6778
  const fields = uiSchema.fields;
6776
6779
  const options = (payload.data?.options || []).filter(function(item){
6777
6780
  let field = fields[item.value];
6778
- return !!field && window.isFieldTypeSearchable(field.type)
6781
+ // TODO: 暂时禁用location类型字段的列表搜索
6782
+ return !!field && window.isFieldTypeSearchable(field.type) && field.type !== 'location'
6779
6783
  });
6780
6784
  payload.data = {
6781
6785
  "options": options
@@ -8378,6 +8382,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
8378
8382
 
8379
8383
  function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
8380
8384
  // console.log(`getObjectHeaderToolbar====>`, filterVisible)
8385
+ console.log(`getObjectHeaderToolbar`, mainObject);
8381
8386
  const isMobile = window.innerWidth < 768;
8382
8387
  if(isMobile){
8383
8388
  showDisplayAs = false;
@@ -8477,7 +8482,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8477
8482
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8478
8483
  },
8479
8484
  // getExportExcelToolbarButtonSchema(),
8480
- getSettingListviewToolbarButtonSchema(),
8485
+ mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
8481
8486
  getDisplayAsButton(mainObject?.name),
8482
8487
  filterVisible ? {
8483
8488
  "label": instance.t('frontend_button_search_tooltip'),
@@ -8873,6 +8878,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
8873
8878
  return ;
8874
8879
  }
8875
8880
  const refObjectConfig = await getUISchema(referenceTo.objectName);
8881
+
8882
+ ctx.idFieldName = refObjectConfig.idFieldName;
8883
+ ctx.objectName = refObjectConfig.name;
8884
+
8876
8885
  const tableFields = [];
8877
8886
  let i = 0;
8878
8887
  const searchableFields = [];
@@ -9240,7 +9249,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
9240
9249
  if(readonly){
9241
9250
  data.tpl = await getLookupTpl(field, ctx);
9242
9251
  }
9243
-
9244
9252
  return data;
9245
9253
  }
9246
9254
 
@@ -10317,12 +10325,35 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
10317
10325
  }
10318
10326
  }
10319
10327
 
10328
+ const coordinatesType = field.coordinatesType || "bd09";
10320
10329
  convertData = {
10321
10330
  type: getAmisStaticFieldType('location', readonly),
10322
10331
  tpl: readonly ? getLocationTpl(field) : null,
10323
10332
  ak,
10324
10333
  vendor,
10325
- label: field.label
10334
+ clearable: true,
10335
+ coordinatesType,
10336
+ label: field.label,
10337
+ pipeOut: (value, oldValue, data) => {
10338
+ if (value) {
10339
+ const lng = value.lng;
10340
+ const lat = value.lat;
10341
+ let coordinates = [lng,lat];
10342
+ if(window.coordtransform){
10343
+ if(coordinatesType.toLowerCase() === 'bd09'){
10344
+ const bd09togcj02 = window.coordtransform.bd09togcj02(lng,lat);
10345
+ coordinates = window.coordtransform.gcj02towgs84(bd09togcj02[0],bd09togcj02[1]);
10346
+ }else if(coordinatesType.toLowerCase() === 'gcj02'){
10347
+ coordinates = window.coordtransform.gcj02towgs84(lng,lat);
10348
+ }
10349
+ }
10350
+ value.wgs84 = {
10351
+ type: "Point",
10352
+ coordinates
10353
+ };
10354
+ return value; // 切换到数字之后的默认值
10355
+ }
10356
+ }
10326
10357
  };
10327
10358
  break;
10328
10359
  case 'avatar':
@@ -10547,6 +10578,24 @@ async function getFieldSearchable(perField, permissionFields, ctx){
10547
10578
  _field.multiple = true;
10548
10579
  _field.is_wide = false;
10549
10580
  _field.defaultValue = undefined;
10581
+ _field.required = false;
10582
+ _field.hidden = false;
10583
+ _field.omit = false;
10584
+
10585
+ if(_field.amis){
10586
+ delete _field.amis.static;
10587
+ delete _field.amis.staticOn;
10588
+ delete _field.amis.disabled;
10589
+ delete _field.amis.disabledOn;
10590
+ delete _field.amis.required;
10591
+ delete _field.amis.requiredOn;
10592
+ delete _field.amis.visible;
10593
+ delete _field.amis.visibleOn;
10594
+ delete _field.amis.hidden;
10595
+ delete _field.amis.hiddenOn;
10596
+ delete _field.amis.autoFill;
10597
+ }
10598
+
10550
10599
  const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
10551
10600
  if(amisField){
10552
10601
  return amisField;
@@ -10790,6 +10839,10 @@ async function getQuickEditSchema(field, options){
10790
10839
  if(field.type == "file" && field.multiple){
10791
10840
  quickEditSchema = false;
10792
10841
  }
10842
+ //TODO:location字段在列表中快速编辑后存在bug,保存时可能会丢失部分数据,暂时禁用
10843
+ if(field.type == "location"){
10844
+ quickEditSchema = false;
10845
+ }
10793
10846
  }
10794
10847
  return quickEditSchema;
10795
10848
  }
@@ -10820,6 +10873,7 @@ async function getTableColumns$1(fields, options){
10820
10873
  if(field.wrap != true){
10821
10874
  className += " whitespace-nowrap";
10822
10875
  }
10876
+ let columnItem;
10823
10877
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
10824
10878
  const previewFileScript = `
10825
10879
  var data = event.data;
@@ -10827,12 +10881,11 @@ async function getTableColumns$1(fields, options){
10827
10881
  var file_id = data._id;
10828
10882
  SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});
10829
10883
  `;
10830
- columns.push({
10884
+ columnItem = {
10831
10885
  "type": "button",
10832
10886
  "label": `<%=data.versions ? data.name : "${field.label}"%>`,
10833
10887
  className,
10834
10888
  "level": "link",
10835
- "quickEdit": quickEditSchema,
10836
10889
  "onEvent": {
10837
10890
  "click": {
10838
10891
  "actions": [
@@ -10858,9 +10911,9 @@ async function getTableColumns$1(fields, options){
10858
10911
  ]
10859
10912
  }
10860
10913
  }
10861
- });
10914
+ };
10862
10915
  }else if(field.type === 'toggle'){
10863
- columns.push(Object.assign({}, {
10916
+ columnItem = Object.assign({}, {
10864
10917
  type: "switch",
10865
10918
  name: field.name,
10866
10919
  label: field.label,
@@ -10868,24 +10921,22 @@ async function getTableColumns$1(fields, options){
10868
10921
  toggled: field.toggled,
10869
10922
  static: true,
10870
10923
  className,
10871
- quickEdit: quickEditSchema
10872
- }, field.amis, {name: field.name}));
10924
+ }, field.amis, {name: field.name});
10873
10925
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
10874
- columns.push(Object.assign({}, {
10926
+ columnItem = Object.assign({}, {
10875
10927
  type: "switch",
10876
10928
  name: field.name,
10877
10929
  label: field.label,
10878
10930
  width: getFieldWidth(field.width),
10879
10931
  toggled: field.toggled,
10880
- quickEdit: quickEditSchema,
10881
10932
  static: true,
10882
10933
  className,
10883
10934
  ...getAmisFileReadonlySchema(field)
10884
- }, field.amis, {name: field.name}));
10935
+ }, field.amis, {name: field.name});
10885
10936
  }
10886
10937
  else if(field.type === 'select'){
10887
10938
  const map = getSelectMap(field.options);
10888
- columns.push(Object.assign({}, {
10939
+ columnItem = Object.assign({}, {
10889
10940
  type: "mapping",
10890
10941
  name: field.name,
10891
10942
  label: field.label,
@@ -10895,8 +10946,7 @@ async function getTableColumns$1(fields, options){
10895
10946
  toggled: field.toggled,
10896
10947
  className,
10897
10948
  static: true,
10898
- quickEdit: quickEditSchema
10899
- }, field.amis, {name: field.name}));
10949
+ }, field.amis, {name: field.name});
10900
10950
  }
10901
10951
  else {
10902
10952
  const tpl = await getFieldTpl(field, options);
@@ -10916,7 +10966,7 @@ async function getTableColumns$1(fields, options){
10916
10966
  className += 'min-w-56';
10917
10967
  }
10918
10968
  if(!field.hidden && !field.extra){
10919
- columns.push(Object.assign({}, {
10969
+ columnItem = Object.assign({}, {
10920
10970
  name: field.name,
10921
10971
  label: field.label,
10922
10972
  sortable: field.sortable,
@@ -10927,13 +10977,18 @@ async function getTableColumns$1(fields, options){
10927
10977
  toggled: field.toggled,
10928
10978
  className,
10929
10979
  static: true,
10930
- quickEdit: quickEditSchema,
10931
10980
  options: field.type === 'html' ? {html: true} : null
10932
10981
  // toggled: true
10933
- }, field.amis, {name: field.name}));
10982
+ }, field.amis, {name: field.name});
10934
10983
  }
10935
10984
  }
10936
-
10985
+ if(columnItem){
10986
+ if(quickEditSchema){
10987
+ columnItem.quickEdit = quickEditSchema;
10988
+ columnItem.quickEditEnabledOn = "${is_system !== true}";
10989
+ }
10990
+ columns.push(columnItem);
10991
+ }
10937
10992
  }
10938
10993
  // columns.push(getOperation(fields));
10939
10994
  if(!___default.some(columns, { name: options.labelFieldName })){
@@ -11239,6 +11294,7 @@ async function getTableOperation(ctx){
11239
11294
  }
11240
11295
 
11241
11296
  async function getTableSchema$1(fields, options){
11297
+ let isLookup = options && options.isLookup;
11242
11298
  if(!options){
11243
11299
  options = {};
11244
11300
  }
@@ -11248,7 +11304,9 @@ async function getTableSchema$1(fields, options){
11248
11304
  }
11249
11305
  else {
11250
11306
  columns = await getTableColumns$1(fields, options);
11251
- columns.push(await getTableOperation(options));
11307
+ if(!isLookup){
11308
+ columns.push(await getTableOperation(options));
11309
+ }
11252
11310
  }
11253
11311
  return {
11254
11312
  mode: "table",
@@ -11344,7 +11402,7 @@ async function getTableApi(mainObject, fields, options){
11344
11402
  try{
11345
11403
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11346
11404
  const listViewId = api.data.listViewId;
11347
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
11405
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
11348
11406
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
11349
11407
  if(localListViewProps){
11350
11408
  localListViewProps = JSON.parse(localListViewProps);
@@ -11545,7 +11603,7 @@ async function getTableApi(mainObject, fields, options){
11545
11603
  try{
11546
11604
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11547
11605
  const listViewId = api.body.listViewId;
11548
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
11606
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
11549
11607
  /**
11550
11608
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
11551
11609
  * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
@@ -13513,8 +13571,8 @@ async function getRelatedListSchema(
13513
13571
  /*
13514
13572
  * @Author: baozhoutao@steedos.com
13515
13573
  * @Date: 2022-07-05 15:55:39
13516
- * @LastEditors: baozhoutao@steedos.com
13517
- * @LastEditTime: 2023-07-29 13:58:07
13574
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
13575
+ * @LastEditTime: 2023-08-01 14:50:23
13518
13576
  * @Description:
13519
13577
  */
13520
13578
 
@@ -13779,7 +13837,7 @@ async function getListSchema(
13779
13837
  * 本次存储代码段
13780
13838
  */
13781
13839
  try {
13782
- const listViewPropsStoreKey = location.pathname + "/crud/" + ctx.listViewId;
13840
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (ctx.listViewId || "");
13783
13841
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
13784
13842
  /**
13785
13843
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
@@ -19220,47 +19278,156 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
19220
19278
  /*
19221
19279
  * @Author: baozhoutao@steedos.com
19222
19280
  * @Date: 2023-01-14 16:41:24
19223
- * @LastEditors: baozhoutao@steedos.com
19224
- * @LastEditTime: 2023-04-21 11:50:26
19281
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
19282
+ * @LastEditTime: 2023-08-03 13:32:08
19225
19283
  * @Description:
19226
19284
  */
19227
19285
  var getSelectFlowSchema = function (id, props) {
19228
- 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;
19229
- console.log("=====onEvent", onEvent);
19230
- 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": className, "required": required, "treeContainerClassName": treeContainerClassName, "heightAuto": true,
19231
- // "menuTpl": {
19232
- // // type: "button",
19233
- // type: "tpl",
19234
- // tpl: "<div class='flex justify-between'><span>${label}</span><span class='rounded p-1 text-xs text-center w-14 ${children != null ? \'hidden\' : \'\'}'><button><i class='fa-regular fa-star'></i></button></span></div>",
19235
- // "onEvent": {
19236
- // "click": {
19237
- // "weight": 0,
19238
- // "actions": [
19239
- // {
19240
- // actionType: 'custom',
19241
- // script: "console.log('====event', event), event.preventDefault(); event.stopPropagation()"
19242
- // },
19243
- // {
19244
- // "args": {
19245
- // "api": {
19246
- // "url": "/aaa",
19247
- // "method": "get",
19248
- // "messages": {
19249
- // }
19250
- // }
19251
- // },
19252
- // "actionType": "download",
19253
- // "stopPropagation": true
19254
- // }
19255
- // ]
19256
- // }
19257
- // }
19258
- // },
19259
- "source": {
19260
- "method": "post",
19261
- "url": "${context.rootUrl}/graphql?keywords=${keywords}",
19262
- "requestAdaptor": "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || '', "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
19263
- "adaptor": "\n payload.data.options?.forEach(function(item,index) {\n if(!item.children || item.children.length == 0){\n payload.data.options.splice(index,1)\n }\n })\n return payload;\n ",
19286
+ 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;
19287
+ // console.log(`=====onEvent`, onEvent)
19288
+ 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,
19289
+ // className: `overflow-y-auto ` + className,
19290
+ className: className, required: required, treeContainerClassName: treeContainerClassName, heightAuto: true, menuTpl: mode === 'input-tree' ? {
19291
+ type: "tpl",
19292
+ 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>",
19293
+ onEvent: {
19294
+ click: {
19295
+ weight: 0,
19296
+ actions: [
19297
+ {
19298
+ actionType: "dialog",
19299
+ dialog: {
19300
+ type: "dialog",
19301
+ size: "lg",
19302
+ title: {
19303
+ type: "tpl",
19304
+ id: "u:0bce3c33b6e5",
19305
+ tpl: '<p>设置星标流程</p>',
19306
+ },
19307
+ body: [
19308
+ {
19309
+ type: "form",
19310
+ title: "表单",
19311
+ debug: false,
19312
+ body: [
19313
+ {
19314
+ type: "steedos-field",
19315
+ name: "startFlows",
19316
+ field: {
19317
+ name: "startFlows",
19318
+ type: 'lookup',
19319
+ label: "流程名称",
19320
+ required: true,
19321
+ reference_to: 'flows',
19322
+ multiple: true,
19323
+ },
19324
+ // type: "steedos-select-flow",
19325
+ // label: "流程名称",
19326
+ // name: "startFlows",
19327
+ // id: "startFlows",
19328
+ // multiple: true,
19329
+ // mode: "tree-select",
19330
+ // required: true,
19331
+ // options: [],
19332
+ // searchable: true,
19333
+ // amis: {
19334
+ // autoFill: {
19335
+ // users: [],
19336
+ // },
19337
+ // },
19338
+ // onlyLeaf: true
19339
+ }
19340
+ ],
19341
+ id: "u:742f9c0dc8a1",
19342
+ mode: "normal",
19343
+ initApi: {
19344
+ url: "${context.rootUrl}/api/steedos_keyvalues/startFlows",
19345
+ method: "get",
19346
+ dataType: "json",
19347
+ headers: {
19348
+ Authorization: "Bearer ${context.tenantId},${context.authToken}",
19349
+ },
19350
+ },
19351
+ api: {
19352
+ url: "${context.rootUrl}/api/steedos_keyvalues/startFlows",
19353
+ method: "post",
19354
+ dataType: "json",
19355
+ data: {
19356
+ "startFlows": "${startFlows}",
19357
+ },
19358
+ headers: {
19359
+ Authorization: "Bearer ${context.tenantId},${context.authToken}",
19360
+ },
19361
+ messages: {
19362
+ success: "设置成功!",
19363
+ failed: "设置失败",
19364
+ },
19365
+ },
19366
+ onEvent: {
19367
+ submitSucc: {
19368
+ actions: [
19369
+ {
19370
+ componentId: "",
19371
+ args: {},
19372
+ actionType: "closeDialog",
19373
+ },
19374
+ ],
19375
+ }
19376
+ },
19377
+ },
19378
+ ],
19379
+ id: "u:519ca64b1934",
19380
+ actions: [
19381
+ {
19382
+ type: "button",
19383
+ label: "取消",
19384
+ onEvent: {
19385
+ click: {
19386
+ actions: [
19387
+ {
19388
+ componentId: "",
19389
+ args: {},
19390
+ actionType: "closeDialog",
19391
+ },
19392
+ ],
19393
+ },
19394
+ },
19395
+ id: "u:1d0d136fe2f0",
19396
+ },
19397
+ {
19398
+ type: "button",
19399
+ label: "确定",
19400
+ onEvent: {
19401
+ click: {
19402
+ actions: [
19403
+ {
19404
+ args: {},
19405
+ actionType: "validate",
19406
+ componentId: "u:742f9c0dc8a1",
19407
+ },
19408
+ {
19409
+ componentId: "u:742f9c0dc8a1",
19410
+ args: {},
19411
+ actionType: "submit",
19412
+ },
19413
+ ],
19414
+ },
19415
+ },
19416
+ id: "u:f7f767bed23f",
19417
+ level: "primary",
19418
+ },
19419
+ ],
19420
+ },
19421
+ expression: "${event.data.value === 'startFlows' ? true : false}",
19422
+ },
19423
+ ],
19424
+ },
19425
+ },
19426
+ } : '', source: {
19427
+ method: "post",
19428
+ url: "${context.rootUrl}/graphql?keywords=${keywords}",
19429
+ requestAdaptor: "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || "", "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
19430
+ adaptor: "\n payload.data.options?.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n return payload;\n ",
19264
19431
  "headers": {
19265
19432
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
19266
19433
  }
@@ -19275,45 +19442,45 @@ var getSelectFlowSchema = function (id, props) {
19275
19442
  */
19276
19443
  var AmisSelectFlow = function (props) {
19277
19444
  //mode: "input-tree" | "tree-select"
19278
- var _a = props.mode, mode = _a === void 0 ? 'input-tree' : _a, _b = props.id, id = _b === void 0 ? 'selectFlow' + random(10000, 99999) : _b;
19445
+ var _a = props.mode, mode = _a === void 0 ? "input-tree" : _a, _b = props.id, id = _b === void 0 ? "selectFlow" + random(10000, 99999) : _b;
19279
19446
  console.log("AmisSelectFlow props", props);
19280
19447
  var inputId = "".concat(id, "_input");
19281
19448
  var flowSchema = getSelectFlowSchema(inputId, props);
19282
- if (mode === 'tree-select') {
19449
+ if (mode === "tree-select") {
19283
19450
  return flowSchema;
19284
19451
  }
19285
19452
  return {
19286
- "type": "service",
19287
- "id": "selectFlowService",
19288
- "className": "steedos-select-flow-service",
19289
- "body": [
19453
+ type: "service",
19454
+ id: "selectFlowService",
19455
+ className: "steedos-select-flow-service",
19456
+ body: [
19290
19457
  {
19291
- "type": "search-box",
19292
- "className": "!w-full mb-2",
19293
- "name": "keywords",
19294
- "enhance": true,
19295
- "onEvent": {
19296
- "search": {
19297
- "actions": [
19458
+ type: "search-box",
19459
+ className: "!w-full mb-2",
19460
+ name: "keywords",
19461
+ enhance: true,
19462
+ onEvent: {
19463
+ search: {
19464
+ actions: [
19298
19465
  {
19299
- "actionType": "setValue",
19300
- "componentId": "selectFlowService",
19301
- "args": {
19302
- "value": {
19303
- "keywords": "${event.data.keywords}",
19304
- }
19305
- }
19466
+ actionType: "setValue",
19467
+ componentId: "selectFlowService",
19468
+ args: {
19469
+ value: {
19470
+ keywords: "${event.data.keywords}",
19471
+ },
19472
+ },
19306
19473
  },
19307
19474
  {
19308
- "componentId": inputId,
19309
- "actionType": "reload"
19310
- }
19311
- ]
19312
- }
19313
- }
19475
+ componentId: inputId,
19476
+ actionType: "reload",
19477
+ },
19478
+ ],
19479
+ },
19480
+ },
19314
19481
  },
19315
- flowSchema
19316
- ]
19482
+ flowSchema,
19483
+ ],
19317
19484
  };
19318
19485
  };
19319
19486