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

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
@@ -1,5 +1,5 @@
1
1
  import * as _$1 from 'lodash';
2
- import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, get, map, toArray, mergeWith, isBoolean, omitBy, isNil, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, startsWith } from 'lodash';
2
+ import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, get, map, toArray, mergeWith, forEach, isBoolean, omitBy, isNil, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, startsWith } from 'lodash';
3
3
  import { Router as Router$1, getSteedosAuth as getSteedosAuth$1, lookupToAmis as lookupToAmis$1, fetchAPI as fetchAPI$1 } from '@steedos-widgets/amis-lib';
4
4
  import isPlainObject from 'lodash/isPlainObject';
5
5
 
@@ -1350,26 +1350,11 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
1350
1350
  }
1351
1351
  };
1352
1352
 
1353
- /*
1354
- * @Author: baozhoutao@steedos.com
1355
- * @Date: 2022-08-04 10:42:49
1356
- * @LastEditors: baozhoutao@steedos.com
1357
- * @LastEditTime: 2022-08-25 10:28:47
1358
- * @Description:
1359
- */
1360
- var config = {
1361
- listView: {
1362
- newRecordMode: 'modal',
1363
- editRecordMode: 'modal',
1364
- perPage: 20
1365
- }
1366
- };
1367
-
1368
1353
  /*
1369
1354
  * @Author: baozhoutao@steedos.com
1370
1355
  * @Date: 2022-11-01 15:51:00
1371
- * @LastEditors: baozhoutao@steedos.com
1372
- * @LastEditTime: 2023-04-19 20:26:27
1356
+ * @LastEditors: Please set LastEditors
1357
+ * @LastEditTime: 2023-04-26 11:52:04
1373
1358
  * @Description:
1374
1359
  */
1375
1360
 
@@ -1461,7 +1446,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
1461
1446
  "schemaApi": {
1462
1447
  "data": {
1463
1448
  "isLookup": "${isLookup}",
1464
- "_master": "${_master}"
1449
+ "_master": "${_master}",
1450
+ "url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}"
1465
1451
  },
1466
1452
  "url": "${context.rootUrl}/api/pageSchema/form?app=${appId}&objectApiName=${objectName}&formFactor=${formFactor}",
1467
1453
  "method": "get",
@@ -1470,7 +1456,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
1470
1456
  "headers": {
1471
1457
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
1472
1458
  },
1473
- "requestAdaptor": "",
1459
+ "requestAdaptor": "return { ...api, url: api.body.url }",
1474
1460
  "adaptor": schemaApiAdaptor
1475
1461
  }
1476
1462
  }
@@ -2379,6 +2365,166 @@ const execute = (button, props) => {
2379
2365
 
2380
2366
  const executeButton = execute;
2381
2367
 
2368
+
2369
+ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2370
+ const { name } = objectSchema;
2371
+ const buttons = getObjectDetailButtons(objectSchema, {});
2372
+ const moreButtons = getObjectDetailMoreButtons(objectSchema, {
2373
+ recordId: recordId,
2374
+ objectName: name
2375
+ });
2376
+ let amisButtonsSchema = ___default.map(buttons, (button) => {
2377
+ return {
2378
+ type: 'steedos-object-button',
2379
+ name: button.name,
2380
+ objectName: button.objectName,
2381
+ visibleOn: getButtonVisibleOn$1(button),
2382
+ className: `button_${button.name}`
2383
+ }
2384
+ });
2385
+ let dropdownButtons = ___default.map(moreButtons, (button) => {
2386
+ return {
2387
+ type: 'steedos-object-button',
2388
+ name: button.name,
2389
+ objectName: button.objectName,
2390
+ visibleOn: getButtonVisibleOn$1(button),
2391
+ }
2392
+ });
2393
+ return {
2394
+ buttons: amisButtonsSchema,
2395
+ moreButtons: dropdownButtons
2396
+ };
2397
+ };
2398
+
2399
+ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
2400
+ const { buttons, moreButtons } = getObjectDetailHeaderButtons(objectSchema, recordId);
2401
+ if(ctx.formFactor === 'SMALL'){
2402
+ return {
2403
+ "type": "button",
2404
+ "icon": "fa fa-angle-down",
2405
+ "onEvent": {
2406
+ "click": {
2407
+ "actions": [
2408
+ {
2409
+ "actionType": "drawer",
2410
+ "drawer": {
2411
+ "type": "drawer",
2412
+ "title": "操作",
2413
+ "body": [
2414
+ {
2415
+ "type": "button-group",
2416
+ "id": "u:fd837823be5b",
2417
+ "vertical": true,
2418
+ "tiled": true,
2419
+ "buttons": [
2420
+ ...___default.map(buttons, (button)=>{
2421
+ button.className += ' w-full';
2422
+ return button;
2423
+ }),
2424
+ ...___default.map(moreButtons, (button)=>{
2425
+ button.className += ' w-full';
2426
+ return button;
2427
+ })
2428
+ ],
2429
+ "btnLevel": "enhance",
2430
+ "className": "w-full",
2431
+ "btnClassName": "w-full",
2432
+ "size": "lg"
2433
+ }
2434
+ ],
2435
+ "id": "u:9815f7366b9f",
2436
+ "position": "bottom",
2437
+ "closeOnOutside": true,
2438
+ "resizable": false,
2439
+ "className": "buttons-drawer",
2440
+ "bodyClassName": "m-none p-none",
2441
+ "actions": []
2442
+ }
2443
+ }
2444
+ ]
2445
+ }
2446
+ },
2447
+ "id": "u:ee7c7929e6ae"
2448
+ }
2449
+ }else {
2450
+ if(moreButtons.length > 0){
2451
+ const dropdownButtonsSchema = {
2452
+ type: "steedos-dropdown-button",
2453
+ label: "",
2454
+ buttons: moreButtons,
2455
+ className: 'slds-icon'
2456
+ };
2457
+ buttons.push(dropdownButtonsSchema);
2458
+ }
2459
+ return buttons;
2460
+ }
2461
+ };
2462
+
2463
+
2464
+ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
2465
+ const buttons = getListViewButtons(objectSchema, ctx);
2466
+ if(ctx.formFactor === 'SMALL'){
2467
+ return {
2468
+ "type": "button",
2469
+ "icon": "fa fa-angle-down",
2470
+ "onEvent": {
2471
+ "click": {
2472
+ "actions": [
2473
+ {
2474
+ "actionType": "drawer",
2475
+ "drawer": {
2476
+ "type": "drawer",
2477
+ "title": "操作",
2478
+ "body": [
2479
+ {
2480
+ "type": "button-group",
2481
+ "id": "u:fd837823be5b",
2482
+ "vertical": true,
2483
+ "tiled": true,
2484
+ "buttons": [
2485
+ ...___default.map(buttons, (button)=>{
2486
+ return {
2487
+ type: 'steedos-object-button',
2488
+ name: button.name,
2489
+ objectName: button.objectName,
2490
+ visibleOn: getButtonVisibleOn$1(button),
2491
+ className: `button_${button.name} w-full`
2492
+ }
2493
+ })
2494
+ ],
2495
+ "btnLevel": "enhance",
2496
+ "className": "w-full",
2497
+ "btnClassName": "w-full",
2498
+ "size": "lg"
2499
+ }
2500
+ ],
2501
+ "id": "u:9815f7366b9f",
2502
+ "position": "bottom",
2503
+ "closeOnOutside": true,
2504
+ "resizable": false,
2505
+ "className": "buttons-drawer",
2506
+ "bodyClassName": "m-none p-none",
2507
+ "actions": []
2508
+ }
2509
+ }
2510
+ ]
2511
+ }
2512
+ },
2513
+ "id": "u:ee7c7929e6ae"
2514
+ }
2515
+ }else {
2516
+ return ___default.map(buttons, (button) => {
2517
+ return {
2518
+ type: 'steedos-object-button',
2519
+ name: button.name,
2520
+ objectName: button.objectName,
2521
+ visibleOn: getButtonVisibleOn$1(button),
2522
+ className: `button_${button.name}`
2523
+ }
2524
+ });
2525
+ }
2526
+ };
2527
+
2382
2528
  async function getObjectFieldsFilterButtonSchema(objectSchema) {
2383
2529
  // const amisListViewId = `listview_${objectSchema.name}`;
2384
2530
  return {
@@ -2512,6 +2658,43 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
2512
2658
  // }
2513
2659
  // listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
2514
2660
  `;
2661
+ const onCancelScript = `
2662
+ const scope = event.context.scoped;
2663
+ var filterForm = scope.parent.parent.getComponents().find(function(n){
2664
+ return n.props.type === "form";
2665
+ });
2666
+ var filterFormValues = filterForm.getValues();
2667
+ var listView = scope.parent.parent.parent.getComponents().find(function(n){
2668
+ return n.props.type === "crud";
2669
+ });
2670
+ const removedValues = {};
2671
+ for(var k in filterFormValues){
2672
+ if(/^__searchable__/.test(k)){
2673
+ removedValues[k] = "";
2674
+ }
2675
+ }
2676
+ if(!event.data.isLookup){
2677
+ // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
2678
+ const listViewId = event.data.listViewId;
2679
+ const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
2680
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
2681
+ if(localListViewProps){
2682
+ localListViewProps = JSON.parse(localListViewProps);
2683
+ for(var k in localListViewProps){
2684
+ removedValues[k] = "";
2685
+ }
2686
+ }
2687
+ }
2688
+ listView.handleFilterSubmit(removedValues);
2689
+ const filterService = filterForm.context.getComponents().find(function(n){
2690
+ return n.props.type === "service";
2691
+ });
2692
+ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
2693
+ //触发amis crud 高度重算
2694
+ setTimeout(()=>{
2695
+ window.dispatchEvent(new Event("resize"))
2696
+ }, 100);
2697
+ `;
2515
2698
  const dataProviderInited = `
2516
2699
  const objectName = data.objectName;
2517
2700
  const isLookup = data.isLookup;
@@ -2705,6 +2888,22 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
2705
2888
  }
2706
2889
  }
2707
2890
  },
2891
+ {
2892
+ "type": "button",
2893
+ "label": "取消",
2894
+ "name": "btn_filter_form_cancel",
2895
+ "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
2896
+ "onEvent": {
2897
+ "click": {
2898
+ "actions": [
2899
+ {
2900
+ "actionType": "custom",
2901
+ "script": onCancelScript
2902
+ }
2903
+ ]
2904
+ }
2905
+ }
2906
+ },
2708
2907
  {
2709
2908
  "type": "button",
2710
2909
  "label": "设置搜索项",
@@ -2861,17 +3060,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
2861
3060
  }
2862
3061
  );
2863
3062
 
2864
- const buttons = getListViewButtons(objectSchema, {});
2865
- let amisButtonsSchema = map(buttons, (button) => {
2866
- return {
2867
- type: 'steedos-object-button',
2868
- name: button.name,
2869
- objectName: button.objectName,
2870
- visibleOn: getButtonVisibleOn$1(button),
2871
- className: `button_${button.name}`
2872
- }
2873
- });
2874
-
3063
+ let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
2875
3064
  const reg = new RegExp('_', 'g');
2876
3065
  const standardIcon = icon && icon.replace(reg, '-');
2877
3066
  return {
@@ -2904,8 +3093,8 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
2904
3093
  },
