@steedos-widgets/amis-lib 1.2.6-beta.9 → 1.2.6

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.umd.js CHANGED
@@ -1376,26 +1376,11 @@
1376
1376
  }
1377
1377
  };
1378
1378
 
1379
- /*
1380
- * @Author: baozhoutao@steedos.com
1381
- * @Date: 2022-08-04 10:42:49
1382
- * @LastEditors: baozhoutao@steedos.com
1383
- * @LastEditTime: 2022-08-25 10:28:47
1384
- * @Description:
1385
- */
1386
- var config = {
1387
- listView: {
1388
- newRecordMode: 'modal',
1389
- editRecordMode: 'modal',
1390
- perPage: 20
1391
- }
1392
- };
1393
-
1394
1379
  /*
1395
1380
  * @Author: baozhoutao@steedos.com
1396
1381
  * @Date: 2022-11-01 15:51:00
1397
- * @LastEditors: baozhoutao@steedos.com
1398
- * @LastEditTime: 2023-04-19 20:26:27
1382
+ * @LastEditors: Please set LastEditors
1383
+ * @LastEditTime: 2023-04-26 11:52:04
1399
1384
  * @Description:
1400
1385
  */
1401
1386
 
@@ -1487,7 +1472,8 @@
1487
1472
  "schemaApi": {
1488
1473
  "data": {
1489
1474
  "isLookup": "${isLookup}",
1490
- "_master": "${_master}"
1475
+ "_master": "${_master}",
1476
+ "url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}"
1491
1477
  },
1492
1478
  "url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
1493
1479
  "method": "get",
@@ -1496,7 +1482,7 @@
1496
1482
  "headers": {
1497
1483
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
1498
1484
  },
1499
- "requestAdaptor": "",
1485
+ "requestAdaptor": "return { ...api, url: api.body.url }",
1500
1486
  "adaptor": schemaApiAdaptor
1501
1487
  }
1502
1488
  }
@@ -2405,6 +2391,166 @@
2405
2391
 
2406
2392
  const executeButton = execute;
2407
2393
 
