@steedos-widgets/amis-object 6.3.4 → 6.3.5

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.
@@ -1,6 +1,6 @@
1
1
  import React, { createContext, useState, useEffect, createElement } from 'react';
2
2
  import * as _$1 from 'lodash';
3
- import _$1__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, toArray, mergeWith, isString, union, has, map, slice, defaultsDeep as defaultsDeep$1, includes, clone, filter, omitBy, isNil, get as get$1, isObject as isObject$1, trimEnd, isBoolean, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isDate } from 'lodash';
3
+ import _$1__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, has, toArray, mergeWith, isString, union, map, slice, defaultsDeep as defaultsDeep$1, includes, clone, filter, omitBy, isNil, get as get$1, isObject as isObject$1, trimEnd, isBoolean, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isDate } from 'lodash';
4
4
  import { Dropdown, Image, Tabs, Spin, Badge, Skeleton, Modal as Modal$1, message, notification, Button, Space, Drawer as Drawer$1 } from 'antd';
5
5
  import ReactDOM, { createRoot } from 'react-dom';
6
6
 
@@ -4313,12 +4313,18 @@ function getAmisStaticFieldType$1(type, readonly, options){
4313
4313
  * @Author: baozhoutao@steedos.com
4314
4314
  * @Date: 2022-07-13 15:18:03
4315
4315
  * @LastEditors: baozhoutao@steedos.com
4316
- * @LastEditTime: 2023-04-11 10:34:26
4316
+ * @LastEditTime: 2024-08-15 12:12:08
4317
4317
  * @Description:
4318
4318
  */
4319
+ let pageCache = {};
4319
4320
 
4320
4321
  async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
4321
4322
  const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
4323
+
4324
+ if(has(pageCache, api)) {
4325
+ return pageCache[api];
4326
+ }
4327
+
4322
4328
  const page = await fetchAPI(api);
4323
4329
  if (page && page.schema) {
4324
4330
  page.schema = JSON.parse(page.schema);
@@ -4328,8 +4334,10 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
4328
4334
  delete page.schema.data.context;
4329
4335
  delete page.schema.data.global;
4330
4336
  }
4331
- return page;
4337
+ pageCache[api] = page;
4338
+ return JSON.parse(JSON.stringify(page)); //clone page;
4332
4339
  }
4340
+ pageCache[api] = null;
4333
4341
  }
4334
4342
 
4335
4343
  /*
@@ -11880,7 +11888,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
11880
11888
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
11881
11889
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
11882
11890
  "align": "right",
11883
- "visibleOn": "${!isLookup}",
11891
+ "visibleOn": "${!isLookup && !!isObjectListview}",
11884
11892
  "buttons": [
11885
11893
  {
11886
11894
  "label": instance.t('frontend_button_listview_control_label'),
@@ -11925,7 +11933,7 @@ const getDisplayAsButton = function(objectName, defaultEnableSplit){
11925
11933
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
11926
11934
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
11927
11935
  "align": "right",
11928
- "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
11936
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup && !!isObjectListview}",
11929
11937
  "buttons": [
11930
11938
  {
11931
11939
  "label": instance.t('frontend_display_as'),
@@ -16600,9 +16608,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
16600
16608
  break;
16601
16609
  case 'percent':
16602
16610
  if(readonly){
16611
+ // convertData = {
16612
+ // type: 'static-tpl',
16613
+ // tpl: Tpl.getUiFieldTpl(field)
16614
+ // }
16603
16615
  convertData = {
16604
- type: 'static-tpl',
16605
- tpl: getUiFieldTpl(field)
16616
+ "type": "static-progress",
16617
+ "name": "progress",
16618
+ pipeIn: (value, data) => {
16619
+ if(value){
16620
+ // 因为例如 1.11 * 100 的值不是111,所以调整下。
16621
+ const result = value*100;
16622
+ return Number(result.toFixed(field.scale));
16623
+ }
16624
+ return value;
16625
+ }
16606
16626
  };
16607
16627
  }else {
16608
16628
  convertData = {
@@ -22342,7 +22362,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
22342
22362
  headerSchema = getObjectListHeader$1(uiSchema, listName, ctx);
22343
22363
  }
22344
22364
  headerSchema.className = "steedos-object-listview-header " + headerSchema.className || "";
22345
- serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
22365
+ serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName, isObjectListview: true });
22346
22366
  if (has(props, 'objectApiName')) {
22347
22367
  serviceData.objectName = objectApiName;
22348
22368
  }
@@ -24765,6 +24785,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
24765
24785
  disabled: true
24766
24786
  });
24767
24787
  }
24788
+ else if (steedosField.type === 'url' && steedosField.show_as_qr) {
24789
+ Object.assign(schema, {
24790
+ type: "control",
24791
+ body: [
24792
+ {
24793
+ "type": "qr-code",
24794
+ "codeSize": inInputTable ? 64 : 128,
24795
+ "name": steedosField.name
24796
+ }
24797
+ ]
24798
+ });
24799
+ }
24768
24800
  Object.assign(schema, steedosField.amis || {});
24769
24801
  return [2 /*return*/, schema];
24770
24802
  case 19: