@steedos-widgets/amis-object 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.
@@ -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,15 +4334,17 @@ 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
  /*
4336
4344
  * @Author: baozhoutao@steedos.com
4337
4345
  * @Date: 2022-10-28 14:15:09
4338
- * @LastEditors: liaodaxue
4339
- * @LastEditTime: 2023-12-29 10:46:50
4346
+ * @LastEditors: baozhoutao@steedos.com
4347
+ * @LastEditTime: 2024-08-19 16:26:58
4340
4348
  * @Description:
4341
4349
  */
4342
4350
 
@@ -4542,6 +4550,11 @@ const getAmisFileEditSchema = (steedosField)=>{
4542
4550
  convertData.multiple = true;
4543
4551
  convertData.joinValues = false;
4544
4552
  convertData.extractValue = true;
4553
+ if(steedosField.type === 'image'){
4554
+ if(Steedos.isCordova() && Steedos.isCordova()){
4555
+ convertData.accept = "";
4556
+ }
4557
+ }
4545
4558
  }
4546
4559
  return convertData;
4547
4560
  };
@@ -11880,7 +11893,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
11880
11893
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
11881
11894
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
11882
11895
  "align": "right",
11883
- "visibleOn": "${!isLookup}",
11896
+ "visibleOn": "${!isLookup && !!isObjectListview}",
11884
11897
  "buttons": [
11885
11898
  {
11886
11899
  "label": instance.t('frontend_button_listview_control_label'),
@@ -11925,7 +11938,7 @@ const getDisplayAsButton = function(objectName, defaultEnableSplit){
11925
11938
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
11926
11939
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
11927
11940
  "align": "right",
11928
- "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
11941
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup && !!isObjectListview}",
11929
11942
  "buttons": [
11930
11943
  {
11931
11944
  "label": instance.t('frontend_display_as'),
@@ -16600,9 +16613,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
16600
16613
  break;
16601
16614
  case 'percent':
16602
16615
  if(readonly){
16616
+ // convertData = {
16617
+ // type: 'static-tpl',
16618
+ // tpl: Tpl.getUiFieldTpl(field)
16619
+ // }
16603
16620
  convertData = {
16604
- type: 'static-tpl',
16605
- tpl: getUiFieldTpl(field)
16621
+ "type": "static-progress",
16622
+ "name": "progress",
16623
+ pipeIn: (value, data) => {
16624
+ if(value){
16625
+ // 因为例如 1.11 * 100 的值不是111,所以调整下。
16626
+ const result = value*100;
16627
+ return Number(result.toFixed(field.scale));
16628
+ }
16629
+ return value;
16630
+ }
16606
16631
  };
16607
16632
  }else {
16608
16633
  convertData = {
@@ -22342,7 +22367,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
22342
22367
  headerSchema = getObjectListHeader$1(uiSchema, listName, ctx);
22343
22368
  }
22344
22369
  headerSchema.className = "steedos-object-listview-header " + headerSchema.className || "";
22345
- serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
22370
+ serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName, isObjectListview: true });
22346
22371
  if (has(props, 'objectApiName')) {
22347
22372
  serviceData.objectName = objectApiName;
22348
22373
  }
@@ -24765,6 +24790,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
24765
24790
  disabled: true
24766
24791
  });
24767
24792
  }
24793
+ else if (steedosField.type === 'url' && steedosField.show_as_qr) {
24794
+ Object.assign(schema, {
24795
+ type: "control",
24796
+ body: [
24797
+ {
24798
+ "type": "qr-code",
24799
+ "codeSize": inInputTable ? 64 : 128,
24800
+ "name": steedosField.name
24801
+ }
24802
+ ]
24803
+ });
24804
+ }
24768
24805
  Object.assign(schema, steedosField.amis || {});
24769
24806
  return [2 /*return*/, schema];
24770
24807
  case 19: