@steedos-widgets/amis-lib 1.2.6-beta.16 → 1.2.6-beta.18

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,21 +1376,6 @@
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
@@ -2406,6 +2391,166 @@
2406
2391
 
2407
2392
  const executeButton = execute;
2408
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
+
2409
2554
  async function getObjectFieldsFilterButtonSchema(objectSchema) {
2410
2555
  // const amisListViewId = `listview_${objectSchema.name}`;
2411
2556
  return {
@@ -2888,17 +3033,7 @@
2888
3033
  }
2889
3034
  );
2890
3035
 
2891
- const buttons = getListViewButtons(objectSchema, {});
2892
- let amisButtonsSchema = _$1.map(buttons, (button) => {
2893
- return {
2894
- type: 'steedos-object-button',
2895
- name: button.name,
2896
- objectName: button.objectName,
2897
- visibleOn: getButtonVisibleOn$1(button),
2898
- className: `button_${button.name}`
2899
- }
2900
- });
2901
-
3036
+ let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
2902
3037
  const reg = new RegExp('_', 'g');
2903
3038
  const standardIcon = icon && icon.replace(reg, '-');
2904
3039
  return {
@@ -3080,7 +3215,10 @@
3080
3215
  * @returns amisSchema
3081
3216
  */
3082
3217
  function getObjectListHeader$1(objectSchema, listViewName, ctx) {
3083
- let firstLineSchema = getObjectListHeaderFirstLine(objectSchema);
3218
+ if (!ctx) {
3219
+ ctx = {};
3220
+ }
3221
+ let firstLineSchema = getObjectListHeaderFirstLine(objectSchema, listViewName, ctx);
3084
3222
  let body = [firstLineSchema];
3085
3223
  let headerSchema = [{
3086
3224
  "type": "wrapper",
@@ -3101,35 +3239,11 @@
3101
3239
  const { showRecordTitle = true } = options || {};
3102
3240
  // console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
3103
3241
  const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
3104
- const buttons = getObjectDetailButtons(objectSchema, {});
3105
- const moreButtons = getObjectDetailMoreButtons(objectSchema, {
3106
- recordId: recordId,
3107
- objectName: name
3108
- });
3109
- let amisButtonsSchema = _$1.map(buttons, (button) => {
3110
- return {
3111
- type: 'steedos-object-button',
3112
- name: button.name,
3113
- objectName: button.objectName,
3114
- visibleOn: getButtonVisibleOn$1(button),
3115
- className: `button_${button.name}`
3116
- }
3117
- });
3118
- let dropdownButtons = _$1.map(moreButtons, (button) => {
3119
- return {
3120
- type: 'steedos-object-button',
3121
- name: button.name,
3122
- objectName: button.objectName,
3123
- visibleOn: getButtonVisibleOn$1(button),
3124
- }
3125
- });
3126
- const dropdownButtonsSchema = {
3127
- type: "steedos-dropdown-button",
3128
- label: "",
3129
- buttons: dropdownButtons,
3130
- className: 'slds-icon'
3131
- };
3132
- amisButtonsSchema.push(dropdownButtonsSchema);
3242
+
3243
+ let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
3244
+
3245
+ // console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
3246
+
3133
3247
  const reg = new RegExp('_', 'g');
3134
3248
  const standardIcon = icon && icon.replace(reg, '-');
3135
3249
 
@@ -6374,7 +6488,7 @@ setTimeout(()=>{
6374
6488
  }),
6375
6489
  filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
6376
6490
  };
6377
- if(options.formFactor !== 'SMALL'){
6491
+ if(options.formFactor !== 'SMALL' || ["split"].indexOf(options.displayAs) == -1){
6378
6492
  Object.assign(bodyProps, {
6379
6493
  bulkActions: options.bulkActions != false ? bulkActions : false
6380
6494
  });
@@ -6707,6 +6821,21 @@ setTimeout(()=>{
6707
6821
  }
6708
6822
  }
6709
6823
 
6824
+ /*
6825
+ * @Author: baozhoutao@steedos.com
6826
+ * @Date: 2022-08-04 10:42:49
6827
+ * @LastEditors: baozhoutao@steedos.com
6828
+ * @LastEditTime: 2022-08-25 10:28:47
6829
+ * @Description:
6830
+ */
6831
+ var config = {
6832
+ listView: {
6833
+ newRecordMode: 'modal',
6834
+ editRecordMode: 'modal',
6835
+ perPage: 20
6836
+ }
6837
+ };
6838
+
6710
6839
  async function getTableColumns(fields, options){
6711
6840
  const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
6712
6841
  for (const field of fields) {
@@ -7057,7 +7186,7 @@ setTimeout(()=>{
7057
7186
  options = {};
7058
7187
  }
7059
7188
  let columns = [];
7060
- if(options.formFactor === 'SMALL'){
7189
+ if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
7061
7190
  columns = await getMobileTableColumns(fields, options);
7062
7191
  }
7063
7192
  else {
@@ -9126,7 +9255,10 @@ setTimeout(()=>{
9126
9255
  const defaults = ctx.defaults || {};
9127
9256
  if(!defaults.headerSchema){
9128
9257
  //传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
9129
- const headerSchema = await getObjectListHeader$1(uiSchema);
9258
+ const headerSchema = await getObjectListHeader$1(uiSchema, listViewName, {
9259
+ onlySecordLine: true,
9260
+ isListviewInit: true
9261
+ });
9130
9262
  defaults.headerSchema = headerSchema;
9131
9263
  }
9132
9264
  ctx.defaults = defaults;
@@ -11802,6 +11934,7 @@ setTimeout(()=>{
11802
11934
  exports.getLookupSapceUserTreeSchema = getLookupSapceUserTreeSchema;
11803
11935
  exports.getNotifications = getNotifications;
11804
11936
  exports.getObjectDetailButtons = getObjectDetailButtons;
11937
+ exports.getObjectDetailButtonsSchemas = getObjectDetailButtonsSchemas;
11805
11938
  exports.getObjectDetailMoreButtons = getObjectDetailMoreButtons;
11806
11939
  exports.getObjectFieldsFilterBarSchema = getObjectFieldsFilterBarSchema;
11807
11940
  exports.getObjectFieldsFilterButtonSchema = getObjectFieldsFilterButtonSchema;
@@ -11810,6 +11943,7 @@ setTimeout(()=>{
11810
11943
  exports.getObjectListHeaderFieldsFilterBar = getObjectListHeaderFieldsFilterBar;
11811
11944
  exports.getObjectListHeaderFirstLine = getObjectListHeaderFirstLine;
11812
11945
  exports.getObjectListHeaderSecordLine = getObjectListHeaderSecordLine;
11946
+ exports.getObjectListViewButtonsSchemas = getObjectListViewButtonsSchemas;
11813
11947
  exports.getObjectRecordDetailHeader = getObjectRecordDetailHeader;
11814
11948
  exports.getObjectRecordDetailRelatedListHeader = getObjectRecordDetailRelatedListHeader;
11815
11949
  exports.getObjectRelated = getObjectRelated;