@steedos-widgets/amis-lib 1.3.0-beta.9 → 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.
package/dist/index.esm.js CHANGED
@@ -382,8 +382,8 @@ const Router = {
382
382
  /*
383
383
  * @Author: baozhoutao@steedos.com
384
384
  * @Date: 2022-07-20 16:29:22
385
- * @LastEditors: Please set LastEditors
386
- * @LastEditTime: 2023-05-18 15:22:51
385
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
386
+ * @LastEditTime: 2023-09-06 18:59:40
387
387
  * @Description:
388
388
  */
389
389
 
@@ -396,11 +396,37 @@ function getContrastColor(bgColor) {
396
396
  return brightness < 128 ? "#ffffff" : "#000000";
397
397
  }
398
398
 
399
+ function getLookupListView(refObjectConfig) {
400
+ const listNameAll = "all";
401
+ const listNameLookup = "lookup";
402
+ let listViewAll, listViewLookup;
403
+
404
+ _.each(
405
+ refObjectConfig.list_views,
406
+ (view, name) => {
407
+ if (name === listNameAll) {
408
+ listViewAll = view;
409
+ if(!listViewAll.name){
410
+ listViewAll.name = name;
411
+ }
412
+ }
413
+ else if (name === listNameLookup) {
414
+ listViewLookup = view;
415
+ if(!listViewLookup.name){
416
+ listViewLookup.name = name;
417
+ }
418
+ }
419
+ }
420
+ );
421
+ let listView = listViewLookup || listViewAll;
422
+ return listView;
423
+ }
424
+
399
425
  /*
400
426
  * @Author: baozhoutao@steedos.com
401
427
  * @Date: 2022-05-23 09:53:08
402
428
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
403
- * @LastEditTime: 2023-08-03 18:07:54
429
+ * @LastEditTime: 2023-08-29 15:04:39
404
430
  * @Description:
405
431
  */
406
432
 
@@ -504,7 +530,7 @@ function getRelatedFieldTpl(field, ctx){
504
530
  linkTarget = "target='_blank'";
505
531
  }
506
532
 
507
- const onlyDisplayLabel = ctx.onlyDisplayLabel;
533
+ const onlyDisplayLookLabel = ctx.onlyDisplayLookLabel;
508
534
 
509
535
  let fieldDataStrTpl = `data._display.${field.name}`;
510
536
 
@@ -515,7 +541,7 @@ function getRelatedFieldTpl(field, ctx){
515
541
  if(_.isString(field.reference_to) || !field.reference_to){
516
542
  if(field.multiple){
517
543
  let labelTpl = `<%=item.label%>`;
518
- if(!onlyDisplayLabel){
544
+ if(!onlyDisplayLookLabel){
519
545
  const href = Router.getObjectDetailPath({
520
546
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
521
547
  });
@@ -533,7 +559,7 @@ function getRelatedFieldTpl(field, ctx){
533
559
  objectNameTpl = `\${${field.name}.objectName}`;
534
560
  recordIdTpl = `\${${field.name}.value}`;
535
561
  }
536
- if(!onlyDisplayLabel){
562
+ if(!onlyDisplayLookLabel){
537
563
  const href = Router.getObjectDetailPath({
538
564
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
539
565
  });
@@ -545,7 +571,7 @@ function getRelatedFieldTpl(field, ctx){
545
571
 
546
572
  }else {
547
573
  let labelTpl = `<%=item.label%>`;
548
- if(!onlyDisplayLabel){
574
+ if(!onlyDisplayLookLabel){
549
575
  const href = Router.getObjectDetailPath({
550
576
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
551
577
  });
@@ -598,7 +624,7 @@ function getLocationTpl(field){
598
624
  }
599
625
 
600
626
  async function getFieldTpl (field, options){
601
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLabel){
627
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
602
628
  return getNameTpl(field, options)
603
629
  }
604
630
  switch (field.type) {
@@ -968,7 +994,7 @@ function getApi$2 (isMobile){
968
994
  }
969
995
  }
970
996
 
971
- var frontend_field_group_generalization$1 = "Generalization";
997
+ var frontend_field_group_generalization$1 = "General";
972
998
  var frontend_download$1 = "Download";
973
999
  var frontend_form_save$1 = "Save";
974
1000
  var frontend_form_save_and_new$1 = "Save and New";
@@ -1653,10 +1679,7 @@ async function getSearchApi(field, ctx) {
1653
1679
  }
1654
1680
 
1655
1681
  function getRefListViewSort$1(refObject){
1656
- const listView = _$1.find(
1657
- refObject.list_views,
1658
- (view, name) => name === "all"
1659
- );
1682
+ let listView = getLookupListView(refObject);
1660
1683
  let sort = "";
1661
1684
  if(listView){
1662
1685
  sort = getListViewSort(listView);
@@ -2165,257 +2188,92 @@ const getSchema$2 = (uiSchema) => {
2165
2188
  title: i18next.t('frontend_import_data'),
2166
2189
  body: [
2167
2190
  {
2168
- type: "form",
2169
- mode: "edit",
2170
- persistData: false,
2171
- promptPageLeave: true,
2172
- name: "form_edit_data_import",
2173
- debug: false,
2174
- title: "",
2175
- submitText: "",
2176
- api: {
2177
- method: "post",
2178
- url: "${context.rootUrl}/graphql",
2179
- data: {
2180
- objectName: "queue_import_history",
2181
- $: "$$",
2182
- },
2183
- requestAdaptor:
2184
- "\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 ",
2185
- responseData: {
2186
- recordId: "${record._id}",
2187
- },
2188
- adaptor:
2189
- "console.log('payload', payload)\n return payload;\n ",
2190
- headers: {
2191
- Authorization:
2192
- "Bearer ${context.tenantId},${context.authToken}",
2193
- },
2194
- dataType: "json",
2191
+ "type": "steedos-object-form",
2192
+ "label": "对象表单",
2193
+ "objectApiName": "queue_import_history",
2194
+ "recordId": "",
2195
+ "mode": "edit",
2196
+ "layout": "normal",
2197
+ "defaultData":{
2198
+ "object_name": "${objectName}"
2195
2199
  },
2196
- initFetch: true,
2197
- body: [
2198
- {
2199
- type: "fieldSet",
2200
- title: i18next.t('frontend_field_group_generalization'),
2201
- collapsable: true,
2202
- body: [
2203
- {
2204
- name: "object_name",
2205
- label: i18next.t('frontend_import_data_object_name'),
2206
- required: false,
2207
- type: "select",
2208
- joinValues: false,
2209
- extractValue: true,
2210
- autoComplete: {
2211
- method: "post",
2212
- url: "${context.rootUrl}/graphql",
2213
- data: {
2214
- orderBy: "${orderBy}",
2215
- orderDir: "${orderDir}",
2216
- pageNo: "${page}",
2217
- pageSize: "${perPage}",
2218
- query:
2219
- "{options:objects(filters: {__filters}, top: {__top}){_id label:label value:name},count:objects__count(filters:{__filters})}",
2220
- $term: "$term",
2221
- $value: "$object_name.name",
2222
- $: "$$",
2223
- rfield: "${object_name}",
2224
- },
2225
- headers: {
2226
- Authorization:
2227
- "Bearer ${context.tenantId},${context.authToken}",
2228
- },
2229
- requestAdaptor:
2230
- "\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 ",
2231
- },
2232
- className: "m-1",
2233
- labelClassName: "text-left",
2234
- clearValueOnHidden: false,
2235
- id: "u:04295fee3896",
2236
- multiple: false,
2237
- hidden: true,
2238
- },
2239
- {
2240
- name: "queue_import",
2241
- label: i18next.t('frontend_import_data_queue_import'),
2242
- required: true,
2243
- type: "picker",
2244
- labelField: "description",
2245
- valueField: "_id",
2246
- modalMode: "dialog",
2247
- source: {
2248
- method: "post",
2249
- url: "${context.rootUrl}/graphql",
2250
- data: {
2251
- orderBy: "${orderBy}",
2252
- orderDir: "${orderDir}",
2253
- pageNo: "${page}",
2254
- pageSize: "${perPage}",
2255
- query:
2256
- '{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})}',
2257
- $term: "$term",
2258
- $self: "$$",
2200
+ "fieldsExtend":{
2201
+ "object_name": {
2202
+ "amis": {
2203
+ "hidden": true
2204
+ }
2205
+ }
2206
+ },
2207
+ "form": {
2208
+ debug: false,
2209
+ resetAfterSubmit: false,
2210
+ initApi: {
2211
+ url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
2212
+ sendOn: 'this.recordId',
2213
+ responseData: {
2214
+ importState: "${state}"
2215
+ }
2216
+ },
2217
+ interval: 3000,
2218
+ stopAutoRefreshWhen: "this.importState === 'finished'",
2219
+ initFetch: false,
2220
+ onEvent: {
2221
+ inited: {
2222
+ weight: 0,
2223
+ actions: [
2224
+ {
2225
+ "actionType": "broadcast",
2226
+ "args": {
2227
+ "eventName": `@data.changed.${uiSchema.name}`
2259
2228
  },
2260
- headers: {
2261
- Authorization:
2262
- "Bearer ${context.tenantId},${context.authToken}",
2229
+ "data": {
2230
+ "objectName": `${uiSchema.name}`,
2231
+ "displayAs": "${displayAs}",
2232
+ "recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
2263
2233
  },
2264
- requestAdaptor:
2265
- "\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 ",
2266
- adaptor:
2267
- "\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 ",
2234
+ "expression": "this.importState === 'finished'"
2268
2235
  },
2269
- size: "lg",
2270
- pickerSchema: {
2271
- mode: "table",
2272
- name: "thelist",
2273
- draggable: false,
2274
- headerToolbar: ["reload"],
2275
- defaultParams: {
2276
- perPage: 20,
2277
- },
2278
- columns: [
2279
- {
2280
- name: "_index",
2281
- type: "text",
2282
- width: 32,
2283
- placeholder: "",
2284
- },
2285
- {
2286
- name: "description",
2287
- label: i18next.t('frontend_import_data_queue_import_description'),
2288
- type: "tpl",
2289
- tpl: '<a href="/app/undefined/undefined/view/${undefined}">${description}</a>',
2290
- className: "whitespace-nowrap",
2291
- html: null,
2292
- },
2293
- {
2294
- name: "object_name",
2295
- label: i18next.t('frontend_import_data_object_name'),
2296
- type: "tpl",
2297
- tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
2298
- className: "whitespace-nowrap",
2299
- html: null,
2300
- },
2301
- {
2302
- name: "encoding",
2303
- label: i18next.t('frontend_import_data_queue_import_encoding'),
2304
- type: "tpl",
2305
- tpl: "<div>${_display.encoding}</div>",
2306
- className: "whitespace-nowrap",
2307
- html: null,
2308
- },
2309
- {
2310
- name: "template_url",
2311
- label: i18next.t('frontend_import_data_queue_import_template_url'),
2312
- type: "button-group",
2313
- buttons: [
2314
- {
2315
- type: "button",
2316
- label: i18next.t('frontend_download'),
2317
- visibleOn: "${template_url}",
2318
- level: "link",
2319
- actionType: "download",
2320
- api:{
2321
- url: "${template_url}",
2322
- method: "get",
2323
- headers: {
2324
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
2325
- }
2326
- }
2327
- }
2328
- ],
2329
- options: {
2330
- html: true
2236
+ {
2237
+ "actionType": "closeDialog",
2238
+ "expression": "this.importState === 'finished'"
2239
+ }
2240
+ ]
2241
+ },
2242
+ submitSucc: {
2243
+ weight: 0,
2244
+ actions: [
2245
+ {
2246
+ args: {
2247
+ api: {
2248
+ url: "${context.rootUrl}/api/data/initiateImport",
2249
+ method: "post",
2250
+ data: {
2251
+ eventData: "${event.data}",
2252
+ },
2253
+ dataType: "json",
2254
+ requestAdaptor:
2255
+ "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
2256
+ adaptor:
2257
+ "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
2258
+ headers: {
2259
+ Authorization:
2260
+ "Bearer ${context.tenantId},${context.authToken}",
2331
2261
  },
2332
- className: "whitespace-nowrap",
2333
- },
2334
- null,
2335
- ],
2336
- syncLocation: false,
2337
- keepItemSelectionOnPageChange: true,
2338
- checkOnItemClick: false,
2339
- autoFillHeight: false,
2340
- },
2341
- joinValues: false,
2342
- extractValue: true,
2343
- className: "m-1",
2344
- labelClassName: "text-left",
2345
- clearValueOnHidden: true,
2346
- id: "u:401df27113e0",
2347
- },
2348
- {
2349
- name: "file",
2350
- label: i18next.t('frontend_import_data_file'),
2351
- required: true,
2352
- type: "input-file",
2353
- accept: ".xlsx,.xls",
2354
- className: "m-1",
2355
- labelClassName: "text-left",
2356
- clearValueOnHidden: true,
2357
- useChunk: false,
2358
- receiver: {
2359
- method: "post",
2360
- url: "${context.rootUrl}/s3/files",
2361
- data: {
2362
- $: "$$",
2363
- context: "${context}",
2364
- },
2365
- adaptor:
2366
- '\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 ',
2367
- headers: {
2368
- Authorization:
2369
- "Bearer ${context.tenantId},${context.authToken}",
2370
- },
2371
- },
2372
- id: "u:0213f2cc365b",
2373
- },
2374
- ],
2375
- id: "u:4899c260d667",
2376
- },
2377
- ],
2378
- panelClassName: "m-0 sm:rounded-lg shadow-none",
2379
- bodyClassName: "p-0",
2380
- className: "p-4 sm:p-0 steedos-amis-form",
2381
- label: "对象表单",
2382
- objectApiName: "queue_import_history",
2383
- id: "u:e4ef598eed61",
2384
- onEvent: {
2385
- submitSucc: {
2386
- weight: 0,
2387
- actions: [
2388
- {
2389
- args: {
2390
- api: {
2391
- url: "${context.rootUrl}/api/data/initiateImport",
2392
- method: "post",
2393
- data: {
2394
- eventData: "${event.data}",
2395
2262
  },
2396
- dataType: "json",
2397
- requestAdaptor:
2398
- "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
2399
- adaptor:
2400
- "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
2401
- headers: {
2402
- Authorization:
2403
- "Bearer ${context.tenantId},${context.authToken}",
2263
+ messages: {
2264
+ success: i18next.t('frontend_import_data_message_success'),
2265
+ failed: i18next.t('frontend_import_data_message_failed'),
2404
2266
  },
2405
2267
  },
2406
- messages: {
2407
- success: i18next.t('frontend_import_data_message_success'),
2408
- failed: i18next.t('frontend_import_data_message_failed'),
2409
- },
2268
+ actionType: "ajax",
2269
+ expression: "event.data.result",
2410
2270
  },
2411
- actionType: "ajax",
2412
- expression: "event.data.result",
2413
- },
2414
- ],
2271
+ ],
2272
+ },
2415
2273
  },
2416
- },
2417
- closeDialogOnSubmit: true,
2418
- },
2274
+ closeDialogOnSubmit: false,
2275
+ }
2276
+ }
2419
2277
  ],
2420
2278
  id: "u:dc05498d3bd4",
2421
2279
  closeOnEsc: false,
@@ -2605,7 +2463,7 @@ const StandardButtons = {
2605
2463
  getStandardImportData: async (uiSchema, ctx)=>{
2606
2464
  return {
2607
2465
  type: 'amis_button',
2608
- amis_schema: await getSchema$2()
2466
+ amis_schema: await getSchema$2(uiSchema)
2609
2467
  }
2610
2468
  },
2611
2469
  getStandardOpenView: async (uiSchema, ctx)=>{
@@ -2635,7 +2493,7 @@ function getButtonVisibleOn$1(button){
2635
2493
  visible = button._visible;
2636
2494
  }
2637
2495
 
2638
- if(___default.isBoolean(visible)){
2496
+ if(_$1.isBoolean(visible)){
2639
2497
  visible = visible.toString();
2640
2498
  }
2641
2499
 
@@ -2663,7 +2521,7 @@ function getButtonVisibleOn$1(button){
2663
2521
 
2664
2522
  const getButtonVisible = (button, ctx) => {
2665
2523
  if (button._visible) {
2666
- if (___default.startsWith(___default.trim(button._visible), "function")) {
2524
+ if (_$1.startsWith(_$1.trim(button._visible), "function")) {
2667
2525
  window.eval("var fun = " + button._visible);
2668
2526
  button.visible = fun;
2669
2527
  } else if (isExpression(button._visible)) {
@@ -2678,7 +2536,7 @@ const getButtonVisible = (button, ctx) => {
2678
2536
  };
2679
2537
  }
2680
2538
  }
2681
- if (___default.isFunction(button.visible)) {
2539
+ if (_$1.isFunction(button.visible)) {
2682
2540
  try {
2683
2541
  return button.visible(ctx);
2684
2542
  } catch (error) {
@@ -2700,7 +2558,7 @@ const standardButtonsTodo = {
2700
2558
  } = this;
2701
2559
  const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
2702
2560
 
2703
- if(___default.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
2561
+ if(_$1.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
2704
2562
  listViewRef.handleAction({}, {
2705
2563
  "actionType": "toast",
2706
2564
  "toast": {
@@ -2727,19 +2585,19 @@ const standardButtonsTodo = {
2727
2585
  */
2728
2586
  const getButtons = (uiSchema, ctx) => {
2729
2587
  const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
2730
- let buttons = ___default.sortBy(___default.values(uiSchema.actions), "sort");
2731
- if (___default.has(uiSchema, "allow_customActions")) {
2732
- buttons = ___default.filter(buttons, (button) => {
2733
- return ___default.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
2588
+ let buttons = _$1.sortBy(_$1.values(uiSchema.actions), "sort");
2589
+ if (_$1.has(uiSchema, "allow_customActions")) {
2590
+ buttons = _$1.filter(buttons, (button) => {
2591
+ return _$1.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
2734
2592
  });
2735
2593
  }
2736
- if (___default.has(uiSchema, "exclude_actions")) {
2737
- buttons = ___default.filter(buttons, (button) => {
2738
- return !___default.include(uiSchema.exclude_actions, button.name);
2594
+ if (_$1.has(uiSchema, "exclude_actions")) {
2595
+ buttons = _$1.filter(buttons, (button) => {
2596
+ return !_$1.include(uiSchema.exclude_actions, button.name);
2739
2597
  });
2740
2598
  }
2741
2599
 
2742
- ___default.each(buttons, (button) => {
2600
+ _$1.each(buttons, (button) => {
2743
2601
  button.objectName = uiSchema.name;
2744
2602
  if (
2745
2603
  ctx.isMobile &&
@@ -2758,7 +2616,7 @@ const getButtons = (uiSchema, ctx) => {
2758
2616
  ctx.isMobile &&
2759
2617
  ["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
2760
2618
  ) {
2761
- ___default.map(buttons, (button) => {
2619
+ _$1.map(buttons, (button) => {
2762
2620
  if (button.name === "standard_edit") {
2763
2621
  button.on = "record_more";
2764
2622
  }
@@ -2768,14 +2626,14 @@ const getButtons = (uiSchema, ctx) => {
2768
2626
  });
2769
2627
  }
2770
2628
 
2771
- return ___default.filter(buttons, (button) => {
2772
- return ___default.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
2629
+ return _$1.filter(buttons, (button) => {
2630
+ return _$1.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
2773
2631
  });
2774
2632
  };
2775
2633
 
2776
2634
  const getListViewButtons = (uiSchema, ctx) => {
2777
2635
  const buttons = getButtons(uiSchema, ctx);
2778
- const listButtons = ___default.filter(buttons, (button) => {
2636
+ const listButtons = _$1.filter(buttons, (button) => {
2779
2637
  return button.on == "list";
2780
2638
  });
2781
2639
  return listButtons;
@@ -2783,23 +2641,23 @@ const getListViewButtons = (uiSchema, ctx) => {
2783
2641
 
2784
2642
  const getObjectDetailButtons = (uiSchema, ctx) => {
2785
2643
  const buttons = getButtons(uiSchema, ctx);
2786
- const detailButtons = ___default.filter(buttons, (button) => {
2644
+ const detailButtons = _$1.filter(buttons, (button) => {
2787
2645
  return button.on == "record" || button.on == "record_only";
2788
2646
  });
2789
- return ___default.sortBy(detailButtons, "sort");
2647
+ return _$1.sortBy(detailButtons, "sort");
2790
2648
  };
2791
2649
 
2792
2650
  const getObjectDetailMoreButtons = (uiSchema, ctx) => {
2793
2651
  const buttons = getButtons(uiSchema, ctx);
2794
- const moreButtons = ___default.filter(buttons, (button) => {
2652
+ const moreButtons = _$1.filter(buttons, (button) => {
2795
2653
  return button.on == "record_more" || button.on == "record_only_more";
2796
2654
  });
2797
- return ___default.sortBy(moreButtons, "sort");
2655
+ return _$1.sortBy(moreButtons, "sort");
2798
2656
  };
2799
2657
 
2800
2658
  const getListViewItemButtons = async (uiSchema, ctx)=>{
2801
2659
  const buttons = getButtons(uiSchema, ctx);
2802
- const listButtons = ___default.filter(buttons, (button) => {
2660
+ const listButtons = _$1.filter(buttons, (button) => {
2803
2661
  return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
2804
2662
  });
2805
2663
  return listButtons;
@@ -2816,7 +2674,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
2816
2674
  // });
2817
2675
  // return relatedListButtons;
2818
2676
  const buttons = getButtons(uiSchema, ctx);
2819
- const listButtons = ___default.filter(buttons, (button) => {
2677
+ const listButtons = _$1.filter(buttons, (button) => {
2820
2678
  return button.on == "list";
2821
2679
  });
2822
2680
  return listButtons;
@@ -2833,7 +2691,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
2833
2691
  const uiSchema = await getUISchema(objectName);
2834
2692
  if(uiSchema){
2835
2693
  const buttons = await getButtons(uiSchema, ctx);
2836
- const button = ___default.find(buttons, (button)=>{
2694
+ const button = _$1.find(buttons, (button)=>{
2837
2695
  return button.name === buttonName
2838
2696
  });
2839
2697
 
@@ -2919,13 +2777,13 @@ const execute = (button, props) => {
2919
2777
  return; //TODO 弹出提示未配置todo
2920
2778
  }
2921
2779
 
2922
- if (___default.isString(button.todo)) {
2923
- if (___default.startsWith(___default.trim(button.todo), "function")) {
2780
+ if (_$1.isString(button.todo)) {
2781
+ if (_$1.startsWith(_$1.trim(button.todo), "function")) {
2924
2782
  window.eval("var fun = " + button.todo);
2925
2783
  button.todo = fun;
2926
2784
  }
2927
2785
  }
2928
- if (___default.isFunction(button.todo)) {
2786
+ if (_$1.isFunction(button.todo)) {
2929
2787
  const todoThis = {
2930
2788
  objectName: props.objectName,
2931
2789
  object_name: props.objectName,
@@ -2950,7 +2808,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2950
2808
  recordId: recordId,
2951
2809
  objectName: name
2952
2810
  });
2953
- let amisButtonsSchema = ___default.map(buttons, (button) => {
2811
+ let amisButtonsSchema = _$1.map(buttons, (button) => {
2954
2812
  return {
2955
2813
  type: 'steedos-object-button',
2956
2814
  name: button.name,
@@ -2960,7 +2818,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2960
2818
  }
2961
2819
  });
2962
2820
  let moreButtonsVisibleOn = '';
2963
- let dropdownButtons = ___default.map(moreButtons, (button, index) => {
2821
+ let dropdownButtons = _$1.map(moreButtons, (button, index) => {
2964
2822
  if(index === 0){
2965
2823
  moreButtonsVisibleOn = getButtonVisibleOn$1(button);
2966
2824
  }else {
@@ -3003,11 +2861,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
3003
2861
  "vertical": true,
3004
2862
  "tiled": true,
3005
2863
  "buttons": [
3006
- ...___default.map(buttons, (button)=>{
2864
+ ..._$1.map(buttons, (button)=>{
3007
2865
  button.className += ' w-full';
3008
2866
  return button;
3009
2867
  }),
3010
- ...___default.map(moreButtons, (button)=>{
2868
+ ..._$1.map(moreButtons, (button)=>{
3011
2869
  button.className += ' w-full';
3012
2870
  return button;
3013
2871
  })
@@ -3052,6 +2910,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3052
2910
  return {
3053
2911
  "type": "button",
3054
2912
  "icon": "fa fa-angle-down",
2913
+ "className": "mr-0",
3055
2914
  "onEvent": {
3056
2915
  "click": {
3057
2916
  "actions": [
@@ -3068,7 +2927,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3068
2927
  "vertical": true,
3069
2928
  "tiled": true,
3070
2929
  "buttons": [
3071
- ...___default.map(buttons, (button)=>{
2930
+ ..._$1.map(buttons, (button)=>{
3072
2931
  return {
3073
2932
  type: 'steedos-object-button',
3074
2933
  name: button.name,
@@ -3097,7 +2956,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3097
2956
  }
3098
2957
  }
3099
2958
  }else {
3100
- return ___default.map(buttons, (button) => {
2959
+ return _$1.map(buttons, (button) => {
3101
2960
  return {
3102
2961
  type: 'steedos-object-button',
3103
2962
  name: button.name,
@@ -3130,7 +2989,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
3130
2989
  "vertical": true,
3131
2990
  "tiled": true,
3132
2991
  "buttons": [
3133
- ...___default.map(buttons, (button)=>{
2992
+ ..._$1.map(buttons, (button)=>{
3134
2993
  return {
3135
2994
  type: 'steedos-object-button',
3136
2995
  name: button.name,
@@ -3159,7 +3018,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
3159
3018
  }
3160
3019
  }
3161
3020
  }else {
3162
- return ___default.map(buttons, (button) => {
3021
+ return _$1.map(buttons, (button) => {
3163
3022
  return {
3164
3023
  type: 'steedos-object-button',
3165
3024
  name: button.name,
@@ -3755,6 +3614,10 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
3755
3614
  each(
3756
3615
  objectSchema.list_views,
3757
3616
  (listView, name) => {
3617
+ if(name === "lookup"){
3618
+ // 内置lookup为弹出选择专用视图,不显示在列表切换区域
3619
+ return;
3620
+ }
3758
3621
  listViewButtonOptions.push({
3759
3622
  type: "button",
3760
3623
  label: listView.label,
@@ -5244,6 +5107,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
5244
5107
 
5245
5108
  return {
5246
5109
  "type": "tooltip-wrapper",
5110
+ "id": "steedos_crud_toolbar_quick_search",
5247
5111
  "align": "right",
5248
5112
  "title": "",
5249
5113
  "content": "可搜索字段:" + searchableFieldsLabel.join(","),
@@ -5275,76 +5139,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5275
5139
  if(isMobile){
5276
5140
  showDisplayAs = false;
5277
5141
  }
5142
+ let toolbarCount;
5143
+ if(!hiddenCount){
5144
+ toolbarCount = {
5145
+ "type": "tpl",
5146
+ "tpl": "${count} " + i18next.t('frontend_record_sum')
5147
+ };
5148
+ }
5149
+ let toolbarReloadButton;
5278
5150
  if(formFactor === 'SMALL'){
5279
- const onReloadScript = `
5280
- const scope = event.context.scoped;
5281
- var listView = scope.parent.getComponents().find(function(n){
5282
- return n.props.type === "crud";
5283
- });
5284
- listView.handleChangePage(1);
5285
- `;
5151
+ // const onReloadScript = `
5152
+ // const scope = event.context.scoped;
5153
+ // var listView = scope.parent.getComponents().find(function(n){
5154
+ // return n.props.type === "crud";
5155
+ // });
5156
+ // listView.handleChangePage(1);
5157
+ // `;
5158
+ // toolbarReloadButton = {
5159
+ // // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
5160
+ // "type": "button",
5161
+ // "align": "right",
5162
+ // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5163
+ // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5164
+ // "tooltipPlacement": "top",
5165
+ // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5166
+ // "label": "",
5167
+ // "icon": "fa fa-sync",
5168
+ // "visibleOn": "${!showFieldsFilter}",
5169
+ // "onEvent": {
5170
+ // "click": {
5171
+ // "actions": [
5172
+ // {
5173
+ // "actionType": "custom",
5174
+ // "script": onReloadScript
5175
+ // }
5176
+ // ]
5177
+ // }
5178
+ // },
5179
+ // };
5180
+
5181
+ // 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
5182
+ toolbarReloadButton = {
5183
+ "type": "reload",
5184
+ "align": "right",
5185
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5186
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5187
+ "tooltip":"",
5188
+ "tooltipPlacement": "top",
5189
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5190
+ };
5191
+ }
5192
+ else {
5193
+ toolbarReloadButton = {
5194
+ "type": "reload",
5195
+ "align": "right",
5196
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5197
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5198
+ "tooltip":"",
5199
+ "tooltipPlacement": "top",
5200
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5201
+ };
5202
+ }
5203
+ let toolbarFilter;
5204
+ if(filterVisible){
5205
+ toolbarFilter ={
5206
+ "label": i18next.t('frontend_button_search_tooltip'),
5207
+ "icon": "fa fa-filter",
5208
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5209
+ // "tooltip": i18next.t('frontend_button_search_tooltip'),
5210
+ // "tooltipPlacement": "top",
5211
+ "type": "button",
5212
+ "badge": {
5213
+ "offset": [
5214
+ -5,
5215
+ 1
5216
+ ],
5217
+ "size":8,
5218
+ "animation": true,
5219
+ "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5220
+ },
5221
+ "align": "right",
5222
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5223
+ "onEvent": {
5224
+ "click": {
5225
+ "actions": [
5226
+ {
5227
+ "actionType": "custom",
5228
+ "script": onFieldsFilterToggleScript
5229
+ }
5230
+ ]
5231
+ }
5232
+ },
5233
+ "id": "steedos_crud_toolbar_filter"
5234
+ };
5235
+ }
5236
+ let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
5237
+ let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
5238
+
5239
+ // toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
5240
+ // 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
5241
+ let toolbars = [];
5242
+ if(formFactor === 'SMALL'){
5243
+ if(toolbarCount){
5244
+ toolbars.push(toolbarCount);
5245
+ }
5246
+ toolbars.push(toolbarReloadButton);
5247
+ if(toolbarFilter){
5248
+ toolbars.push(toolbarFilter);
5249
+ }
5250
+ toolbars.push(toolbarDisplayAsButton);
5251
+ toolbars.push(toolbarDQuickSearchBox);
5286
5252
  return [
5287
5253
  // "bulkActions",
5288
5254
  ...(headerToolbarItems || []),
5289
- hiddenCount ? {} :{
5290
- "type": "tpl",
5291
- "tpl": "${count} " + i18next.t('frontend_record_sum')
5292
- },
5293
- {
5294
- // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
5295
- "type": "button",
5296
- "align": "right",
5297
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5298
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5299
- "tooltipPlacement": "top",
5300
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5301
- "label": "",
5302
- "icon": "fa fa-sync",
5303
- "visibleOn": "${!showFieldsFilter}",
5304
- "onEvent": {
5305
- "click": {
5306
- "actions": [
5307
- {
5308
- "actionType": "custom",
5309
- "script": onReloadScript
5310
- }
5311
- ]
5312
- }
5313
- },
5314
- },
5315
- filterVisible ? {
5316
- "label": i18next.t('frontend_button_search_tooltip'),
5317
- "icon": "fa fa-search",
5318
- "type": "button",
5319
- "tooltipPlacement": "top",
5320
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5321
- // "tooltip": i18next.t('frontend_button_search_tooltip'),
5322
- "badge": {
5323
- "offset": [
5324
- -5,
5325
- 1
5326
- ],
5327
- "size":8,
5328
- "animation": true,
5329
- "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5330
- },
5331
- "align": "right",
5332
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5333
- "onEvent": {
5334
- "click": {
5335
- "actions": [
5336
- {
5337
- "actionType": "custom",
5338
- "script": onFieldsFilterToggleScript
5339
- }
5340
- ]
5341
- }
5342
- }
5343
- } : {},
5344
- getDisplayAsButton(mainObject?.name),
5345
- getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
5255
+ ...toolbars,
5346
5256
  ]
5347
5257
  }else {
5258
+ if(toolbarCount){
5259
+ toolbars.push(toolbarCount);
5260
+ }
5261
+ if(toolbarFilter){
5262
+ toolbars.push(toolbarFilter);
5263
+ }
5264
+ toolbars.push(toolbarReloadButton);
5265
+ if(mainObject?.permissions?.allowCreateListViews){
5266
+ toolbars.push(getSettingListviewToolbarButtonSchema());
5267
+ }
5268
+ toolbars.push(toolbarDisplayAsButton);
5269
+ toolbars.push(toolbarDQuickSearchBox);
5348
5270
  return [
5349
5271
  // "filter-toggler",
5350
5272
  ...(headerToolbarItems || []),
@@ -5353,56 +5275,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5353
5275
  "type": "columns-toggler",
5354
5276
  "className": "hidden"
5355
5277
  },
5278
+ ...toolbars,
5356
5279
  // {
5357
5280
  // "type": "columns-toggler",
5358
5281
  // "className": "mr-2"
5359
5282
  // },
5360
- hiddenCount ? {} : {
5361
- "type": "tpl",
5362
- "tpl": "${count} " + i18next.t('frontend_record_sum')
5363
- },
5364
- filterVisible ? {
5365
- "label": i18next.t('frontend_button_search_tooltip'),
5366
- "icon": "fa fa-filter",
5367
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5368
- // "tooltip": i18next.t('frontend_button_search_tooltip'),
5369
- // "tooltipPlacement": "top",
5370
- "type": "button",
5371
- "badge": {
5372
- "offset": [
5373
- -5,
5374
- 1
5375
- ],
5376
- "size":8,
5377
- "animation": true,
5378
- "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
5379
- },
5380
- "align": "right",
5381
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5382
- "onEvent": {
5383
- "click": {
5384
- "actions": [
5385
- {
5386
- "actionType": "custom",
5387
- "script": onFieldsFilterToggleScript
5388
- }
5389
- ]
5390
- }
5391
- }
5392
- } : {},
5393
- {
5394
- "type": "reload",
5395
- "align": "right",
5396
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
5397
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
5398
- "tooltip":"",
5399
- "tooltipPlacement": "top",
5400
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5401
- },
5402
5283
  // getExportExcelToolbarButtonSchema(),
5403
- mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
5404
- getDisplayAsButton(mainObject?.name),
5405
- getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
5406
5284
  // {
5407
5285
  // "type": "drag-toggler",
5408
5286
  // "align": "right"
@@ -5603,10 +5481,8 @@ async function getDeferApi(field, ctx) {
5603
5481
  }
5604
5482
 
5605
5483
  function getRefListViewSort(refObject){
5606
- const listView = _$1.find(
5607
- refObject.list_views,
5608
- (view, name) => name === "all"
5609
- );
5484
+ let listView = getLookupListView(refObject);
5485
+
5610
5486
  let sort = "";
5611
5487
  if(listView){
5612
5488
  sort = getListViewSort(listView);
@@ -5696,12 +5572,11 @@ const getReferenceTo = async (field)=>{
5696
5572
  }
5697
5573
  };
5698
5574
 
5699
- function getLookupSapceUserTreeSchema(){
5700
- const tree = [{
5575
+ function getLookupSapceUserTreeSchema(isMobile){
5576
+ const treeSchema = {
5701
5577
  "type": "input-tree",
5702
- "className": "",
5578
+ "className":"steedos-select-user-tree",
5703
5579
  "inputClassName": "p-0",
5704
- "id": "u:7fd77b7915b0",
5705
5580
  "source": {
5706
5581
  "method": "post",
5707
5582
  "url": "${context.rootUrl}/graphql",
@@ -5732,6 +5607,10 @@ function getLookupSapceUserTreeSchema(){
5732
5607
  });
5733
5608
  listView.handleFilterSubmit(Object.assign({}, filterFormValues));
5734
5609
  `
5610
+ },
5611
+ {
5612
+ "actionType": "custom",
5613
+ "script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
5735
5614
  }
5736
5615
  ]
5737
5616
  }
@@ -5756,18 +5635,56 @@ function getLookupSapceUserTreeSchema(){
5756
5635
  "placeholder": "查找部门"
5757
5636
  },
5758
5637
  "unfoldedLevel": 2,
5759
- "style": {
5760
- "max-height": "100%",
5761
- "position": "absolute",
5762
- "left": "-330px",
5763
- "width": "320px",
5764
- "bottom": 0,
5765
- "top": "0",
5766
- "overflow": "auto",
5767
- "min-height":"300px"
5768
- },
5769
5638
  "originPosition": "left-top"
5770
- }];
5639
+ };
5640
+ const tree = [];
5641
+ if(isMobile){
5642
+ tree.push({
5643
+ type: "action",
5644
+ body:[
5645
+ {
5646
+ type: "action",
5647
+ body:[
5648
+ treeSchema
5649
+ ],
5650
+ className:"h-full w-[240px]"
5651
+ }
5652
+ ],
5653
+ className: "absolute inset-0 steedos-select-user-sidebar",
5654
+ "onEvent": {
5655
+ "click": {
5656
+ "actions": [
5657
+ {
5658
+ "actionType": "custom",
5659
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
5660
+ }
5661
+ ]
5662
+ }
5663
+ },
5664
+ id: "steedos_crud_toolbar_select_user_tree"
5665
+ });
5666
+ tree.push({
5667
+ "type": "button",
5668
+ "label": "组织",
5669
+ "icon": "fa fa-sitemap",
5670
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5671
+ "align": "left",
5672
+ "onEvent": {
5673
+ "click": {
5674
+ "actions": [
5675
+ {
5676
+ "actionType": "custom",
5677
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
5678
+ }
5679
+ ]
5680
+ }
5681
+ },
5682
+ "id": "steedos_crud_toolbar_organization_button"
5683
+ });
5684
+ }else {
5685
+ tree.push(treeSchema);
5686
+ }
5687
+
5771
5688
  return tree;
5772
5689
  }
5773
5690
 
@@ -5782,19 +5699,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
5782
5699
  ctx.objectName = refObjectConfig.name;
5783
5700
 
5784
5701
  let tableFields = [];
5785
- let i = 0;
5786
5702
  const searchableFields = [];
5787
5703
 
5788
- const fieldsArr = [];
5789
-
5790
- const listName = "all";
5704
+ let fieldsArr = [];
5791
5705
 
5792
5706
  const isMobile = window.innerWidth < 768;
5793
5707
 
5794
- const listView = _$1.find(
5795
- refObjectConfig.list_views,
5796
- (listView, name) => name === listName
5797
- );
5708
+ let listView = getLookupListView(refObjectConfig);
5709
+ let listName = listView && listView.name;
5798
5710
  if (listView && listView.columns) {
5799
5711
  _$1.each(listView.columns, function (column) {
5800
5712
  if (_$1.isString(column) && refObjectConfig.fields[column]) {
@@ -5809,7 +5721,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5809
5721
  }
5810
5722
  });
5811
5723
  }else {
5812
- _$1.each(refObjectConfig.fields , (field, field_name)=>{
5724
+ _$1.each(refObjectConfig.fields, (field, field_name)=>{
5813
5725
  if(field_name != '_id' && !field.hidden){
5814
5726
  if(!_$1.has(field, "name")){
5815
5727
  field.name = field_name;
@@ -5817,16 +5729,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
5817
5729
  fieldsArr.push(field);
5818
5730
  }
5819
5731
  });
5732
+ // 没有视图权限时,取对象上前5个字段,按sort_no排序
5733
+ fieldsArr = _$1.sortBy(fieldsArr, "sort_no").slice(0,5);
5820
5734
  }
5821
5735
 
5822
- _$1.each(_$1.sortBy(fieldsArr, "sort_no"),function(field){
5823
- if(i < 5){
5824
- if(!_$1.find(tableFields, function(f){
5825
- return f.name === field.name
5826
- })){
5827
- i++;
5828
- tableFields.push(field);
5829
- }
5736
+ _$1.each(fieldsArr,function(field){
5737
+ if(!_$1.find(tableFields, function(f){
5738
+ return f.name === field.name
5739
+ })){
5740
+ tableFields.push(field);
5830
5741
  }
5831
5742
  });
5832
5743
 
@@ -6020,13 +5931,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
6020
5931
  }
6021
5932
 
6022
5933
  let pickerSchema = null;
6023
- if(ctx.formFactor === 'SMALL'){
6024
- pickerSchema = await getListSchema$1(tableFields, {
6025
- top: top,
6026
- ...ctx,
6027
- actions: false
6028
- });
6029
- }else {
5934
+ {
6030
5935
  pickerSchema = await getTableSchema$1(tableFields, {
6031
5936
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
6032
5937
  top: top,
@@ -6037,13 +5942,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
6037
5942
  pickerSchema.affixHeader = false;
6038
5943
 
6039
5944
  var headerToolbarItems = [];
6040
- if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
6041
- headerToolbarItems = getLookupSapceUserTreeSchema();
6042
- pickerSchema["style"] = {
6043
- "margin-left":"330px",
6044
- "min-height": "300px"
6045
- };
6046
- pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
5945
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
5946
+ headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
5947
+ pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
6047
5948
  }
6048
5949
 
6049
5950
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
@@ -6139,13 +6040,25 @@ async function lookupToAmisPicker(field, readonly, ctx){
6139
6040
  pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
6140
6041
  }
6141
6042
 
6043
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
6044
+ //手机端选人控件只保留部分toolbar
6045
+ pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
6046
+ 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){
6047
+ return true;
6048
+ }else {
6049
+ return false;
6050
+ }
6051
+ });
6052
+ pickerSchema.footerToolbar = ["pagination"];
6053
+ }
6054
+
6142
6055
  const data = {
6143
6056
  type: getAmisStaticFieldType('picker', readonly),
6144
6057
  modalTitle: i18next.t('frontend_form_please_select') + " " + refObjectConfig.label,
6145
6058
  labelField: referenceTo.labelField.name,
6146
6059
  valueField: referenceTo.valueField.name,
6147
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
6148
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
6060
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
6061
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
6149
6062
  modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
6150
6063
  source: source,
6151
6064
  size: "lg",
@@ -6211,10 +6124,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
6211
6124
  }
6212
6125
 
6213
6126
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
6214
- const listView = refObjectConfig && _$1.find(
6215
- refObjectConfig.list_views,
6216
- (listView, name) => name === "all"
6217
- );
6127
+ let listView = getLookupListView(refObjectConfig);
6218
6128
 
6219
6129
  let sort = "";
6220
6130
  if(listView){
@@ -6325,8 +6235,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
6325
6235
  joinValues: false,
6326
6236
  extractValue: true,
6327
6237
  clearable: true,
6328
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
6329
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
6238
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
6239
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
6330
6240
  // labelField: labelField,
6331
6241
  // valueField: valueField,
6332
6242
  source: apiInfo,
@@ -6395,6 +6305,7 @@ async function lookupToAmis(field, readonly, ctx){
6395
6305
  }
6396
6306
 
6397
6307
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
6308
+ ctx.onlyDisplayLookLabel = true;
6398
6309
  if(ctx.idsDependOn){
6399
6310
  // ids人员点选模式
6400
6311
  return await lookupToAmisIdsPicker(field, readonly, ctx);
@@ -6448,7 +6359,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6448
6359
 
6449
6360
  const tableFields = [referenceTo.labelField];
6450
6361
 
6451
- const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}`});
6362
+ const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
6452
6363
 
6453
6364
  source.data.$term = "$term";
6454
6365
  source.data.$self = "$$";
@@ -6457,6 +6368,12 @@ async function getIdsPickerSchema(field, readonly, ctx){
6457
6368
  source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
6458
6369
  source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
6459
6370
  }
6371
+
6372
+ let listView = getLookupListView(refObjectConfig);
6373
+ let sort = "";
6374
+ if(listView){
6375
+ sort = getListViewSort(listView);
6376
+ }
6460
6377
 
6461
6378
  source.requestAdaptor = `
6462
6379
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
@@ -6464,6 +6381,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
6464
6381
  var pageSize = api.data.pageSize || 1000;
6465
6382
  var pageNo = api.data.pageNo || 1;
6466
6383
  var skip = (pageNo - 1) * pageSize;
6384
+ var orderBy = api.data.orderBy || '';
6385
+ var orderDir = api.data.orderDir || '';
6386
+ var sort = orderBy + ' ' + orderDir;
6387
+ sort = orderBy ? sort : "${sort}";
6467
6388
  if(selfData.op === 'loadOptions' && selfData.value){
6468
6389
  if(selfData.value && selfData.value.indexOf(',') > 0){
6469
6390
  filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
@@ -6481,7 +6402,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6481
6402
  filters.push(["${referenceTo.valueField.name}", "=", ids]);
6482
6403
  }
6483
6404
 
6484
- api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip);
6405
+ api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
6485
6406
  return api;
6486
6407
  `;
6487
6408
 
@@ -6498,6 +6419,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6498
6419
  pickerSchema = await getTableSchema$1(tableFields, {
6499
6420
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
6500
6421
  top: top,
6422
+ isLookup: true,
6501
6423
  ...ctx
6502
6424
  });
6503
6425
 
@@ -6511,8 +6433,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
6511
6433
  valueField: referenceTo.valueField.name,
6512
6434
  modalMode: 'dialog',
6513
6435
  source: source,
6514
- // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
6515
- disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
6436
+ // disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
6437
+ disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
6516
6438
  size: "lg",
6517
6439
  pickerSchema: pickerSchema,
6518
6440
  joinValues: false,
@@ -6540,8 +6462,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
6540
6462
  /*
6541
6463
  * @Author: baozhoutao@steedos.com
6542
6464
  * @Date: 2023-01-13 17:27:54
6543
- * @LastEditors: liaodaxue
6544
- * @LastEditTime: 2023-07-27 17:33:54
6465
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
6466
+ * @LastEditTime: 2023-08-28 17:45:38
6545
6467
  * @Description:
6546
6468
  */
6547
6469
 
@@ -6603,18 +6525,47 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
6603
6525
 
6604
6526
  const getHtmlFieldSchema = (field, readonly, ctx)=>{
6605
6527
  if(readonly){
6528
+ // return {
6529
+ // "type": "control",
6530
+ // "label": field.label,
6531
+ // "body": {
6532
+ // "type": "html",
6533
+ // "name": field.name
6534
+ // }
6535
+ // }
6606
6536
  return {
6607
- "type": "control",
6608
- "label": field.label,
6609
- "body": {
6610
- "type": "html",
6611
- "name": field.name
6612
- }
6537
+ "type": "input-rich-text",
6538
+ "receiver": "${context.rootUrl}/s3/images",
6539
+ "name": field.name,
6540
+ "options": {
6541
+ "menu": {
6542
+ "insert": {
6543
+ "title": "Insert",
6544
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
6545
+ }
6546
+ },
6547
+ "plugins": [
6548
+ "autoresize"
6549
+ ],
6550
+ // "max_height": 2000,
6551
+ "statusbar": false,
6552
+ "readonly": true,
6553
+ "toolbar": false,
6554
+ "menubar": false
6613
6555
  }
6556
+ }
6614
6557
  }else {
6615
6558
  return {
6616
6559
  "type": "input-rich-text",
6617
6560
  "receiver": "${context.rootUrl}/s3/images",
6561
+ "options":{
6562
+ "menu": {
6563
+ "insert": {
6564
+ "title": "Insert",
6565
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
6566
+ }
6567
+ }
6568
+ },
6618
6569
  "name": field.name
6619
6570
  }
6620
6571
  // return {
@@ -6668,6 +6619,9 @@ function getAmisStaticFieldType(type, readonly, options){
6668
6619
  return type;
6669
6620
  }
6670
6621
  if(_$1.includes(['text','image'], type)){
6622
+ if('text' === type && options && options.amis && options.amis.tpl){
6623
+ return 'static';
6624
+ }
6671
6625
  if('image' === type && options && options.multiple){
6672
6626
  return `static-images`;
6673
6627
  }
@@ -6938,7 +6892,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6938
6892
  // }
6939
6893
  switch (field.type) {
6940
6894
  case 'text':
6941
- convertData.type = getAmisStaticFieldType('text', readonly);
6895
+ convertData.type = getAmisStaticFieldType('text', readonly, field);
6942
6896
  break;
6943
6897
  case 'textarea':
6944
6898
  convertData.type = getAmisStaticFieldType('textarea', readonly);
@@ -7385,7 +7339,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
7385
7339
  convertData.className = 'm-1';
7386
7340
  }
7387
7341
  if(readonly){
7388
- convertData.className = `${convertData.className} md:border-b`;
7342
+ convertData.className = `${convertData.className} border-b`;
7389
7343
  }
7390
7344
  if(readonly){
7391
7345
  convertData.quickEdit = false;
@@ -7855,7 +7809,10 @@ function getFieldWidth(width){
7855
7809
  }
7856
7810
 
7857
7811
  async function getTableColumns(fields, options){
7858
- const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
7812
+ const columns = [];
7813
+ if(!options.isLookup){
7814
+ columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
7815
+ }
7859
7816
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
7860
7817
 
7861
7818
  for (const field of fields) {
@@ -8090,7 +8047,7 @@ async function getMobileTableColumns(fields, options){
8090
8047
  let tpl = "";
8091
8048
  if(field.is_name || field.name === options.labelFieldName){
8092
8049
  nameField = field;
8093
- options.onlyDisplayLabel = true;
8050
+ options.onlyDisplayLookLabel = true;
8094
8051
  tpl = await getFieldTpl(field, options);
8095
8052
  }
8096
8053
  else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
@@ -8099,12 +8056,13 @@ async function getMobileTableColumns(fields, options){
8099
8056
  }
8100
8057
  else {
8101
8058
  if(field.type === 'lookup' || field.type === 'master_detail'){
8102
- options.onlyDisplayLabel = true;
8059
+ options.onlyDisplayLookLabel = true;
8103
8060
  }
8104
8061
  tpl = await getFieldTpl(field, options);
8105
8062
  }
8106
8063
  if(!tpl){
8107
- tpl = `\${${field.name}}`;
8064
+ //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
8065
+ tpl = `\${${field.name} | raw}`;
8108
8066
  }
8109
8067
  if(!field.hidden && !field.extra){
8110
8068
  tpls.push({ field, tpl });
@@ -8300,7 +8258,12 @@ async function getTableSchema$1(fields, options){
8300
8258
  options = {};
8301
8259
  }
8302
8260
  let columns = [];
8303
- if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
8261
+ let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
8262
+ if(isLookup){
8263
+ // 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
8264
+ useMobileColumns = false;
8265
+ }
8266
+ if(useMobileColumns){
8304
8267
  columns = await getMobileTableColumns(fields, options);
8305
8268
  }
8306
8269
  else {
@@ -8320,7 +8283,7 @@ async function getTableSchema$1(fields, options){
8320
8283
  columns: columns,
8321
8284
  syncLocation: false,
8322
8285
  keepItemSelectionOnPageChange: true,
8323
- checkOnItemClick: false,
8286
+ checkOnItemClick: isLookup ? true : false,
8324
8287
  labelTpl: `\${${options.labelFieldName}}`,
8325
8288
  autoFillHeight: false, // 自动高度效果不理想,先关闭
8326
8289
  columnsTogglable: false,
@@ -8944,7 +8907,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
8944
8907
  var defaultValues = {};
8945
8908
  _.each(uiSchema && uiSchema.fields, function(field){
8946
8909
  var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
8947
- if(value){
8910
+ if(!_.isNil(value)){
8948
8911
  defaultValues[field.name] = value;
8949
8912
  }
8950
8913
  });
@@ -9602,14 +9565,15 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
9602
9565
  /*
9603
9566
  * @Author: baozhoutao@steedos.com
9604
9567
  * @Date: 2022-05-26 16:02:08
9605
- * @LastEditors: liaodaxue
9606
- * @LastEditTime: 2023-07-12 15:45:55
9568
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
9569
+ * @LastEditTime: 2023-09-05 15:42:26
9607
9570
  * @Description:
9608
9571
  */
9609
9572
 
9610
- const getFieldSchemaArray = (formFields) => {
9573
+ const getFieldSchemaArray = (formFields, ctx) => {
9611
9574
  let fieldSchemaArray = [];
9612
9575
  fieldSchemaArray.length = 0;
9576
+ const recordId = ctx && ctx.recordId;
9613
9577
 
9614
9578
  _$1.forEach(formFields, (field) => {
9615
9579
  if (!field.group || field.group == 'null' || field.group == '-')
@@ -9621,8 +9585,14 @@ const getFieldSchemaArray = (formFields) => {
9621
9585
  field.is_wide = true;
9622
9586
  }
9623
9587
 
9588
+ let forceHidden = false;
9589
+ if(!recordId && field.readonly){
9590
+ // 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
9591
+ forceHidden = true;
9592
+ }
9593
+
9624
9594
  if (!isObjectField) {
9625
- if (!field.hidden) {
9595
+ if (!field.hidden && !forceHidden) {
9626
9596
  fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
9627
9597
  }
9628
9598
  }
@@ -9693,7 +9663,7 @@ const getSections = async (permissionFields, formFields, ctx) => {
9693
9663
  if (!ctx) {
9694
9664
  ctx = {};
9695
9665
  }
9696
- const fieldSchemaArray = getFieldSchemaArray(formFields);
9666
+ const fieldSchemaArray = getFieldSchemaArray(formFields, ctx);
9697
9667
  const _sections = _$1.groupBy(fieldSchemaArray, 'group');
9698
9668
  const sections = [];
9699
9669
  var sectionVisibleOns = [];
@@ -9914,7 +9884,7 @@ async function getObjectCRUD(objectSchema, fields, options){
9914
9884
  }
9915
9885
  `;
9916
9886
  let autoFillHeight = true;
9917
- if(options.isRelated || Steedos.isMobile()){
9887
+ if(options.isRelated || window.innerWidth < 768){
9918
9888
  autoFillHeight = false;
9919
9889
  }
9920
9890
 
@@ -10287,7 +10257,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
10287
10257
  * @Author: baozhoutao@steedos.com
10288
10258
  * @Date: 2022-07-05 15:55:39
10289
10259
  * @LastEditors: liaodaxue
10290
- * @LastEditTime: 2023-08-21 14:50:21
10260
+ * @LastEditTime: 2023-08-28 14:55:23
10291
10261
  * @Description:
10292
10262
  */
10293
10263
 
@@ -10433,11 +10403,16 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10433
10403
  // }
10434
10404
  const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
10435
10405
  const componentId = `steedos-record-related-list-${relatedObjectName}`;
10406
+ const isMobile = window.innerWidth < 768;
10407
+ let headerToolbar = [];
10408
+ if(!isMobile){
10409
+ headerToolbar.push("bulkActions");
10410
+ }
10436
10411
  const options = {
10437
10412
  globalFilter,
10438
10413
  defaults: {
10439
10414
  listSchema: {
10440
- headerToolbar:["bulkActions"],
10415
+ headerToolbar,
10441
10416
  columnsTogglable: false,
10442
10417
  onEvent: {
10443
10418
  [`@data.changed.${relatedObjectName}`]: {