@steedos-widgets/amis-lib 1.2.6-beta.17 → 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.esm.js CHANGED
@@ -1350,21 +1350,6 @@ 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
@@ -2380,6 +2365,166 @@ const execute = (button, props) => {
2380
2365
 
2381
2366
  const executeButton = execute;
2382
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
+
2383
2528
  async function getObjectFieldsFilterButtonSchema(objectSchema) {
2384
2529
  // const amisListViewId = `listview_${objectSchema.name}`;
2385
2530
  return {
@@ -2862,17 +3007,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
2862
3007
  }
2863
3008
  );
2864
3009
 
2865
- const buttons = getListViewButtons(objectSchema, {});
2866
- let amisButtonsSchema = map(buttons, (button) => {
2867
- return {
2868
- type: 'steedos-object-button',
2869
- name: button.name,
2870
- objectName: button.objectName,
2871
- visibleOn: getButtonVisibleOn$1(button),
2872
- className: `button_${button.name}`
2873
- }
2874
- });
2875
-
3010
+ let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
2876
3011
  const reg = new RegExp('_', 'g');
2877
3012
  const standardIcon = icon && icon.replace(reg, '-');
2878
3013
  return {
@@ -3054,7 +3189,10 @@ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ct
3054
3189
  * @returns amisSchema
3055
3190
  */
3056
3191
  function getObjectListHeader$1(objectSchema, listViewName, ctx) {
3057
- let firstLineSchema = getObjectListHeaderFirstLine(objectSchema);
3192
+ if (!ctx) {
3193
+ ctx = {};
3194
+ }
3195
+ let firstLineSchema = getObjectListHeaderFirstLine(objectSchema, listViewName, ctx);
3058
3196
  let body = [firstLineSchema];
3059
3197
  let headerSchema = [{
3060
3198
  "type": "wrapper",
@@ -3075,35 +3213,11 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
3075
3213
  const { showRecordTitle = true } = options || {};
3076
3214
  // console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
3077
3215
  const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
3078
- const buttons = getObjectDetailButtons(objectSchema, {});
3079
- const moreButtons = getObjectDetailMoreButtons(objectSchema, {
3080
- recordId: recordId,
3081
- objectName: name
3082
- });
3083
- let amisButtonsSchema = map(buttons, (button) => {
3084
- return {
3085
- type: 'steedos-object-button',
3086
- name: button.name,
3087
- objectName: button.objectName,
3088
- visibleOn: getButtonVisibleOn$1(button),
3089
- className: `button_${button.name}`
3090
- }
3091
- });
3092
- let dropdownButtons = map(moreButtons, (button) => {
3093
- return {
3094
- type: 'steedos-object-button',
3095
- name: button.name,
3096
- objectName: button.objectName,
3097
- visibleOn: getButtonVisibleOn$1(button),
3098
- }
3099
- });
3100
- const dropdownButtonsSchema = {
3101
- type: "steedos-dropdown-button",
3102
- label: "",
3103
- buttons: dropdownButtons,
3104
- className: 'slds-icon'
3105
- };
3106
- amisButtonsSchema.push(dropdownButtonsSchema);
3216
+
3217
+ let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
3218
+
3219
+ // console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
3220
+
3107
3221
  const reg = new RegExp('_', 'g');
3108
3222
  const standardIcon = icon && icon.replace(reg, '-');
3109
3223
 
@@ -6348,7 +6462,7 @@ async function getObjectCRUD(objectSchema, fields, options){
6348
6462
  }),
6349
6463
  filter: options.filterVisible !== false && await getObjectFilter(objectSchema, fields, options),
6350
6464
  };
6351
- if(options.formFactor !== 'SMALL'){
6465
+ if(options.formFactor !== 'SMALL' || ["split"].indexOf(options.displayAs) == -1){
6352
6466
  Object.assign(bodyProps, {
6353
6467
  bulkActions: options.bulkActions != false ? bulkActions : false
6354
6468
  });
@@ -6681,6 +6795,21 @@ async function getObjectDetail(objectSchema, recordId, ctx){
6681
6795
  }
6682
6796
  }
6683
6797
 
6798
+ /*
6799
+ * @Author: baozhoutao@steedos.com
6800
+ * @Date: 2022-08-04 10:42:49
6801
+ * @LastEditors: baozhoutao@steedos.com
6802
+ * @LastEditTime: 2022-08-25 10:28:47
6803
+ * @Description:
6804
+ */
6805
+ var config = {
6806
+ listView: {
6807
+ newRecordMode: 'modal',
6808
+ editRecordMode: 'modal',
6809
+ perPage: 20
6810
+ }
6811
+ };
6812
+
6684
6813
  async function getTableColumns(fields, options){
6685
6814
  const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
6686
6815
  for (const field of fields) {
@@ -7031,7 +7160,7 @@ async function getTableSchema$1(fields, options){
7031
7160
  options = {};
7032
7161
  }
7033
7162
  let columns = [];
7034
- if(options.formFactor === 'SMALL'){
7163
+ if(options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1){
7035
7164
  columns = await getMobileTableColumns(fields, options);
7036
7165
  }
7037
7166
  else {
@@ -9100,7 +9229,10 @@ async function getListviewInitSchema(objectApiName, listViewName, ctx) {
9100
9229
  const defaults = ctx.defaults || {};
9101
9230
  if(!defaults.headerSchema){
9102
9231
  //传入isListviewInit是区别于对象列表类型的微页面,即getListPageInitSchema函数中该属性为false
9103
- const headerSchema = await getObjectListHeader$1(uiSchema);
9232
+ const headerSchema = await getObjectListHeader$1(uiSchema, listViewName, {
9233
+ onlySecordLine: true,
9234
+ isListviewInit: true
9235
+ });
9104
9236
  defaults.headerSchema = headerSchema;
9105
9237
  }
9106
9238
  ctx.defaults = defaults;
@@ -11729,5 +11861,5 @@ const getInstanceInfo = async ({ instanceId, box }) => {
11729
11861
  };
11730
11862
  };
11731
11863
 
11732
- 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 };
11864
+ 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 };
11733
11865
  //# sourceMappingURL=index.esm.js.map