@steedos-widgets/amis-object 3.6.13 → 3.6.15

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.
@@ -1913,9 +1913,6 @@ body.steedos {
1913
1913
  -moz-column-gap: 1rem;
1914
1914
  column-gap: 1rem;
1915
1915
  }
1916
- .steedos-object-form .antd-Collapse .antd-Collapse-header.hidden {
1917
- display: none !important;
1918
- }
1919
1916
  .steedos-object-form .antd-Tabs-pane.is-active {
1920
1917
  display: grid;
1921
1918
  grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -1942,6 +1939,9 @@ body.steedos {
1942
1939
  overflow: visible;
1943
1940
  }
1944
1941
  }
1942
+ .steedos-object-form .antd-Collapse .antd-Collapse-header.hidden {
1943
+ display: none !important;
1944
+ }
1945
1945
  .steedos-object-form .steedos-input-rich-text-readonly .antd-RichTextControl {
1946
1946
  border: 0;
1947
1947
  }
@@ -1949,6 +1949,9 @@ body.steedos {
1949
1949
  .steedos-object-form .antd-Form-item .antd-Form-label + .antd-Form-item-controlBox {
1950
1950
  max-width: unset;
1951
1951
  }
1952
+ .steedos-object-form .antd-Collapse::before {
1953
+ content: unset;
1954
+ }
1952
1955
  }
1953
1956
 
