@steedos-widgets/amis-object 6.3.0 → 6.3.1

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.
@@ -4387,7 +4387,7 @@ async function getLookupLinkOnClick$1(field, options) {
4387
4387
  const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
4388
4388
 
4389
4389
  const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
4390
- "recordId": "${value}",
4390
+ "recordId": `\${${field.name}}`,
4391
4391
  "data": {
4392
4392
  ...recordPage.schema.data,
4393
4393
  "_inDrawer": true, // 用于判断是否在抽屉中
@@ -4397,7 +4397,7 @@ async function getLookupLinkOnClick$1(field, options) {
4397
4397
  }) : {
4398
4398
  "type": "steedos-record-detail",
4399
4399
  "objectApiName": options.objectName,
4400
- "recordId": "${value}",
4400
+ "recordId": `\${${field.name}}`,
4401
4401
  "showBackButton": false,
4402
4402
  "showButtons": true,
4403
4403
  "data": {
@@ -4503,7 +4503,7 @@ const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
4503
4503
  labelClassName: "hidden",
4504
4504
  label: false,
4505
4505
  className: 'm-0',
4506
- tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
4506
+ tpl: `<a href="/app/-/cfs_files_filerecord/view/\${${steedosField.name}}" ${lookupATagClick}>\${name}</a>`,
4507
4507
  // tpl: "<%= item.name >",
4508
4508
  // onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
4509
4509
  onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick$1(steedosField, {
@@ -5513,7 +5513,7 @@ async function getTableColumns$1(object, fields, options){
5513
5513
  }
5514
5514
  //增加quickEdit属性,实现快速编辑
5515
5515
  const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
5516
- let className = "";
5516
+ let className = `steedos-table-${field.type}-field`;
5517
5517
  const bowserType = getBowserType();
5518
5518
  if(bowserType === "Safari"){
5519
5519
  className += " whitespace-nowrap ";
@@ -16900,6 +16900,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
16900
16900
  if(gridSub){
16901
16901
  delete gridSub.name;
16902
16902
  delete gridSub.label;
16903
+ //去除重复样式
16904
+ gridSub.className = gridSub.className.replace('border-b', '');
16903
16905
  convertData.items.push(
16904
16906
  Object.assign({}, gridSub, {label: subField.label}, subField.amis, {
16905
16907
  name: subFieldName
@@ -16954,6 +16956,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
16954
16956
  }
16955
16957
  // if(ctx.mode === 'edit'){
16956
16958
  let convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
16959
+ // 只读时file字段的外层control层若存在name,内部each组件存在问题
16960
+ if(readonly && field.type == "file") {
16961
+ convertDataResult.name = "";
16962
+ }
16957
16963
  // console.log("convertDataResult:", convertDataResult);
16958
16964
  return convertDataResult;
16959
16965
  // }else{
@@ -17173,13 +17179,17 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
17173
17179
  // console.log(`perField.type object ===> field`, field)
17174
17180
  }
17175
17181
  if (field.name.indexOf(".") < 0) {
17182
+ let _field = _.cloneDeep(field);
17183
+ if(field.type === "select" && field.data_type && field.data_type != "text"){
17184
+ _field.type = field.data_type;
17185
+ }
17176
17186
  if(field.type === "steedos-field"){
17177
17187
  // 如果是steedos-field则不需要通过convertSFieldToAmisField函数转换,因为steedos-field组件会转换
17178
- fieldSetBody.push(field);
17188
+ fieldSetBody.push(_field);
17179
17189
  }
17180
17190
  else {
17181
17191
  ctx.__formFields = formFields;
17182
- const amisField = await convertSFieldToAmisField(field, field.readonly, ctx);
17192
+ const amisField = await convertSFieldToAmisField(_field, _field.readonly, ctx);
17183
17193
  // 如果steedos-field稳定了,可以放开下面的代码直接用组件统一渲染字段
17184
17194
  // const amisField = {
17185
17195
  // "type": "steedos-field",
@@ -22874,7 +22884,7 @@ var AmisProvider = function (props) { return __awaiter(void 0, void 0, void 0, f
22874
22884
  * @Description:
22875
22885
  */
22876
22886
  var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0, function () {
22877
- 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;
22887
+ 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, overlaySchema;
22878
22888
  return __generator(this, function (_e) {
22879
22889
  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;
22880
22890
  if (!app) {
@@ -22889,113 +22899,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
22889
22899
  mobileInitApiAdaptorScript = "\n let app_items = payload;\n ".concat(convertAppVisibleOnScript, "\n payload = {\n app_items\n }\n return payload;\n ");
22890
22900
  dialogSchema = {};
22891
22901
  badgeText = "${IF(${id} == 'approve_workflow',${ss:keyvalues.badge.value|pick:'workflow'},${ss:keyvalues.badge.value|pick:${id}}) | toInt}";
22892
- if (isMobile) {
22893
- dialogSchema = {
22894
- "type": "service",
22895
- "className": "steedos-apps-service",
22896
- "affixFooter": false,
22897
- "body": [
22898
- {
22899
- "type": "each",
22900
- "name": "app_items",
22901
- "items": {
22902
- "type": "button",
22903
- "level": "link",
22904
- "body": [
22905
- {
22906
- "type": "tpl",
22907
- "tpl": "<div class='flex flex-col justify-center'><div class='text-center'><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></div><div class='text-center text-lg'>${name}</div></div>",
22908
- "badge": {
22909
- "mode": "text",
22910
- "text": badgeText,
22911
- "visibleOn": badgeText,
22912
- "overflowCount": 99,
22913
- "style": {
22914
- "right": "50%",
22915
- "margin-right": "-23px",
22916
- "height": "20px",
22917
- "border-radius": "10px",
22918
- "font-size": "16px",
22919
- "line-height": "18px"
22920
- }
22921
- }
22922
- }
22923
- ],
22924
- "onEvent": {
22925
- "click": {
22926
- "actions": [
22927
- {
22928
- "actionType": "closeDialog"
22929
- },
22930
- {
22931
- "actionType": "link",
22932
- "args": {
22933
- "link": "${path}"
22934
- },
22935
- "expression": "${AND(!blank , !on_click)}"
22936
- },
22937
- {
22938
- "actionType": "custom",
22939
- "script": mobile_blank_script,
22940
- "expression": "${AND(blank , !on_click)}"
22941
- },
22942
- {
22943
- "actionType": "custom",
22944
- "script": on_click_script,
22945
- "expression": "${on_click}"
22946
- }
22947
- ]
22948
- }
22949
- },
22950
- "visibleOn": "${visible_on}",
22951
- "className": "block w-1/3 py-4",
22952
- "style": {
22953
- "display": "inline-flex",
22954
- "justify-content": "center"
22955
- }
22956
- },
22957
- "className": "flex flex-wrap",
22958
- "id": "u:a98e9f6fb4db"
22959
- }
22960
- ],
22961
- "clearValueOnHidden": false,
22962
- "visible": true,
22963
- "messages": {},
22964
- "api": {
22965
- "method": "get",
22966
- "url": "${context.rootUrl}/service/api/apps/menus?mobile=true",
22967
- "headers": {
22968
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
22969
- },
22970
- "adaptor": mobileInitApiAdaptorScript,
22971
- "messages": {}
22972
- },
22973
- "onEvent": {
22974
- "@data.changed.steedos_keyvalues": {
22975
- "actions": [
22976
- {
22977
- "actionType": "reload"
22978
- }
22979
- ]
22980
- },
22981
- "fetchInited": {
22982
- "actions": [
22983
- {
22984
- "actionType": "broadcast",
22985
- "args": {
22986
- "eventName": "@appsLoaded"
22987
- },
22988
- "data": {
22989
- "apps": "${event.data.app_items}"
22990
- }
22991
- }
22992
- ]
22993
- }
22994
- },
22995
- "id": "u:2c8bd22d4ea8"
22996
- };
22997
- }
22998
- else {
22902
+ if (!isMobile) {
22999
22903
  dialogSchema = {
23000
22904
  "type": "service",
23001
22905
  "id": "u:0f6224a0836f",
@@ -23158,6 +23062,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
23158
23062
  },
23159
23063
  "api": {
23160
23064
  "method": "get",
23065
+ "cache": "10000",
23161
23066
  "url": "${context.rootUrl}/service/api/apps/menus?mobile=" + isMobile,
23162
23067
  "data": null,
23163
23068
  "headers": {
@@ -23167,11 +23072,139 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
23167
23072
  }
23168
23073
  };
23169
23074
  }
23075
+ overlaySchema = {
23076
+ "type": "service",
23077
+ "className": isMobile ? "steedos-apps-service" : "steedos-apps-service w-96",
23078
+ "affixFooter": false,
23079
+ "body": [
23080
+ {
23081
+ "type": "each",
23082
+ "source": isMobile ? "${app_items}" : "${ARRAYFILTER(app_items, (item,index) => index<=8)}",
23083
+ "items": {
23084
+ "type": "button",
23085
+ "level": "link",
23086
+ "body": [
23087
+ {
23088
+ "type": "tpl",
23089
+ "tpl": "<div class='flex flex-col justify-center'><div class='text-center'><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></div><div class='text-center text-lg'>${name}</div></div>",
23090
+ "badge": {
23091
+ "mode": "text",
23092
+ "text": badgeText,
23093
+ "visibleOn": badgeText,
23094
+ "overflowCount": 99,
23095
+ "style": {
23096
+ "right": "50%",
23097
+ "margin-right": "-23px",
23098
+ "height": "20px",
23099
+ "border-radius": "10px",
23100
+ "font-size": "16px",
23101
+ "line-height": "18px"
23102
+ }
23103
+ }
23104
+ }
23105
+ ],
23106
+ "onEvent": {
23107
+ "click": {
23108
+ "actions": [
23109
+ {
23110
+ "actionType": "closeDialog"
23111
+ },
23112
+ {
23113
+ "actionType": "link",
23114
+ "args": {
23115
+ "link": "${path}"
23116
+ },
23117
+ "expression": "${AND(!blank , !on_click)}"
23118
+ },
23119
+ {
23120
+ "actionType": "custom",
23121
+ "script": mobile_blank_script,
23122
+ "expression": "${AND(blank , !on_click)}"
23123
+ },
23124
+ {
23125
+ "actionType": "custom",
23126
+ "script": on_click_script,
23127
+ "expression": "${on_click}"
23128
+ }
23129
+ ]
23130
+ }
23131
+ },
23132
+ "visibleOn": "${visible_on}",
23133
+ "className": "block w-1/3 py-4",
23134
+ "style": {
23135
+ "display": "inline-flex",
23136
+ "justify-content": "center"
23137
+ }
23138
+ },
23139
+ "className": "flex flex-wrap",
23140
+ "id": "u:a98e9f6fb4db"
23141
+ },
23142
+ isMobile ? null : {
23143
+ "type": "divider",
23144
+ "className": "m-0"
23145
+ },
23146
+ isMobile ? null : {
23147
+ "type": "button",
23148
+ "level": "link",
23149
+ "label": "更多",
23150
+ "className": "w-full h-10",
23151
+ "actionType": "dialog",
23152
+ "dialog": {
23153
+ "size": "xl",
23154
+ "title": {
23155
+ "type": "tpl",
23156
+ "tpl": instance.t('frontend_application_launcher'),
23157
+ "className": "block text-xl text-center"
23158
+ },
23159
+ "actions": [],
23160
+ "body": [
23161
+ dialogSchema
23162
+ ]
23163
+ }
23164
+ }
23165
+ ],
23166
+ "clearValueOnHidden": false,
23167
+ "visible": true,
23168
+ "messages": {},
23169
+ "api": {
23170
+ "method": "get",
23171
+ "cache": "10000",
23172
+ "url": "${context.rootUrl}/service/api/apps/menus?mobile=true",
23173
+ "headers": {
23174
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
23175
+ },
23176
+ "adaptor": mobileInitApiAdaptorScript,
23177
+ "messages": {}
23178
+ },
23179
+ "onEvent": {
23180
+ "@data.changed.steedos_keyvalues": {
23181
+ "actions": [
23182
+ {
23183
+ "actionType": "reload"
23184
+ }
23185
+ ]
23186
+ },
23187
+ "fetchInited": {
23188
+ "actions": [
23189
+ {
23190
+ "actionType": "broadcast",
23191
+ "args": {
23192
+ "eventName": "@appsLoaded"
23193
+ },
23194
+ "data": {
23195
+ "apps": "${event.data.app_items}"
23196
+ }
23197
+ }
23198
+ ]
23199
+ }
23200
+ },
23201
+ "id": "u:2c8bd22d4ea8"
23202
+ };
23170
23203
  return [2 /*return*/, {
23171
23204
  "type": "service",
23172
23205
  className: className,
23173
23206
  "body": [
23174
- {
23207
+ isMobile ? {
23175
23208
  "type": "button",
23176
23209
  "actionType": "dialog",
23177
23210
  "className": "flex items-center",
@@ -23206,10 +23239,43 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
23206
23239
  },
23207
23240
  "actions": [],
23208
23241
  "body": [
23209
- dialogSchema
23242
+ overlaySchema
23210
23243
  ]
23211
23244
  },
23212
23245
  "id": "u:b5dc095e1c11"
23246
+ } : {
23247
+ "type": "steedos-dropdown",
23248
+ "placement": "bottomRight",
23249
+ "trigger": [
23250
+ "click"
23251
+ ],
23252
+ "body": __spreadArray([
23253
+ {
23254
+ "type": "tpl",
23255
+ "className": "flex items-center",
23256
+ "tpl": "<div aria-haspopup='true' title='".concat(instance.t('frontend_open_app_launcher'), "' class='slds-icon-waffle_container slds-context-bar__button' type='button'><span class='slds-icon-waffle'><span class='slds-r1'></span><span class='slds-r2'></span><span class='slds-r3'></span><span class='slds-r4'></span><span class='slds-r5'></span><span class='slds-r6'></span><span class='slds-r7'></span><span class='slds-r8'></span><span class='slds-r9'></span></span></div>"),
23257
+ "badge": {
23258
+ "visibleOn": "${ss:keyvalues.badge.value.workflow | toInt}",
23259
+ "offset": [3, -3],
23260
+ "style": {
23261
+ "width": "8px",
23262
+ "height": "8px"
23263
+ }
23264
+ },
23265
+ "hiddenOn": "".concat(!showAppIcon)
23266
+ },
23267
+ {
23268
+ type: 'tpl',
23269
+ className: "text-xl ml-4 mr-4 text-black nowrap ".concat(appNameClassName, " "),
23270
+ tpl: '${app.name}',
23271
+ hiddenOn: "".concat(!!app || !!!showAppName)
23272
+ }
23273
+ ], __read(customElements), false),
23274
+ "overlay": [
23275
+ overlaySchema
23276
+ ],
23277
+ "className": "flex items-center",
23278
+ "open": false
23213
23279
  }
23214
23280
  ],
23215
23281
  "id": "u:06ee48db134a",
@@ -23905,7 +23971,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
23905
23971
  body: [
23906
23972
  {
23907
23973
  "type": "wrapper",
23908
- "className": "bg-white sticky p-0 top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-50 border-b-[3px] border-sky-500 border-solid steedos-header-container sm:shadow",
23974
+ "className": "bg-white sticky p-0 top-0 z-40 w-full flex-none backdrop-blur transition-colors duration-500 lg:z-[1000] border-b-[3px] border-sky-500 border-solid steedos-header-container sm:shadow",
23909
23975
  body: [
23910
23976
  {
23911
23977
  "type": "wrapper",
@@ -24361,7 +24427,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
24361
24427
  _q), {
24362
24428
  type: 'static',
24363
24429
  tpl: '-',
24364
- className: "".concat(fieldBaseProps.className || '', " text-muted"),
24430
+ className: "".concat(fieldBaseProps.className || '', " text-muted !border-b-0"),
24365
24431
  hiddenOn: "${_display.".concat(steedosField.name, "}"),
24366
24432
  }],
24367
24433
  _p)]));
@@ -24475,7 +24541,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
24475
24541
  hasImageOrFile_1 = false;
24476
24542
  _$1.forEach(fieldValue, function (item) {
24477
24543
  var fileName = item.name;
24478
- if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
24544
+ if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.toLowerCase().slice(-4)) > -1) {
24479
24545
  hasImageOrFile_1 = true;
24480
24546
  }
24481
24547
  });
@@ -24487,7 +24553,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
24487
24553
  var fileName = item.name;
24488
24554
  var fileUrl = item.url;
24489
24555
  var filePreviewHtml = '';
24490
- if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
24556
+ if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.toLowerCase().slice(-4)) > -1) {
24491
24557
  var indexOfQuestionMark = fileUrl.indexOf('?');
24492
24558
  if (indexOfQuestionMark > -1) {
24493
24559
  var filePreviewUrl = fileUrl.substring(0, indexOfQuestionMark);