2905
3094
  {
2906
3095
  "type": "dropdown-button",
2907
- "className": "",
2908
- "label": "\${uiSchema.list_views[listName].label}",
3096
+ "className": "",
3097
+ "label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
2909
3098
  "rightIcon": "fa fa-caret-down",
2910
3099
  "size": "sm",
2911
3100
  "hideCaret": true,
@@ -3053,7 +3242,10 @@ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ct
3053
3242
  * @returns amisSchema
3054
3243
  */
3055
3244
  function getObjectListHeader$1(objectSchema, listViewName, ctx) {
3056
- let firstLineSchema = getObjectListHeaderFirstLine(objectSchema);
3245
+ if (!ctx) {
3246
+ ctx = {};
3247
+ }
3248
+ let firstLineSchema = getObjectListHeaderFirstLine(objectSchema, listViewName, ctx);
3057
3249
  let body = [firstLineSchema];
3058
3250
  let headerSchema = [{
3059
3251
  "type": "wrapper",
@@ -3074,35 +3266,11 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3074
3266
  const { showRecordTitle = true } = options || {};
3075
3267
  // console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
3076
3268
  const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
3077
- const buttons = getObjectDetailButtons(objectSchema, {});
3078
- const moreButtons = getObjectDetailMoreButtons(objectSchema, {
3079
- recordId: recordId,
3080
- objectName: name
3081
- });
3082
- let amisButtonsSchema = map(buttons, (button) => {
3083
- return {
3084
- type: 'steedos-object-button',
3085
- name: button.name,
3086
- objectName: button.objectName,
3087
- visibleOn: getButtonVisibleOn$1(button),
3088
- className: `button_${button.name}`
3089
- }
3090
- });
3091
- let dropdownButtons = map(moreButtons, (button) => {
3092
- return {
3093
- type: 'steedos-object-button',
3094
- name: button.name,
3095
- objectName: button.objectName,
3096
- visibleOn: getButtonVisibleOn$1(button),
3097
- }
3098
- });
3099
- const dropdownButtonsSchema = {
3100
- type: "steedos-dropdown-button",
3101
- label: "",
3102
- buttons: dropdownButtons,
3103
- className: 'slds-icon'
3104
- };
3105
- amisButtonsSchema.push(dropdownButtonsSchema);
3269
+
3270
+ let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
3271
+
3272
+ // console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
3273
+
3106
3274
  const reg = new RegExp('_', 'g');
3107
3275
  const standardIcon = icon && icon.replace(reg, '-');
3108
3276
 
@@ -3313,8 +3481,8 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
3313
3481
  "icon": "fa fa-table-columns",
3314
3482
  "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
3315
3483
  "align": "right",
3316
- "visibleOn": "${formFactor !== 'SMALL'}",
3317
- "buttons": [
3484
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
3485
+ "buttons": [
3318
3486
  {
3319
3487
  "label": "显示为",
3320
3488
  "children": buttons
@@ -3334,11 +3502,26 @@ const filterForm = scope.getComponents().find(function(n){
3334
3502
  const filterService = filterForm.context.getComponents().find(function(n){
3335
3503
  return n.props.type === "service";
3336
3504
  });
3337
- filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
3338
- //触发amis crud 高度重算
3339
- setTimeout(()=>{
3340
- window.dispatchEvent(new Event("resize"))
3341
- }, 100)
3505
+ // filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
3506
+ let resizeWindow = function(){
3507
+ //触发amis crud 高度重算
3508
+ setTimeout(()=>{
3509
+ window.dispatchEvent(new Event("resize"))
3510
+ }, 500);
3511
+ }
3512
+ if(filterService.props.data.showFieldsFilter){
3513
+ let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
3514
+ direction: "down",
3515
+ name: "btn_filter_form_cancel"
3516
+ });
3517
+ buttonCancel.props.dispatchEvent('click', {}).then(function(){
3518
+ resizeWindow();
3519
+ });
3520
+ }
3521
+ else{
3522
+ filterService.setData({showFieldsFilter: true});
3523
+ resizeWindow();
3524
+ }
3342
3525
  `;
3343
3526
 
3344
3527
  function getExportApiRequestAdaptorScript(){
@@ -3411,6 +3594,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3411
3594
  `;
3412
3595
  return [
3413
3596
  // "bulkActions",
3597
+ ...(headerToolbarItems || []),
3414
3598
  hiddenCount ? {} :{
3415
3599
  "type": "tpl",
3416
3600
  "tpl": "${count} 个项目"
@@ -3555,7 +3739,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3555
3739
  "list_view": "${uiSchema.list_views[listName]}",
3556
3740
  "appId": "${appId}",
3557
3741
  "global": "${global}",
3558
- "objectName": "${objectName}",
3742
+ "targetObjectName": "${objectName}",
3559
3743
  },
3560
3744
  "body": [
3561
3745
  {
@@ -3595,7 +3779,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3595
3779
  {
3596
3780
  "args": {
3597
3781
  // 直接使用recordId不能拿到数据,只能通过result里面拿数据
3598
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3782
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
3599
3783
  "blank": false
3600
3784
  },
3601
3785
  "actionType": "url",
@@ -3636,7 +3820,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3636
3820
  "data": {
3637
3821
  "&": "$$",
3638
3822
  "listName": "${listName}",
3639
- "objectName": "${objectName}",
3823
+ "targetObjectName": "${objectName}",
3640
3824
  "list_view": "${uiSchema.list_views[listName]}",
3641
3825
  "appId": "${appId}",
3642
3826
  "global": "${global}"
@@ -3679,7 +3863,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3679
3863
  "actions": [
3680
3864
  {
3681
3865
  "args": {
3682
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/listview_${result.data.recordId|lowerCase}",
3866
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
3683
3867
  "blank": false
3684
3868
  },
3685
3869
  "actionType": "url",
@@ -3715,7 +3899,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3715
3899
  "type": "dialog",
3716
3900
  "title": "重命名 列表视图",
3717
3901
  "data": {
3718
- "objectName": "${objectName}",
3902
+ "targetObjectName": "${objectName}",
3719
3903
  "recordId": "${uiSchema.list_views[listName]._id}",
3720
3904
  "appId": "${appId}"
3721
3905
  },
@@ -3736,7 +3920,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3736
3920
  "actions": [
3737
3921
  {
3738
3922
  "args": {
3739
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${name}",
3923
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${name}",
3740
3924
  "blank": false
3741
3925
  },
3742
3926
  "actionType": "url",
@@ -3810,6 +3994,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3810
3994
  "type": "dialog",
3811
3995
  "title": "过滤设置",
3812
3996
  "data": {
3997
+ "targetObjectName": "${objectName}",
3813
3998
  "objectName": "${objectName}",
3814
3999
  "recordId": "${uiSchema.list_views[listName]._id}",
3815
4000
  "listName": "${listName}",
@@ -3835,7 +4020,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3835
4020
  "actions": [
3836
4021
  {
3837
4022
  "args": {
3838
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4023
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
3839
4024
  "blank": false
3840
4025
  },
3841
4026
  "actionType": "url",
@@ -3873,6 +4058,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3873
4058
  "title": "显示的列",
3874
4059
  "data": {
3875
4060
  "&": "$$",
4061
+ "targetObjectName": "${objectName}",
3876
4062
  "objectName": "${objectName}",
3877
4063
  "recordId": "${uiSchema.list_views[listName]._id}",
3878
4064
  "listName": "${listName}",
@@ -3898,7 +4084,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3898
4084
  "actions": [
3899
4085
  {
3900
4086
  "args": {
3901
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4087
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
3902
4088
  "blank": false
3903
4089
  },
3904
4090
  "actionType": "url"
@@ -3934,6 +4120,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3934
4120
  "title": "弹框标题",
3935
4121
  "data": {
3936
4122
  "&": "$$",
4123
+ "targetObjectName": "${objectName}",
3937
4124
  "objectName": "${objectName}",
3938
4125
  "recordId": "${uiSchema.list_views[listName]._id}",
3939
4126
  "listName": "${listName}",
@@ -3959,7 +4146,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
3959
4146
  "actions": [
3960
4147
  {
3961
4148
  "args": {
3962
- "url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
4149
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/${listName}",
3963
4150
  "blank": false
3964
4151
  },
3965
4152
  "actionType": "url"
@@ -4073,8 +4260,8 @@ function getObjectFooterToolbar(mainObject, formFactor) {
4073
4260
  }
4074
4261
  else {
4075
4262
  return [
4263
+ "switch-per-page",
4076
4264
  "statistics",
4077
- // "switch-per-page",
4078
4265
  "pagination"
4079
4266
  ]
4080
4267
  }
@@ -4507,13 +4694,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
4507
4694
  var sort = orderBy + ' ' + orderDir;
4508
4695
  sort = orderBy ? sort : "${sort}";
4509
4696
  var allowSearchFields = ${JSON.stringify(searchableFields)};
4697
+ let fieldValue;
4510
4698
  if(api.data.$term){
4511
4699
  filters = [["name", "contains", "'+ api.data.$term +'"]];
4512
4700
  }else if(selfData.op === 'loadOptions' && selfData.value){
4513
4701
  if(selfData.value?.indexOf(',') > 0){
4514
- filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
4702
+ fieldValue = selfData.value.split(',');
4703
+ filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
4515
4704
  }else{
4516
- filters = [["${referenceTo.valueField.name}", "=", selfData.value]];
4705
+ fieldValue = selfData.value;
4706
+ filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
4517
4707
  }
4518
4708
  }
4519
4709
 
@@ -4567,6 +4757,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
4567
4757
  if(enable_tree){
4568
4758
  pageSize = 10000;
4569
4759
  }
4760
+ if(fieldValue && _.isArray(fieldValue) && fieldValue.length > pageSize){
4761
+ pageSize = fieldValue.length;
4762
+ }
4570
4763
  api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());
4571
4764
  return api;
4572
4765
  `;
@@ -4647,6 +4840,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
4647
4840
  ...ctx
4648
4841
  });
4649
4842
 
4843
+ pickerSchema.affixHeader = false;
4844
+
4650
4845
  var headerToolbarItems = [];
4651
4846
  const isMobile = window.innerWidth < 768;
4652
4847
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
@@ -4664,14 +4859,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
4664
4859
  pickerSchema.headerToolbar.push(new_button);
4665
4860
  }
4666
4861
  pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
4667
- //TODO: 等待放大镜bug修复,if会去掉,始终显示放大镜
4668
- if(referenceTo.objectName != "space_users" || field.reference_to_field != "user"){
4669
- if (ctx.filterVisible !== false) {
4670
- pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
4671
- isLookup: true,
4672
- ...ctx
4673
- });
4674
- }
4862
+ if (ctx.filterVisible !== false) {
4863
+ pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
4864
+ isLookup: true,
4865
+ ...ctx
4866
+ });
4675
4867
  }
4676
4868
  pickerSchema.data = Object.assign({}, pickerSchema.data, {
4677
4869
  "&": "$$",
@@ -4855,11 +5047,12 @@ async function lookupToAmisSelect(field, readonly, ctx){
4855
5047
  autoComplete: apiInfo,
4856
5048
  searchable: true,
4857
5049
  };
5050
+ //删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
4858
5051
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
4859
5052
  <span role='img' aria-label='smile' class='anticon anticon-smile'>
4860
5053
  <span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
4861
5054
  <svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
4862
- <use xlink:href='\${context.rootUrl}/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
5055
+ <use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
4863
5056
  </svg>
4864
5057
  </span>
4865
5058
  </span>
@@ -4917,8 +5110,10 @@ async function lookupToAmis(field, readonly, ctx){
4917
5110
 
4918
5111
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
4919
5112
  if(ctx.idsDependOn || field.amis){
5113
+ // ids人员点选模式
4920
5114
  return await lookupToAmisIdsPicker(field, readonly, ctx);
4921
5115
  }
5116
+ // 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
4922
5117
  // return await lookupToAmisSelectUser(field, readonly, ctx);
4923
5118
  }
4924
5119
 
@@ -5019,6 +5214,9 @@ async function getIdsPickerSchema(field, readonly, ctx){
5019
5214
  top: top,
5020
5215
  ...ctx
5021
5216
  });
5217
+
5218
+ pickerSchema.affixHeader = false;
5219
+
5022
5220
  }
5023
5221
 
5024
5222
  const data = {
@@ -5048,7 +5246,6 @@ async function getIdsPickerSchema(field, readonly, ctx){
5048
5246
  if(readonly){
5049
5247
  data.tpl = await getLookupTpl(field, ctx);
5050
5248
  }
5051
-
5052
5249
  return data;
5053
5250
  }
5054
5251
 
@@ -5256,6 +5453,23 @@ const getAmisFileSchema = (steedosField, readonly)=>{
5256
5453
  return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
5257
5454
  };
5258
5455
 
5456
+ /*
5457
+ * @Author: baozhoutao@steedos.com
5458
+ * @Date: 2022-07-20 16:29:22
5459
+ * @LastEditors: Please set LastEditors
5460
+ * @LastEditTime: 2023-05-11 11:19:54
5461
+ * @Description:
5462
+ */
5463
+
5464
+ function getContrastColor(bgColor) {
5465
+ var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
5466
+ var r = parseInt(backgroundColor.substr(0, 2), 16);
5467
+ var g = parseInt(backgroundColor.substr(2, 2), 16);
5468
+ var b = parseInt(backgroundColor.substr(4, 2), 16);
5469
+ var brightness = (r * 299 + g * 587 + b * 114) / 1000;
5470
+ return brightness >= 128 ? "#000000" : "#ffffff";
5471
+ }
5472
+
5259
5473
  const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
5260
5474
  // const Lookup = require('./lookup');
5261
5475
 
@@ -5409,6 +5623,8 @@ function getSelectFieldOptions(field){
5409
5623
  }
5410
5624
 
5411
5625
  async function convertSFieldToAmisField(field, readonly, ctx) {
5626
+ // console.log('convertSFieldToAmisField====>', field, readonly, ctx)
5627
+ const isMobile = window.innerWidth <= 768;
5412
5628
  // 创建人和修改人、创建时间和修改时间不显示
5413
5629
  if(_$1.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
5414
5630
  return;
@@ -5443,20 +5659,42 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
5443
5659
  // }
5444
5660
  // break;
5445
5661
  case 'select':
5446
- convertData = {
5447
- type: getAmisStaticFieldType('select', readonly),
5448
- joinValues: false,
5449
- options: getSelectFieldOptions(field),
5450
- extractValue: true,
5451
- clearable: true,
5452
- labelField: 'label',
5453
- valueField: 'value',
5454
- tpl: readonly ? getSelectTpl(field) : null
5455
- };
5456
- if(field.multiple){
5457
- convertData.multiple = true;
5458
- convertData.extractValue = true;
5662
+ if(readonly){
5663
+ const selectOptions = field.options;
5664
+ let map = {};
5665
+ _$1.forEach(selectOptions,(option)=>{
5666
+ const optionValue = option.value + '';
5667
+ if(option.color){
5668
+ const background = '#'+option.color;
5669
+ const color = getContrastColor(background);
5670
+ const optionColorStyle = 'background:'+background+';color:'+color;
5671
+ map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
5672
+ }else {
5673
+ map[optionValue] = option.label;
5674
+ }
5675
+ });
5676
+ convertData = {
5677
+ type: "static-mapping",
5678
+ name: field.name,
5679
+ label: field.label,
5680
+ map: map
5681
+ };
5682
+ }else {
5683
+ convertData = {
5684
+ type: getAmisStaticFieldType('select', readonly),
5685
+ joinValues: false,
5686
+ options: getSelectFieldOptions(field),
5687
+ extractValue: true,
5688
+ clearable: true,
5689
+ labelField: 'label',
5690
+ valueField: 'value'
5691
+ };
5692
+ if(field.multiple){
5693
+ convertData.multiple = true;
5694
+ convertData.extractValue = true;
5695
+ }
5459
5696
  }
5697
+
5460
5698
  break;
5461
5699
  case 'boolean':
5462
5700
  convertData = {
@@ -5476,7 +5714,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
5476
5714
  };
5477
5715
  break;
5478
5716
  case 'date':
5479
- convertData = {
5717
+ convertData = isMobile && !readonly ? {
5718
+ type: "native-date",
5719
+ pipeIn: (value, data) => {
5720
+ if (value) {
5721
+ value = moment(value).utc().format('YYYY-MM-DD');
5722
+ return value;
5723
+ } else {
5724
+ return "";
5725
+ }
5726
+
5727
+ },
5728
+ pipeOut: (value, oldValue, data) => {
5729
+ if (value) {
5730
+ value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
5731
+ return value;
5732
+ } else {
5733
+ return "";
5734
+ }
5735
+ }
5736
+ } : {
5480
5737
  type: getAmisStaticFieldType('date', readonly),
5481
5738
  inputFormat: "YYYY-MM-DD",
5482
5739
  format:'YYYY-MM-DDT00:00:00.000[Z]',
@@ -5495,12 +5752,48 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
5495
5752
  };
5496
5753
  break;
5497
5754
  case 'datetime':
5498
- convertData = {
5755
+ convertData = isMobile && !readonly ? {
5756
+ type: "combo",
5757
+ pipeIn: (value, data) => {
5758
+ let revalue = {};
5759
+ if (value && value != "Invalid date") {
5760
+ value = moment(value).format('YYYY-MM-DD HH:mm:ss');
5761
+ revalue[field.name + "-native-date"] = value.split(' ')[0];
5762
+ revalue[field.name + "-native-time"] = value.split(' ')[1];
5763
+ } else {
5764
+ revalue[field.name + "-native-date"] = "";
5765
+ revalue[field.name + "-native-time"] = "";
5766
+ }
5767
+ return revalue;
5768
+ },
5769
+ pipeOut: (value, oldValue, data) => {
5770
+ let revalue = "";
5771
+ if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
5772
+ revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
5773
+ revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
5774
+ }
5775
+ return revalue;
5776
+ },
5777
+ items: [
5778
+ {
5779
+ type: "native-date",
5780
+ name: field.name + "-native-date",
5781
+ className: "steedos-native-date",
5782
+ value: ""
5783
+ },
5784
+ {
5785
+ type: "native-time",
5786
+ name: field.name + "-native-time",
5787
+ className: "steedos-native-time",
5788
+ value: ""
5789
+ }
5790
+ ]
5791
+ } : {
5499
5792
  type: getAmisStaticFieldType('datetime', readonly),
5500
5793
  inputFormat: 'YYYY-MM-DD HH:mm',
5501
- format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
5794
+ format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
5502
5795
  tpl: readonly ? getDateTimeTpl(field) : null,
5503
- utc: true
5796
+ utc: true,
5504
5797
  };
5505
5798
  break;
5506
5799
  case 'input-time-range':
@@ -5515,7 +5808,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
5515
5808
  };
5516
5809
  break;
5517
5810
  case 'time':
5518
- convertData = {
5811
+ convertData = isMobile && !readonly ? {
5812
+ type: "native-time",
5813
+ pipeIn: (value, data) => {
5814
+ if (value) {
5815
+ value = moment(value).utc().format('HH:mm');
5816
+ return value;
5817
+ } else {
5818
+ return "";
5819
+ }
5820
+
5821
+ },
5822
+ pipeOut: (value, oldValue, data) => {
5823
+ if (value) {
5824
+ value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
5825
+ return value;
5826
+ } else {
5827
+ return "";
5828
+ }
5829
+ }
5830
+ } : {
5519
5831
  type: getAmisStaticFieldType('time', readonly),
5520
5832
  inputFormat: 'HH:mm',
5521
5833
  timeFormat:'HH:mm',
@@ -5627,7 +5939,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
5627
5939
  convertData = {
5628
5940
  type: "editor",
5629
5941
  language: field.language,
5630
- // value: field.defaultValue || ''
5942
+ editorDidMount: new Function('editor', 'monaco', field.editorDidMount)
5631
5943
  };
5632
5944
  break;
5633
5945
  case 'toggle':
@@ -5648,7 +5960,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
5648
5960
  columnsTogglable: false,
5649
5961
  strictMode:false,
5650
5962
  affixHeader: false, // 是否固定表头, 不固定表头, 否则form有y轴滚动条时, 表头会跟随滚动条滚动.
5651
- // needConfirm: true, 此属性设置为false后,导致table不能编辑。
5963
+ needConfirm: false,
5652
5964
  editable: !readonly,
5653
5965
  addable: !readonly,
5654
5966
  removable: !readonly,
@@ -5719,6 +6031,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
5719
6031
  convertData.quickEdit = false;
5720
6032
  }
5721
6033
 
6034
+ let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
6035
+ if (convertData.className) {
6036
+ convertData.className = convertData.className + fieldTypeClassName;
6037
+ } else {
6038
+ convertData.className = fieldTypeClassName;
6039
+ }
6040
+
5722
6041
  if(field.visible_on){
5723
6042
  // convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
5724
6043
  if(field.visible_on.startsWith("{{")){
@@ -5878,6 +6197,12 @@ function getReadonlyFormAdaptor(object, fields){
5878
6197
  // })
5879
6198
 
5880
6199
  return `
6200
+ if(payload.data.data.length === 0){
6201
+ return {
6202
+ status: 2,
6203
+ msg: "无法找到记录"
6204
+ }
6205
+ }
5881
6206
  if(payload.data.data){
5882
6207
  var data = payload.data.data[0];
5883
6208
  var gridAndObjectFieldsName = ${JSON.stringify(gridAndObjectFieldsName)};
@@ -6002,12 +6327,12 @@ function getScriptForRewriteValueForFileFields(fields){
6002
6327
  });
6003
6328
  }
6004
6329
  }else{
6005
- data[item] = {
6330
+ data[item] = [{
6006
6331
  value: fileFieldValue,
6007
6332
  name: fileFieldDisplayValue.name,
6008
6333
  url: fileFieldDisplayValue.url + "?download=true",
6009
6334
  state: "uploaded"
6010
- };
6335
+ }];
6011
6336
  }
6012
6337
  }
6013
6338
  })
@@ -6025,7 +6350,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
6025
6350
 
6026
6351
  return {
6027
6352
  method: "post",
6028
- url: getApi$2(),
6353
+ url: getApi$2() + '&objectName=${objectName}' ,
6029
6354
  // sendOn: "!!this.recordId",
6030
6355
  cache: API_CACHE,
6031
6356
  requestAdaptor: `
@@ -6331,7 +6656,7 @@ async function getObjectCRUD(objectSchema, fields, options){
6331
6656
  }),
6332
6657
  filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
6333
6658
  };
6334
- if(options.formFactor !== 'SMALL'){
6659
+ if(options.formFactor !== 'SMALL' || ["split"].indexOf(options.displayAs) == -1){
6335
6660
  Object.assign(bodyProps, {
6336
6661
  bulkActions: options.bulkActions != false ? bulkActions : false
6337
6662
  });
@@ -6396,7 +6721,7 @@ async function getObjectCRUD(objectSchema, fields, options){
6396
6721
  api: await getTableApi(objectSchema, fields, options),
6397
6722
  hiddenOn: options.tableHiddenOn,
6398
6723
  autoFillHeight: options.isRelated ? false : true,
6399
- className: `flex-auto ${crudClassName || ""}`,
6724
+ className: `flex-auto bg-white ${crudClassName || ""}`,
6400
6725
  crudClassName: crudClassName,
6401
6726
  },
6402
6727
  bodyProps,
@@ -6545,7 +6870,8 @@ async function getObjectForm(objectSchema, ctx){
6545
6870
  "eventName": `@data.changed.${objectSchema.name}`
6546
6871
  },
6547
6872
  "data": {
6548
- "objectName": `${objectSchema.name}`
6873
+ "objectName": `${objectSchema.name}`,
6874
+ "displayAs": "${displayAs}"
6549
6875
  }
6550
6876
  },
6551
6877
  {
@@ -6645,7 +6971,8 @@ async function getObjectDetail(objectSchema, recordId, ctx){
6645
6971
  data: {
6646
6972
  objectName: "${event.data.__objectName}",
6647
6973
  record: "${event.data.__record}"
6648
- }
6974
+ },
6975
+ expression: "${event.data.__response.error != true}"
6649
6976
  },
6650
6977
  {
6651
6978
  "actionType": "setValue",
@@ -6653,7 +6980,8 @@ async function getObjectDetail(objectSchema, recordId, ctx){
6653
6980
  value: {
6654
6981
  "recordLoaded": true,
6655
6982
  }
6656
- }
6983
+ },
6984
+ expression: "${event.data.__response.error != true}"
6657
6985
  }
6658
6986
  ]
6659
6987
  }
@@ -6661,6 +6989,21 @@ async function getObjectDetail(objectSchema, recordId, ctx){
6661
6989
  }
6662
6990
  }
6663
6991
 
6992
+ /*
6993
+ * @Author: baozhoutao@steedos.com
6994
+ * @Date: 2022-08-04 10:42:49
6995
+ * @LastEditors: baozhoutao@steedos.com
6996
+ * @LastEditTime: 2022-08-25 10:28:47
6997
+ * @Description:
6998
+ */
6999
+ var config = {
7000
+ listView: {
7001
+ newRecordMode: 'modal',
7002
+ editRecordMode: 'modal',
7003
+ perPage: 20
7004
+ }
7005
+ };
7006
+
6664
7007
  async function getTableColumns(fields, options){
6665
7008
  const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
6666
7009
  for (const field of fields) {
@@ -6724,7 +7067,31 @@ async function getTableColumns(fields, options){
6724
7067
  ...getAmisFileReadonlySchema(field)
6725
7068
  }, field.amis, {name: field.name}));
6726
7069
  }
6727
-
7070
+ else if(field.type === 'select'){
7071
+ const selectOptions = field.options;
7072
+ let map = {};
7073
+ forEach(selectOptions,(option)=>{
7074
+ const optionValue = option.value + '';
7075
+ if(option.color){
7076
+ const background = '#'+option.color;
7077
+ const color = getContrastColor(background);
7078
+ const optionColorStyle = 'background:'+background+';color:'+color;
7079
+ map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
7080
+ }else {
7081
+ map[optionValue] = option.label;
7082
+ }
7083
+ });
7084
+ columns.push(Object.assign({}, {
7085
+ type: "mapping",
7086
+ name: field.name,
7087
+ label: field.label,
7088
+ map: map,
7089
+ sortable: field.sortable,
7090
+ width: field.width,
7091
+ toggled: field.toggled,
7092
+ className:"whitespace-nowrap",
7093
+ }, field.amis, {name: field.name}));
7094
+ }
6728
7095
  else {
6729
7096
  const tpl = await getFieldTpl(field, options);
6730
7097
 
@@ -6734,6 +7101,13 @@ async function getTableColumns(fields, options){
6734
7101
  }else if(field.type === 'html'){
6735
7102
  type = 'markdown';
6736
7103
  }
7104
+ let className = "";
7105
+ if(field.type === 'textarea'){
7106
+ className = 'min-w-56';
7107
+ }
7108
+ if(field.wrap === false){
7109
+ className += " whitespace-nowrap";
7110
+ }
6737
7111
  if(!field.hidden && !field.extra){
6738
7112
  columns.push(Object.assign({}, {
6739
7113
  name: field.name,
@@ -6744,7 +7118,7 @@ async function getTableColumns(fields, options){
6744
7118
  type: type,
6745
7119
  tpl: tpl,
6746
7120
  toggled: field.toggled,
6747
- className: field.type === 'textarea' ? 'min-w-56 whitespace-pre-wrap textarea' : "whitespace-nowrap",
7121
+ className,
6748
7122
  html: field.type === 'html' ? true : null
6749
7123
  // toggled: true
6750
7124
  }, field.amis, {name: field.name}));
@@ -6869,8 +7243,9 @@ async function getMobileTableColumns(fields, options){
6869
7243
  const url = getNameTplUrl(nameField, options);
6870
7244
 
6871
7245
  const columnLines = getMobileLines(tpls);
6872
-
6873
- columns.push({
7246
+
7247
+
7248
+ let column = {
6874
7249
  name: nameField.name,
6875
7250
  label: nameField.label,
6876
7251
  sortable: nameField.sortable,
@@ -6879,13 +7254,66 @@ async function getMobileTableColumns(fields, options){
6879
7254
  actionType: "link",
6880
7255
  link: url,
6881
7256
  innerClassName: "steedos-listview-item block text-gray-500",
6882
- body:{
7257
+ body: {
6883
7258
  "type": "wrapper",
6884
7259
  "body": columnLines,
6885
7260
  "size": "none",
6886
7261
  "className": "p-1"
6887
7262
  }
6888
- });
7263
+ };
7264
+
7265
+ if(options.objectName === 'cms_files'){
7266
+ if(window.Meteor?.isCordova){
7267
+ column = {
7268
+ ...column,
7269
+ actionType: "",
7270
+ link: "",
7271
+ onEvent: {
7272
+ "click": {
7273
+ "actions": [
7274
+ {
7275
+ "script": `
7276
+ let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
7277
+ Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
7278
+ `,
7279
+ "actionType": "custom"
7280
+ }
7281
+ ],
7282
+ "weight": 0
7283
+ }
7284
+ }
7285
+ };
7286
+ }else {
7287
+ column = {
7288
+ ...column,
7289
+ actionType: "",
7290
+ link: "",
7291
+ onEvent: {
7292
+ "click": {
7293
+ "actions": [
7294
+ {
7295
+ "args": {
7296
+ "api": {
7297
+ "url": url,
7298
+ "method": "get",
7299
+ "headers": {
7300
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7301
+ }
7302
+ }
7303
+ },
7304
+ "actionType": "download"
7305
+ }
7306
+ ],
7307
+ "weight": 0
7308
+ }
7309
+ }
7310
+ };
7311
+ }
7312
+
7313
+ }
7314
+
7315
+ columns.push(column);
7316
+
6889
7317
 
6890
7318
  return columns;
6891
7319
  }
@@ -7004,7 +7432,7 @@ async function getTableSchema$1(fields, options){
7004
7432
  options = {};
7005
7433
  }
7006
7434
  let columns = [];
7007
- if(options.formFactor === 'SMALL'){
7435
+ if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
7008
7436
  columns = await getMobileTableColumns(fields, options);
7009
7437
  }
7010
7438
  else {
@@ -7207,7 +7635,11 @@ async function getTableApi(mainObject, fields, options){
7207
7635
  filters = systemFilters;
7208
7636
  };
7209
7637
  if(api.data.$self.additionalFilters){
7210
- userFilters.push(api.data.$self.additionalFilters)
7638
+ if(_.isString(api.data.$self.additionalFilters)){
7639
+ userFilters.push(eval(api.data.$self.additionalFilters))
7640
+ }else{
7641
+ userFilters.push(api.data.$self.additionalFilters)
7642
+ }
7211
7643
  }
7212
7644
 
7213
7645
  if(api.data.$self._isRelated){
@@ -7240,8 +7672,7 @@ async function getTableApi(mainObject, fields, options){
7240
7672
  if(_.isEmpty(filters)){
7241
7673
  filters = userFilters;
7242
7674
  }else{
7243
- filters.push('and');
7244
- filters.push(userFilters)
7675
+ filters = [filters, 'and', userFilters]
7245
7676
  }
7246
7677
  }
7247
7678
  api.data = {
@@ -7668,7 +8099,6 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7668
8099
  // ObjectForm会认作用域下的变量值
7669
8100
  // TODO: 待组件支持initValues属性后应该改掉,不应该通过data直接传值
7670
8101
  // TODO: 全天事件属性传入doc了但是没有生效,需要手动在ObjectForm中勾选全天事件
7671
- event.data = doc;
7672
8102
  const title = "新建 ${objectSchema.label}";
7673
8103
  doAction(
7674
8104
  {
@@ -7681,6 +8111,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7681
8111
  "type": "steedos-object-form",
7682
8112
  "objectApiName": "\${objectName}",
7683
8113
  "mode": "edit",
8114
+ "defaultData": doc,
7684
8115
  "onEvent": {
7685
8116
  "submitSucc": {
7686
8117
  "weight": 0,
@@ -7973,7 +8404,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
7973
8404
  * @Author: baozhoutao@steedos.com
7974
8405
  * @Date: 2022-07-05 15:55:39
7975
8406
  * @LastEditors: Please set LastEditors
7976
- * @LastEditTime: 2023-04-20 11:43:14
8407
+ * @LastEditTime: 2023-05-08 16:34:25
7977
8408
  * @Description:
7978
8409
  */
7979
8410
 
@@ -8227,7 +8658,7 @@ function getDefaultRelatedListProps(uiSchema, listName, ctx) {
8227
8658
  }
8228
8659
  function getRelatedListProps(uiSchema, listViewName, ctx) {
8229
8660
  if (ctx.columns) {
8230
- const sort = getListViewSort(ctx.sort);
8661
+ const sort = getListViewSort({sort: ctx.sort});
8231
8662
  let { filters , filtersFunction} = ctx;
8232
8663
  if(!filtersFunction && filters){
8233
8664
  filtersFunction = str2function(
@@ -8316,7 +8747,7 @@ async function getRelatedListSchema(
8316
8747
  * @Author: baozhoutao@steedos.com
8317
8748
  * @Date: 2022-07-05 15:55:39
8318
8749
  * @LastEditors: baozhoutao@steedos.com
8319
- * @LastEditTime: 2023-04-17 15:26:17
8750
+ * @LastEditTime: 2023-04-28 11:11:29
8320
8751
  * @Description:
8321
8752
  */
8322
8753
 
@@ -8514,6 +8945,9 @@ async function getListSchema(
8514
8945
  ctx = {}
8515
8946
  ) {
8516
8947
  const uiSchema = await getUISchema(objectName);
8948
+ if(!uiSchema){
8949
+ return {}
8950
+ }
8517
8951
  const listView = find(
8518
8952
  uiSchema.list_views,
8519
8953
  (listView, name) => {
@@ -9067,7 +9501,10 @@ async function getListviewInitSchema(objectApiName, listViewName, ctx) {
9067
9501
  const defaults = ctx.defaults || {};
9068
9502
  if(!defaults.headerSchema){
9069
9503
  //传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
9070
- const headerSchema = await getObjectListHeader$1(uiSchema);
9504
+ const headerSchema = await getObjectListHeader$1(uiSchema, listViewName, {
9505
+ onlySecordLine: true,
9506
+ isListviewInit: true
9507
+ });
9071
9508
  defaults.headerSchema = headerSchema;
9072
9509
  }
9073
9510
  ctx.defaults = defaults;
@@ -11696,5 +12133,5 @@ const getInstanceInfo = async ({ instanceId, box }) => {
11696
12133
  };
11697
12134
  };
11698
12135
 
11699
- export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn$1 as getButtonVisibleOn, getButtons, getCalendarSchema, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLookupSapceUserTreeSchema, getNotifications, getObjectDetailButtons, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getPage, getRecord, getRecordDetailHeaderSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getTableSchema, getTenantId, getUISchema, getUISchemaSync, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
12136
+ export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn$1 as getButtonVisibleOn, getButtons, getCalendarSchema, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLookupSapceUserTreeSchema, getNotifications, getObjectDetailButtons, getObjectDetailButtonsSchemas, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectListViewButtonsSchemas, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getPage, getRecord, getRecordDetailHeaderSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getTableSchema, getTenantId, getUISchema, getUISchemaSync, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
11700
12137
  //# sourceMappingURL=index.esm.js.map