@steedos-widgets/amis-lib 6.3.4 → 6.3.6

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,15 +1181,17 @@ 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
  /*
1183
1191
  * @Author: baozhoutao@steedos.com
1184
1192
  * @Date: 2022-10-28 14:15:09
1185
- * @LastEditors: liaodaxue
1186
- * @LastEditTime: 2023-12-29 10:46:50
1193
+ * @LastEditors: baozhoutao@steedos.com
1194
+ * @LastEditTime: 2024-08-19 16:26:58
1187
1195
  * @Description:
1188
1196
  */
1189
1197
 
@@ -1389,6 +1397,11 @@ const getAmisFileEditSchema = (steedosField)=>{
1389
1397
  convertData.multiple = true;
1390
1398
  convertData.joinValues = false;
1391
1399
  convertData.extractValue = true;
1400
+ if(steedosField.type === 'image'){
1401
+ if(Steedos.isCordova() && Steedos.isCordova()){
1402
+ convertData.accept = "";
1403
+ }
1404
+ }
1392
1405
  }
1393
1406
  return convertData;
1394
1407
  };
@@ -8727,7 +8740,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
8727
8740
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
8728
8741
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
8729
8742
  "align": "right",
8730
- "visibleOn": "${!isLookup}",
8743
+ "visibleOn": "${!isLookup && !!isObjectListview}",
8731
8744
  "buttons": [
8732
8745
  {
8733
8746
  "label": i18next.t('frontend_button_listview_control_label'),
@@ -8772,7 +8785,7 @@ const getDisplayAsButton = function(objectName, defaultEnableSplit){
8772
8785
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
8773
8786
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
8774
8787
  "align": "right",
8775
- "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
8788
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup && !!isObjectListview}",
8776
8789
  "buttons": [
8777
8790
  {
8778
8791
  "label": i18next.t('frontend_display_as'),
@@ -13447,9 +13460,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
13447
13460
  break;
13448
13461
  case 'percent':
13449
13462
  if(readonly){
13463
+ // convertData = {
13464
+ // type: 'static-tpl',
13465
+ // tpl: Tpl.getUiFieldTpl(field)
13466
+ // }
13450
13467
  convertData = {
13451
- type: 'static-tpl',
13452
- tpl: getUiFieldTpl(field)
13468
+ "type": "static-progress",
13469
+ "name": "progress",
13470
+ pipeIn: (value, data) => {
13471
+ if(value){
13472
+ // 因为例如 1.11 * 100 的值不是111,所以调整下。
13473
+ const result = value*100;
13474
+ return Number(result.toFixed(field.scale));
13475
+ }
13476
+ return value;
13477
+ }
13453
13478
  };
13454
13479
  }else {
13455
13480
  convertData = {