@steedos-widgets/amis-lib 1.3.0-beta.9 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -409,8 +409,8 @@ const Router = {
409
409
  /*
410
410
  * @Author: baozhoutao@steedos.com
411
411
  * @Date: 2022-07-20 16:29:22
412
- * @LastEditors: Please set LastEditors
413
- * @LastEditTime: 2023-05-18 15:22:51
412
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
413
+ * @LastEditTime: 2023-09-08 14:09:48
414
414
  * @Description:
415
415
  */
416
416
 
@@ -423,11 +423,40 @@ function getContrastColor(bgColor) {
423
423
  return brightness < 128 ? "#ffffff" : "#000000";
424
424
  }
425
425
 
426
+ function getLookupListView(refObjectConfig) {
427
+ if(!refObjectConfig){
428
+ return null;
429
+ }
430
+ const listNameAll = "all";
431
+ const listNameLookup = "lookup";
432
+ let listViewAll, listViewLookup;
433
+
434
+ _.each(
435
+ refObjectConfig.list_views,
436
+ (view, name) => {
437
+ if (name === listNameAll) {
438
+ listViewAll = view;
439
+ if(!listViewAll.name){
440
+ listViewAll.name = name;
441
+ }
442
+ }
443
+ else if (name === listNameLookup) {
444
+ listViewLookup = view;
445
+ if(!listViewLookup.name){
446
+ listViewLookup.name = name;
447
+ }
448
+ }
449
+ }
450
+ );
451
+ let listView = listViewLookup || listViewAll;
452
+ return listView;
453
+ }
454
+
426
455
  /*
427
456
  * @Author: baozhoutao@steedos.com
428
457
  * @Date: 2022-05-23 09:53:08
429
458
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
430
- * @LastEditTime: 2023-08-03 18:07:54
459
+ * @LastEditTime: 2023-08-29 15:04:39
431
460
  * @Description:
432
461
  */
433
462
 
@@ -531,7 +560,7 @@ function getRelatedFieldTpl(field, ctx){
531
560
  linkTarget = "target='_blank'";
532
561
  }
533
562
 
534
- const onlyDisplayLabel = ctx.onlyDisplayLabel;
563
+ const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
535
564
 
536
565
  let fieldDataStrTpl = `data._display.${field.name}`;
537
566
 
@@ -542,7 +571,7 @@ function getRelatedFieldTpl(field, ctx){
542
571
  if(_.isString(field.reference_to) || !field.reference_to){
543
572
  if(field.multiple){
544
573
  let labelTpl = `<%=item.label%>`;
545
- if(!onlyDisplayLabel){
574
+ if(!onlyDisplayLookLabel){
546
575
  const href = Router.getObjectDetailPath({
547
576
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
548
577
  });
@@ -560,7 +589,7 @@ function getRelatedFieldTpl(field, ctx){
560
589
  objectNameTpl = `\${${field.name}.objectName}`;
561
590
  recordIdTpl = `\${${field.name}.value}`;
562
591
  }
563
- if(!onlyDisplayLabel){
592
+ if(!onlyDisplayLookLabel){
564
593
  const href = Router.getObjectDetailPath({
565
594
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
566
595
  });
@@ -572,7 +601,7 @@ function getRelatedFieldTpl(field, ctx){
572
601
 
573
602
  }else {
574
603
  let labelTpl = `<%=item.label%>`;
575
- if(!onlyDisplayLabel){
604
+ if(!onlyDisplayLookLabel){
576
605
  const href = Router.getObjectDetailPath({
577
606
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
578
607
  });
@@ -625,7 +654,7 @@ function getLocationTpl(field){
625
654
  }
626
655
 
627
656
  async function getFieldTpl (field, options){
628
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLabel){
657
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
629
658
  return getNameTpl(field, options)
630
659
  }
631
660
  switch (field.type) {
@@ -995,7 +1024,7 @@ function getApi$2 (isMobile){
995
1024
  }
996
1025
  }
997
1026
 
998
- var frontend_field_group_generalization$1 = "Generalization";
1027
+ var frontend_field_group_generalization$1 = "General";
999
1028
  var frontend_download$1 = "Download";
1000
1029
  var frontend_form_save$1 = "Save";
1001
1030
  var frontend_form_save_and_new$1 = "Save and New";
@@ -1680,10 +1709,7 @@ async function getSearchApi(field, ctx) {
1680
1709
  }
1681
1710
 
1682
1711
  function getRefListViewSort$1(refObject){
1683
- const listView = ___namespace.find(
1684
- refObject.list_views,
1685
- (view, name) => name === "all"
1686
- );
1712
+ let listView = getLookupListView(refObject);
1687
1713
  let sort = "";
1688
1714
  if(listView){
1689
1715
  sort = getListViewSort(listView);
@@ -2192,257 +2218,92 @@ const getSchema$2 = (uiSchema) => {
2192
2218
  title: i18next__default["default"].t('frontend_import_data'),
2193
2219
  body: [
2194
2220
  {
2195
- type: "form",
2196
- mode: "edit",
2197
- persistData: false,
2198
- promptPageLeave: true,
2199
- name: "form_edit_data_import",
2200
- debug: false,
2201
- title: "",
2202
- submitText: "",
2203
- api: {
2204
- method: "post",
2205
- url: "${context.rootUrl}/graphql",
2206
- data: {
2207
- objectName: "queue_import_history",
2208
- $: "$$",
2209
- },
2210
- requestAdaptor:
2211
- "\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 ",
2212
- responseData: {
2213
- recordId: "${record._id}",
2214
- },
2215
- adaptor:
2216
- "console.log('payload', payload)\n return payload;\n ",
2217
- headers: {
2218
- Authorization:
2219
- "Bearer ${context.tenantId},${context.authToken}",
2220
- },
2221
- dataType: "json",
2221
+ "type": "steedos-object-form",
2222
+ "label": "对象表单",
2223
+ "objectApiName": "queue_import_history",
2224
+ "recordId": "",
2225
+ "mode": "edit",
2226
+ "layout": "normal",
2227
+ "defaultData":{
2228
+ "object_name": "${objectName}"
2222
2229
  },
2223
- initFetch: true,
2224
- body: [
2225
- {
2226
- type: "fieldSet",
2227
- title: i18next__default["default"].t('frontend_field_group_generalization'),
2228
- collapsable: true,
2229
- body: [
2230
- {
2231
- name: "object_name",
2232
- label: i18next__default["default"].t('frontend_import_data_object_name'),
2233
- required: false,
2234
- type: "select",
2235
- joinValues: false,
2236
- extractValue: true,
2237
- autoComplete: {
2238
- method: "post",
2239
- url: "${context.rootUrl}/graphql",
2240
- data: {
2241
- orderBy: "${orderBy}",
2242
- orderDir: "${orderDir}",
2243
- pageNo: "${page}",
2244
- pageSize: "${perPage}",
2245
- query:
2246
- "{options:objects(filters: {__filters}, top: {__top}){_id label:label value:name},count:objects__count(filters:{__filters})}",
2247
- $term: "$term",
2248
- $value: "$object_name.name",
2249
- $: "$$",
2250
- rfield: "${object_name}",
2251
- },
2252
- headers: {
2253
- Authorization:
2254
- "Bearer ${context.tenantId},${context.authToken}",
2255
- },
2256
- requestAdaptor:
2257
- "\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 ",
2258
- },
2259
- className: "m-1",
2260
- labelClassName: "text-left",
2261
- clearValueOnHidden: false,
2262
- id: "u:04295fee3896",
2263
- multiple: false,
2264
- hidden: true,
2265
- },
2266
- {
2267
- name: "queue_import",
2268
- label: i18next__default["default"].t('frontend_import_data_queue_import'),
2269
- required: true,
2270
- type: "picker",
2271
- labelField: "description",
2272
- valueField: "_id",
2273
- modalMode: "dialog",
2274
- source: {
2275
- method: "post",
2276
- url: "${context.rootUrl}/graphql",
2277
- data: {
2278
- orderBy: "${orderBy}",
2279
- orderDir: "${orderDir}",
2280
- pageNo: "${page}",
2281
- pageSize: "${perPage}",
2282
- query:
2283
- '{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})}',
2284
- $term: "$term",
2285
- $self: "$$",
2230
+ "fieldsExtend":{
2231
+ "object_name": {
2232
+ "amis": {
2233
+ "hidden": true
2234
+ }
2235
+ }
2236
+ },
2237
+ "form": {
2238
+ debug: false,
2239
+ resetAfterSubmit: false,
2240
+ initApi: {
2241
+ url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
2242
+ sendOn: 'this.recordId',
2243
+ responseData: {
2244
+ importState: "${state}"
2245
+ }
2246
+ },
2247
+ interval: 3000,
2248
+ stopAutoRefreshWhen: "this.importState === 'finished'",
2249
+ initFetch: false,
2250
+ onEvent: {
2251
+ inited: {
2252
+ weight: 0,
2253
+ actions: [
2254
+ {
2255
+ "actionType": "broadcast",
2256
+ "args": {
2257
+ "eventName": `@data.changed.${uiSchema.name}`
2286
2258
  },
2287
- headers: {
2288
- Authorization:
2289
- "Bearer ${context.tenantId},${context.authToken}",
2259
+ "data": {
2260
+ "objectName": `${uiSchema.name}`,
2261
+ "displayAs": "${displayAs}",
2262
+ "recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
2290
2263
  },
2291
- requestAdaptor:
2292
- "\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 ",
2293
- adaptor:
2294
- "\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 ",
2264
+ "expression": "this.importState === 'finished'"
2295
2265
  },
2296
- size: "lg",
2297
- pickerSchema: {
2298
- mode: "table",
2299
- name: "thelist",
2300
- draggable: false,
2301
- headerToolbar: ["reload"],
2302
- defaultParams: {
2303
- perPage: 20,
2304
- },
2305
- columns: [
2306
- {
2307
- name: "_index",
2308
- type: "text",
2309
- width: 32,
2310
- placeholder: "",
2311
- },
2312
- {
2313
- name: "description",
2314
- label: i18next__default["default"].t('frontend_import_data_queue_import_description'),
2315
- type: "tpl",
2316
- tpl: '<a href="/app/undefined/undefined/view/${undefined}">${description}</a>',
2317
- className: "whitespace-nowrap",
2318
- html: null,
2319
- },
2320
- {
2321
- name: "object_name",
2322
- label: i18next__default["default"].t('frontend_import_data_object_name'),
2323
- type: "tpl",
2324
- tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
2325
- className: "whitespace-nowrap",
2326
- html: null,
2327
- },
2328
- {
2329
- name: "encoding",
2330
- label: i18next__default["default"].t('frontend_import_data_queue_import_encoding'),
2331
- type: "tpl",
2332
- tpl: "<div>${_display.encoding}</div>",
2333
- className: "whitespace-nowrap",
2334
- html: null,
2335
- },
2336
- {
2337
- name: "template_url",
2338
- label: i18next__default["default"].t('frontend_import_data_queue_import_template_url'),
2339
- type: "button-group",
2340
- buttons: [
2341
- {
2342
- type: "button",
2343
- label: i18next__default["default"].t('frontend_download'),
2344
- visibleOn: "${template_url}",
2345
- level: "link",
2346
- actionType: "download",
2347
- api:{
2348
- url: "${template_url}",
2349
- method: "get",
2350
- headers: {
2351
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
2352
- }
2353
- }
2354
- }
2355
- ],
2356
- options: {
2357
- html: true
2266
+ {
2267
+ "actionType": "closeDialog",
2268
+ "expression": "this.importState === 'finished'"
2269
+ }
2270
+ ]
2271
+ },
2272
+ submitSucc: {
2273
+ weight: 0,
2274
+ actions: [
2275
+ {
2276
+ args: {
2277
+ api: {
2278
+ url: "${context.rootUrl}/api/data/initiateImport",
2279
+ method: "post",
2280
+ data: {
2281
+ eventData: "${event.data}",
2282
+ },
2283
+ dataType: "json",
2284
+ requestAdaptor:
2285
+ "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
2286
+ adaptor:
2287
+ "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
2288
+ headers: {
2289
+ Authorization:
2290
+ "Bearer ${context.tenantId},${context.authToken}",
2358
2291
  },
2359
- className: "whitespace-nowrap",
2360
- },
2361
- null,
2362
- ],
2363
- syncLocation: false,
2364
- keepItemSelectionOnPageChange: true,
2365
- checkOnItemClick: false,
2366
- autoFillHeight: false,
2367
- },
2368
- joinValues: false,
2369
- extractValue: true,
2370
- className: "m-1",
2371
- labelClassName: "text-left",
2372
- clearValueOnHidden: true,
2373
- id: "u:401df27113e0",
2374
- },
2375
- {
2376
- name: "file",
2377
- label: i18next__default["default"].t('frontend_import_data_file'),
2378
- required: true,
2379
- type: "input-file",
2380
- accept: ".xlsx,.xls",
2381
- className: "m-1",
2382
- labelClassName: "text-left",
2383
- clearValueOnHidden: true,
2384
- useChunk: false,
2385
- receiver: {
2386
- method: "post",
2387
- url: "${context.rootUrl}/s3/files",
2388
- data: {
2389
- $: "$$",
2390
- context: "${context}",
2391
- },
2392
- adaptor:
2393
- '\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 ',
2394
- headers: {
2395
- Authorization:
2396
- "Bearer ${context.tenantId},${context.authToken}",
2397
- },
2398
- },
2399
- id: "u:0213f2cc365b",
2400
- },
2401
- ],
2402
- id: "u:4899c260d667",
2403
- },
2404
- ],
2405
- panelClassName: "m-0 sm:rounded-lg shadow-none",
2406
- bodyClassName: "p-0",
2407
- className: "p-4 sm:p-0 steedos-amis-form",
2408
- label: "对象表单",
2409
- objectApiName: "queue_import_history",
2410
- id: "u:e4ef598eed61",
2411
- onEvent: {
2412
- submitSucc: {
2413
- weight: 0,
2414
- actions: [
2415
- {
2416
- args: {
2417
- api: {
2418
- url: "${context.rootUrl}/api/data/initiateImport",
2419
- method: "post",
2420
- data: {
2421
- eventData: "${event.data}",
2422
2292
  },
2423
- dataType: "json",
2424
- requestAdaptor:
2425
- "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
2426
- adaptor:
2427
- "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
2428
- headers: {
2429
- Authorization:
2430
- "Bearer ${context.tenantId},${context.authToken}",
2293
+ messages: {
2294
+ success: i18next__default["default"].t('frontend_import_data_message_success'),
2295
+ failed: i18next__default["default"].t('frontend_import_data_message_failed'),
2431
2296
  },
2432
2297
  },
2433
- messages: {
2434
- success: i18next__default["default"].t('frontend_import_data_message_success'),
2435
- failed: i18next__default["default"].t('frontend_import_data_message_failed'),
2436
- },
2298
+ actionType: "ajax",
2299
+ expression: "event.data.result",
2437
2300
  },
2438
- actionType: "ajax",
2439
- expression: "event.data.result",
2440
- },
2441
- ],
2301
+ ],
2302
+ },
2442
2303
  },
2443
- },
2444
- closeDialogOnSubmit: true,
2445
- },
2304
+ closeDialogOnSubmit: false,
2305
+ }
2306
+ }
2446
2307
  ],
2447
2308
  id: "u:dc05498d3bd4",
2448
2309
  closeOnEsc: false,
@@ -2632,7 +2493,7 @@ const StandardButtons = {
2632
2493
  getStandardImportData: async (uiSchema, ctx)=>{
2633
2494
  return {
2634
2495
  type: 'amis_button',
2635
- amis_schema: await getSchema$2()
2496
+ amis_schema: await getSchema$2(uiSchema)
2636
2497
  }
2637
2498
  },
2638
2499
  getStandardOpenView: async (uiSchema, ctx)=>{
@@ -2662,7 +2523,7 @@ function getButtonVisibleOn$1(button){
2662
2523
  visible = button._visible;
2663
2524
  }
2664
2525
 
2665
- if(___default["default"].isBoolean(visible)){
2526
+ if(___namespace.isBoolean(visible)){
2666
2527
  visible = visible.toString();
2667
2528
  }
2668
2529
 
@@ -2690,7 +2551,7 @@ function getButtonVisibleOn$1(button){
2690
2551
 
2691
2552
  const getButtonVisible = (button, ctx) => {
2692
2553
  if (button._visible) {
2693
- if (___default["default"].startsWith(___default["default"].trim(button._visible), "function")) {
2554
+ if (___namespace.startsWith(___namespace.trim(button._visible), "function")) {
2694
2555
  window.eval("var fun = " + button._visible);
2695
2556
  button.visible = fun;
2696
2557
  } else if (isExpression(button._visible)) {
@@ -2705,7 +2566,7 @@ const getButtonVisible = (button, ctx) => {
2705
2566
  };
2706
2567
  }
2707
2568
  }
2708
- if (___default["default"].isFunction(button.visible)) {
2569
+ if (___namespace.isFunction(button.visible)) {
2709
2570
  try {
2710
2571
  return button.visible(ctx);
2711
2572
  } catch (error) {
@@ -2727,7 +2588,7 @@ const standardButtonsTodo = {
2727
2588
  } = this;
2728
2589
  const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
2729
2590
 
2730
- if(___default["default"].isEmpty(listViewRef.props.store.toJSON().selectedItems)){
2591
+ if(___namespace.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
2731
2592
  listViewRef.handleAction({}, {
2732
2593
  "actionType": "toast",
2733
2594
  "toast": {
@@ -2754,19 +2615,19 @@ const standardButtonsTodo = {
2754
2615
  */
2755
2616
  const getButtons = (uiSchema, ctx) => {
2756
2617
  const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
2757
- let buttons = ___default["default"].sortBy(___default["default"].values(uiSchema.actions), "sort");
2758
- if (___default["default"].has(uiSchema, "allow_customActions")) {
2759
- buttons = ___default["default"].filter(buttons, (button) => {
2760
- return ___default["default"].include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
2618
+ let buttons = ___namespace.sortBy(___namespace.values(uiSchema.actions), "sort");
2619
+ if (___namespace.has(uiSchema, "allow_customActions")) {
2620
+ buttons = ___namespace.filter(buttons, (button) => {
2621
+ return ___namespace.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
2761
2622
  });
2762
2623
  }
2763
- if (___default["default"].has(uiSchema, "exclude_actions")) {
2764
- buttons = ___default["default"].filter(buttons, (button) => {
2765
- return !___default["default"].include(uiSchema.exclude_actions, button.name);
2624
+ if (___namespace.has(uiSchema, "exclude_actions")) {
2625
+ buttons = ___namespace.filter(buttons, (button) => {
2626
+ return !___namespace.include(uiSchema.exclude_actions, button.name);
2766
2627
  });
2767
2628
  }
2768
2629
 
2769
- ___default["default"].each(buttons, (button) => {
2630
+ ___namespace.each(buttons, (button) => {
2770
2631
  button.objectName = uiSchema.name;
2771
2632
  if (
2772
2633
  ctx.isMobile &&
@@ -2785,7 +2646,7 @@ const getButtons = (uiSchema, ctx) => {
2785
2646
  ctx.isMobile &&
2786
2647
  ["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
2787
2648
  ) {
2788
- ___default["default"].map(buttons, (button) => {
2649
+ ___namespace.map(buttons, (button) => {
2789
2650
  if (button.name === "standard_edit") {
2790
2651
  button.on = "record_more";
2791
2652
  }
@@ -2795,14 +2656,14 @@ const getButtons = (uiSchema, ctx) => {
2795
2656
  });
2796
2657
  }
2797
2658
 
2798
- return ___default["default"].filter(buttons, (button) => {
2799
- return ___default["default"].indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
2659
+ return ___namespace.filter(buttons, (button) => {
2660
+ return ___namespace.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
2800
2661
  });
2801
2662
  };
2802
2663
 
2803
2664
  const getListViewButtons = (uiSchema, ctx) => {
2804
2665
  const buttons = getButtons(uiSchema, ctx);
2805
- const listButtons = ___default["default"].filter(buttons, (button) => {
2666
+ const listButtons = ___namespace.filter(buttons, (button) => {
2806
2667
  return button.on == "list";
2807
2668
  });
2808
2669
  return listButtons;
@@ -2810,23 +2671,23 @@ const getListViewButtons = (uiSchema, ctx) => {
2810
2671
 
2811
2672
  const getObjectDetailButtons = (uiSchema, ctx) => {
2812
2673
  const buttons = getButtons(uiSchema, ctx);
2813
- const detailButtons = ___default["default"].filter(buttons, (button) => {
2674
+ const detailButtons = ___namespace.filter(buttons, (button) => {
2814
2675
  return button.on == "record" || button.on == "record_only";
2815
2676
  });
2816
- return ___default["default"].sortBy(detailButtons, "sort");
2677
+ return ___namespace.sortBy(detailButtons, "sort");
2817
2678
  };
2818
2679
 
2819
2680
  const getObjectDetailMoreButtons = (uiSchema, ctx) => {
2820
2681
  const buttons = getButtons(uiSchema, ctx);
2821
- const moreButtons = ___default["default"].filter(buttons, (button) => {
2682
+ const moreButtons = ___namespace.filter(buttons, (button) => {
2822
2683
  return button.on == "record_more" || button.on == "record_only_more";
2823
2684
  });
2824
- return ___default["default"].sortBy(moreButtons, "sort");
2685
+ return ___namespace.sortBy(moreButtons, "sort");
2825
2686
  };
2826
2687
 
2827
2688
  const getListViewItemButtons = async (uiSchema, ctx)=>{
2828
2689
  const buttons = getButtons(uiSchema, ctx);
2829
- const listButtons = ___default["default"].filter(buttons, (button) => {
2690
+ const listButtons = ___namespace.filter(buttons, (button) => {
2830
2691
  return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
2831
2692
  });
2832
2693
  return listButtons;
@@ -2843,7 +2704,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
2843
2704
  // });
2844
2705
  // return relatedListButtons;
2845
2706
  const buttons = getButtons(uiSchema, ctx);
2846
- const listButtons = ___default["default"].filter(buttons, (button) => {
2707
+ const listButtons = ___namespace.filter(buttons, (button) => {
2847
2708
  return button.on == "list";
2848
2709
  });
2849
2710
  return listButtons;
@@ -2860,7 +2721,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
2860
2721
  const uiSchema = await getUISchema(objectName);
2861
2722
  if(uiSchema){
2862
2723
  const buttons = await getButtons(uiSchema, ctx);
2863
- const button = ___default["default"].find(buttons, (button)=>{
2724
+ const button = ___namespace.find(buttons, (button)=>{
2864
2725
  return button.name === buttonName
2865
2726
  });
2866
2727
 
@@ -2946,13 +2807,13 @@ const execute = (button, props) => {
2946
2807
  return; //TODO 弹出提示未配置todo
2947
2808
  }
2948
2809
 
2949
- if (___default["default"].isString(button.todo)) {
2950
- if (___default["default"].startsWith(___default["default"].trim(button.todo), "function")) {
2810
+ if (___namespace.isString(button.todo)) {
2811
+ if (___namespace.startsWith(___namespace.trim(button.todo), "function")) {
2951
2812
  window.eval("var fun = " + button.todo);
2952
2813
  button.todo = fun;
2953
2814
  }
2954
2815
  }
2955
- if (___default["default"].isFunction(button.todo)) {
2816
+ if (___namespace.isFunction(button.todo)) {
2956
2817
  const todoThis = {
2957
2818
  objectName: props.objectName,
2958
2819
  object_name: props.objectName,
@@ -2977,7 +2838,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2977
2838
  recordId: recordId,
2978
2839
  objectName: name
2979
2840
  });
2980
- let amisButtonsSchema = ___default["default"].map(buttons, (button) => {
2841
+ let amisButtonsSchema = ___namespace.map(buttons, (button) => {
2981
2842
  return {
2982
2843
  type: 'steedos-object-button',
2983
2844
  name: button.name,
@@ -2987,7 +2848,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2987
2848
  }
2988
2849
  });
2989
2850
  let moreButtonsVisibleOn = '';
2990
- let dropdownButtons = ___default["default"].map(moreButtons, (button, index) => {
2851
+ let dropdownButtons = ___namespace.map(moreButtons, (button, index) => {
2991
2852
  if(index === 0){
2992
2853
  moreButtonsVisibleOn = getButtonVisibleOn$1(button);
2993
2854
  }else {
@@ -3030,11 +2891,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
3030
2891
  "vertical": true,
3031
2892
  "tiled": true,
3032
2893
  "buttons": [
3033
- ...___default["default"].map(buttons, (button)=>{
2894
+ ...___namespace.map(buttons, (button)=>{
3034
2895
  button.className += ' w-full';
3035
2896
  return button;
3036
2897
  }),
3037
- ...___default["default"].map(moreButtons, (button)=>{
2898
+ ...___namespace.map(moreButtons, (button)=>{
3038
2899
  button.className += ' w-full';
3039
2900
  return button;
3040
2901
  })
@@ -3079,6 +2940,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3079
2940
  return {
3080
2941
  "type": "button",
3081
2942
  "icon": "fa fa-angle-down",
2943
+ "className": "mr-0",
3082
2944
  "onEvent": {
3083
2945
  "click": {
3084
2946
  "actions": [
@@ -3095,7 +2957,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3095
2957
  "vertical": true,
3096
2958
  "tiled": true,
3097
2959
  "buttons": [
3098
- ...___default["default"].map(buttons, (button)=>{
2960
+ ...___namespace.map(buttons, (button)=>{
3099
2961
  return {
3100
2962
  type: 'steedos-object-button',
3101
2963
  name: button.name,
@@ -3124,7 +2986,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3124
2986
  }
3125
2987
  }
3126
2988
  }else {
3127
- return ___default["default"].map(buttons, (button) => {
2989
+ return ___namespace.map(buttons, (button) => {
3128
2990
  return {
3129
2991
  type: 'steedos-object-button',
3130
2992
  name: button.name,
@@ -3157,7 +3019,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
3157
3019
  "vertical": true,
3158
3020
  "tiled": true,
3159
3021
  "buttons": [
3160
- ...___default["default"].map(buttons, (button)=>{
3022
+ ...___namespace.map(buttons, (button)=>{
3161
3023
  return {
3162
3024
  type: 'steedos-object-button',
3163
3025
  name: button.name,
@@ -3186,7 +3048,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
3186
3048
  }
3187
3049
  }
3188
3050
  }else {
3189
- return ___default["default"].map(buttons, (button) => {
3051
+ return ___namespace.map(buttons, (button) => {
3190
3052
  return {
3191
3053
  type: 'steedos-object-button',
3192
3054
  name: button.name,
@@ -3782,6 +3644,10 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
3782
3644
  _$1.each(
3783
3645
  objectSchema.list_views,
3784
3646
  (listView, name) => {
3647
+ if(name === "lookup"){
3648
+ // 内置lookup为弹出选择专用视图,不显示在列表切换区域
3649
+ return;
3650
+ }
3785
3651
  listViewButtonOptions.push({
3786
3652
  type: "button",
3787
3653
  label: listView.label,
@@ -5271,6 +5137,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
5271
5137
 
5272
5138
  return {
5273
5139
  "type": "tooltip-wrapper",
5140
+ "id": "steedos_crud_toolbar_quick_search",
5274
5141
  "align": "right",
5275
5142
  "title": "",
5276
5143
  "content": "可搜索字段:" + searchableFieldsLabel.join(","),
@@ -5302,76 +5169,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5302
5169
  if(isMobile){
5303
5170
  showDisplayAs = false;
5304
5171
  }
5172
+ let toolbarCount;
5173
+ if(!hiddenCount){
5174
+ toolbarCount = {
5175
+ "type": "tpl",
5176
+ "tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
5177
+ };
5178
+ }
5179
+ let toolbarReloadButton;
5305
5180
  if(formFactor === 'SMALL'){
5306
- const onReloadScript = `
5307
- const scope = event.context.scoped;
5308
- var listView = scope.parent.getComponents().find(function(n){
5309
- return n.props.type === "crud";
5310
- });
5311
- listView.handleChangePage(1);
5312
- `;
5181
+ // const onReloadScript = `
5182
+ // const scope = event.context.scoped;
5183
+ // var listView = scope.parent.getComponents().find(function(n){
5184
+ // return n.props.type === "crud";
5185
+ // });
5186
+ // listView.handleChangePage(1);
5187
+ // `;
5188
+ // toolbarReloadButton = {
5189
+ // // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
5190
+ // "type": "button",
5191
+ // "align": "right",
5192
+ // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5193
+ // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5194
+ // "tooltipPlacement": "top",
5195
+ // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5196
+ // "label": "",
5197
+ // "icon": "fa fa-sync",
5198
+ // "visibleOn": "${!showFieldsFilter}",
5199
+ // "onEvent": {
5200
+ // "click": {
5201
+ // "actions": [
5202
+ // {
5203
+ // "actionType": "custom",
5204
+ // "script": onReloadScript
5205
+ // }
5206
+ // ]
5207
+ // }
5208
+ // },
5209
+ // };
5210
+
5211
+ // 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
5212
+ toolbarReloadButton = {
5213
+ "type": "reload",
5214
+ "align": "right",
5215
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5216
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5217
+ "tooltip":"",
5218
+ "tooltipPlacement": "top",
5219
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5220
+ };
5221
+ }
5222
+ else {
5223
+ toolbarReloadButton = {
5224
+ "type": "reload",
5225
+ "align": "right",
5226
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5227
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5228
+ "tooltip":"",
5229
+ "tooltipPlacement": "top",
5230
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5231
+ };
5232
+ }
5233
+ let toolbarFilter;
5234
+ if(filterVisible){
5235
+ toolbarFilter ={
5236
+ "label": i18next__default["default"].t('frontend_button_search_tooltip'),
5237
+ "icon": "fa fa-filter",
5238
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5239
+ // "tooltip": i18next.t('frontend_button_search_tooltip'),
5240
+ // "tooltipPlacement": "top",
5241
+ "type": "button",
5242
+ "badge": {
5243
+ "offset": [
5244
+ -5,
5245
+ 1
5246
+ ],
5247
+ "size":8,
5248
+ "animation": true,
5249
+ "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5250
+ },
5251
+ "align": "right",
5252
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5253
+ "onEvent": {
5254
+ "click": {
5255
+ "actions": [
5256
+ {
5257
+ "actionType": "custom",
5258
+ "script": onFieldsFilterToggleScript
5259
+ }
5260
+ ]
5261
+ }
5262
+ },
5263
+ "id": "steedos_crud_toolbar_filter"
5264
+ };
5265
+ }
5266
+ let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
5267
+ let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
5268
+
5269
+ // toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
5270
+ // 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
5271
+ let toolbars = [];
5272
+ if(formFactor === 'SMALL'){
5273
+ if(toolbarCount){
5274
+ toolbars.push(toolbarCount);
5275
+ }
5276
+ toolbars.push(toolbarReloadButton);
5277
+ if(toolbarFilter){
5278
+ toolbars.push(toolbarFilter);
5279
+ }
5280
+ toolbars.push(toolbarDisplayAsButton);
5281
+ toolbars.push(toolbarDQuickSearchBox);
5313
5282
  return [
5314
5283
  // "bulkActions",
5315
5284
  ...(headerToolbarItems || []),
5316
- hiddenCount ? {} :{
5317
- "type": "tpl",
5318
- "tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
5319
- },
5320
- {
5321
- // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
5322
- "type": "button",
5323
- "align": "right",
5324
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5325
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5326
- "tooltipPlacement": "top",
5327
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5328
- "label": "",
5329
- "icon": "fa fa-sync",
5330
- "visibleOn": "${!showFieldsFilter}",
5331
- "onEvent": {
5332
- "click": {
5333
- "actions": [
5334
- {
5335
- "actionType": "custom",
5336
- "script": onReloadScript
5337
- }
5338
- ]
5339
- }
5340
- },
5341
- },
5342
- filterVisible ? {
5343
- "label": i18next__default["default"].t('frontend_button_search_tooltip'),
5344
- "icon": "fa fa-search",
5345
- "type": "button",
5346
- "tooltipPlacement": "top",
5347
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5348
- // "tooltip": i18next.t('frontend_button_search_tooltip'),
5349
- "badge": {
5350
- "offset": [
5351
- -5,
5352
- 1
5353
- ],
5354
- "size":8,
5355
- "animation": true,
5356
- "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5357
- },
5358
- "align": "right",
5359
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5360
- "onEvent": {
5361
- "click": {
5362
- "actions": [
5363
- {
5364
- "actionType": "custom",
5365
- "script": onFieldsFilterToggleScript
5366
- }
5367
- ]
5368
- }
5369
- }
5370
- } : {},
5371
- getDisplayAsButton(mainObject?.name),
5372
- getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
5285
+ ...toolbars,
5373
5286
  ]
5374
5287
  }else {
5288
+ if(toolbarCount){
5289
+ toolbars.push(toolbarCount);
5290
+ }
5291
+ if(toolbarFilter){
5292
+ toolbars.push(toolbarFilter);
5293
+ }
5294
+ toolbars.push(toolbarReloadButton);
5295
+ if(mainObject?.permissions?.allowCreateListViews){
5296
+ toolbars.push(getSettingListviewToolbarButtonSchema());
5297
+ }
5298
+ toolbars.push(toolbarDisplayAsButton);
5299
+ toolbars.push(toolbarDQuickSearchBox);
5375
5300
  return [
5376
5301
  // "filter-toggler",
5377
5302
  ...(headerToolbarItems || []),
@@ -5380,56 +5305,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5380
5305
  "type": "columns-toggler",
5381
5306
  "className": "hidden"
5382
5307
  },
5308
+ ...toolbars,
5383
5309
  // {
5384
5310
  // "type": "columns-toggler",
5385
5311
  // "className": "mr-2"
5386
5312
  // },
5387
- hiddenCount ? {} : {
5388
- "type": "tpl",
5389
- "tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
5390
- },
5391
- filterVisible ? {
5392
- "label": i18next__default["default"].t('frontend_button_search_tooltip'),
5393
- "icon": "fa fa-filter",
5394
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5395
- // "tooltip": i18next.t('frontend_button_search_tooltip'),
5396
- // "tooltipPlacement": "top",
5397
- "type": "button",
5398
- "badge": {
5399
- "offset": [
5400
- -5,
5401
- 1
5402
- ],
5403
- "size":8,
5404
- "animation": true,
5405
- "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5406
- },
5407
- "align": "right",
5408
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5409
- "onEvent": {
5410
- "click": {
5411
- "actions": [
5412
- {
5413
- "actionType": "custom",
5414
- "script": onFieldsFilterToggleScript
5415
- }
5416
- ]
5417
- }
5418
- }
5419
- } : {},
5420
- {
5421
- "type": "reload",
5422
- "align": "right",
5423
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5424
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5425
- "tooltip":"",
5426
- "tooltipPlacement": "top",
5427
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5428
- },
5429
5313
  // getExportExcelToolbarButtonSchema(),
5430
- mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
5431
- getDisplayAsButton(mainObject?.name),
5432
- getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
5433
5314
  // {
5434
5315
  // "type": "drag-toggler",
5435
5316
  // "align": "right"
@@ -5630,10 +5511,8 @@ async function getDeferApi(field, ctx) {
5630
5511
  }
5631
5512
 
5632
5513
  function getRefListViewSort(refObject){
5633
- const listView = ___namespace.find(
5634
- refObject.list_views,
5635
- (view, name) => name === "all"
5636
- );
5514
+ let listView = getLookupListView(refObject);
5515
+
5637
5516
  let sort = "";
5638
5517
  if(listView){
5639
5518
  sort = getListViewSort(listView);
@@ -5723,12 +5602,11 @@ const getReferenceTo = async (field)=>{
5723
5602
  }
5724
5603
  };
5725
5604
 
5726
- function getLookupSapceUserTreeSchema(){
5727
- const tree = [{
5605
+ function getLookupSapceUserTreeSchema(isMobile){
5606
+ const treeSchema = {
5728
5607
  "type": "input-tree",
5729
- "className": "",
5608
+ "className":"steedos-select-user-tree",
5730
5609
  "inputClassName": "p-0",
5731
- "id": "u:7fd77b7915b0",
5732
5610
  "source": {
5733
5611
  "method": "post",
5734
5612
  "url": "${context.rootUrl}/graphql",
@@ -5759,6 +5637,10 @@ function getLookupSapceUserTreeSchema(){
5759
5637
  });
5760
5638
  listView.handleFilterSubmit(Object.assign({}, filterFormValues));
5761
5639
  `
5640
+ },
5641
+ {
5642
+ "actionType": "custom",
5643
+ "script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
5762
5644
  }
5763
5645
  ]
5764
5646
  }
@@ -5783,18 +5665,56 @@ function getLookupSapceUserTreeSchema(){
5783
5665
  "placeholder": "查找部门"
5784
5666
  },
5785
5667
  "unfoldedLevel": 2,
5786
- "style": {
5787
- "max-height": "100%",
5788
- "position": "absolute",
5789
- "left": "-330px",
5790
- "width": "320px",
5791
- "bottom": 0,
5792
- "top": "0",
5793
- "overflow": "auto",
5794
- "min-height":"300px"
5795
- },
5796
5668
  "originPosition": "left-top"
5797
- }];
5669
+ };
5670
+ const tree = [];
5671
+ if(isMobile){
5672
+ tree.push({
5673
+ type: "action",
5674
+ body:[
5675
+ {
5676
+ type: "action",
5677
+ body:[
5678
+ treeSchema
5679
+ ],
5680
+ className:"h-full w-[240px]"
5681
+ }
5682
+ ],
5683
+ className: "absolute inset-0 steedos-select-user-sidebar",
5684
+ "onEvent": {
5685
+ "click": {
5686
+ "actions": [
5687
+ {
5688
+ "actionType": "custom",
5689
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
5690
+ }
5691
+ ]
5692
+ }
5693
+ },
5694
+ id: "steedos_crud_toolbar_select_user_tree"
5695
+ });
5696
+ tree.push({
5697
+ "type": "button",
5698
+ "label": "组织",
5699
+ "icon": "fa fa-sitemap",
5700
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5701
+ "align": "left",
5702
+ "onEvent": {
5703
+ "click": {
5704
+ "actions": [
5705
+ {
5706
+ "actionType": "custom",
5707
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
5708
+ }
5709
+ ]
5710
+ }
5711
+ },
5712
+ "id": "steedos_crud_toolbar_organization_button"
5713
+ });
5714
+ }else {
5715
+ tree.push(treeSchema);
5716
+ }
5717
+
5798
5718
  return tree;
5799
5719
  }
5800
5720
 
@@ -5809,19 +5729,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
5809
5729
  ctx.objectName = refObjectConfig.name;
5810
5730
 
5811
5731
  let tableFields = [];
5812
- let i = 0;
5813
5732
  const searchableFields = [];
5814
5733
 
5815
- const fieldsArr = [];
5816
-
5817
- const listName = "all";
5734
+ let fieldsArr = [];
5818
5735
 
5819
5736
  const isMobile = window.innerWidth < 768;
5820
5737
 
5821
- const listView = ___namespace.find(
5822
- refObjectConfig.list_views,
5823
- (listView, name) => name === listName
5824
- );
5738
+ let listView = getLookupListView(refObjectConfig);
5739
+ let listName = listView && listView.name;
5825
5740
  if (listView && listView.columns) {
5826
5741
  ___namespace.each(listView.columns, function (column) {
5827
5742
  if (___namespace.isString(column) && refObjectConfig.fields[column]) {
@@ -5836,7 +5751,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5836
5751
  }
5837
5752
  });
5838
5753
  }else {
5839
- ___namespace.each(refObjectConfig.fields , (field, field_name)=>{
5754
+ ___namespace.each(refObjectConfig.fields, (field, field_name)=>{
5840
5755
  if(field_name != '_id' && !field.hidden){
5841
5756
  if(!___namespace.has(field, "name")){
5842
5757
  field.name = field_name;
@@ -5844,16 +5759,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
5844
5759
  fieldsArr.push(field);
5845
5760
  }
5846
5761
  });
5762
+ // 没有视图权限时,取对象上前5个字段,按sort_no排序
5763
+ fieldsArr = ___namespace.sortBy(fieldsArr, "sort_no").slice(0,5);
5847
5764
  }
5848
5765
 
5849
- ___namespace.each(___namespace.sortBy(fieldsArr, "sort_no"),function(field){
5850
- if(i < 5){
5851
- if(!___namespace.find(tableFields, function(f){
5852
- return f.name === field.name
5853
- })){
5854
- i++;
5855
- tableFields.push(field);
5856
- }
5766
+ ___namespace.each(fieldsArr,function(field){
5767
+ if(!___namespace.find(tableFields, function(f){
5768
+ return f.name === field.name
5769
+ })){
5770
+ tableFields.push(field);
5857
5771
  }
5858
5772
  });
5859
5773
 
@@ -6047,13 +5961,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
6047
5961
  }
6048
5962
 
6049
5963
  let pickerSchema = null;
6050
- if(ctx.formFactor === 'SMALL'){
6051
- pickerSchema = await getListSchema$1(tableFields, {
6052
- top: top,
6053
- ...ctx,
6054
- actions: false
6055
- });
6056
- }else {
5964
+ {
6057
5965
  pickerSchema = await getTableSchema$1(tableFields, {
6058
5966
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
6059
5967
  top: top,
@@ -6064,13 +5972,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
6064
5972
  pickerSchema.affixHeader = false;
6065
5973
 
6066
5974
  var headerToolbarItems = [];
6067
- if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
6068
- headerToolbarItems = getLookupSapceUserTreeSchema();
6069
- pickerSchema["style"] = {
6070
- "margin-left":"330px",
6071
- "min-height": "300px"
6072
- };
6073
- pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
5975
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
5976
+ headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
5977
+ pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
6074
5978
  }
6075
5979
 
6076
5980
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
@@ -6166,13 +6070,25 @@ async function lookupToAmisPicker(field, readonly, ctx){
6166
6070
  pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
6167
6071
  }
6168
6072
 
6073
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
6074
+ //手机端选人控件只保留部分toolbar
6075
+ pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
6076
+ 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){
6077
+ return true;
6078
+ }else {
6079
+ return false;
6080
+ }
6081
+ });
6082
+ pickerSchema.footerToolbar = ["pagination"];
6083
+ }
6084
+
6169
6085
  const data = {
6170
6086
  type: getAmisStaticFieldType('picker', readonly),
6171
6087
  modalTitle: i18next__default["default"].t('frontend_form_please_select') + " " + refObjectConfig.label,
6172
6088
  labelField: referenceTo.labelField.name,
6173
6089
  valueField: referenceTo.valueField.name,
6174
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
6175
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
6090
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
6091
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
6176
6092
  modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
6177
6093
  source: source,
6178
6094
  size: "lg",
@@ -6238,10 +6154,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
6238
6154
  }
6239
6155
 
6240
6156
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
6241
- const listView = refObjectConfig && ___namespace.find(
6242
- refObjectConfig.list_views,
6243
- (listView, name) => name === "all"
6244
- );
6157
+ let listView = getLookupListView(refObjectConfig);
6245
6158
 
6246
6159
  let sort = "";
6247
6160
  if(listView){
@@ -6352,8 +6265,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
6352
6265
  joinValues: false,
6353
6266
  extractValue: true,
6354
6267
  clearable: true,
6355
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
6356
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
6268
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
6269
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
6357
6270
  // labelField: labelField,
6358
6271
  // valueField: valueField,
6359
6272
  source: apiInfo,
@@ -6422,6 +6335,7 @@ async function lookupToAmis(field, readonly, ctx){
6422
6335
  }
6423
6336
 
6424
6337
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
6338
+ ctx.onlyDisplayLookLabel = true;
6425
6339
  if(ctx.idsDependOn){
6426
6340
  // ids人员点选模式
6427
6341
  return await lookupToAmisIdsPicker(field, readonly, ctx);
@@ -6475,7 +6389,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6475
6389
 
6476
6390
  const tableFields = [referenceTo.labelField];
6477
6391
 
6478
- const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}`});
6392
+ const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
6479
6393
 
6480
6394
  source.data.$term = "$term";
6481
6395
  source.data.$self = "$$";
@@ -6484,6 +6398,12 @@ async function getIdsPickerSchema(field, readonly, ctx){
6484
6398
  source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
6485
6399
  source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
6486
6400
  }
6401
+
6402
+ let listView = getLookupListView(refObjectConfig);
6403
+ let sort = "";
6404
+ if(listView){
6405
+ sort = getListViewSort(listView);
6406
+ }
6487
6407
 
6488
6408
  source.requestAdaptor = `
6489
6409
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
@@ -6491,6 +6411,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
6491
6411
  var pageSize = api.data.pageSize || 1000;
6492
6412
  var pageNo = api.data.pageNo || 1;
6493
6413
  var skip = (pageNo - 1) * pageSize;
6414
+ var orderBy = api.data.orderBy || '';
6415
+ var orderDir = api.data.orderDir || '';
6416
+ var sort = orderBy + ' ' + orderDir;
6417
+ sort = orderBy ? sort : "${sort}";
6494
6418
  if(selfData.op === 'loadOptions' && selfData.value){
6495
6419
  if(selfData.value && selfData.value.indexOf(',') > 0){
6496
6420
  filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
@@ -6508,7 +6432,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6508
6432
  filters.push(["${referenceTo.valueField.name}", "=", ids]);
6509
6433
  }
6510
6434
 
6511
- api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip);
6435
+ api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
6512
6436
  return api;
6513
6437
  `;
6514
6438
 
@@ -6525,6 +6449,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6525
6449
  pickerSchema = await getTableSchema$1(tableFields, {
6526
6450
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
6527
6451
  top: top,
6452
+ isLookup: true,
6528
6453
  ...ctx
6529
6454
  });
6530
6455
 
@@ -6538,8 +6463,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
6538
6463
  valueField: referenceTo.valueField.name,
6539
6464
  modalMode: 'dialog',
6540
6465
  source: source,
6541
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
6542
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
6466
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
6467
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
6543
6468
  size: "lg",
6544
6469
  pickerSchema: pickerSchema,
6545
6470
  joinValues: false,
@@ -6567,8 +6492,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
6567
6492
  /*
6568
6493
  * @Author: baozhoutao@steedos.com
6569
6494
  * @Date: 2023-01-13 17:27:54
6570
- * @LastEditors: liaodaxue
6571
- * @LastEditTime: 2023-07-27 17:33:54
6495
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
6496
+ * @LastEditTime: 2023-08-28 17:45:38
6572
6497
  * @Description:
6573
6498
  */
6574
6499
 
@@ -6630,18 +6555,47 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
6630
6555
 
6631
6556
  const getHtmlFieldSchema = (field, readonly, ctx)=>{
6632
6557
  if(readonly){
6558
+ // return {
6559
+ // "type": "control",
6560
+ // "label": field.label,
6561
+ // "body": {
6562
+ // "type": "html",
6563
+ // "name": field.name
6564
+ // }
6565
+ // }
6633
6566
  return {
6634
- "type": "control",
6635
- "label": field.label,
6636
- "body": {
6637
- "type": "html",
6638
- "name": field.name
6639
- }
6567
+ "type": "input-rich-text",
6568
+ "receiver": "${context.rootUrl}/s3/images",
6569
+ "name": field.name,
6570
+ "options": {
6571
+ "menu": {
6572
+ "insert": {
6573
+ "title": "Insert",
6574
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
6575
+ }
6576
+ },
6577
+ "plugins": [
6578
+ "autoresize"
6579
+ ],
6580
+ // "max_height": 2000,
6581
+ "statusbar": false,
6582
+ "readonly": true,
6583
+ "toolbar": false,
6584
+ "menubar": false
6640
6585
  }
6586
+ }
6641
6587
  }else {
6642
6588
  return {
6643
6589
  "type": "input-rich-text",
6644
6590
  "receiver": "${context.rootUrl}/s3/images",
6591
+ "options":{
6592
+ "menu": {
6593
+ "insert": {
6594
+ "title": "Insert",
6595
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
6596
+ }
6597
+ }
6598
+ },
6645
6599
  "name": field.name
6646
6600
  }
6647
6601
  // return {
@@ -6695,6 +6649,9 @@ function getAmisStaticFieldType(type, readonly, options){
6695
6649
  return type;
6696
6650
  }
6697
6651
  if(___namespace.includes(['text','image'], type)){
6652
+ if('text' === type && options && options.amis && options.amis.tpl){
6653
+ return 'static';
6654
+ }
6698
6655
  if('image' === type && options && options.multiple){
6699
6656
  return `static-images`;
6700
6657
  }
@@ -6965,7 +6922,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6965
6922
  // }
6966
6923
  switch (field.type) {
6967
6924
  case 'text':
6968
- convertData.type = getAmisStaticFieldType('text', readonly);
6925
+ convertData.type = getAmisStaticFieldType('text', readonly, field);
6969
6926
  break;
6970
6927
  case 'textarea':
6971
6928
  convertData.type = getAmisStaticFieldType('textarea', readonly);
@@ -7412,7 +7369,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
7412
7369
  convertData.className = 'm-1';
7413
7370
  }
7414
7371
  if(readonly){
7415
- convertData.className = `${convertData.className} md:border-b`;
7372
+ convertData.className = `${convertData.className} border-b`;
7416
7373
  }
7417
7374
  if(readonly){
7418
7375
  convertData.quickEdit = false;
@@ -7882,7 +7839,10 @@ function getFieldWidth(width){
7882
7839
  }
7883
7840
 
7884
7841
  async function getTableColumns(fields, options){
7885
- const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
7842
+ const columns = [];
7843
+ if(!options.isLookup){
7844
+ columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
7845
+ }
7886
7846
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
7887
7847
 
7888
7848
  for (const field of fields) {
@@ -8117,7 +8077,7 @@ async function getMobileTableColumns(fields, options){
8117
8077
  let tpl = "";
8118
8078
  if(field.is_name || field.name === options.labelFieldName){
8119
8079
  nameField = field;
8120
- options.onlyDisplayLabel = true;
8080
+ options.onlyDisplayLookLabel = true;
8121
8081
  tpl = await getFieldTpl(field, options);
8122
8082
  }
8123
8083
  else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
@@ -8126,12 +8086,13 @@ async function getMobileTableColumns(fields, options){
8126
8086
  }
8127
8087
  else {
8128
8088
  if(field.type === 'lookup' || field.type === 'master_detail'){
8129
- options.onlyDisplayLabel = true;
8089
+ options.onlyDisplayLookLabel = true;
8130
8090
  }
8131
8091
  tpl = await getFieldTpl(field, options);
8132
8092
  }
8133
8093
  if(!tpl){
8134
- tpl = `\${${field.name}}`;
8094
+ //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
8095
+ tpl = `\${${field.name} | raw}`;
8135
8096
  }
8136
8097
  if(!field.hidden && !field.extra){
8137
8098
  tpls.push({ field, tpl });
@@ -8327,7 +8288,12 @@ async function getTableSchema$1(fields, options){
8327
8288
  options = {};
8328
8289
  }
8329
8290
  let columns = [];
8330
- if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
8291
+ let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
8292
+ if(isLookup){
8293
+ // 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
8294
+ useMobileColumns = false;
8295
+ }
8296
+ if(useMobileColumns){
8331
8297
  columns = await getMobileTableColumns(fields, options);
8332
8298
  }
8333
8299
  else {
@@ -8347,7 +8313,7 @@ async function getTableSchema$1(fields, options){
8347
8313
  columns: columns,
8348
8314
  syncLocation: false,
8349
8315
  keepItemSelectionOnPageChange: true,
8350
- checkOnItemClick: false,
8316
+ checkOnItemClick: isLookup ? true : false,
8351
8317
  labelTpl: `\${${options.labelFieldName}}`,
8352
8318
  autoFillHeight: false, // 自动高度效果不理想,先关闭
8353
8319
  columnsTogglable: false,
@@ -8971,7 +8937,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
8971
8937
  var defaultValues = {};
8972
8938
  _.each(uiSchema && uiSchema.fields, function(field){
8973
8939
  var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
8974
- if(value){
8940
+ if(!_.isNil(value)){
8975
8941
  defaultValues[field.name] = value;
8976
8942
  }
8977
8943
  });
@@ -9629,14 +9595,15 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
9629
9595
  /*
9630
9596
  * @Author: baozhoutao@steedos.com
9631
9597
  * @Date: 2022-05-26 16:02:08
9632
- * @LastEditors: liaodaxue
9633
- * @LastEditTime: 2023-07-12 15:45:55
9598
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
9599
+ * @LastEditTime: 2023-09-05 15:42:26
9634
9600
  * @Description:
9635
9601
  */
9636
9602
 
9637
- const getFieldSchemaArray = (formFields) => {
9603
+ const getFieldSchemaArray = (formFields, ctx) => {
9638
9604
  let fieldSchemaArray = [];
9639
9605
  fieldSchemaArray.length = 0;
9606
+ const recordId = ctx && ctx.recordId;
9640
9607
 
9641
9608
  ___namespace.forEach(formFields, (field) => {
9642
9609
  if (!field.group || field.group == 'null' || field.group == '-')
@@ -9648,8 +9615,14 @@ const getFieldSchemaArray = (formFields) => {
9648
9615
  field.is_wide = true;
9649
9616
  }
9650
9617
 
9618
+ let forceHidden = false;
9619
+ if(!recordId && field.readonly){
9620
+ // 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
9621
+ forceHidden = true;
9622
+ }
9623
+
9651
9624
  if (!isObjectField) {
9652
- if (!field.hidden) {
9625
+ if (!field.hidden && !forceHidden) {
9653
9626
  fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
9654
9627
  }
9655
9628
  }
@@ -9720,7 +9693,7 @@ const getSections = async (permissionFields, formFields, ctx) => {
9720
9693
  if (!ctx) {
9721
9694
  ctx = {};
9722
9695
  }
9723
- const fieldSchemaArray = getFieldSchemaArray(formFields);
9696
+ const fieldSchemaArray = getFieldSchemaArray(formFields, ctx);
9724
9697
  const _sections = ___namespace.groupBy(fieldSchemaArray, 'group');
9725
9698
  const sections = [];
9726
9699
  var sectionVisibleOns = [];
@@ -9941,7 +9914,7 @@ async function getObjectCRUD(objectSchema, fields, options){
9941
9914
  }
9942
9915
  `;
9943
9916
  let autoFillHeight = true;
9944
- if(options.isRelated || Steedos.isMobile()){
9917
+ if(options.isRelated || window.innerWidth < 768){
9945
9918
  autoFillHeight = false;
9946
9919
  }
9947
9920
 
@@ -10314,7 +10287,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
10314
10287
  * @Author: baozhoutao@steedos.com
10315
10288
  * @Date: 2022-07-05 15:55:39
10316
10289
  * @LastEditors: liaodaxue
10317
- * @LastEditTime: 2023-08-21 14:50:21
10290
+ * @LastEditTime: 2023-08-28 14:55:23
10318
10291
  * @Description:
10319
10292
  */
10320
10293
 
@@ -10460,11 +10433,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10460
10433
  // }
10461
10434
  const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
10462
10435
  const componentId = `steedos-record-related-list-${relatedObjectName}`;
10436
+ const isMobile = window.innerWidth < 768;
10437
+ let headerToolbar = [];
10438
+ if(!isMobile){
10439
+ headerToolbar.push("bulkActions");
10440
+ }
10463
10441
  const options = {
10464
10442
  globalFilter,
10465
10443
  defaults: {
10466
10444
  listSchema: {
10467
- headerToolbar:["bulkActions"],
10445
+ headerToolbar,
10468
10446
  columnsTogglable: false,
10469
10447
  onEvent: {
10470
10448
  [`@data.changed.${relatedObjectName}`]: {