@steedos-widgets/amis-lib 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.
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, forEach, includes, trimEnd, isBoolean, omitBy, isNil, toArray, mergeWith, get, map, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, clone, filter, startsWith } from 'lodash';
2
+ import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, includes, trimEnd, has, isBoolean, omitBy, isNil, toArray, mergeWith, get, map, isString, union, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, clone, filter, startsWith } from 'lodash';
3
3
  import i18next from 'i18next';
4
4
  export { default as i18next } from 'i18next';
5
5
  import { initReactI18next } from 'react-i18next';
@@ -1160,12 +1160,18 @@ function getAmisStaticFieldType(type, readonly, options){
1160
1160
  * @Author: baozhoutao@steedos.com
1161
1161
  * @Date: 2022-07-13 15:18:03
1162
1162
  * @LastEditors: baozhoutao@steedos.com
1163
- * @LastEditTime: 2023-04-11 10:34:26
1163
+ * @LastEditTime: 2024-08-15 12:12:08
1164
1164
  * @Description:
1165
1165
  */
1166
+ let pageCache = {};
1166
1167
 
1167
1168
  async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
1168
1169
  const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
1170
+
1171
+ if(has(pageCache, api)) {
1172
+ return pageCache[api];
1173
+ }
1174
+
1169
1175
  const page = await fetchAPI(api);
1170
1176
  if (page && page.schema) {
1171
1177
  page.schema = JSON.parse(page.schema);
@@ -1175,8 +1181,10 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1175
1181
  delete page.schema.data.context;
1176
1182
  delete page.schema.data.global;
1177
1183
  }
1178
- return page;
1184
+ pageCache[api] = page;
1185
+ return JSON.parse(JSON.stringify(page)); //clone page;
1179
1186
  }
1187
+ pageCache[api] = null;
1180
1188
  }
1181
1189
 
1182
1190
  /*
@@ -8727,7 +8735,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
8727
8735
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
8728
8736
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
8729
8737
  "align": "right",
8730
- "visibleOn": "${!isLookup}",
8738
+ "visibleOn": "${!isLookup && !!isObjectListview}",
8731
8739
  "buttons": [
8732
8740
  {
8733
8741
  "label": i18next.t('frontend_button_listview_control_label'),
@@ -8772,7 +8780,7 @@ const getDisplayAsButton = function(objectName, defaultEnableSplit){
8772
8780
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
8773
8781
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
8774
8782
  "align": "right",
8775
- "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
8783
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup && !!isObjectListview}",
8776
8784
  "buttons": [
8777
8785
  {
8778
8786
  "label": i18next.t('frontend_display_as'),
@@ -13447,9 +13455,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
13447
13455
  break;
13448
13456
  case 'percent':
13449
13457
  if(readonly){
13458
+ // convertData = {
13459
+ // type: 'static-tpl',
13460
+ // tpl: Tpl.getUiFieldTpl(field)
13461
+ // }
13450
13462
  convertData = {
13451
- type: 'static-tpl',
13452
- tpl: getUiFieldTpl(field)
13463
+ "type": "static-progress",
13464
+ "name": "progress",
13465
+ pipeIn: (value, data) => {
13466
+ if(value){
13467
+ // 因为例如 1.11 * 100 的值不是111,所以调整下。
13468
+ const result = value*100;
13469
+ return Number(result.toFixed(field.scale));
13470
+ }
13471
+ return value;
13472
+ }
13453
13473
  };
13454
13474
  }else {
13455
13475
  convertData = {