2394
+
2395
+ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2396
+ const { name } = objectSchema;
2397
+ const buttons = getObjectDetailButtons(objectSchema, {});
2398
+ const moreButtons = getObjectDetailMoreButtons(objectSchema, {
2399
+ recordId: recordId,
2400
+ objectName: name
2401
+ });
2402
+ let amisButtonsSchema = ___default["default"].map(buttons, (button) => {
2403
+ return {
2404
+ type: 'steedos-object-button',
2405
+ name: button.name,
2406
+ objectName: button.objectName,
2407
+ visibleOn: getButtonVisibleOn$1(button),
2408
+ className: `button_${button.name}`
2409
+ }
2410
+ });
2411
+ let dropdownButtons = ___default["default"].map(moreButtons, (button) => {
2412
+ return {
2413
+ type: 'steedos-object-button',
2414
+ name: button.name,
2415
+ objectName: button.objectName,
2416
+ visibleOn: getButtonVisibleOn$1(button),
2417
+ }
2418
+ });
2419
+ return {
2420
+ buttons: amisButtonsSchema,
2421
+ moreButtons: dropdownButtons
2422
+ };
2423
+ };
2424
+
2425
+ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
2426
+ const { buttons, moreButtons } = getObjectDetailHeaderButtons(objectSchema, recordId);
2427
+ if(ctx.formFactor === 'SMALL'){
2428
+ return {
2429
+ "type": "button",
2430
+ "icon": "fa fa-angle-down",
2431
+ "onEvent": {
2432
+ "click": {
2433
+ "actions": [
2434
+ {
2435
+ "actionType": "drawer",
2436
+ "drawer": {
2437
+ "type": "drawer",
2438
+ "title": "操作",
2439
+ "body": [
2440
+ {
2441
+ "type": "button-group",
2442
+ "id": "u:fd837823be5b",
2443
+ "vertical": true,
2444
+ "tiled": true,
2445
+ "buttons": [
2446
+ ...___default["default"].map(buttons, (button)=>{
2447
+ button.className += ' w-full';
2448
+ return button;
2449
+ }),
2450
+ ...___default["default"].map(moreButtons, (button)=>{
2451
+ button.className += ' w-full';
2452
+ return button;
2453
+ })
2454
+ ],
2455
+ "btnLevel": "enhance",
2456
+ "className": "w-full",
2457
+ "btnClassName": "w-full",
2458
+ "size": "lg"
2459
+ }
2460
+ ],
2461
+ "id": "u:9815f7366b9f",
2462
+ "position": "bottom",
2463
+ "closeOnOutside": true,
2464
+ "resizable": false,
2465
+ "className": "buttons-drawer",
2466
+ "bodyClassName": "m-none p-none",
2467
+ "actions": []
2468
+ }
2469
+ }
2470
+ ]
2471
+ }
2472
+ },
2473
+ "id": "u:ee7c7929e6ae"
2474
+ }
2475
+ }else {
2476
+ if(moreButtons.length > 0){
2477
+ const dropdownButtonsSchema = {
2478
+ type: "steedos-dropdown-button",
2479
+ label: "",
2480
+ buttons: moreButtons,
2481
+ className: 'slds-icon'
2482
+ };
2483
+ buttons.push(dropdownButtonsSchema);
2484
+ }
2485
+ return buttons;
2486
+ }
2487
+ };
2488
+
2489
+
2490
+ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
2491
+ const buttons = getListViewButtons(objectSchema, ctx);
2492
+ if(ctx.formFactor === 'SMALL'){
2493
+ return {
2494
+ "type": "button",
2495
+ "icon": "fa fa-angle-down",
2496
+ "onEvent": {
2497
+ "click": {
2498
+ "actions": [
2499
+ {
2500
+ "actionType": "drawer",
2501
+ "drawer": {
2502
+ "type": "drawer",
2503
+ "title": "操作",
2504
+ "body": [
2505
+ {
2506
+ "type": "button-group",
2507
+ "id": "u:fd837823be5b",
2508
+ "vertical": true,
2509
+ "tiled": true,
2510
+ "buttons": [
2511
+ ...___default["default"].map(buttons, (button)=>{
2512
+ return {
2513
+ type: 'steedos-object-button',
2514
+ name: button.name,
2515
+ objectName: button.objectName,
2516
+ visibleOn: getButtonVisibleOn$1(button),
2517
+ className: `button_${button.name} w-full`
2518
+ }
2519
+ })
2520
+ ],
2521
+ "btnLevel": "enhance",
2522
+ "className": "w-full",
2523
+ "btnClassName": "w-full",
2524
+ "size": "lg"
2525
+ }
2526
+ ],
2527
+ "id": "u:9815f7366b9f",
2528
+ "position": "bottom",
2529
+ "closeOnOutside": true,
2530
+ "resizable": false,
2531
+ "className": "buttons-drawer",
2532
+ "bodyClassName": "m-none p-none",
2533
+ "actions": []
2534
+ }
2535
+ }
2536
+ ]
2537
+ }
2538
+ },
2539
+ "id": "u:ee7c7929e6ae"
2540
+ }
2541
+ }else {
2542
+ return ___default["default"].map(buttons, (button) => {
2543
+ return {
2544
+ type: 'steedos-object-button',
2545
+ name: button.name,
2546
+ objectName: button.objectName,
2547
+ visibleOn: getButtonVisibleOn$1(button),
2548
+ className: `button_${button.name}`
2549
+ }
2550
+ });
2551
+ }
2552
+ };
2553
+
2408
2554
  async function getObjectFieldsFilterButtonSchema(objectSchema) {
2409
2555
  // const amisListViewId = `listview_${objectSchema.name}`;
2410
2556
  return {
@@ -2537,6 +2683,35 @@
2537
2683
  // }
2538
2684
  // }
2539
2685
  // listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
2686
+ `;
2687
+ const onResetScript = `
2688
+ const scope = event.context.scoped;
2689
+ var filterForm = scope.parent.parent.getComponents().find(function(n){
2690
+ return n.props.type === "form";
2691
+ });
2692
+ var filterFormValues = filterForm.getValues();
2693
+ var listView = scope.parent.parent.parent.getComponents().find(function(n){
2694
+ return n.props.type === "crud";
2695
+ });
2696
+ const removedValues = {};
2697
+ for(var k in filterFormValues){
2698
+ if(/^__searchable__/.test(k)){
2699
+ removedValues[k] = "";
2700
+ }
2701
+ }
2702
+ if(!event.data.isLookup){
2703
+ // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
2704
+ const listViewId = event.data.listViewId;
2705
+ const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
2706
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
2707
+ if(localListViewProps){
2708
+ localListViewProps = JSON.parse(localListViewProps);
2709
+ for(var k in localListViewProps){
2710
+ removedValues[k] = "";
2711
+ }
2712
+ }
2713
+ }
2714
+ listView.handleFilterSubmit(removedValues);
2540
2715
  `;
2541
2716
  const dataProviderInited = `
2542
2717
  const objectName = data.objectName;
@@ -2731,6 +2906,21 @@
2731
2906
  }
2732
2907
  }