1954
1957
  @media (max-width: 767px) {
@@ -4253,7 +4253,7 @@ function getRecordPermissionsQuery(object, recordId, options){
4253
4253
  function getApi$2 (isMobile){
4254
4254
  if(isMobile);else {
4255
4255
  // return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
4256
- return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
4256
+ return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
4257
4257
  }
4258
4258
  }
4259
4259
 
@@ -4467,6 +4467,7 @@ var frontend_form_confirm$1 = "Confirm";
4467
4467
  var frontend_form_delete$1 = "Delete";
4468
4468
  var frontend_form_view$1 = "view";
4469
4469
  var frontend_form_details$1 = "details";
4470
+ var frontend_form_validation_failed_url$1 = "The URL format is incorrect";
4470
4471
  var frontend_delete_confirm_text$1 = "Are you sure you want to delete this item?";
4471
4472
  var frontend_delete_many_selected_required$1 = "Please select the item to be deleted";
4472
4473
  var frontend_delete_many_confirm_text$1 = "Are you sure you want to delete?";
@@ -4555,6 +4556,7 @@ var en_us = {
4555
4556
  frontend_form_delete: frontend_form_delete$1,
4556
4557
  frontend_form_view: frontend_form_view$1,
4557
4558
  frontend_form_details: frontend_form_details$1,
4559
+ frontend_form_validation_failed_url: frontend_form_validation_failed_url$1,
4558
4560
  frontend_delete_confirm_text: frontend_delete_confirm_text$1,
4559
4561
  frontend_delete_many_selected_required: frontend_delete_many_selected_required$1,
4560
4562
  frontend_delete_many_confirm_text: frontend_delete_many_confirm_text$1,
@@ -4644,6 +4646,7 @@ var frontend_form_confirm = "确认";
4644
4646
  var frontend_form_delete = "删除";
4645
4647
  var frontend_form_view = "查看";
4646
4648
  var frontend_form_details = "详情";
4649
+ var frontend_form_validation_failed_url = "URL 格式不正确";
4647
4650
  var frontend_delete_confirm_text = "确定要删除此项目?";
4648
4651
  var frontend_delete_many_selected_required = "请选择要删除的项";
4649
4652
  var frontend_delete_many_confirm_text = "确定要删除吗?";
@@ -4733,6 +4736,7 @@ var zh_cn = {
4733
4736
  frontend_form_delete: frontend_form_delete,
4734
4737
  frontend_form_view: frontend_form_view,
4735
4738
  frontend_form_details: frontend_form_details,
4739
+ frontend_form_validation_failed_url: frontend_form_validation_failed_url,
4736
4740
  frontend_delete_confirm_text: frontend_delete_confirm_text,
4737
4741
  frontend_delete_many_selected_required: frontend_delete_many_selected_required,
4738
4742
  frontend_delete_many_confirm_text: frontend_delete_many_confirm_text,
@@ -11464,6 +11468,10 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11464
11468
  // const scope = event.context.scoped;
11465
11469
  // 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
11466
11470
  // 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
11471
+ let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
11472
+ if(!filterForm){
11473
+ return;
11474
+ }
11467
11475
  let isLookup = event.data.isLookup;
11468
11476
  let __lookupField = event.data.__lookupField;
11469
11477
  let __changedFilterFormValuesKey = "__changedFilterFormValues";
@@ -11474,9 +11482,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11474
11482
  }
11475
11483
  __changedFilterFormValuesKey += lookupTag;
11476
11484
  }
11477
- let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
11478
11485
  setTimeout(function(){
11479
- filterForm.setValues(event.data[__changedFilterFormValuesKey]);
11486
+ filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
11480
11487
  }, 500);
11481
11488
  `;
11482
11489
 
@@ -16067,6 +16074,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
16067
16074
  type: getAmisStaticFieldType$1('url', readonly, field),
16068
16075
  static: readonly ? true : false
16069
16076
  };
16077
+ if(!readonly){
16078
+ // amis input-url控件不支持相对路径,这里支持下
16079
+ // 如果要使用amis原生input-url控件的默认的isUrl验证效果或自定义字段validations效果,配置字段的amis.validations属性即可,配置为null或空字符串则使用amis默认的isUrl效果
16080
+ let fieldAmisValidations = field.amis?.validations;
16081
+ if(typeof fieldAmisValidations === "undefined"){
16082
+ Object.assign(convertData, {
16083
+ "validations": {
16084
+ "matchRegexp": "^((http:\\/\\/|https:\\/\\/|ftp:\\/\\/|sftp:\\/\\/)+([^\\s\\/\\.]+(\\.[^\\s\\/\\.]+)+))*(\\/[^\\s\\.\\/]+)*$"
16085
+ },
16086
+ "validationErrors": {
16087
+ "matchRegexp": instance.t('frontend_form_validation_failed_url')//"URL 格式不正确"
16088
+ }
16089
+ });
16090
+ }
16091
+ }
16070
16092
  if(readonly && field.show_as_qr){
16071
16093
  convertData = {
16072
16094
  type: "control",
@@ -22213,12 +22235,12 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
22213
22235
  /*
22214
22236
  * @Author: baozhoutao@steedos.com
22215
22237
  * @Date: 2022-09-01 14:44:57
22216
- * @LastEditors: baozhoutao@steedos.com
22217
- * @LastEditTime: 2024-03-30 10:06:03
22238
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
22239
+ * @LastEditTime: 2024-05-14 15:12:49
22218
22240
  * @Description:
22219
22241
  */
22220
22242
  var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0, function () {
22221
- var app, data, className, _a, showAppName, _b, appNameClassName, _c, customElements, _d, showAppIcon, formFactor, isMobile, on_click_script, mobile_blank_script, dialogSchema, badgeText;
22243
+ var app, data, className, _a, showAppName, _b, appNameClassName, _c, customElements, _d, showAppIcon, formFactor, isMobile, on_click_script, mobile_blank_script, convertAppVisibleOnScript, pcInitApiAdaptorScript, mobileInitApiAdaptorScript, dialogSchema, badgeText;
22222
22244
  return __generator(this, function (_e) {
22223
22245
  app = props.app, data = props.data, className = props.className, _a = props.showAppName, showAppName = _a === void 0 ? true : _a, _b = props.appNameClassName, appNameClassName = _b === void 0 ? '' : _b, _c = props.customElements, customElements = _c === void 0 ? [] : _c, _d = props.showAppIcon, showAppIcon = _d === void 0 ? true : _d;
22224
22246
  if (!app) {
@@ -22228,6 +22250,9 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
22228
22250
  isMobile = formFactor === "SMALL" ? true : false;
22229
22251
  on_click_script = "\n var evalFunString = \"(function(){\" + event.data.on_click + \"})()\";\n try{\n eval(evalFunString);\n }\n catch(e){\n console.error(\"catch some error when eval the on_click script for app link:\");\n console.error(e.message + \"\\r\\n\" + e.stack);\n }\n ";
22230
22252
  mobile_blank_script = "\n if(event.data.path[0] == \"/\"){\n Steedos.openWindow(event.data.context.rootUrl + event.data.path)\n }else{\n Steedos.openWindow(event.data.path)\n }\n ";
22253
+ convertAppVisibleOnScript = "\n var currentAmis = amisRequire('amis');\n app_items.forEach((item) => {\n let visible_on = item.visible_on && item.visible_on.trim();\n if(visible_on){\n // amis visibleOn\u5C5E\u6027\u4E2D\u7684\u8868\u8FBE\u5F0F\u6765\u81EA\u4F5C\u7528\u57DF\u4E2D\u53D8\u91CF\u65F6,amis\u4E0D\u8BA4,\u6240\u4EE5\u8FD9\u91CC\u628A\u516C\u5F0F\u8868\u8FBE\u5F0F\u63D0\u524D\u8FD0\u884C\u4E0B\n try{\n visible_on = currentAmis.evaluate(visible_on, BuilderAmisObject.AmisLib.createObject(context, item));\n item.visible_on = visible_on;\n }\n catch(ex){\n console.error(\"\u8FD0\u884C\u5E94\u7528\u201C\" + item.name + \"\u201D\u7684\u663E\u793A\u516C\u5F0F\u8868\u8FBE\u5F0F\u65F6\u51FA\u73B0\u9519\u8BEF:\",ex);\n item.visible_on = false;\n }\n }\n else{\n item.visible_on = true;\n }\n });\n ";
22254
+ pcInitApiAdaptorScript = "\n let app_items = payload;\n let object_items = [];\n let objects = [];\n app_items.forEach((item) => {\n item.children.forEach((i) => {\n if (objects.indexOf(i.id) < 0) {\n objects.push(i.id);\n if(i.type != 'url' && i.type != 'page'){object_items.push(i);}\n }\n })\n })\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items,\n object_items\n }\n return payload;\n ");
22255
+ mobileInitApiAdaptorScript = "\n let app_items = payload;\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items\n }\n return payload;\n ");
22231
22256
  dialogSchema = {};
22232
22257
  badgeText = "${IF(${id} == 'approve_workflow',${ss:keyvalues.badge.value|pick:'workflow'},${ss:keyvalues.badge.value|pick:${id}}) | toInt}";
22233
22258
  if (isMobile) {
@@ -22288,6 +22313,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
22288
22313
  ]
22289
22314
  }
22290
22315
  },
22316
+ "visibleOn": "${visible_on}",
22291
22317
  "className": "block w-1/3 py-4",
22292
22318
  "style": {
22293
22319
  "display": "inline-flex",
@@ -22307,7 +22333,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
22307
22333
  "headers": {
22308
22334
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
22309
22335
  },
22310
- "adaptor": "\nlet app_items = payload;\npayload = {\n app_items\n}\nreturn payload;",
22336
+ "adaptor": mobileInitApiAdaptorScript,
22311
22337
  "messages": {}
22312
22338
  },
22313
22339
  "onEvent": {
@@ -22356,63 +22382,64 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
22356
22382
  {
22357
22383
  "type": "each",
22358
22384
  "name": "app_items",
22359
- "items": {
22360
- "type": "button",
22361
- "level": "link",
22362
- "body": [{
22363
- "type": "tpl",
22364
- "tpl": "<div class='slds-app-launcher__tile slds-text-link_reset'><div class='slds-app-launcher__tile-figure'><svg class='w-12 h-12 slds-icon slds-icon_container slds-icon-standard-${REPLACE(icon, '_', '-')}' aria-hidden='true'><use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#${icon}'></use></svg><span class='slds-assistive-text'>${name}</span></div><div class='slds-app-launcher__tile-body'><span class='slds-link text-blue-600 text-lg'><span title='${name}'>${name}</span></span><div style='display: -webkit-box; -webkit-line-clamp: 1;-webkit-box-orient: vertical;overflow: hidden;'><span title='${description}'>${description}</span></div></div></div>",
22365
- "badge": {
22366
- "mode": "text",
22367
- "text": badgeText,
22368
- "visibleOn": badgeText,
22369
- "className": "w-full",
22370
- "overflowCount": 99,
22371
- "style": {
22372
- "top": "20px",
22373
- "left": "37px",
22374
- "height": "20px",
22375
- "border-radius": "10px",
22376
- "line-height": "18px",
22377
- "margin-left": "${" + badgeText + ">9?(" + badgeText + ">99?'-21px':'-11px'):'0'}",
22378
- "right": "auto",
22379
- "font-size": "16px"
22385
+ "items": [{
22386
+ "type": "button",
22387
+ "level": "link",
22388
+ "body": [{
22389
+ "type": "tpl",
22390
+ "tpl": "<div class='slds-app-launcher__tile slds-text-link_reset'><div class='slds-app-launcher__tile-figure'><svg class='w-12 h-12 slds-icon slds-icon_container slds-icon-standard-${REPLACE(icon, '_', '-')}' aria-hidden='true'><use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#${icon}'></use></svg><span class='slds-assistive-text'>${name}</span></div><div class='slds-app-launcher__tile-body'><span class='slds-link text-blue-600 text-lg'><span title='${name}'>${name}</span></span><div style='display: -webkit-box; -webkit-line-clamp: 1;-webkit-box-orient: vertical;overflow: hidden;'><span title='${description}'>${description}</span></div></div></div>",
22391
+ "badge": {
22392
+ "mode": "text",
22393
+ "text": badgeText,
22394
+ "visibleOn": badgeText,
22395
+ "className": "w-full",
22396
+ "overflowCount": 99,
22397
+ "style": {
22398
+ "top": "20px",
22399
+ "left": "37px",
22400
+ "height": "20px",
22401
+ "border-radius": "10px",
22402
+ "line-height": "18px",
22403
+ "margin-left": "${" + badgeText + ">9?(" + badgeText + ">99?'-21px':'-11px'):'0'}",
22404
+ "right": "auto",
22405
+ "font-size": "16px"
22406
+ }
22380
22407
  }
22381
- }
22382
- }],
22383
- "onEvent": {
22384
- "click": {
22385
- "actions": [
22386
- {
22387
- "actionType": "closeDialog"
22388
- },
22389
- {
22390
- "actionType": "link",
22391
- "args": {
22392
- "link": "${path}"
22408
+ }],
22409
+ "onEvent": {
22410
+ "click": {
22411
+ "actions": [
22412
+ {
22413
+ "actionType": "closeDialog"
22393
22414
  },
22394
- "expression": "${AND(!blank , !on_click)}"
22395
- },
22396
- {
22397
- "actionType": "url",
22398
- "args": {
22399
- "url": "${path}",
22400
- "blank": true
22415
+ {
22416
+ "actionType": "link",
22417
+ "args": {
22418
+ "link": "${path}"
22419
+ },
22420
+ "expression": "${AND(!blank , !on_click)}"
22401
22421
  },
22402
- "expression": "${AND(blank , !on_click)}"
22403
- },
22404
- {
22405
- "actionType": "custom",
22406
- "script": on_click_script,
22407
- "expression": "${!!on_click}"
22408
- }
22409
- ]
22410
- }
22411
- },
22412
- "inline": true,
22413
- "style": {},
22414
- "className": "slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3"
22415
- },
22422
+ {
22423
+ "actionType": "url",
22424
+ "args": {
22425
+ "url": "${path}",
22426
+ "blank": true
22427
+ },
22428
+ "expression": "${AND(blank , !on_click)}"
22429
+ },
22430
+ {
22431
+ "actionType": "custom",
22432
+ "script": on_click_script,
22433
+ "expression": "${!!on_click}"
22434
+ }
22435
+ ]
22436
+ }
22437
+ },
22438
+ "inline": true,
22439
+ "style": {},
22440
+ "visibleOn": "${visible_on}",
22441
+ "className": "slds-p-horizontal_small slds-size_1-of-1 slds-medium-size_1-of-3"
22442
+ }],
22416
22443
  "className": "slds-grid slds-wrap slds-grid_pull-padded"
22417
22444
  }
22418
22445
  ]
@@ -22502,7 +22529,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
22502
22529
  "headers": {
22503
22530
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
22504
22531
  },
22505
- "adaptor": "\nlet app_items = payload;\nlet object_items = [];\nlet objects = [];\napp_items.forEach((item) => {\n item.children.forEach((i) => {\n if (objects.indexOf(i.id) < 0) {\n objects.push(i.id);\n if(i.type != 'url' && i.type != 'page'){object_items.push(i);}\n }\n })\n})\npayload = {\n app_items,\n object_items\n}\nreturn payload;"
22532
+ "adaptor": pcInitApiAdaptorScript
22506
22533
  }
22507
22534
  };
22508
22535
  }