@steedos-widgets/amis-object 1.3.0-beta.8 → 1.3.0

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.
@@ -1,6 +1,6 @@
1
1
  import React, { createContext, useState, useEffect, createElement } from 'react';
2
- import * as ___default from 'lodash';
3
- import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get as get$1, isBoolean, omitBy, isNil, forEach, trimEnd, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isNumber } from 'lodash';
2
+ import * as _$1 from 'lodash';
3
+ import _$1__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get as get$1, isBoolean, omitBy, isNil, forEach, trimEnd, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign } from 'lodash';
4
4
  import { Dropdown, Tabs, Spin, Badge, Skeleton, Modal as Modal$1, message, notification, Button, Space, Drawer as Drawer$1 } from 'antd';
5
5
  import ReactDOM, { createRoot } from 'react-dom';
6
6
 
@@ -3523,8 +3523,8 @@ const Router$1 = {
3523
3523
  /*
3524
3524
  * @Author: baozhoutao@steedos.com
3525
3525
  * @Date: 2022-07-20 16:29:22
3526
- * @LastEditors: Please set LastEditors
3527
- * @LastEditTime: 2023-05-18 15:22:51
3526
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
3527
+ * @LastEditTime: 2023-09-06 18:59:40
3528
3528
  * @Description:
3529
3529
  */
3530
3530
 
@@ -3537,11 +3537,37 @@ function getContrastColor(bgColor) {
3537
3537
  return brightness < 128 ? "#ffffff" : "#000000";
3538
3538
  }
3539
3539
 
3540
+ function getLookupListView(refObjectConfig) {
3541
+ const listNameAll = "all";
3542
+ const listNameLookup = "lookup";
3543
+ let listViewAll, listViewLookup;
3544
+
3545
+ _.each(
3546
+ refObjectConfig.list_views,
3547
+ (view, name) => {
3548
+ if (name === listNameAll) {
3549
+ listViewAll = view;
3550
+ if(!listViewAll.name){
3551
+ listViewAll.name = name;
3552
+ }
3553
+ }
3554
+ else if (name === listNameLookup) {
3555
+ listViewLookup = view;
3556
+ if(!listViewLookup.name){
3557
+ listViewLookup.name = name;
3558
+ }
3559
+ }
3560
+ }
3561
+ );
3562
+ let listView = listViewLookup || listViewAll;
3563
+ return listView;
3564
+ }
3565
+
3540
3566
  /*
3541
3567
  * @Author: baozhoutao@steedos.com
3542
3568
  * @Date: 2022-05-23 09:53:08
3543
3569
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
3544
- * @LastEditTime: 2023-08-03 18:07:54
3570
+ * @LastEditTime: 2023-08-29 15:04:39
3545
3571
  * @Description:
3546
3572
  */
3547
3573
 
@@ -3645,7 +3671,7 @@ function getRelatedFieldTpl(field, ctx){
3645
3671
  linkTarget = "target='_blank'";
3646
3672
  }
3647
3673
 
3648
- const onlyDisplayLabel = ctx.onlyDisplayLabel;
3674
+ const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
3649
3675
 
3650
3676
  let fieldDataStrTpl = `data._display.${field.name}`;
3651
3677
 
@@ -3656,7 +3682,7 @@ function getRelatedFieldTpl(field, ctx){
3656
3682
  if(_.isString(field.reference_to) || !field.reference_to){
3657
3683
  if(field.multiple){
3658
3684
  let labelTpl = `<%=item.label%>`;
3659
- if(!onlyDisplayLabel){
3685
+ if(!onlyDisplayLookLabel){
3660
3686
  const href = Router$1.getObjectDetailPath({
3661
3687
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
3662
3688
  });
@@ -3674,7 +3700,7 @@ function getRelatedFieldTpl(field, ctx){
3674
3700
  objectNameTpl = `\${${field.name}.objectName}`;
3675
3701
  recordIdTpl = `\${${field.name}.value}`;
3676
3702
  }
3677
- if(!onlyDisplayLabel){
3703
+ if(!onlyDisplayLookLabel){
3678
3704
  const href = Router$1.getObjectDetailPath({
3679
3705
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
3680
3706
  });
@@ -3686,7 +3712,7 @@ function getRelatedFieldTpl(field, ctx){
3686
3712
 
3687
3713
  }else {
3688
3714
  let labelTpl = `<%=item.label%>`;
3689
- if(!onlyDisplayLabel){
3715
+ if(!onlyDisplayLookLabel){
3690
3716
  const href = Router$1.getObjectDetailPath({
3691
3717
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
3692
3718
  });
@@ -3739,7 +3765,7 @@ function getLocationTpl(field){
3739
3765
  }
3740
3766
 
3741
3767
  async function getFieldTpl (field, options){
3742
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLabel){
3768
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
3743
3769
  return getNameTpl(field, options)
3744
3770
  }
3745
3771
  switch (field.type) {
@@ -3783,10 +3809,10 @@ async function getFieldsTemplate(fields, display){
3783
3809
  let fieldsName = ['_id'];
3784
3810
  let displayFields = [];
3785
3811
  let fieldsArr = [];
3786
- if(___default.isArray(fields)){
3812
+ if(_$1.isArray(fields)){
3787
3813
  fieldsArr = fields;
3788
3814
  }else {
3789
- fieldsArr = ___default.values(fields);
3815
+ fieldsArr = _$1.values(fields);
3790
3816
  }
3791
3817
  for (const field of fieldsArr) {
3792
3818
  //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
@@ -3814,11 +3840,11 @@ async function getFieldsTemplate(fields, display){
3814
3840
  }
3815
3841
  }
3816
3842
 
3817
- displayFields = ___default.uniq(displayFields);
3818
- fieldsName = ___default.uniq(fieldsName);
3843
+ displayFields = _$1.uniq(displayFields);
3844
+ fieldsName = _$1.uniq(fieldsName);
3819
3845
  let expandFieldsQuery = "";
3820
3846
  if(expandFields.length > 0){
3821
- ___default.each(expandFields, function(field){
3847
+ _$1.each(expandFields, function(field){
3822
3848
  expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3823
3849
  });
3824
3850
  }
@@ -4045,7 +4071,7 @@ async function getFindQuery(object, recordId, fields, options){
4045
4071
  }
4046
4072
  }
4047
4073
  var treeFields = '';
4048
- if(object.enable_tree && ___default.includes(___default.keys(object.fields), 'parent') && ___default.includes(___default.keys(object.fields), 'children')){
4074
+ if(object.enable_tree && _$1.includes(_$1.keys(object.fields), 'parent') && _$1.includes(_$1.keys(object.fields), 'children')){
4049
4075
  treeFields = ',parent,children';
4050
4076
  }
4051
4077
 
@@ -4109,7 +4135,7 @@ function getApi$2 (isMobile){
4109
4135
  }
4110
4136
  }
4111
4137
 
4112
- var frontend_field_group_generalization$1 = "Generalization";
4138
+ var frontend_field_group_generalization$1 = "General";
4113
4139
  var frontend_download$1 = "Download";
4114
4140
  var frontend_form_save$1 = "Save";
4115
4141
  var frontend_form_save_and_new$1 = "Save and New";
@@ -4794,10 +4820,7 @@ async function getSearchApi(field, ctx) {
4794
4820
  }
4795
4821
 
4796
4822
  function getRefListViewSort$1(refObject){
4797
- const listView = ___default.find(
4798
- refObject.list_views,
4799
- (view, name) => name === "all"
4800
- );
4823
+ let listView = getLookupListView(refObject);
4801
4824
  let sort = "";
4802
4825
  if(listView){
4803
4826
  sort = getListViewSort(listView);
@@ -5306,257 +5329,92 @@ const getSchema$2 = (uiSchema) => {
5306
5329
  title: instance.t('frontend_import_data'),
5307
5330
  body: [
5308
5331
  {
5309
- type: "form",
5310
- mode: "edit",
5311
- persistData: false,
5312
- promptPageLeave: true,
5313
- name: "form_edit_data_import",
5314
- debug: false,
5315
- title: "",
5316
- submitText: "",
5317
- api: {
5318
- method: "post",
5319
- url: "${context.rootUrl}/graphql",
5320
- data: {
5321
- objectName: "queue_import_history",
5322
- $: "$$",
5323
- },
5324
- requestAdaptor:
5325
- "\n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n delete formData.success_count;\ndelete formData.failure_count;\ndelete formData.total_count;\ndelete formData.start_time;\ndelete formData.end_time;\ndelete formData.state;\ndelete formData.error;\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\n \n \n let fileFieldsKeys = [\"file\"];\n let fileFields = {\"file\":{\"name\":\"file\"}};\n fileFieldsKeys.forEach((item)=>{\n let fileFieldValue = formData[item];\n if(fileFieldValue){\n // 因为表单初始化接口的接收适配器中为file字段值重写了值及格式(为了字段编辑时正常显示附件名、点击附件名正常下载),所以保存时还原(为了字段值保存时正常保存id)。\n if(fileFields[item].multiple){\n if(fileFieldValue instanceof Array && fileFieldValue.length){\n formData[item] = fileFieldValue.map((value)=>{ \n if(typeof value === 'object'){\n return value.value;\n }else{\n return value;\n }\n });\n }\n }else{\n formData[item] = typeof fileFieldValue === 'object' ? fileFieldValue.value : fileFieldValue;\n }\n }\n })\n \n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId && formData.recordId !='new'){\n query = `mutation{record: ${objectName}__update(id: \"${formData._id}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
5326
- responseData: {
5327
- recordId: "${record._id}",
5328
- },
5329
- adaptor:
5330
- "console.log('payload', payload)\n return payload;\n ",
5331
- headers: {
5332
- Authorization:
5333
- "Bearer ${context.tenantId},${context.authToken}",
5334
- },
5335
- dataType: "json",
5332
+ "type": "steedos-object-form",
5333
+ "label": "对象表单",
5334
+ "objectApiName": "queue_import_history",
5335
+ "recordId": "",
5336
+ "mode": "edit",
5337
+ "layout": "normal",
5338
+ "defaultData":{
5339
+ "object_name": "${objectName}"
5336
5340
  },
5337
- initFetch: true,
5338
- body: [
5339
- {
5340
- type: "fieldSet",
5341
- title: instance.t('frontend_field_group_generalization'),
5342
- collapsable: true,
5343
- body: [
5344
- {
5345
- name: "object_name",
5346
- label: instance.t('frontend_import_data_object_name'),
5347
- required: false,
5348
- type: "select",
5349
- joinValues: false,
5350
- extractValue: true,
5351
- autoComplete: {
5352
- method: "post",
5353
- url: "${context.rootUrl}/graphql",
5354
- data: {
5355
- orderBy: "${orderBy}",
5356
- orderDir: "${orderDir}",
5357
- pageNo: "${page}",
5358
- pageSize: "${perPage}",
5359
- query:
5360
- "{options:objects(filters: {__filters}, top: {__top}){_id label:label value:name},count:objects__count(filters:{__filters})}",
5361
- $term: "$term",
5362
- $value: "$object_name.name",
5363
- $: "$$",
5364
- rfield: "${object_name}",
5365
- },
5366
- headers: {
5367
- Authorization:
5368
- "Bearer ${context.tenantId},${context.authToken}",
5369
- },
5370
- requestAdaptor:
5371
- "\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
5372
- },
5373
- className: "m-1",
5374
- labelClassName: "text-left",
5375
- clearValueOnHidden: false,
5376
- id: "u:04295fee3896",
5377
- multiple: false,
5378
- hidden: true,
5379
- },
5380
- {
5381
- name: "queue_import",
5382
- label: instance.t('frontend_import_data_queue_import'),
5383
- required: true,
5384
- type: "picker",
5385
- labelField: "description",
5386
- valueField: "_id",
5387
- modalMode: "dialog",
5388
- source: {
5389
- method: "post",
5390
- url: "${context.rootUrl}/graphql",
5391
- data: {
5392
- orderBy: "${orderBy}",
5393
- orderDir: "${orderDir}",
5394
- pageNo: "${page}",
5395
- pageSize: "${perPage}",
5396
- query:
5397
- '{rows:queue_import(filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"){_id,description,object_name,encoding,template_url,_display:_ui{object_name,encoding}},count:queue_import__count(filters:{__filters})}',
5398
- $term: "$term",
5399
- $self: "$$",
5341
+ "fieldsExtend":{
5342
+ "object_name": {
5343
+ "amis": {
5344
+ "hidden": true
5345
+ }
5346
+ }
5347
+ },
5348
+ "form": {
5349
+ debug: false,
5350
+ resetAfterSubmit: false,
5351
+ initApi: {
5352
+ url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
5353
+ sendOn: 'this.recordId',
5354
+ responseData: {
5355
+ importState: "${state}"
5356
+ }
5357
+ },
5358
+ interval: 3000,
5359
+ stopAutoRefreshWhen: "this.importState === 'finished'",
5360
+ initFetch: false,
5361
+ onEvent: {
5362
+ inited: {
5363
+ weight: 0,
5364
+ actions: [
5365
+ {
5366
+ "actionType": "broadcast",
5367
+ "args": {
5368
+ "eventName": `@data.changed.${uiSchema.name}`
5400
5369
  },
5401
- headers: {
5402
- Authorization:
5403
- "Bearer ${context.tenantId},${context.authToken}",
5370
+ "data": {
5371
+ "objectName": `${uiSchema.name}`,
5372
+ "displayAs": "${displayAs}",
5373
+ "recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
5404
5374
  },
5405
- requestAdaptor:
5406
- "\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value && selfData.value.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
5407
- adaptor:
5408
- "\n const enable_tree = undefined;\n if(enable_tree){\n const records = payload.data.rows;\n const treeRecords = [];\n const getChildren = (records, childrenIds)=>{\n if(!childrenIds){\n return;\n }\n const children = _.filter(records, (record)=>{\n return _.includes(childrenIds, record._id)\n });\n _.each(children, (item)=>{\n if(item.children){\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n _.each(records, (record)=>{\n if(!record.parent){\n treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));\n }\n });\n payload.data.rows = treeRecords;\n }\n return payload;\n ",
5375
+ "expression": "this.importState === 'finished'"
5409
5376
  },
5410
- size: "lg",
5411
- pickerSchema: {
5412
- mode: "table",
5413
- name: "thelist",
5414
- draggable: false,
5415
- headerToolbar: ["reload"],
5416
- defaultParams: {
5417
- perPage: 20,
5418
- },
5419
- columns: [
5420
- {
5421
- name: "_index",
5422
- type: "text",
5423
- width: 32,
5424
- placeholder: "",
5425
- },
5426
- {
5427
- name: "description",
5428
- label: instance.t('frontend_import_data_queue_import_description'),
5429
- type: "tpl",
5430
- tpl: '<a href="/app/undefined/undefined/view/${undefined}">${description}</a>',
5431
- className: "whitespace-nowrap",
5432
- html: null,
5433
- },
5434
- {
5435
- name: "object_name",
5436
- label: instance.t('frontend_import_data_object_name'),
5437
- type: "tpl",
5438
- tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
5439
- className: "whitespace-nowrap",
5440
- html: null,
5441
- },
5442
- {
5443
- name: "encoding",
5444
- label: instance.t('frontend_import_data_queue_import_encoding'),
5445
- type: "tpl",
5446
- tpl: "<div>${_display.encoding}</div>",
5447
- className: "whitespace-nowrap",
5448
- html: null,
5449
- },
5450
- {
5451
- name: "template_url",
5452
- label: instance.t('frontend_import_data_queue_import_template_url'),
5453
- type: "button-group",
5454
- buttons: [
5455
- {
5456
- type: "button",
5457
- label: instance.t('frontend_download'),
5458
- visibleOn: "${template_url}",
5459
- level: "link",
5460
- actionType: "download",
5461
- api:{
5462
- url: "${template_url}",
5463
- method: "get",
5464
- headers: {
5465
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
5466
- }
5467
- }
5468
- }
5469
- ],
5470
- options: {
5471
- html: true
5377
+ {
5378
+ "actionType": "closeDialog",
5379
+ "expression": "this.importState === 'finished'"
5380
+ }
5381
+ ]
5382
+ },
5383
+ submitSucc: {
5384
+ weight: 0,
5385
+ actions: [
5386
+ {
5387
+ args: {
5388
+ api: {
5389
+ url: "${context.rootUrl}/api/data/initiateImport",
5390
+ method: "post",
5391
+ data: {
5392
+ eventData: "${event.data}",
5393
+ },
5394
+ dataType: "json",
5395
+ requestAdaptor:
5396
+ "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
5397
+ adaptor:
5398
+ "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
5399
+ headers: {
5400
+ Authorization:
5401
+ "Bearer ${context.tenantId},${context.authToken}",
5472
5402
  },
5473
- className: "whitespace-nowrap",
5474
- },
5475
- null,
5476
- ],
5477
- syncLocation: false,
5478
- keepItemSelectionOnPageChange: true,
5479
- checkOnItemClick: false,
5480
- autoFillHeight: false,
5481
- },
5482
- joinValues: false,
5483
- extractValue: true,
5484
- className: "m-1",
5485
- labelClassName: "text-left",
5486
- clearValueOnHidden: true,
5487
- id: "u:401df27113e0",
5488
- },
5489
- {
5490
- name: "file",
5491
- label: instance.t('frontend_import_data_file'),
5492
- required: true,
5493
- type: "input-file",
5494
- accept: ".xlsx,.xls",
5495
- className: "m-1",
5496
- labelClassName: "text-left",
5497
- clearValueOnHidden: true,
5498
- useChunk: false,
5499
- receiver: {
5500
- method: "post",
5501
- url: "${context.rootUrl}/s3/files",
5502
- data: {
5503
- $: "$$",
5504
- context: "${context}",
5505
- },
5506
- adaptor:
5507
- '\n const { context } = api.body; \n var rootUrl = context.rootUrl + "/api/files/files/";\n payload = {\n status: response.status == 200 ? 0 : response.status,\n msg: response.statusText,\n data: {\n value: payload._id,\n name: payload.original.name,\n url: rootUrl + payload._id,\n }\n }\n return payload;\n ',
5508
- headers: {
5509
- Authorization:
5510
- "Bearer ${context.tenantId},${context.authToken}",
5511
- },
5512
- },
5513
- id: "u:0213f2cc365b",
5514
- },
5515
- ],
5516
- id: "u:4899c260d667",
5517
- },
5518
- ],
5519
- panelClassName: "m-0 sm:rounded-lg shadow-none",
5520
- bodyClassName: "p-0",
5521
- className: "p-4 sm:p-0 steedos-amis-form",
5522
- label: "对象表单",
5523
- objectApiName: "queue_import_history",
5524
- id: "u:e4ef598eed61",
5525
- onEvent: {
5526
- submitSucc: {
5527
- weight: 0,
5528
- actions: [
5529
- {
5530
- args: {
5531
- api: {
5532
- url: "${context.rootUrl}/api/data/initiateImport",
5533
- method: "post",
5534
- data: {
5535
- eventData: "${event.data}",
5536
5403
  },
5537
- dataType: "json",
5538
- requestAdaptor:
5539
- "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
5540
- adaptor:
5541
- "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
5542
- headers: {
5543
- Authorization:
5544
- "Bearer ${context.tenantId},${context.authToken}",
5404
+ messages: {
5405
+ success: instance.t('frontend_import_data_message_success'),
5406
+ failed: instance.t('frontend_import_data_message_failed'),
5545
5407
  },
5546
5408
  },
5547
- messages: {
5548
- success: instance.t('frontend_import_data_message_success'),
5549
- failed: instance.t('frontend_import_data_message_failed'),
5550
- },
5409
+ actionType: "ajax",
5410
+ expression: "event.data.result",
5551
5411
  },
5552
- actionType: "ajax",
5553
- expression: "event.data.result",
5554
- },
5555
- ],
5412
+ ],
5413
+ },
5556
5414
  },
5557
- },
5558
- closeDialogOnSubmit: true,
5559
- },
5415
+ closeDialogOnSubmit: false,
5416
+ }
5417
+ }
5560
5418
  ],
5561
5419
  id: "u:dc05498d3bd4",
5562
5420
  closeOnEsc: false,
@@ -5746,7 +5604,7 @@ const StandardButtons = {
5746
5604
  getStandardImportData: async (uiSchema, ctx)=>{
5747
5605
  return {
5748
5606
  type: 'amis_button',
5749
- amis_schema: await getSchema$2()
5607
+ amis_schema: await getSchema$2(uiSchema)
5750
5608
  }
5751
5609
  },
5752
5610
  getStandardOpenView: async (uiSchema, ctx)=>{
@@ -5776,7 +5634,7 @@ function getButtonVisibleOn$1(button){
5776
5634
  visible = button._visible;
5777
5635
  }
5778
5636
 
5779
- if(___default__default.isBoolean(visible)){
5637
+ if(_$1.isBoolean(visible)){
5780
5638
  visible = visible.toString();
5781
5639
  }
5782
5640
 
@@ -5804,7 +5662,7 @@ function getButtonVisibleOn$1(button){
5804
5662
 
5805
5663
  const getButtonVisible = (button, ctx) => {
5806
5664
  if (button._visible) {
5807
- if (___default__default.startsWith(___default__default.trim(button._visible), "function")) {
5665
+ if (_$1.startsWith(_$1.trim(button._visible), "function")) {
5808
5666
  window.eval("var fun = " + button._visible);
5809
5667
  button.visible = fun;
5810
5668
  } else if (isExpression$1(button._visible)) {
@@ -5819,7 +5677,7 @@ const getButtonVisible = (button, ctx) => {
5819
5677
  };
5820
5678
  }
5821
5679
  }
5822
- if (___default__default.isFunction(button.visible)) {
5680
+ if (_$1.isFunction(button.visible)) {
5823
5681
  try {
5824
5682
  return button.visible(ctx);
5825
5683
  } catch (error) {
@@ -5841,7 +5699,7 @@ const standardButtonsTodo = {
5841
5699
  } = this;
5842
5700
  const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
5843
5701
 
5844
- if(___default__default.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
5702
+ if(_$1.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
5845
5703
  listViewRef.handleAction({}, {
5846
5704
  "actionType": "toast",
5847
5705
  "toast": {
@@ -5868,19 +5726,19 @@ const standardButtonsTodo = {
5868
5726
  */
5869
5727
  const getButtons = (uiSchema, ctx) => {
5870
5728
  const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
5871
- let buttons = ___default__default.sortBy(___default__default.values(uiSchema.actions), "sort");
5872
- if (___default__default.has(uiSchema, "allow_customActions")) {
5873
- buttons = ___default__default.filter(buttons, (button) => {
5874
- return ___default__default.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
5729
+ let buttons = _$1.sortBy(_$1.values(uiSchema.actions), "sort");
5730
+ if (_$1.has(uiSchema, "allow_customActions")) {
5731
+ buttons = _$1.filter(buttons, (button) => {
5732
+ return _$1.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
5875
5733
  });
5876
5734
  }
5877
- if (___default__default.has(uiSchema, "exclude_actions")) {
5878
- buttons = ___default__default.filter(buttons, (button) => {
5879
- return !___default__default.include(uiSchema.exclude_actions, button.name);
5735
+ if (_$1.has(uiSchema, "exclude_actions")) {
5736
+ buttons = _$1.filter(buttons, (button) => {
5737
+ return !_$1.include(uiSchema.exclude_actions, button.name);
5880
5738
  });
5881
5739
  }
5882
5740
 
5883
- ___default__default.each(buttons, (button) => {
5741
+ _$1.each(buttons, (button) => {
5884
5742
  button.objectName = uiSchema.name;
5885
5743
  if (
5886
5744
  ctx.isMobile &&
@@ -5899,7 +5757,7 @@ const getButtons = (uiSchema, ctx) => {
5899
5757
  ctx.isMobile &&
5900
5758
  ["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
5901
5759
  ) {
5902
- ___default__default.map(buttons, (button) => {
5760
+ _$1.map(buttons, (button) => {
5903
5761
  if (button.name === "standard_edit") {
5904
5762
  button.on = "record_more";
5905
5763
  }
@@ -5909,14 +5767,14 @@ const getButtons = (uiSchema, ctx) => {
5909
5767
  });
5910
5768
  }
5911
5769
 
5912
- return ___default__default.filter(buttons, (button) => {
5913
- return ___default__default.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
5770
+ return _$1.filter(buttons, (button) => {
5771
+ return _$1.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
5914
5772
  });
5915
5773
  };
5916
5774
 
5917
5775
  const getListViewButtons = (uiSchema, ctx) => {
5918
5776
  const buttons = getButtons(uiSchema, ctx);
5919
- const listButtons = ___default__default.filter(buttons, (button) => {
5777
+ const listButtons = _$1.filter(buttons, (button) => {
5920
5778
  return button.on == "list";
5921
5779
  });
5922
5780
  return listButtons;
@@ -5924,23 +5782,23 @@ const getListViewButtons = (uiSchema, ctx) => {
5924
5782
 
5925
5783
  const getObjectDetailButtons = (uiSchema, ctx) => {
5926
5784
  const buttons = getButtons(uiSchema, ctx);
5927
- const detailButtons = ___default__default.filter(buttons, (button) => {
5785
+ const detailButtons = _$1.filter(buttons, (button) => {
5928
5786
  return button.on == "record" || button.on == "record_only";
5929
5787
  });
5930
- return ___default__default.sortBy(detailButtons, "sort");
5788
+ return _$1.sortBy(detailButtons, "sort");
5931
5789
  };
5932
5790
 
5933
5791
  const getObjectDetailMoreButtons = (uiSchema, ctx) => {
5934
5792
  const buttons = getButtons(uiSchema, ctx);
5935
- const moreButtons = ___default__default.filter(buttons, (button) => {
5793
+ const moreButtons = _$1.filter(buttons, (button) => {
5936
5794
  return button.on == "record_more" || button.on == "record_only_more";
5937
5795
  });
5938
- return ___default__default.sortBy(moreButtons, "sort");
5796
+ return _$1.sortBy(moreButtons, "sort");
5939
5797
  };
5940
5798
 
5941
5799
  const getListViewItemButtons = async (uiSchema, ctx)=>{
5942
5800
  const buttons = getButtons(uiSchema, ctx);
5943
- const listButtons = ___default__default.filter(buttons, (button) => {
5801
+ const listButtons = _$1.filter(buttons, (button) => {
5944
5802
  return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
5945
5803
  });
5946
5804
  return listButtons;
@@ -5957,7 +5815,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
5957
5815
  // });
5958
5816
  // return relatedListButtons;
5959
5817
  const buttons = getButtons(uiSchema, ctx);
5960
- const listButtons = ___default__default.filter(buttons, (button) => {
5818
+ const listButtons = _$1.filter(buttons, (button) => {
5961
5819
  return button.on == "list";
5962
5820
  });
5963
5821
  return listButtons;
@@ -5974,7 +5832,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
5974
5832
  const uiSchema = await getUISchema(objectName);
5975
5833
  if(uiSchema){
5976
5834
  const buttons = await getButtons(uiSchema, ctx);
5977
- const button = ___default__default.find(buttons, (button)=>{
5835
+ const button = _$1.find(buttons, (button)=>{
5978
5836
  return button.name === buttonName
5979
5837
  });
5980
5838
 
@@ -6060,13 +5918,13 @@ const execute = (button, props) => {
6060
5918
  return; //TODO 弹出提示未配置todo
6061
5919
  }
6062
5920
 
6063
- if (___default__default.isString(button.todo)) {
6064
- if (___default__default.startsWith(___default__default.trim(button.todo), "function")) {
5921
+ if (_$1.isString(button.todo)) {
5922
+ if (_$1.startsWith(_$1.trim(button.todo), "function")) {
6065
5923
  window.eval("var fun = " + button.todo);
6066
5924
  button.todo = fun;
6067
5925
  }
6068
5926
  }
6069
- if (___default__default.isFunction(button.todo)) {
5927
+ if (_$1.isFunction(button.todo)) {
6070
5928
  const todoThis = {
6071
5929
  objectName: props.objectName,
6072
5930
  object_name: props.objectName,
@@ -6091,7 +5949,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
6091
5949
  recordId: recordId,
6092
5950
  objectName: name
6093
5951
  });
6094
- let amisButtonsSchema = ___default__default.map(buttons, (button) => {
5952
+ let amisButtonsSchema = _$1.map(buttons, (button) => {
6095
5953
  return {
6096
5954
  type: 'steedos-object-button',
6097
5955
  name: button.name,
@@ -6101,7 +5959,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
6101
5959
  }
6102
5960
  });
6103
5961
  let moreButtonsVisibleOn = '';
6104
- let dropdownButtons = ___default__default.map(moreButtons, (button, index) => {
5962
+ let dropdownButtons = _$1.map(moreButtons, (button, index) => {
6105
5963
  if(index === 0){
6106
5964
  moreButtonsVisibleOn = getButtonVisibleOn$1(button);
6107
5965
  }else {
@@ -6144,11 +6002,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
6144
6002
  "vertical": true,
6145
6003
  "tiled": true,
6146
6004
  "buttons": [
6147
- ...___default__default.map(buttons, (button)=>{
6005
+ ..._$1.map(buttons, (button)=>{
6148
6006
  button.className += ' w-full';
6149
6007
  return button;
6150
6008
  }),
6151
- ...___default__default.map(moreButtons, (button)=>{
6009
+ ..._$1.map(moreButtons, (button)=>{
6152
6010
  button.className += ' w-full';
6153
6011
  return button;
6154
6012
  })
@@ -6193,6 +6051,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
6193
6051
  return {
6194
6052
  "type": "button",
6195
6053
  "icon": "fa fa-angle-down",
6054
+ "className": "mr-0",
6196
6055
  "onEvent": {
6197
6056
  "click": {
6198
6057
  "actions": [
@@ -6209,7 +6068,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
6209
6068
  "vertical": true,
6210
6069
  "tiled": true,
6211
6070
  "buttons": [
6212
- ...___default__default.map(buttons, (button)=>{
6071
+ ..._$1.map(buttons, (button)=>{
6213
6072
  return {
6214
6073
  type: 'steedos-object-button',
6215
6074
  name: button.name,
@@ -6238,7 +6097,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
6238
6097
  }
6239
6098
  }
6240
6099
  }else {
6241
- return ___default__default.map(buttons, (button) => {
6100
+ return _$1.map(buttons, (button) => {
6242
6101
  return {
6243
6102
  type: 'steedos-object-button',
6244
6103
  name: button.name,
@@ -6271,7 +6130,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
6271
6130
  "vertical": true,
6272
6131
  "tiled": true,
6273
6132
  "buttons": [
6274
- ...___default__default.map(buttons, (button)=>{
6133
+ ..._$1.map(buttons, (button)=>{
6275
6134
  return {
6276
6135
  type: 'steedos-object-button',
6277
6136
  name: button.name,
@@ -6300,7 +6159,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
6300
6159
  }
6301
6160
  }
6302
6161
  }else {
6303
- return ___default__default.map(buttons, (button) => {
6162
+ return _$1.map(buttons, (button) => {
6304
6163
  return {
6305
6164
  type: 'steedos-object-button',
6306
6165
  name: button.name,
@@ -6896,6 +6755,10 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
6896
6755
  each(
6897
6756
  objectSchema.list_views,
6898
6757
  (listView, name) => {
6758
+ if(name === "lookup"){
6759
+ // 内置lookup为弹出选择专用视图,不显示在列表切换区域
6760
+ return;
6761
+ }
6899
6762
  listViewButtonOptions.push({
6900
6763
  type: "button",
6901
6764
  label: listView.label,
@@ -8385,6 +8248,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
8385
8248
 
8386
8249
  return {
8387
8250
  "type": "tooltip-wrapper",
8251
+ "id": "steedos_crud_toolbar_quick_search",
8388
8252
  "align": "right",
8389
8253
  "title": "",
8390
8254
  "content": "可搜索字段:" + searchableFieldsLabel.join(","),
@@ -8416,76 +8280,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
8416
8280
  if(isMobile){
8417
8281
  showDisplayAs = false;
8418
8282
  }
8283
+ let toolbarCount;
8284
+ if(!hiddenCount){
8285
+ toolbarCount = {
8286
+ "type": "tpl",
8287
+ "tpl": "${count} " + instance.t('frontend_record_sum')
8288
+ };
8289
+ }
8290
+ let toolbarReloadButton;
8419
8291
  if(formFactor === 'SMALL'){
8420
- const onReloadScript = `
8421
- const scope = event.context.scoped;
8422
- var listView = scope.parent.getComponents().find(function(n){
8423
- return n.props.type === "crud";
8424
- });
8425
- listView.handleChangePage(1);
8426
- `;
8292
+ // const onReloadScript = `
8293
+ // const scope = event.context.scoped;
8294
+ // var listView = scope.parent.getComponents().find(function(n){
8295
+ // return n.props.type === "crud";
8296
+ // });
8297
+ // listView.handleChangePage(1);
8298
+ // `;
8299
+ // toolbarReloadButton = {
8300
+ // // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
8301
+ // "type": "button",
8302
+ // "align": "right",
8303
+ // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8304
+ // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8305
+ // "tooltipPlacement": "top",
8306
+ // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8307
+ // "label": "",
8308
+ // "icon": "fa fa-sync",
8309
+ // "visibleOn": "${!showFieldsFilter}",
8310
+ // "onEvent": {
8311
+ // "click": {
8312
+ // "actions": [
8313
+ // {
8314
+ // "actionType": "custom",
8315
+ // "script": onReloadScript
8316
+ // }
8317
+ // ]
8318
+ // }
8319
+ // },
8320
+ // };
8321
+
8322
+ // 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
8323
+ toolbarReloadButton = {
8324
+ "type": "reload",
8325
+ "align": "right",
8326
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8327
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8328
+ "tooltip":"",
8329
+ "tooltipPlacement": "top",
8330
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8331
+ };
8332
+ }
8333
+ else {
8334
+ toolbarReloadButton = {
8335
+ "type": "reload",
8336
+ "align": "right",
8337
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8338
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8339
+ "tooltip":"",
8340
+ "tooltipPlacement": "top",
8341
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8342
+ };
8343
+ }
8344
+ let toolbarFilter;
8345
+ if(filterVisible){
8346
+ toolbarFilter ={
8347
+ "label": instance.t('frontend_button_search_tooltip'),
8348
+ "icon": "fa fa-filter",
8349
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8350
+ // "tooltip": i18next.t('frontend_button_search_tooltip'),
8351
+ // "tooltipPlacement": "top",
8352
+ "type": "button",
8353
+ "badge": {
8354
+ "offset": [
8355
+ -5,
8356
+ 1
8357
+ ],
8358
+ "size":8,
8359
+ "animation": true,
8360
+ "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
8361
+ },
8362
+ "align": "right",
8363
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8364
+ "onEvent": {
8365
+ "click": {
8366
+ "actions": [
8367
+ {
8368
+ "actionType": "custom",
8369
+ "script": onFieldsFilterToggleScript
8370
+ }
8371
+ ]
8372
+ }
8373
+ },
8374
+ "id": "steedos_crud_toolbar_filter"
8375
+ };
8376
+ }
8377
+ let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
8378
+ let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
8379
+
8380
+ // toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
8381
+ // 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
8382
+ let toolbars = [];
8383
+ if(formFactor === 'SMALL'){
8384
+ if(toolbarCount){
8385
+ toolbars.push(toolbarCount);
8386
+ }
8387
+ toolbars.push(toolbarReloadButton);
8388
+ if(toolbarFilter){
8389
+ toolbars.push(toolbarFilter);
8390
+ }
8391
+ toolbars.push(toolbarDisplayAsButton);
8392
+ toolbars.push(toolbarDQuickSearchBox);
8427
8393
  return [
8428
8394
  // "bulkActions",
8429
8395
  ...(headerToolbarItems || []),
8430
- hiddenCount ? {} :{
8431
- "type": "tpl",
8432
- "tpl": "${count} " + instance.t('frontend_record_sum')
8433
- },
8434
- {
8435
- // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
8436
- "type": "button",
8437
- "align": "right",
8438
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8439
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8440
- "tooltipPlacement": "top",
8441
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8442
- "label": "",
8443
- "icon": "fa fa-sync",
8444
- "visibleOn": "${!showFieldsFilter}",
8445
- "onEvent": {
8446
- "click": {
8447
- "actions": [
8448
- {
8449
- "actionType": "custom",
8450
- "script": onReloadScript
8451
- }
8452
- ]
8453
- }
8454
- },
8455
- },
8456
- filterVisible ? {
8457
- "label": instance.t('frontend_button_search_tooltip'),
8458
- "icon": "fa fa-search",
8459
- "type": "button",
8460
- "tooltipPlacement": "top",
8461
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8462
- // "tooltip": i18next.t('frontend_button_search_tooltip'),
8463
- "badge": {
8464
- "offset": [
8465
- -5,
8466
- 1
8467
- ],
8468
- "size":8,
8469
- "animation": true,
8470
- "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
8471
- },
8472
- "align": "right",
8473
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8474
- "onEvent": {
8475
- "click": {
8476
- "actions": [
8477
- {
8478
- "actionType": "custom",
8479
- "script": onFieldsFilterToggleScript
8480
- }
8481
- ]
8482
- }
8483
- }
8484
- } : {},
8485
- getDisplayAsButton(mainObject?.name),
8486
- getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
8396
+ ...toolbars,
8487
8397
  ]
8488
8398
  }else {
8399
+ if(toolbarCount){
8400
+ toolbars.push(toolbarCount);
8401
+ }
8402
+ if(toolbarFilter){
8403
+ toolbars.push(toolbarFilter);
8404
+ }
8405
+ toolbars.push(toolbarReloadButton);
8406
+ if(mainObject?.permissions?.allowCreateListViews){
8407
+ toolbars.push(getSettingListviewToolbarButtonSchema());
8408
+ }
8409
+ toolbars.push(toolbarDisplayAsButton);
8410
+ toolbars.push(toolbarDQuickSearchBox);
8489
8411
  return [
8490
8412
  // "filter-toggler",
8491
8413
  ...(headerToolbarItems || []),
@@ -8494,56 +8416,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
8494
8416
  "type": "columns-toggler",
8495
8417
  "className": "hidden"
8496
8418
  },
8419
+ ...toolbars,
8497
8420
  // {
8498
8421
  // "type": "columns-toggler",
8499
8422
  // "className": "mr-2"
8500
8423
  // },
8501
- hiddenCount ? {} : {
8502
- "type": "tpl",
8503
- "tpl": "${count} " + instance.t('frontend_record_sum')
8504
- },
8505
- filterVisible ? {
8506
- "label": instance.t('frontend_button_search_tooltip'),
8507
- "icon": "fa fa-filter",
8508
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8509
- // "tooltip": i18next.t('frontend_button_search_tooltip'),
8510
- // "tooltipPlacement": "top",
8511
- "type": "button",
8512
- "badge": {
8513
- "offset": [
8514
- -5,
8515
- 1
8516
- ],
8517
- "size":8,
8518
- "animation": true,
8519
- "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
8520
- },
8521
- "align": "right",
8522
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8523
- "onEvent": {
8524
- "click": {
8525
- "actions": [
8526
- {
8527
- "actionType": "custom",
8528
- "script": onFieldsFilterToggleScript
8529
- }
8530
- ]
8531
- }
8532
- }
8533
- } : {},
8534
- {
8535
- "type": "reload",
8536
- "align": "right",
8537
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8538
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8539
- "tooltip":"",
8540
- "tooltipPlacement": "top",
8541
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8542
- },
8543
8424
  // getExportExcelToolbarButtonSchema(),
8544
- mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
8545
- getDisplayAsButton(mainObject?.name),
8546
- getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
8547
8425
  // {
8548
8426
  // "type": "drag-toggler",
8549
8427
  // "align": "right"
@@ -8744,10 +8622,8 @@ async function getDeferApi(field, ctx) {
8744
8622
  }
8745
8623
 
8746
8624
  function getRefListViewSort(refObject){
8747
- const listView = ___default.find(
8748
- refObject.list_views,
8749
- (view, name) => name === "all"
8750
- );
8625
+ let listView = getLookupListView(refObject);
8626
+
8751
8627
  let sort = "";
8752
8628
  if(listView){
8753
8629
  sort = getListViewSort(listView);
@@ -8837,12 +8713,11 @@ const getReferenceTo = async (field)=>{
8837
8713
  }
8838
8714
  };
8839
8715
 
8840
- function getLookupSapceUserTreeSchema(){
8841
- const tree = [{
8716
+ function getLookupSapceUserTreeSchema(isMobile){
8717
+ const treeSchema = {
8842
8718
  "type": "input-tree",
8843
- "className": "",
8719
+ "className":"steedos-select-user-tree",
8844
8720
  "inputClassName": "p-0",
8845
- "id": "u:7fd77b7915b0",
8846
8721
  "source": {
8847
8722
  "method": "post",
8848
8723
  "url": "${context.rootUrl}/graphql",
@@ -8873,6 +8748,10 @@ function getLookupSapceUserTreeSchema(){
8873
8748
  });
8874
8749
  listView.handleFilterSubmit(Object.assign({}, filterFormValues));
8875
8750
  `
8751
+ },
8752
+ {
8753
+ "actionType": "custom",
8754
+ "script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
8876
8755
  }
8877
8756
  ]
8878
8757
  }
@@ -8897,18 +8776,56 @@ function getLookupSapceUserTreeSchema(){
8897
8776
  "placeholder": "查找部门"
8898
8777
  },
8899
8778
  "unfoldedLevel": 2,
8900
- "style": {
8901
- "max-height": "100%",
8902
- "position": "absolute",
8903
- "left": "-330px",
8904
- "width": "320px",
8905
- "bottom": 0,
8906
- "top": "0",
8907
- "overflow": "auto",
8908
- "min-height":"300px"
8909
- },
8910
8779
  "originPosition": "left-top"
8911
- }];
8780
+ };
8781
+ const tree = [];
8782
+ if(isMobile){
8783
+ tree.push({
8784
+ type: "action",
8785
+ body:[
8786
+ {
8787
+ type: "action",
8788
+ body:[
8789
+ treeSchema
8790
+ ],
8791
+ className:"h-full w-[240px]"
8792
+ }
8793
+ ],
8794
+ className: "absolute inset-0 steedos-select-user-sidebar",
8795
+ "onEvent": {
8796
+ "click": {
8797
+ "actions": [
8798
+ {
8799
+ "actionType": "custom",
8800
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
8801
+ }
8802
+ ]
8803
+ }
8804
+ },
8805
+ id: "steedos_crud_toolbar_select_user_tree"
8806
+ });
8807
+ tree.push({
8808
+ "type": "button",
8809
+ "label": "组织",
8810
+ "icon": "fa fa-sitemap",
8811
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
8812
+ "align": "left",
8813
+ "onEvent": {
8814
+ "click": {
8815
+ "actions": [
8816
+ {
8817
+ "actionType": "custom",
8818
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
8819
+ }
8820
+ ]
8821
+ }
8822
+ },
8823
+ "id": "steedos_crud_toolbar_organization_button"
8824
+ });
8825
+ }else {
8826
+ tree.push(treeSchema);
8827
+ }
8828
+
8912
8829
  return tree;
8913
8830
  }
8914
8831
 
@@ -8923,24 +8840,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
8923
8840
  ctx.objectName = refObjectConfig.name;
8924
8841
 
8925
8842
  let tableFields = [];
8926
- let i = 0;
8927
8843
  const searchableFields = [];
8928
8844
 
8929
- const fieldsArr = [];
8930
-
8931
- const listName = "all";
8845
+ let fieldsArr = [];
8932
8846
 
8933
8847
  const isMobile = window.innerWidth < 768;
8934
8848
 
8935
- const listView = ___default.find(
8936
- refObjectConfig.list_views,
8937
- (listView, name) => name === listName
8938
- );
8849
+ let listView = getLookupListView(refObjectConfig);
8850
+ let listName = listView && listView.name;
8939
8851
  if (listView && listView.columns) {
8940
- ___default.each(listView.columns, function (column) {
8941
- if (___default.isString(column) && refObjectConfig.fields[column]) {
8852
+ _$1.each(listView.columns, function (column) {
8853
+ if (_$1.isString(column) && refObjectConfig.fields[column]) {
8942
8854
  fieldsArr.push(refObjectConfig.fields[column]);
8943
- } else if (___default.isObject(column) && refObjectConfig.fields[column.field]) {
8855
+ } else if (_$1.isObject(column) && refObjectConfig.fields[column.field]) {
8944
8856
  fieldsArr.push(
8945
8857
  Object.assign({}, refObjectConfig.fields[column.field], {
8946
8858
  width: column.width,
@@ -8950,28 +8862,27 @@ async function lookupToAmisPicker(field, readonly, ctx){
8950
8862
  }
8951
8863
  });
8952
8864
  }else {
8953
- ___default.each(refObjectConfig.fields , (field, field_name)=>{
8865
+ _$1.each(refObjectConfig.fields, (field, field_name)=>{
8954
8866
  if(field_name != '_id' && !field.hidden){
8955
- if(!___default.has(field, "name")){
8867
+ if(!_$1.has(field, "name")){
8956
8868
  field.name = field_name;
8957
8869
  }
8958
8870
  fieldsArr.push(field);
8959
8871
  }
8960
8872
  });
8873
+ // 没有视图权限时,取对象上前5个字段,按sort_no排序
8874
+ fieldsArr = _$1.sortBy(fieldsArr, "sort_no").slice(0,5);
8961
8875
  }
8962
8876
 
8963
- ___default.each(___default.sortBy(fieldsArr, "sort_no"),function(field){
8964
- if(i < 5){
8965
- if(!___default.find(tableFields, function(f){
8966
- return f.name === field.name
8967
- })){
8968
- i++;
8969
- tableFields.push(field);
8970
- }
8877
+ _$1.each(fieldsArr,function(field){
8878
+ if(!_$1.find(tableFields, function(f){
8879
+ return f.name === field.name
8880
+ })){
8881
+ tableFields.push(field);
8971
8882
  }
8972
8883
  });
8973
8884
 
8974
- ___default.each(refObjectConfig.fields, function (field) {
8885
+ _$1.each(refObjectConfig.fields, function (field) {
8975
8886
  if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
8976
8887
  searchableFields.push(field.name);
8977
8888
  }
@@ -8982,7 +8893,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
8982
8893
  [referenceTo.valueField.name]: referenceTo.valueField
8983
8894
  };
8984
8895
 
8985
- ___default.each(tableFields, (tableField)=>{
8896
+ _$1.each(tableFields, (tableField)=>{
8986
8897
  if(!tableField.hidden){
8987
8898
  fields[tableField.name] = tableField;
8988
8899
  }
@@ -8998,7 +8909,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
8998
8909
  if(source.url && !ctx.inFilterForm){
8999
8910
  const depend_on = [];
9000
8911
  const sendOn = [];
9001
- ___default.each(field.depend_on, (fName)=>{
8912
+ _$1.each(field.depend_on, (fName)=>{
9002
8913
  depend_on.push(`depend_on_${fName}=\${${fName}}`);
9003
8914
  sendOn.push(`this.${fName}`);
9004
8915
  });
@@ -9161,13 +9072,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
9161
9072
  }
9162
9073
 
9163
9074
  let pickerSchema = null;
9164
- if(ctx.formFactor === 'SMALL'){
9165
- pickerSchema = await getListSchema$1(tableFields, {
9166
- top: top,
9167
- ...ctx,
9168
- actions: false
9169
- });
9170
- }else {
9075
+ {
9171
9076
  pickerSchema = await getTableSchema$1(tableFields, {
9172
9077
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
9173
9078
  top: top,
@@ -9178,13 +9083,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
9178
9083
  pickerSchema.affixHeader = false;
9179
9084
 
9180
9085
  var headerToolbarItems = [];
9181
- if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
9182
- headerToolbarItems = getLookupSapceUserTreeSchema();
9183
- pickerSchema["style"] = {
9184
- "margin-left":"330px",
9185
- "min-height": "300px"
9186
- };
9187
- pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
9086
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
9087
+ headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
9088
+ pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
9188
9089
  }
9189
9090
 
9190
9091
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
@@ -9280,13 +9181,25 @@ async function lookupToAmisPicker(field, readonly, ctx){
9280
9181
  pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
9281
9182
  }
9282
9183
 
9184
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
9185
+ //手机端选人控件只保留部分toolbar
9186
+ pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
9187
+ if(["steedos_crud_toolbar_quick_search","steedos_crud_toolbar_filter","steedos_crud_toolbar_select_user_tree","steedos_crud_toolbar_organization_button"].indexOf(item.id) > -1){
9188
+ return true;
9189
+ }else {
9190
+ return false;
9191
+ }
9192
+ });
9193
+ pickerSchema.footerToolbar = ["pagination"];
9194
+ }
9195
+
9283
9196
  const data = {
9284
9197
  type: getAmisStaticFieldType('picker', readonly),
9285
9198
  modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
9286
9199
  labelField: referenceTo.labelField.name,
9287
9200
  valueField: referenceTo.valueField.name,
9288
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
9289
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
9201
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
9202
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
9290
9203
  modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
9291
9204
  source: source,
9292
9205
  size: "lg",
@@ -9352,10 +9265,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
9352
9265
  }
9353
9266
 
9354
9267
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
9355
- const listView = refObjectConfig && ___default.find(
9356
- refObjectConfig.list_views,
9357
- (listView, name) => name === "all"
9358
- );
9268
+ let listView = getLookupListView(refObjectConfig);
9359
9269
 
9360
9270
  let sort = "";
9361
9271
  if(listView){
@@ -9366,7 +9276,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
9366
9276
  if(apiInfo.url && !ctx.inFilterForm){
9367
9277
  const depend_on = [];
9368
9278
  const sendOn = [];
9369
- ___default.each(field.depend_on, (fName)=>{
9279
+ _$1.each(field.depend_on, (fName)=>{
9370
9280
  depend_on.push(`depend_on_${fName}=\${${fName}}`);
9371
9281
  sendOn.push(`this.${fName}`);
9372
9282
  });
@@ -9379,7 +9289,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
9379
9289
  apiInfo.data.$term = "$term";
9380
9290
  // apiInfo.data.$value = `$${field.name}.${referenceTo ? referenceTo.valueField.name : '_id'}`;
9381
9291
  apiInfo.data.$value = ctx.isRefToMutiple ? `$${field.name}.ids` : `$${field.name}`;
9382
- ___default.each(field.depend_on, function(fName){
9292
+ _$1.each(field.depend_on, function(fName){
9383
9293
  apiInfo.data[fName] = `$${fName}`;
9384
9294
  });
9385
9295
  apiInfo.data['$'] = `$$`;
@@ -9466,8 +9376,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
9466
9376
  joinValues: false,
9467
9377
  extractValue: true,
9468
9378
  clearable: true,
9469
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
9470
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
9379
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
9380
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
9471
9381
  // labelField: labelField,
9472
9382
  // valueField: valueField,
9473
9383
  source: apiInfo,
@@ -9520,7 +9430,7 @@ async function lookupToAmis(field, readonly, ctx){
9520
9430
  tpl: getRelatedFieldTpl(field, ctx)
9521
9431
  }
9522
9432
  }
9523
- if(field.reference_to && !___default.isString(field.reference_to) && !readonly){
9433
+ if(field.reference_to && !_$1.isString(field.reference_to) && !readonly){
9524
9434
  return {
9525
9435
  type: 'steedos-field-lookup',
9526
9436
  field,
@@ -9536,6 +9446,7 @@ async function lookupToAmis(field, readonly, ctx){
9536
9446
  }
9537
9447
 
9538
9448
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
9449
+ ctx.onlyDisplayLookLabel = true;
9539
9450
  if(ctx.idsDependOn){
9540
9451
  // ids人员点选模式
9541
9452
  return await lookupToAmisIdsPicker(field, readonly, ctx);
@@ -9549,7 +9460,7 @@ async function lookupToAmis(field, readonly, ctx){
9549
9460
  // 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
9550
9461
  // 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
9551
9462
  // TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
9552
- if(refObject.enable_enhanced_lookup == true && ___default.isEmpty(field.depend_on)){
9463
+ if(refObject.enable_enhanced_lookup == true && _$1.isEmpty(field.depend_on)){
9553
9464
  return await lookupToAmisPicker(field, readonly, ctx);
9554
9465
  }else if(refObject.enable_tree) {
9555
9466
  return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
@@ -9589,7 +9500,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
9589
9500
 
9590
9501
  const tableFields = [referenceTo.labelField];
9591
9502
 
9592
- const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}`});
9503
+ const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
9593
9504
 
9594
9505
  source.data.$term = "$term";
9595
9506
  source.data.$self = "$$";
@@ -9598,6 +9509,12 @@ async function getIdsPickerSchema(field, readonly, ctx){
9598
9509
  source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
9599
9510
  source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
9600
9511
  }
9512
+
9513
+ let listView = getLookupListView(refObjectConfig);
9514
+ let sort = "";
9515
+ if(listView){
9516
+ sort = getListViewSort(listView);
9517
+ }
9601
9518
 
9602
9519
  source.requestAdaptor = `
9603
9520
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
@@ -9605,6 +9522,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
9605
9522
  var pageSize = api.data.pageSize || 1000;
9606
9523
  var pageNo = api.data.pageNo || 1;
9607
9524
  var skip = (pageNo - 1) * pageSize;
9525
+ var orderBy = api.data.orderBy || '';
9526
+ var orderDir = api.data.orderDir || '';
9527
+ var sort = orderBy + ' ' + orderDir;
9528
+ sort = orderBy ? sort : "${sort}";
9608
9529
  if(selfData.op === 'loadOptions' && selfData.value){
9609
9530
  if(selfData.value && selfData.value.indexOf(',') > 0){
9610
9531
  filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
@@ -9622,7 +9543,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
9622
9543
  filters.push(["${referenceTo.valueField.name}", "=", ids]);
9623
9544
  }
9624
9545
 
9625
- api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip);
9546
+ api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
9626
9547
  return api;
9627
9548
  `;
9628
9549
 
@@ -9639,6 +9560,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
9639
9560
  pickerSchema = await getTableSchema$1(tableFields, {
9640
9561
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
9641
9562
  top: top,
9563
+ isLookup: true,
9642
9564
  ...ctx
9643
9565
  });
9644
9566
 
@@ -9652,8 +9574,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
9652
9574
  valueField: referenceTo.valueField.name,
9653
9575
  modalMode: 'dialog',
9654
9576
  source: source,
9655
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
9656
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
9577
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
9578
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
9657
9579
  size: "lg",
9658
9580
  pickerSchema: pickerSchema,
9659
9581
  joinValues: false,
@@ -9681,8 +9603,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
9681
9603
  /*
9682
9604
  * @Author: baozhoutao@steedos.com
9683
9605
  * @Date: 2023-01-13 17:27:54
9684
- * @LastEditors: liaodaxue
9685
- * @LastEditTime: 2023-07-27 17:33:54
9606
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
9607
+ * @LastEditTime: 2023-08-28 17:45:38
9686
9608
  * @Description:
9687
9609
  */
9688
9610
 
@@ -9744,18 +9666,47 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
9744
9666
 
9745
9667
  const getHtmlFieldSchema = (field, readonly, ctx)=>{
9746
9668
  if(readonly){
9669
+ // return {
9670
+ // "type": "control",
9671
+ // "label": field.label,
9672
+ // "body": {
9673
+ // "type": "html",
9674
+ // "name": field.name
9675
+ // }
9676
+ // }
9747
9677
  return {
9748
- "type": "control",
9749
- "label": field.label,
9750
- "body": {
9751
- "type": "html",
9752
- "name": field.name
9753
- }
9678
+ "type": "input-rich-text",
9679
+ "receiver": "${context.rootUrl}/s3/images",
9680
+ "name": field.name,
9681
+ "options": {
9682
+ "menu": {
9683
+ "insert": {
9684
+ "title": "Insert",
9685
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
9686
+ }
9687
+ },
9688
+ "plugins": [
9689
+ "autoresize"
9690
+ ],
9691
+ // "max_height": 2000,
9692
+ "statusbar": false,
9693
+ "readonly": true,
9694
+ "toolbar": false,
9695
+ "menubar": false
9754
9696
  }
9697
+ }
9755
9698
  }else {
9756
9699
  return {
9757
9700
  "type": "input-rich-text",
9758
9701
  "receiver": "${context.rootUrl}/s3/images",
9702
+ "options":{
9703
+ "menu": {
9704
+ "insert": {
9705
+ "title": "Insert",
9706
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
9707
+ }
9708
+ }
9709
+ },
9759
9710
  "name": field.name
9760
9711
  }
9761
9712
  // return {
@@ -9801,14 +9752,17 @@ const AmisFormInputs = [
9801
9752
 
9802
9753
  function getAmisStaticFieldType(type, readonly, options){
9803
9754
  if(!readonly){
9804
- if(___default.includes(AmisFormInputs, type)){
9755
+ if(_$1.includes(AmisFormInputs, type)){
9805
9756
  return `input-${type}`;
9806
9757
  }else if(type === 'location'){
9807
9758
  return "location-picker"
9808
9759
  }
9809
9760
  return type;
9810
9761
  }
9811
- if(___default.includes(['text','image'], type)){
9762
+ if(_$1.includes(['text','image'], type)){
9763
+ if('text' === type && options && options.amis && options.amis.tpl){
9764
+ return 'static';
9765
+ }
9812
9766
  if('image' === type && options && options.multiple){
9813
9767
  return `static-images`;
9814
9768
  }
@@ -9998,8 +9952,8 @@ function getAmisFieldType(sField){
9998
9952
  }
9999
9953
  function getObjectFieldSubFields(mainField, fields){
10000
9954
  const newMainField = Object.assign({subFields: []}, mainField);
10001
- const subFields = ___default.filter(fields, function(field){
10002
- let result = field.name.startsWith(`${mainField.name}.`) && ___default.split(field.name, ".").length < 3;
9955
+ const subFields = _$1.filter(fields, function(field){
9956
+ let result = field.name.startsWith(`${mainField.name}.`) && _$1.split(field.name, ".").length < 3;
10003
9957
  if(result){
10004
9958
  field._prefix = `${mainField.name}.`;
10005
9959
  }
@@ -10011,7 +9965,7 @@ function getObjectFieldSubFields(mainField, fields){
10011
9965
 
10012
9966
  function getGridFieldSubFields(mainField, fields){
10013
9967
  const newMainField = Object.assign({subFields: []}, mainField);
10014
- const subFields = ___default.filter(fields, function(field){
9968
+ const subFields = _$1.filter(fields, function(field){
10015
9969
  let result = field.name.startsWith(`${mainField.name}.`);
10016
9970
  if(result){
10017
9971
  field._prefix = `${mainField.name}.`;
@@ -10030,13 +9984,13 @@ function getGridFieldSubFields(mainField, fields){
10030
9984
  function getPermissionFields(object, userSession){
10031
9985
  const permissionFields = [];
10032
9986
  const fieldsArr = [];
10033
- ___default.each(object.fields , (field, field_name)=>{
10034
- if(!___default.has(field, "name")){
9987
+ _$1.each(object.fields , (field, field_name)=>{
9988
+ if(!_$1.has(field, "name")){
10035
9989
  field.name = field_name;
10036
9990
  }
10037
9991
  fieldsArr.push(field);
10038
9992
  });
10039
- ___default.each(___default.sortBy(fieldsArr, "sort_no"), function(field){
9993
+ _$1.each(_$1.sortBy(fieldsArr, "sort_no"), function(field){
10040
9994
  if(!field.hidden){
10041
9995
  permissionFields.push( Object.assign({}, field, {permission: {allowEdit: true}}));
10042
9996
  }
@@ -10048,7 +10002,7 @@ function getGridFieldSubFields(mainField, fields){
10048
10002
  function getSelectFieldOptions(field){
10049
10003
  const dataType = field.data_type || 'text';
10050
10004
  const options = [];
10051
- ___default.each(field.options, (item)=>{
10005
+ _$1.each(field.options, (item)=>{
10052
10006
  switch (dataType) {
10053
10007
  case 'number':
10054
10008
  options.push({label: item.label, value: Number(item.value), icon: item.icon});
@@ -10068,10 +10022,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
10068
10022
  // console.log('convertSFieldToAmisField====>', field, readonly, ctx)
10069
10023
  const isMobile = window.innerWidth <= 768;
10070
10024
  // 创建人和修改人、创建时间和修改时间不显示
10071
- if(___default.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
10025
+ if(_$1.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
10072
10026
  return;
10073
10027
  }
10074
- const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required: ___default.has(ctx, 'required') ? ctx.required : field.required};
10028
+ const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required: _$1.has(ctx, 'required') ? ctx.required : field.required};
10075
10029
  let convertData = {
10076
10030
  };
10077
10031
  // if(_.includes(OMIT_FIELDS, field.name)){
@@ -10079,7 +10033,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
10079
10033
  // }
10080
10034
  switch (field.type) {
10081
10035
  case 'text':
10082
- convertData.type = getAmisStaticFieldType('text', readonly);
10036
+ convertData.type = getAmisStaticFieldType('text', readonly, field);
10083
10037
  break;
10084
10038
  case 'textarea':
10085
10039
  convertData.type = getAmisStaticFieldType('textarea', readonly);
@@ -10519,14 +10473,14 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
10519
10473
  }
10520
10474
  break;
10521
10475
  }
10522
- if(!___default.isEmpty(convertData)){
10476
+ if(!_$1.isEmpty(convertData)){
10523
10477
  if(field.is_wide || convertData.type === 'group'){
10524
10478
  convertData.className = 'col-span-2 m-1';
10525
10479
  }else {
10526
10480
  convertData.className = 'm-1';
10527
10481
  }
10528
10482
  if(readonly){
10529
- convertData.className = `${convertData.className} md:border-b`;
10483
+ convertData.className = `${convertData.className} border-b`;
10530
10484
  }
10531
10485
  if(readonly){
10532
10486
  convertData.quickEdit = false;
@@ -10548,7 +10502,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
10548
10502
  }
10549
10503
  }
10550
10504
 
10551
- if(___default.isString(baseData.required)){
10505
+ if(_$1.isString(baseData.required)){
10552
10506
  if(baseData.required.startsWith("{{")){
10553
10507
  baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
10554
10508
  delete baseData.required;
@@ -10663,7 +10617,7 @@ if(typeof window != 'undefined'){
10663
10617
 
10664
10618
 
10665
10619
  function isFieldTypeSearchable(fieldType) {
10666
- return !___default.includes(
10620
+ return !_$1.includes(
10667
10621
  [
10668
10622
  "grid",
10669
10623
  "avatar",
@@ -10735,7 +10689,7 @@ async function getQuickEditSchema(field, options){
10735
10689
  if (field.disabled) {
10736
10690
  quickEditSchema = false;
10737
10691
  } else {
10738
- var fieldSchema = await convertSFieldToAmisField(field, false, ___default.omit(options, 'buttons'));
10692
+ var fieldSchema = await convertSFieldToAmisField(field, false, _$1.omit(options, 'buttons'));
10739
10693
  //存在属性上可编辑,实际不可编辑的字段,convertSFieldToAmisField函数可能会返回undefined,如summary
10740
10694
  if (!!fieldSchema) {
10741
10695
  quickEditSchema.body.push(fieldSchema);
@@ -10996,7 +10950,10 @@ function getFieldWidth(width){
10996
10950
  }
10997
10951
 
10998
10952
  async function getTableColumns$1(fields, options){
10999
- const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
10953
+ const columns = [];
10954
+ if(!options.isLookup){
10955
+ columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
10956
+ }
11000
10957
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
11001
10958
 
11002
10959
  for (const field of fields) {
@@ -11132,7 +11089,7 @@ async function getTableColumns$1(fields, options){
11132
11089
  }
11133
11090
  }
11134
11091
  // columns.push(getOperation(fields));
11135
- if(!___default.some(columns, { name: options.labelFieldName })){
11092
+ if(!_$1.some(columns, { name: options.labelFieldName })){
11136
11093
  const href = Router$1.getObjectDetailPath({
11137
11094
  ...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
11138
11095
  });
@@ -11231,7 +11188,7 @@ async function getMobileTableColumns(fields, options){
11231
11188
  let tpl = "";
11232
11189
  if(field.is_name || field.name === options.labelFieldName){
11233
11190
  nameField = field;
11234
- options.onlyDisplayLabel = true;
11191
+ options.onlyDisplayLookLabel = true;
11235
11192
  tpl = await getFieldTpl(field, options);
11236
11193
  }
11237
11194
  else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
@@ -11240,12 +11197,13 @@ async function getMobileTableColumns(fields, options){
11240
11197
  }
11241
11198
  else {
11242
11199
  if(field.type === 'lookup' || field.type === 'master_detail'){
11243
- options.onlyDisplayLabel = true;
11200
+ options.onlyDisplayLookLabel = true;
11244
11201
  }
11245
11202
  tpl = await getFieldTpl(field, options);
11246
11203
  }
11247
11204
  if(!tpl){
11248
- tpl = `\${${field.name}}`;
11205
+ //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
11206
+ tpl = `\${${field.name} | raw}`;
11249
11207
  }
11250
11208
  if(!field.hidden && !field.extra){
11251
11209
  tpls.push({ field, tpl });
@@ -11441,7 +11399,12 @@ async function getTableSchema$1(fields, options){
11441
11399
  options = {};
11442
11400
  }
11443
11401
  let columns = [];
11444
- if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
11402
+ let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
11403
+ if(isLookup){
11404
+ // 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
11405
+ useMobileColumns = false;
11406
+ }
11407
+ if(useMobileColumns){
11445
11408
  columns = await getMobileTableColumns(fields, options);
11446
11409
  }
11447
11410
  else {
@@ -11461,7 +11424,7 @@ async function getTableSchema$1(fields, options){
11461
11424
  columns: columns,
11462
11425
  syncLocation: false,
11463
11426
  keepItemSelectionOnPageChange: true,
11464
- checkOnItemClick: false,
11427
+ checkOnItemClick: isLookup ? true : false,
11465
11428
  labelTpl: `\${${options.labelFieldName}}`,
11466
11429
  autoFillHeight: false, // 自动高度效果不理想,先关闭
11467
11430
  columnsTogglable: false,
@@ -11481,8 +11444,8 @@ async function getTableApi(mainObject, fields, options){
11481
11444
  const searchableFields = [];
11482
11445
  let { filter, filtersFunction, sort, top, setDataToComponentId = '' } = options;
11483
11446
 
11484
- if(___default.isArray(filter)){
11485
- filter = ___default.map(filter, function(item){
11447
+ if(_$1.isArray(filter)){
11448
+ filter = _$1.map(filter, function(item){
11486
11449
  if(item.operation){
11487
11450
  return [item.field, item.operation, item.value];
11488
11451
  }else {
@@ -11498,7 +11461,7 @@ async function getTableApi(mainObject, fields, options){
11498
11461
  baseFilters = filter;
11499
11462
  }
11500
11463
 
11501
- ___default.each(mainObject.fields, function (field) {
11464
+ _$1.each(mainObject.fields, function (field) {
11502
11465
  if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
11503
11466
  searchableFields.push(field.name);
11504
11467
  }
@@ -11509,7 +11472,7 @@ async function getTableApi(mainObject, fields, options){
11509
11472
  // 含有optionsFunction属性, 无reference_to属性的lookup字段
11510
11473
  const lookupFields = {};
11511
11474
  fields.forEach((item)=>{
11512
- if(___default.includes(['image','avatar','file'], item.type)){
11475
+ if(_$1.includes(['image','avatar','file'], item.type)){
11513
11476
  fileFieldsKeys.push(item.name);
11514
11477
  fileFields[item.name] = {
11515
11478
  name: item.name,
@@ -11517,7 +11480,7 @@ async function getTableApi(mainObject, fields, options){
11517
11480
  multiple: item.multiple
11518
11481
  };
11519
11482
  }
11520
- if(___default.includes(['lookup'], item.type) && !item.reference_to ){
11483
+ if(_$1.includes(['lookup'], item.type) && !item.reference_to ){
11521
11484
  lookupFields[item.name] = item;
11522
11485
  }
11523
11486
  });
@@ -11692,7 +11655,7 @@ async function getTableApi(mainObject, fields, options){
11692
11655
  sort: sort.trim(),
11693
11656
  pageSize: pageSize,
11694
11657
  skip: skip,
11695
- fields: ${JSON.stringify(___default.map(fields, 'name'))}
11658
+ fields: ${JSON.stringify(_$1.map(fields, 'name'))}
11696
11659
  }));
11697
11660
  return api;
11698
11661
  `;
@@ -11833,10 +11796,10 @@ const API_CACHE = 100;
11833
11796
 
11834
11797
  function getReadonlyFormAdaptor(object, fields, options){
11835
11798
  let scriptStr = '';
11836
- const selectFields = ___default.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
11837
- const gridAndObjectFieldsName = ___default.map(___default.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
11838
- ___default.each(selectFields, function(field){
11839
- if(!___default.includes(OMIT_FIELDS, field.name)){
11799
+ const selectFields = _$1.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
11800
+ const gridAndObjectFieldsName = _$1.map(_$1.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
11801
+ _$1.each(selectFields, function(field){
11802
+ if(!_$1.includes(OMIT_FIELDS, field.name)){
11840
11803
  field.name;
11841
11804
  if(field.options){
11842
11805
  const options = JSON.stringify({options: field.options});
@@ -11869,7 +11832,7 @@ function getReadonlyFormAdaptor(object, fields, options){
11869
11832
  // }
11870
11833
  // })
11871
11834
 
11872
- var fieldNames = ___default.map(fields, function(n){return n.name});
11835
+ var fieldNames = _$1.map(fields, function(n){return n.name});
11873
11836
  return `
11874
11837
  if(payload.data.data.length === 0){
11875
11838
  var isEditor = !!${options && options.isEditor};
@@ -11942,7 +11905,7 @@ function getScriptForAddUrlPrefixForImgFields(fields){
11942
11905
  let imgFieldsKeys = [];
11943
11906
  let imgFields = {};
11944
11907
  fields.forEach((item)=>{
11945
- if(___default.includes(['image','avatar'], item.type)){
11908
+ if(_$1.includes(['image','avatar'], item.type)){
11946
11909
  imgFieldsKeys.push(item.name);
11947
11910
  imgFields[item.name] = {
11948
11911
  name: item.name,
@@ -12085,7 +12048,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
12085
12048
  var defaultValues = {};
12086
12049
  _.each(uiSchema && uiSchema.fields, function(field){
12087
12050
  var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
12088
- if(value){
12051
+ if(!_.isNil(value)){
12089
12052
  defaultValues[field.name] = value;
12090
12053
  }
12091
12054
  });
@@ -12199,8 +12162,8 @@ async function getCalendarApi(mainObject, fields, options) {
12199
12162
  top = 200;
12200
12163
  }
12201
12164
 
12202
- if (___default__default.isArray(filter)) {
12203
- filter = ___default__default.map(filter, function (item) {
12165
+ if (_$1__default.isArray(filter)) {
12166
+ filter = _$1__default.map(filter, function (item) {
12204
12167
  if (item.operation) {
12205
12168
  return [item.field, item.operation, item.value];
12206
12169
  } else {
@@ -12212,7 +12175,7 @@ async function getCalendarApi(mainObject, fields, options) {
12212
12175
  filter = [];
12213
12176
  }
12214
12177
 
12215
- ___default__default.each(fields, function (field) {
12178
+ _$1__default.each(fields, function (field) {
12216
12179
  if (field.searchable) {
12217
12180
  searchableFields.push(field.name);
12218
12181
  }
@@ -12743,16 +12706,17 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
12743
12706
  /*
12744
12707
  * @Author: baozhoutao@steedos.com
12745
12708
  * @Date: 2022-05-26 16:02:08
12746
- * @LastEditors: liaodaxue
12747
- * @LastEditTime: 2023-07-12 15:45:55
12709
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12710
+ * @LastEditTime: 2023-09-05 15:42:26
12748
12711
  * @Description:
12749
12712
  */
12750
12713
 
12751
- const getFieldSchemaArray = (formFields) => {
12714
+ const getFieldSchemaArray = (formFields, ctx) => {
12752
12715
  let fieldSchemaArray = [];
12753
12716
  fieldSchemaArray.length = 0;
12717
+ const recordId = ctx && ctx.recordId;
12754
12718
 
12755
- ___default.forEach(formFields, (field) => {
12719
+ _$1.forEach(formFields, (field) => {
12756
12720
  if (!field.group || field.group == 'null' || field.group == '-')
12757
12721
  field.group = instance.t('frontend_field_group_generalization');
12758
12722
  const fieldName = field.name;
@@ -12762,8 +12726,14 @@ const getFieldSchemaArray = (formFields) => {
12762
12726
  field.is_wide = true;
12763
12727
  }
12764
12728
 
12729
+ let forceHidden = false;
12730
+ if(!recordId && field.readonly){
12731
+ // 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
12732
+ forceHidden = true;
12733
+ }
12734
+
12765
12735
  if (!isObjectField) {
12766
- if (!field.hidden) {
12736
+ if (!field.hidden && !forceHidden) {
12767
12737
  fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
12768
12738
  }
12769
12739
  }
@@ -12775,8 +12745,8 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
12775
12745
  if (!ctx) {
12776
12746
  ctx = {};
12777
12747
  }
12778
- const sectionFields = ___default.filter(fieldSchemaArray, { 'group': sectionName });
12779
- if (sectionFields.length == ___default.filter(sectionFields, ['hidden', true]).length) {
12748
+ const sectionFields = _$1.filter(fieldSchemaArray, { 'group': sectionName });
12749
+ if (sectionFields.length == _$1.filter(sectionFields, ['hidden', true]).length) {
12780
12750
  return;
12781
12751
  }
12782
12752
 
@@ -12802,7 +12772,7 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
12802
12772
  }
12803
12773
 
12804
12774
  // fieldSet 已支持显隐控制
12805
- const sectionFieldsVisibleOn = ___default.map(___default.compact(___default.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
12775
+ const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
12806
12776
  let visible = visibleOn;
12807
12777
  if(visible.indexOf('${')>-1){
12808
12778
  visible = visible.substring(visible.indexOf('{')+1, visible.indexOf('}'));
@@ -12834,8 +12804,8 @@ const getSections = async (permissionFields, formFields, ctx) => {
12834
12804
  if (!ctx) {
12835
12805
  ctx = {};
12836
12806
  }
12837
- const fieldSchemaArray = getFieldSchemaArray(formFields);
12838
- const _sections = ___default.groupBy(fieldSchemaArray, 'group');
12807
+ const fieldSchemaArray = getFieldSchemaArray(formFields, ctx);
12808
+ const _sections = _$1.groupBy(fieldSchemaArray, 'group');
12839
12809
  const sections = [];
12840
12810
  var sectionVisibleOns = [];
12841
12811
  for (const key in _sections) {
@@ -13025,7 +12995,7 @@ async function getObjectCRUD(objectSchema, fields, options){
13025
12995
  const table = await getTableSchema$1(fields, Object.assign({idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName, permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit}, options));
13026
12996
  delete table.mode;
13027
12997
  //image与avatar需要在提交修改时特别处理
13028
- const imageNames = ___default__default.compact(___default__default.map(___default__default.filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
12998
+ const imageNames = _$1__default.compact(_$1__default.map(_$1__default.filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
13029
12999
  const quickSaveApiRequestAdaptor = `
13030
13000
  var graphqlOrder = "";
13031
13001
  var imageNames = ${JSON.stringify(imageNames)};
@@ -13055,7 +13025,7 @@ async function getObjectCRUD(objectSchema, fields, options){
13055
13025
  }
13056
13026
  `;
13057
13027
  let autoFillHeight = true;
13058
- if(options.isRelated || Steedos.isMobile()){
13028
+ if(options.isRelated || window.innerWidth < 768){
13059
13029
  autoFillHeight = false;
13060
13030
  }
13061
13031
 
@@ -13096,16 +13066,16 @@ async function getObjectCRUD(objectSchema, fields, options){
13096
13066
  if (headerSchema || footerSchema) {
13097
13067
  let wrappedBody = [body];
13098
13068
  if (headerSchema) {
13099
- if(___default__default.isArray(headerSchema)){
13100
- wrappedBody = ___default__default.union(headerSchema,wrappedBody);
13069
+ if(_$1__default.isArray(headerSchema)){
13070
+ wrappedBody = _$1__default.union(headerSchema,wrappedBody);
13101
13071
  }
13102
13072
  else {
13103
13073
  wrappedBody.unshift(headerSchema);
13104
13074
  }
13105
13075
  }
13106
13076
  if (footerSchema) {
13107
- if(___default__default.isArray(footerSchema)){
13108
- wrappedBody = ___default__default.union(wrappedBody,footerSchema);
13077
+ if(_$1__default.isArray(footerSchema)){
13078
+ wrappedBody = _$1__default.union(wrappedBody,footerSchema);
13109
13079
  }
13110
13080
  else {
13111
13081
  wrappedBody.push(footerSchema);
@@ -13148,7 +13118,7 @@ const getFormFields = (objectSchema, formProps)=>{
13148
13118
 
13149
13119
  let fields = {};
13150
13120
  // 以uiSchema fields 为基础, 遍历字段, 并更新字段定义
13151
- ___default__default.forEach(objectSchema.fields, (field, fieldName)=>{
13121
+ _$1__default.forEach(objectSchema.fields, (field, fieldName)=>{
13152
13122
  if(!lodash.has(field, "name")){
13153
13123
  field.name = fieldName;
13154
13124
  }
@@ -13159,9 +13129,9 @@ const getFormFields = (objectSchema, formProps)=>{
13159
13129
  }
13160
13130
  });
13161
13131
 
13162
- if(!___default__default.isEmpty(includedFields) && ___default__default.isArray(includedFields)){
13132
+ if(!_$1__default.isEmpty(includedFields) && _$1__default.isArray(includedFields)){
13163
13133
  const includedFieldsMap = {};
13164
- ___default__default.each(includedFields, (fName, index)=>{
13134
+ _$1__default.each(includedFields, (fName, index)=>{
13165
13135
  if(fields[fName]){
13166
13136
  includedFieldsMap[fName] = Object.assign({}, fields[fName], {sort_no: index});
13167
13137
  }
@@ -13169,21 +13139,21 @@ const getFormFields = (objectSchema, formProps)=>{
13169
13139
  fields = includedFieldsMap;
13170
13140
  }
13171
13141
 
13172
- if(!___default__default.isEmpty(excludedFields) && ___default__default.isArray(excludedFields)){
13173
- ___default__default.each(excludedFields, (fName)=>{
13142
+ if(!_$1__default.isEmpty(excludedFields) && _$1__default.isArray(excludedFields)){
13143
+ _$1__default.each(excludedFields, (fName)=>{
13174
13144
  delete fields[fName];
13175
13145
  });
13176
13146
  }
13177
13147
 
13178
- return lodash.sortBy(___default__default.values(fields), "sort_no");
13148
+ return lodash.sortBy(_$1__default.values(fields), "sort_no");
13179
13149
  };
13180
13150
 
13181
13151
  async function getObjectForm(objectSchema, ctx){
13182
13152
  const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, tabId, appId, defaults } = ctx;
13183
- const fields = ___default__default.values(objectSchema.fields);
13153
+ const fields = _$1__default.values(objectSchema.fields);
13184
13154
  const formFields = getFormFields(objectSchema, ctx);
13185
13155
  const formSchema = defaults && defaults.formSchema || {};
13186
- if(___default__default.has(formSchema, 'className')){
13156
+ if(_$1__default.has(formSchema, 'className')){
13187
13157
  formSchema.className = 'steedos-amis-form';
13188
13158
  }
13189
13159
  if(!formSchema.id){
@@ -13267,7 +13237,7 @@ async function getObjectForm(objectSchema, ctx){
13267
13237
 
13268
13238
  async function getObjectDetail(objectSchema, recordId, ctx){
13269
13239
  const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, formInitProps } = ctx;
13270
- const fields = ___default__default.values(objectSchema.fields);
13240
+ const fields = _$1__default.values(objectSchema.fields);
13271
13241
  const formFields = getFormFields(objectSchema, ctx);
13272
13242
  const serviceId = `service_detail_page`;
13273
13243
  return {
@@ -13428,7 +13398,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
13428
13398
  * @Author: baozhoutao@steedos.com
13429
13399
  * @Date: 2022-07-05 15:55:39
13430
13400
  * @LastEditors: liaodaxue
13431
- * @LastEditTime: 2023-08-21 14:50:21
13401
+ * @LastEditTime: 2023-08-28 14:55:23
13432
13402
  * @Description:
13433
13403
  */
13434
13404
 
@@ -13574,11 +13544,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
13574
13544
  // }
13575
13545
  const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
13576
13546
  const componentId = `steedos-record-related-list-${relatedObjectName}`;
13547
+ const isMobile = window.innerWidth < 768;
13548
+ let headerToolbar = [];
13549
+ if(!isMobile){
13550
+ headerToolbar.push("bulkActions");
13551
+ }
13577
13552
  const options = {
13578
13553
  globalFilter,
13579
13554
  defaults: {
13580
13555
  listSchema: {
13581
- headerToolbar:["bulkActions"],
13556
+ headerToolbar,
13582
13557
  columnsTogglable: false,
13583
13558
  onEvent: {
13584
13559
  [`@data.changed.${relatedObjectName}`]: {
@@ -13843,14 +13818,14 @@ function getListViewFilter(listView){
13843
13818
  const userId = getUserId();
13844
13819
  let filters = listView.filters;
13845
13820
  if(listView.filter_scope === 'mine'){
13846
- if(___default__default.isEmpty(filters)){
13821
+ if(_$1__default.isEmpty(filters)){
13847
13822
  filters = [["owner", "=", userId]];
13848
13823
  }else {
13849
- if(___default__default.isString(filters) && ___default__default.startsWith(___default__default.trim(filters), "function")){
13824
+ if(_$1__default.isString(filters) && _$1__default.startsWith(_$1__default.trim(filters), "function")){
13850
13825
  filters = new Function(`return ${filters}`);
13851
13826
  filters = filters();
13852
13827
  }
13853
- if(___default__default.isArray(filters)){
13828
+ if(_$1__default.isArray(filters)){
13854
13829
  filters.push(["owner", "=", userId]);
13855
13830
  }else {
13856
13831
  console.debug(`listView filters is not array`, listView);
@@ -13868,7 +13843,7 @@ function formatUISchemaCache(objectName, uiSchema){
13868
13843
  setUISchemaCache(objectName, uiSchema);
13869
13844
  each(uiSchema.fields, (field)=>{
13870
13845
  try {
13871
- if(field.type === "lookup" && field._reference_to && ___default__default.isString(field._reference_to)){
13846
+ if(field.type === "lookup" && field._reference_to && _$1__default.isString(field._reference_to)){
13872
13847
  field.reference_to = eval(`(${field._reference_to})`)();
13873
13848
  }
13874
13849
  } catch (exception) {
@@ -14894,12 +14869,12 @@ const conditionItemToFilters = (item) => {
14894
14869
  // }
14895
14870
  const filterToConditionItem = (filter) => {
14896
14871
  if (filter.length === 3) {
14897
- const op = ___default__default.findKey(opMaps, (value) => {
14872
+ const op = _$1__default.findKey(opMaps, (value) => {
14898
14873
  return value === filter[1];
14899
14874
  });
14900
14875
  if (
14901
14876
  op === "between" &&
14902
- ___default__default.includes(DATE_DATETIME_BETWEEN_VALUES, filter[2])
14877
+ _$1__default.includes(DATE_DATETIME_BETWEEN_VALUES, filter[2])
14903
14878
  ) {
14904
14879
  return {
14905
14880
  left: {
@@ -14924,7 +14899,7 @@ const filterToConditionItem = (filter) => {
14924
14899
  };
14925
14900
 
14926
14901
  const filterObjectToArray = (filter) => {
14927
- if (!___default__default.isArray(filter) && ___default__default.isObject(filter)) {
14902
+ if (!_$1__default.isArray(filter) && _$1__default.isObject(filter)) {
14928
14903
  return [filter.field, filter.operation, filter.value];
14929
14904
  }
14930
14905
  return filter;
@@ -16912,8 +16887,8 @@ const getUserApprove = ({ instance, userId }) => {
16912
16887
  //传阅的approve返回最新一条
16913
16888
  if (!currentApprove || currentApprove.type == "cc") {
16914
16889
  // 当前是传阅
16915
- ___default__default.each(instance.traces, function (t) {
16916
- ___default__default.each(t.approves, function (a) {
16890
+ _$1__default.each(instance.traces, function (t) {
16891
+ _$1__default.each(t.approves, function (a) {
16917
16892
  if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
16918
16893
  currentApprove = a;
16919
16894
  }
@@ -17003,7 +16978,7 @@ const getLastCCStep = ({ traces }, userId) => {
17003
16978
 
17004
16979
  while (i >= 0) {
17005
16980
  if (!trace_id && traces[i].is_finished) {
17006
- ___default__default.each(traces[i].approves, function (ap) {
16981
+ _$1__default.each(traces[i].approves, function (ap) {
17007
16982
  if (!trace_id) {
17008
16983
  if (
17009
16984
  ap.is_finished &&
@@ -17026,7 +17001,7 @@ const getLastCCStep = ({ traces }, userId) => {
17026
17001
  };
17027
17002
 
17028
17003
  const isCurrentStepOpinionField = (field, currentStep)=>{
17029
- return ___default__default.includes(___default__default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
17004
+ return _$1__default.includes(_$1__default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
17030
17005
  };
17031
17006
 
17032
17007
  const getInstanceInfo = async ({ instanceId, box }) => {
@@ -17095,7 +17070,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
17095
17070
  step = getStep({ flowVersion, stepId: trace.step });
17096
17071
  }
17097
17072
 
17098
- let currentStep = getStep({ flowVersion, stepId: ___default__default.last(instance.traces).step });
17073
+ let currentStep = getStep({ flowVersion, stepId: _$1__default.last(instance.traces).step });
17099
17074
 
17100
17075
  const lastCCStep = getLastCCStep(instance, userId);
17101
17076
 
@@ -17127,7 +17102,7 @@ const getInstanceInfo = async ({ instanceId, box }) => {
17127
17102
  approveValues: values,
17128
17103
  title: instance.name || instance.form.name,
17129
17104
  name: instance.name || instance.form.name,
17130
- fields: ___default__default.map(formVersion.fields, (field) => {
17105
+ fields: _$1__default.map(formVersion.fields, (field) => {
17131
17106
  return Object.assign({}, field, {
17132
17107
  permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
17133
17108
  }) ;
@@ -17145,10 +17120,10 @@ const getInstanceInfo = async ({ instanceId, box }) => {
17145
17120
  forward_from_instance: instance.forward_from_instance,
17146
17121
  cc_users: instance.cc_users,
17147
17122
  traces: instance.traces,
17148
- historyApproves: ___default__default.map(instance.traces, (trace) => {
17123
+ historyApproves: _$1__default.map(instance.traces, (trace) => {
17149
17124
  return Object.assign(
17150
17125
  {
17151
- children: ___default__default.map(trace.approves, (approve) => {
17126
+ children: _$1__default.map(trace.approves, (approve) => {
17152
17127
  let finishDate = approve.finish_date;
17153
17128
  let judge = approve.judge;
17154
17129
  let userName = approve.user_name;
@@ -17519,7 +17494,7 @@ var AmisObjectButton = function (props) {
17519
17494
  delete schema.body[0]['visibleOn'];
17520
17495
  }
17521
17496
  if (schema && className) {
17522
- schema.className = schema.className + ' ' + className;
17497
+ schema.className = schema.className + ' steedos-object-button ' + className;
17523
17498
  }
17524
17499
  var renderData = Object.assign(data, { objectName: objectName, app_id: appId, className: className });
17525
17500
  if (data._id) {
@@ -17540,7 +17515,7 @@ var AmisObjectButton = function (props) {
17540
17515
  }))) : null));
17541
17516
  }
17542
17517
  else {
17543
- return (React.createElement("button", { onClick: buttonClick, className: "antd-Button antd-Button--default antd-Button--size-default ".concat(className ? className : '') }, button.label));
17518
+ return (React.createElement("button", { onClick: buttonClick, className: "antd-Button antd-Button--default antd-Button--size-default steedos-object-button ".concat(className ? className : '') }, button.label));
17544
17519
  }
17545
17520
  };
17546
17521
 
@@ -17916,7 +17891,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
17916
17891
  body: [{
17917
17892
  "type": "wrapper",
17918
17893
  "size": "none",
17919
- "className": "flex flex-1 overflow-hidden h-full",
17894
+ "className": "flex flex-1 h-full",
17920
17895
  body: [
17921
17896
  sideSchema ? {
17922
17897
  "type": "wrapper",
@@ -18351,6 +18326,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
18351
18326
  if (isMobile) {
18352
18327
  dialogSchema = {
18353
18328
  "type": "service",
18329
+ "className": "steedos-apps-service",
18354
18330
  "affixFooter": false,
18355
18331
  "body": [
18356
18332
  {
@@ -18587,7 +18563,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
18587
18563
  ],
18588
18564
  }
18589
18565
  ],
18590
- "className": "",
18566
+ "className": "steedos-apps-service",
18591
18567
  "visibleOn": "",
18592
18568
  "clearValueOnHidden": false,
18593
18569
  "visible": true,
@@ -18721,7 +18697,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
18721
18697
  schemaApi: {
18722
18698
  "method": "get",
18723
18699
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
18724
- "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
18700
+ "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n return groupLength + tab.index;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
18725
18701
  "headers": {
18726
18702
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18727
18703
  }
@@ -18772,7 +18748,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
18772
18748
  schemaApi: {
18773
18749
  "method": "get",
18774
18750
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?mobile=true"),
18775
- "adaptor": "\n try {\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n let sum = 0;\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">${tab.name}</span></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n });\n }\n })\n\n payload.data = {\n \"type\": \"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"footerService\",\n \"body\": {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": {\n \"enable\": true,\n \"maxVisibleCount\": 4,\n \"overflowPopoverClassName\": \"steedos-global-footer-popup\",\n \"overflowLabel\":{\n \"type\": 'tpl',\n \"tpl\": `<span class=' truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"!fill-slate-500 flex-shrink-0 !h-10 !w-10\" style=\"padding:7px\"><use xlink:href=\"/assets/icons/utility-sprite/svg/symbols.svg#rows\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">").concat(instance.t('frontend_menu'), "</span></span>`,\n \"className\":'h-full flex items-center'\n },\n \"overflowIndicator\":\"\"\n },\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"footerService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"footerService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n }\n ]\n }\n }\n }\n \n };\n } catch (error) {\n console.log(`error`, error)\n }\n return payload;\n "),
18751
+ "adaptor": "\n try {\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n let sum = 0;\n payload.children = _.sortBy(payload.children, function(tab){\n return tab.index;\n })\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">${tab.name}</span></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n });\n }\n })\n payload.data = {\n \"type\": \"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"footerService\",\n \"body\": {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": {\n \"enable\": true,\n \"maxVisibleCount\": 4,\n \"overflowPopoverClassName\": \"steedos-global-footer-popup\",\n \"overflowLabel\":{\n \"type\": 'tpl',\n \"tpl\": `<span class=' truncate text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"!fill-slate-500 flex-shrink-0 !h-10 !w-10\" style=\"padding:7px\"><use xlink:href=\"/assets/icons/utility-sprite/svg/symbols.svg#rows\"></use></svg><span class=\"truncate\" style=\"max-width: 20vw\">").concat(instance.t('frontend_menu'), "</span></span>`,\n \"className\":'h-full flex items-center'\n },\n \"overflowIndicator\":\"\"\n },\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"footerService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"footerService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n }\n ]\n }\n }\n }\n \n };\n } catch (error) {\n console.log(`error`, error)\n }\n return payload;\n "),
18776
18752
  "headers": {
18777
18753
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18778
18754
  }
@@ -18787,7 +18763,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
18787
18763
  * @Author: baozhoutao@steedos.com
18788
18764
  * @Date: 2022-09-01 14:44:57
18789
18765
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
18790
- * @LastEditTime: 2023-08-21 14:00:27
18766
+ * @LastEditTime: 2023-08-28 15:04:28
18791
18767
  * @Description:
18792
18768
  */
18793
18769
  var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -18932,7 +18908,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
18932
18908
  "name": "notifications",
18933
18909
  "items": {
18934
18910
  "type": "tpl",
18935
- "tpl": "<div class='flex items-center p-4 hover:bg-sky-50'>\n <img src='<%=data.context.rootUrl + \"/avatar/\" + data.from%>' alt='' class='h-10 w-10 flex-none rounded-full'>\n <div class='ml-4 flex-auto'>\n <div class='font-medium'>\n <span class='text-primary'><%=data.name%></span>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=moment(data.created).fromNow()%>\n <abbr class='slds-text-link slds-m-horizontal_xxx-small <%=data.is_read ? 'hidden' : ''%>' title='unread'>\u25CF</abbr>\n </div>\n </div>\n </div>",
18911
+ "tpl": "<div class='flex items-center p-4 hover:bg-sky-50'>\n <img src='<%=data.context.rootUrl + \"/avatar/\" + data.from%>' alt='' class='h-10 w-10 flex-none rounded-full'>\n <div class='ml-4 flex-auto'>\n <div class='font-medium'>\n <span class='text-primary'><%=data.name%></span>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=data.body%>\n </div>\n <div class='mt-1 text-slate-700'>\n <%=moment(data.created).locale(data.global.user.language).fromNow()%>\n <abbr class='slds-text-link slds-m-horizontal_xxx-small <%=data.is_read ? 'hidden' : ''%>' title='unread'>\u25CF</abbr>\n </div>\n </div>\n </div>",
18936
18912
  "id": "u:07ece657c7b7",
18937
18913
  "onEvent": {
18938
18914
  "click": {
@@ -19482,8 +19458,8 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
19482
19458
  /*
19483
19459
  * @Author: baozhoutao@steedos.com
19484
19460
  * @Date: 2023-01-14 16:41:24
19485
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
19486
- * @LastEditTime: 2023-08-21 10:03:05
19461
+ * @LastEditors: baozhoutao@steedos.com
19462
+ * @LastEditTime: 2023-09-05 17:06:44
19487
19463
  * @Description:
19488
19464
  */
19489
19465
  var getSelectFlowSchema = function (id, props) {
@@ -19631,7 +19607,7 @@ var getSelectFlowSchema = function (id, props) {
19631
19607
  method: "post",
19632
19608
  url: "${context.rootUrl}/graphql?keywords=${keywords}",
19633
19609
  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 "),
19634
- adaptor: "\n var options = payload.data.options;\n if(options){\n 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 }\n return payload;\n ",
19610
+ adaptor: "\n var options = payload.data.options;\n if(options){\n 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 }\n if(payload.data.options.length === 1 && payload.data.options[0].children.length === 1){\n payload.data.value = payload.data.options[0].children[0].value\n }\n return payload;\n ",
19635
19611
  "headers": {
19636
19612
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
19637
19613
  }
@@ -19877,7 +19853,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
19877
19853
  });
19878
19854
  }); };
19879
19855
 
19880
- var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
19856
+ var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var s=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,s=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&(r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var o=e.data_type||"text";!r||n||e.multiple||("text"!==o||isString(r)?"number"===o&&isString(r)?r=Number(r):"boolean"===o&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r:isBoolean(r)||(r=!1);}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
19881
19857
 
19882
19858
  var index_esm = /*#__PURE__*/Object.freeze({
19883
19859
  __proto__: null,