2733
2908
  },
2909
+ {
2910
+ "type": "button",
2911
+ "label": "重置",
2912
+ "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
2913
+ "onEvent": {
2914
+ "click": {
2915
+ "actions": [
2916
+ {
2917
+ "actionType": "custom",
2918
+ "script": onResetScript
2919
+ }
2920
+ ]
2921
+ }
2922
+ }
2923
+ },
2734
2924
  {
2735
2925
  "type": "button",
2736
2926
  "label": "设置搜索项",
@@ -2887,17 +3077,7 @@
2887
3077
  }
2888
3078
  );
2889
3079
 
2890
- const buttons = getListViewButtons(objectSchema, {});
2891
- let amisButtonsSchema = _$1.map(buttons, (button) => {
2892
- return {
2893
- type: 'steedos-object-button',
2894
- name: button.name,
2895
- objectName: button.objectName,
2896
- visibleOn: getButtonVisibleOn$1(button),
2897
- className: `button_${button.name}`
2898
- }
2899
- });
2900
-
3080
+ let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
2901
3081
  const reg = new RegExp('_', 'g');
2902
3082
  const standardIcon = icon && icon.replace(reg, '-');
2903
3083
  return {
@@ -2930,8 +3110,8 @@
2930
3110
  },
2931
3111
  {
2932
3112
  "type": "dropdown-button",
2933
- "className": "",
2934
- "label": "\${uiSchema.list_views[listName].label}",
3113
+ "className": "",
3114
+ "label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
2935
3115
  "rightIcon": "fa fa-caret-down",
2936
3116
  "size": "sm",
2937
3117
  "hideCaret": true,
@@ -3079,7 +3259,10 @@
3079
3259
  * @returns amisSchema
3080
3260
  */
3081
3261
  function getObjectListHeader$1(objectSchema, listViewName, ctx) {
3082
- let firstLineSchema = getObjectListHeaderFirstLine(objectSchema);
3262
+ if (!ctx) {
3263
+ ctx = {};
3264
+ }
3265
+ let firstLineSchema = getObjectListHeaderFirstLine(objectSchema, listViewName, ctx);
3083
3266
  let body = [firstLineSchema];
3084
3267
  let headerSchema = [{
3085
3268
  "type": "wrapper",
@@ -3100,35 +3283,11 @@
3100
3283
  const { showRecordTitle = true } = options || {};
3101
3284
  // console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
3102
3285
  const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
3103
- const buttons = getObjectDetailButtons(objectSchema, {});
3104
- const moreButtons = getObjectDetailMoreButtons(objectSchema, {
3105
- recordId: recordId,
3106
- objectName: name
3107
- });
3108
- let amisButtonsSchema = _$1.map(buttons, (button) => {
3109
- return {
3110
- type: 'steedos-object-button',
3111
- name: button.name,
3112
- objectName: button.objectName,
3113
- visibleOn: getButtonVisibleOn$1(button),
3114
- className: `button_${button.name}`
3115
- }
3116
- });
3117
- let dropdownButtons = _$1.map(moreButtons, (button) => {
3118
- return {
3119
- type: 'steedos-object-button',
3120
- name: button.name,
3121
- objectName: button.objectName,
3122
- visibleOn: getButtonVisibleOn$1(button),
3123
- }
3124
- });
3125
- const dropdownButtonsSchema = {
3126
- type: "steedos-dropdown-button",
3127
- label: "",
3128
- buttons: dropdownButtons,
3129
- className: 'slds-icon'
3130
- };
3131
- amisButtonsSchema.push(dropdownButtonsSchema);
3286
+
3287
+ let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
3288
+
3289
+ // console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
3290
+
3132
3291
  const reg = new RegExp('_', 'g');
3133
3292
  const standardIcon = icon && icon.replace(reg, '-');
3134
3293
 
@@ -3339,8 +3498,8 @@
3339
3498
  "icon": "fa fa-table-columns",
3340
3499
  "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
3341
3500
  "align": "right",
3342
- "visibleOn": "${formFactor !== 'SMALL'}",
3343
- "buttons": [
3501
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
3502
+ "buttons": [
3344
3503
  {
3345
3504
  "label": "显示为",
3346
3505
  "children": buttons
@@ -3437,6 +3596,7 @@ setTimeout(()=>{
3437
3596
  `;
3438
3597
  return [
3439
3598
  // "bulkActions",
3599
+ ...(headerToolbarItems || []),
3440
3600
  hiddenCount ? {} :{
3441
3601
  "type": "tpl",
3442
3602
  "tpl": "${count} 个项目"
@@ -3581,7 +3741,7 @@ setTimeout(()=>{
3581
3741
  "list_view": "${uiSchema.list_views[listName]}",
3582
3742
  "appId": "${appId}",
3583
3743
  "global": "${global}",
3584
- "objectName": "${objectName}",
3744
+ "targetObjectName": "${objectName}",
3585
3745
  },
3586
3746
  "body": [
3587
3747
  {
@@ -3621,7 +3781,7 @@ setTimeout(()=>{
3621
3781
  {
3622
3782
  "args": {
3623
3783
  // 直接使用recordId不能拿到数据,只能通过result里面拿数据
3624
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3784
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
3625
3785
  "blank": false
3626
3786
  },
3627
3787
  "actionType": "url",
@@ -3662,7 +3822,7 @@ setTimeout(()=>{
3662
3822
  "data": {
3663
3823
  "&": "$$",
3664
3824
  "listName": "${listName}",
3665
- "objectName": "${objectName}",
3825
+ "targetObjectName": "${objectName}",
3666
3826
  "list_view": "${uiSchema.list_views[listName]}",
3667
3827
  "appId": "${appId}",
3668
3828
  "global": "${global}"
@@ -3705,7 +3865,7 @@ setTimeout(()=>{
3705
3865
  "actions": [
3706
3866
  {
3707
3867
  "args": {
3708
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3868
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
3709
3869
  "blank": false
3710
3870
  },
3711
3871
  "actionType": "url",
@@ -3741,7 +3901,7 @@ setTimeout(()=>{
3741
3901
  "type": "dialog",
3742
3902
  "title": "重命名 列表视图",
3743
3903
  "data": {
3744
- "objectName": "${objectName}",
3904
+ "targetObjectName": "${objectName}",
3745
3905
  "recordId": "${uiSchema.list_views[listName]._id}",
3746
3906
  "appId": "${appId}"
3747
3907
  },
@@ -3762,7 +3922,7 @@ setTimeout(()=>{
3762
3922
  "actions": [
3763
3923
  {
3764
3924
  "args": {
3765
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${name}",
3925
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
3766
3926
  "blank": false
3767
3927
  },
3768
3928
  "actionType": "url",
@@ -3836,6 +3996,7 @@ setTimeout(()=>{
3836
3996
  "type": "dialog",
3837
3997
  "title": "过滤设置",
3838
3998
  "data": {
3999
+ "targetObjectName": "${objectName}",
3839
4000
  "objectName": "${objectName}",
3840
4001
  "recordId": "${uiSchema.list_views[listName]._id}",
3841
4002
  "listName": "${listName}",
@@ -3861,7 +4022,7 @@ setTimeout(()=>{
3861
4022
  "actions": [
3862
4023
  {
3863
4024
  "args": {
3864
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4025
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
3865
4026
  "blank": false
3866
4027
  },
3867
4028
  "actionType": "url",
@@ -3899,6 +4060,7 @@ setTimeout(()=>{
3899
4060
  "title": "显示的列",
3900
4061
  "data": {
3901
4062
  "&": "$$",
4063
+ "targetObjectName": "${objectName}",
3902
4064
  "objectName": "${objectName}",
3903
4065
  "recordId": "${uiSchema.list_views[listName]._id}",
3904
4066
  "listName": "${listName}",
@@ -3924,7 +4086,7 @@ setTimeout(()=>{
3924
4086
  "actions": [
3925
4087
  {
3926
4088
  "args": {
3927
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4089
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
3928
4090
  "blank": false
3929
4091
  },
3930
4092
  "actionType": "url"
@@ -3960,6 +4122,7 @@ setTimeout(()=>{
3960
4122
  "title": "弹框标题",
3961
4123
  "data": {
3962
4124
  "&": "$$",
4125
+ "targetObjectName": "${objectName}",
3963
4126
  "objectName": "${objectName}",
3964
4127
  "recordId": "${uiSchema.list_views[listName]._id}",
3965
4128
  "listName": "${listName}",
@@ -3985,7 +4148,7 @@ setTimeout(()=>{
3985
4148
  "actions": [
3986
4149
  {
3987
4150
  "args": {
3988
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4151
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
3989
4152
  "blank": false
3990
4153
  },
3991
4154
  "actionType": "url"
@@ -4533,13 +4696,16 @@ setTimeout(()=>{
4533
4696
  var sort = orderBy + ' ' + orderDir;
4534
4697
  sort = orderBy ? sort : "${sort}";
4535
4698
  var allowSearchFields = ${JSON.stringify(searchableFields)};
4699
+ let fieldValue;
4536
4700
  if(api.data.$term){
4537
4701
  filters = [["name", "contains", "'+ api.data.$term +'"]];
4538
4702
  }else if(selfData.op === 'loadOptions' && selfData.value){
4539
4703
  if(selfData.value?.indexOf(',') > 0){
4540
- filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
4704
+ fieldValue = selfData.value.split(',');
4705
+ filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
4541
4706
  }else{
4542
- filters = [["${referenceTo.valueField.name}", "=", selfData.value]];
4707
+ fieldValue = selfData.value;
4708
+ filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
4543
4709
  }
4544
4710
  }
4545
4711
 
@@ -4593,6 +4759,9 @@ setTimeout(()=>{
4593
4759
  if(enable_tree){
4594
4760
  pageSize = 10000;
4595
4761
  }
4762
+ if(fieldValue && _.isArray(fieldValue) && fieldValue.length > pageSize){
4763
+ pageSize = fieldValue.length;
4764
+ }
4596
4765
  api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
4597
4766
  return api;
4598
4767
  `;
@@ -4673,6 +4842,8 @@ setTimeout(()=>{
4673
4842
  ...ctx
4674
4843
  });
4675
4844
 
4845
+ pickerSchema.affixHeader = false;
4846
+
4676
4847
  var headerToolbarItems = [];
4677
4848
  const isMobile = window.innerWidth < 768;
4678
4849
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
@@ -4690,14 +4861,11 @@ setTimeout(()=>{
4690
4861
  pickerSchema.headerToolbar.push(new_button);
4691
4862
  }
4692
4863
  pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
4693
- //TODO: 等待放大镜bug修复,if会去掉,始终显示放大镜
4694
- if(referenceTo.objectName != "space_users" || field.reference_to_field != "user"){
4695
- if (ctx.filterVisible !== false) {
4696
- pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
4697
- isLookup: true,
4698
- ...ctx
4699
- });
4700
- }
4864
+ if (ctx.filterVisible !== false) {
4865
+ pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
4866
+ isLookup: true,
4867
+ ...ctx
4868
+ });
4701
4869
  }
4702
4870
  pickerSchema.data = Object.assign({}, pickerSchema.data, {
4703
4871
  "&": "$$",
@@ -4881,11 +5049,12 @@ setTimeout(()=>{
4881
5049
  autoComplete: apiInfo,
4882
5050
  searchable: true,
4883
5051
  };
5052
+ //删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
4884
5053
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
4885
5054
  <span role='img' aria-label='smile' class='anticon anticon-smile'>
4886
5055
  <span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
4887
5056
  <svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
4888
- <use xlink:href='\${context.rootUrl}/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
5057
+ <use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
4889
5058
  </svg>
4890
5059
  </span>
4891
5060
  </span>
@@ -4943,8 +5112,10 @@ setTimeout(()=>{
4943
5112
 
4944
5113
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
4945
5114
  if(ctx.idsDependOn || field.amis){
5115
+ // ids人员点选模式
4946
5116
  return await lookupToAmisIdsPicker(field, readonly, ctx);
4947
5117
  }
5118
+ // 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
4948
5119
  // return await lookupToAmisSelectUser(field, readonly, ctx);
4949
5120
  }
4950
5121
 
@@ -5045,6 +5216,9 @@ setTimeout(()=>{
5045
5216
  top: top,
5046
5217
  ...ctx
5047
5218
  });
5219
+
5220
+ pickerSchema.affixHeader = false;
5221
+
5048
5222
  }
5049
5223
 
5050
5224
  const data = {
@@ -5074,7 +5248,6 @@ setTimeout(()=>{
5074
5248
  if(readonly){
5075
5249
  data.tpl = await getLookupTpl(field, ctx);
5076
5250
  }
5077
-
5078
5251
  return data;
5079
5252
  }
5080
5253
 
@@ -5653,7 +5826,7 @@ setTimeout(()=>{
5653
5826
  convertData = {
5654
5827
  type: "editor",
5655
5828
  language: field.language,
5656
- // value: field.defaultValue || ''
5829
+ editorDidMount: new Function('editor', 'monaco', field.editorDidMount)
5657
5830
  };
5658
5831
  break;
5659
5832
  case 'toggle':
@@ -5674,7 +5847,7 @@ setTimeout(()=>{
5674
5847
  columnsTogglable: false,
5675
5848
  strictMode:false,
5676
5849
  affixHeader: false, // 是否固定表头, 不固定表头, 否则form有y轴滚动条时, 表头会跟随滚动条滚动.
5677
- // needConfirm: true, 此属性设置为false后,导致table不能编辑。
5850
+ needConfirm: false,
5678
5851
  editable: !readonly,
5679
5852
  addable: !readonly,
5680
5853
  removable: !readonly,
@@ -5904,6 +6077,12 @@ setTimeout(()=>{
5904
6077
  // })
5905
6078
 
5906
6079
  return `
6080
+ if(payload.data.data.length === 0){
6081
+ return {
6082
+ status: 2,
6083
+ msg: "无法找到记录"
6084
+ }
6085
+ }
5907
6086
  if(payload.data.data){
5908
6087
  var data = payload.data.data[0];
5909
6088
  var gridAndObjectFieldsName = ${JSON.stringify(gridAndObjectFieldsName)};
@@ -6028,12 +6207,12 @@ setTimeout(()=>{
6028
6207
  });
6029
6208
  }
6030
6209
  }else{
6031
- data[item] = {
6210
+ data[item] = [{
6032
6211
  value: fileFieldValue,
6033
6212
  name: fileFieldDisplayValue.name,
6034
6213
  url: fileFieldDisplayValue.url + "?download=true",
6035
6214
  state: "uploaded"
6036
- };
6215
+ }];
6037
6216
  }
6038
6217
  }
6039
6218
  })
@@ -6051,7 +6230,7 @@ setTimeout(()=>{
6051
6230
 
6052
6231
  return {
6053
6232
  method: "post",
6054
- url: getApi$2(),
6233
+ url: getApi$2() + '&objectName=${objectName}' ,
6055
6234
  // sendOn: "!!this.recordId",
6056
6235
  cache: API_CACHE,
6057
6236
  requestAdaptor: `
@@ -6357,7 +6536,7 @@ setTimeout(()=>{
6357
6536
  }),
6358
6537
  filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
6359
6538
  };
6360
- if(options.formFactor !== 'SMALL'){
6539
+ if(options.formFactor !== 'SMALL' || ["split"].indexOf(options.displayAs) == -1){
6361
6540
  Object.assign(bodyProps, {
6362
6541
  bulkActions: options.bulkActions != false ? bulkActions : false
6363
6542
  });
@@ -6571,7 +6750,8 @@ setTimeout(()=>{
6571
6750
  "eventName": `@data.changed.${objectSchema.name}`
6572
6751
  },
6573
6752
  "data": {
6574
- "objectName": `${objectSchema.name}`
6753
+ "objectName": `${objectSchema.name}`,
6754
+ "displayAs": "${displayAs}"
6575
6755
  }
6576
6756
  },
6577
6757
  {
@@ -6671,7 +6851,8 @@ setTimeout(()=>{
6671
6851
  data: {
6672
6852
  objectName: "${event.data.__objectName}",
6673
6853
  record: "${event.data.__record}"
6674
- }
6854
+ },
6855
+ expression: "${event.data.__response.error != true}"
6675
6856
  },
6676
6857
  {
6677
6858
  "actionType": "setValue",
@@ -6679,7 +6860,8 @@ setTimeout(()=>{
6679
6860
  value: {
6680
6861
  "recordLoaded": true,
6681
6862
  }
6682
- }
6863
+ },
6864
+ expression: "${event.data.__response.error != true}"
6683
6865
  }
6684
6866
  ]
6685
6867
  }
@@ -6687,6 +6869,21 @@ setTimeout(()=>{
6687
6869
  }
6688
6870
  }
6689
6871
 
6872
+ /*
6873
+ * @Author: baozhoutao@steedos.com
6874
+ * @Date: 2022-08-04 10:42:49
6875
+ * @LastEditors: baozhoutao@steedos.com
6876
+ * @LastEditTime: 2022-08-25 10:28:47
6877
+ * @Description:
6878
+ */
6879
+ var config = {
6880
+ listView: {
6881
+ newRecordMode: 'modal',
6882
+ editRecordMode: 'modal',
6883
+ perPage: 20
6884
+ }
6885
+ };
6886
+
6690
6887
  async function getTableColumns(fields, options){
6691
6888
  const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
6692
6889
  for (const field of fields) {
@@ -6760,6 +6957,13 @@ setTimeout(()=>{
6760
6957
  }else if(field.type === 'html'){
6761
6958
  type = 'markdown';
6762
6959
  }
6960
+ let className = "";
6961
+ if(field.type === 'textarea'){
6962
+ className = 'min-w-56';
6963
+ }
6964
+ if(field.wrap === false){
6965
+ className += " whitespace-nowrap";
6966
+ }
6763
6967
  if(!field.hidden && !field.extra){
6764
6968
  columns.push(Object.assign({}, {
6765
6969
  name: field.name,
@@ -6770,7 +6974,7 @@ setTimeout(()=>{
6770
6974
  type: type,
6771
6975
  tpl: tpl,
6772
6976
  toggled: field.toggled,
6773
- className: field.type === 'textarea' ? 'min-w-56 whitespace-pre-wrap textarea' : "whitespace-nowrap",
6977
+ className,
6774
6978
  html: field.type === 'html' ? true : null
6775
6979
  // toggled: true
6776
6980
  }, field.amis, {name: field.name}));
@@ -6895,8 +7099,9 @@ setTimeout(()=>{
6895
7099
  const url = getNameTplUrl(nameField, options);
6896
7100
 
6897
7101
  const columnLines = getMobileLines(tpls);
6898
-
6899
- columns.push({
7102
+
7103
+
7104
+ let column = {
6900
7105
  name: nameField.name,
6901
7106
  label: nameField.label,
6902
7107
  sortable: nameField.sortable,
@@ -6905,13 +7110,66 @@ setTimeout(()=>{
6905
7110
  actionType: "link",
6906
7111
  link: url,
6907
7112
  innerClassName: "steedos-listview-item block text-gray-500",
6908
- body:{
7113
+ body: {
6909
7114
  "type": "wrapper",
6910
7115
  "body": columnLines,
6911
7116
  "size": "none",
6912
7117
  "className": "p-1"
6913
7118
  }
6914
- });
7119
+ };
7120
+
7121
+ if(options.objectName === 'cms_files'){
7122
+ if(window.Meteor?.isCordova){
7123
+ column = {
7124
+ ...column,
7125
+ actionType: "",
7126
+ link: "",
7127
+ onEvent: {
7128
+ "click": {
7129
+ "actions": [
7130
+ {
7131
+ "script": `
7132
+ let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
7133
+ Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
7134
+ `,
7135
+ "actionType": "custom"
7136
+ }
7137
+ ],
7138
+ "weight": 0
7139
+ }
7140
+ }
7141
+ };
7142
+ }else {
7143
+ column = {
7144
+ ...column,
7145
+ actionType: "",
7146
+ link: "",
7147
+ onEvent: {
7148
+ "click": {
7149
+ "actions": [
7150
+ {
7151
+ "args": {
7152
+ "api": {
7153
+ "url": url,
7154
+ "method": "get",
7155
+ "headers": {
7156
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7157
+ }
7158
+ }
7159
+ },
7160
+ "actionType": "download"
7161
+ }
7162
+ ],
7163
+ "weight": 0
7164
+ }
7165
+ }
7166
+ };
7167
+ }
7168
+
7169
+ }
7170
+
7171
+ columns.push(column);
7172
+
6915
7173
 
6916
7174
  return columns;
6917
7175
  }
@@ -7030,7 +7288,7 @@ setTimeout(()=>{
7030
7288
  options = {};
7031
7289
  }
7032
7290
  let columns = [];
7033
- if(options.formFactor === 'SMALL'){
7291
+ if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
7034
7292
  columns = await getMobileTableColumns(fields, options);
7035
7293
  }
7036
7294
  else {
@@ -7233,7 +7491,11 @@ setTimeout(()=>{
7233
7491
  filters = systemFilters;
7234
7492
  };
7235
7493
  if(api.data.$self.additionalFilters){
7236
- userFilters.push(api.data.$self.additionalFilters)
7494
+ if(_.isString(api.data.$self.additionalFilters)){
7495
+ userFilters.push(eval(api.data.$self.additionalFilters))
7496
+ }else{
7497
+ userFilters.push(api.data.$self.additionalFilters)
7498
+ }
7237
7499
  }
7238
7500
 
7239
7501
  if(api.data.$self._isRelated){
@@ -7266,8 +7528,7 @@ setTimeout(()=>{
7266
7528
  if(_.isEmpty(filters)){
7267
7529
  filters = userFilters;
7268
7530
  }else{
7269
- filters.push('and');
7270
- filters.push(userFilters)
7531
+ filters = [filters, 'and', userFilters]
7271
7532
  }
7272
7533
  }
7273
7534
  api.data = {
@@ -7694,7 +7955,6 @@ setTimeout(()=>{
7694
7955
  // ObjectForm会认作用域下的变量值
7695
7956
  // TODO: 待组件支持initValues属性后应该改掉,不应该通过data直接传值
7696
7957
  // TODO: 全天事件属性传入doc了但是没有生效,需要手动在ObjectForm中勾选全天事件
7697
- event.data = doc;
7698
7958
  const title = "新建 ${objectSchema.label}";
7699
7959
  doAction(
7700
7960
  {
@@ -7707,6 +7967,7 @@ setTimeout(()=>{
7707
7967
  "type": "steedos-object-form",
7708
7968
  "objectApiName": "\${objectName}",
7709
7969
  "mode": "edit",
7970
+ "defaultData": doc,
7710
7971
  "onEvent": {
7711
7972
  "submitSucc": {
7712
7973
  "weight": 0,
@@ -7999,7 +8260,7 @@ setTimeout(()=>{
7999
8260
  * @Author: baozhoutao@steedos.com
8000
8261
  * @Date: 2022-07-05 15:55:39
8001
8262
  * @LastEditors: Please set LastEditors
8002
- * @LastEditTime: 2023-04-20 11:43:14
8263
+ * @LastEditTime: 2023-05-08 16:34:25
8003
8264
  * @Description:
8004
8265
  */
8005
8266
 
@@ -8253,7 +8514,7 @@ setTimeout(()=>{
8253
8514
  }
8254
8515
  function getRelatedListProps(uiSchema, listViewName, ctx) {
8255
8516
  if (ctx.columns) {
8256
- const sort = getListViewSort(ctx.sort);
8517
+ const sort = getListViewSort({sort: ctx.sort});
8257
8518
  let { filters , filtersFunction} = ctx;
8258
8519
  if(!filtersFunction && filters){
8259
8520
  filtersFunction = str2function(
@@ -8342,7 +8603,7 @@ setTimeout(()=>{
8342
8603
  * @Author: baozhoutao@steedos.com
8343
8604
  * @Date: 2022-07-05 15:55:39
8344
8605
  * @LastEditors: baozhoutao@steedos.com
8345
- * @LastEditTime: 2023-04-17 15:26:17
8606
+ * @LastEditTime: 2023-04-28 11:11:29
8346
8607
  * @Description:
8347
8608
  */
8348
8609
 
@@ -8540,6 +8801,9 @@ setTimeout(()=>{
8540
8801
  ctx = {}
8541
8802
  ) {
8542
8803
  const uiSchema = await getUISchema(objectName);
8804
+ if(!uiSchema){
8805
+ return {}
8806
+ }
8543
8807
  const listView = _$1.find(
8544
8808
  uiSchema.list_views,
8545
8809
  (listView, name) => {
@@ -9093,7 +9357,10 @@ setTimeout(()=>{
9093
9357
  const defaults = ctx.defaults || {};
9094
9358
  if(!defaults.headerSchema){
9095
9359
  //传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
9096
- const headerSchema = await getObjectListHeader$1(uiSchema);
9360
+ const headerSchema = await getObjectListHeader$1(uiSchema, listViewName, {
9361
+ onlySecordLine: true,
9362
+ isListviewInit: true
9363
+ });
9097
9364
  defaults.headerSchema = headerSchema;
9098
9365
  }
9099
9366
  ctx.defaults = defaults;
@@ -11769,6 +12036,7 @@ setTimeout(()=>{
11769
12036
  exports.getLookupSapceUserTreeSchema = getLookupSapceUserTreeSchema;
11770
12037
  exports.getNotifications = getNotifications;
11771
12038
  exports.getObjectDetailButtons = getObjectDetailButtons;
12039
+ exports.getObjectDetailButtonsSchemas = getObjectDetailButtonsSchemas;
11772
12040
  exports.getObjectDetailMoreButtons = getObjectDetailMoreButtons;
11773
12041
  exports.getObjectFieldsFilterBarSchema = getObjectFieldsFilterBarSchema;
11774
12042
  exports.getObjectFieldsFilterButtonSchema = getObjectFieldsFilterButtonSchema;
@@ -11777,6 +12045,7 @@ setTimeout(()=>{
11777
12045
  exports.getObjectListHeaderFieldsFilterBar = getObjectListHeaderFieldsFilterBar;
11778
12046
  exports.getObjectListHeaderFirstLine = getObjectListHeaderFirstLine;
11779
12047
  exports.getObjectListHeaderSecordLine = getObjectListHeaderSecordLine;
12048
+ exports.getObjectListViewButtonsSchemas = getObjectListViewButtonsSchemas;
11780
12049
  exports.getObjectRecordDetailHeader = getObjectRecordDetailHeader;
11781
12050
  exports.getObjectRecordDetailRelatedListHeader = getObjectRecordDetailRelatedListHeader;
11782
12051
  exports.getObjectRelated = getObjectRelated;