@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.
@@ -4341,12 +4341,18 @@ function getAmisStaticFieldType$1(type, readonly, options){
4341
4341
  * @Author: baozhoutao@steedos.com
4342
4342
  * @Date: 2022-07-13 15:18:03
4343
4343
  * @LastEditors: baozhoutao@steedos.com
4344
- * @LastEditTime: 2023-04-11 10:34:26
4344
+ * @LastEditTime: 2024-08-15 12:12:08
4345
4345
  * @Description:
4346
4346
  */
4347
+ let pageCache = {};
4347
4348
 
4348
4349
  async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
4349
4350
  const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
4351
+
4352
+ if(_$1.has(pageCache, api)) {
4353
+ return pageCache[api];
4354
+ }
4355
+
4350
4356
  const page = await fetchAPI(api);
4351
4357
  if (page && page.schema) {
4352
4358
  page.schema = JSON.parse(page.schema);
@@ -4356,8 +4362,10 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
4356
4362
  delete page.schema.data.context;
4357
4363
  delete page.schema.data.global;
4358
4364
  }
4359
- return page;
4365
+ pageCache[api] = page;
4366
+ return JSON.parse(JSON.stringify(page)); //clone page;
4360
4367
  }
4368
+ pageCache[api] = null;
4361
4369
  }
4362
4370
 
4363
4371
  /*
@@ -11908,7 +11916,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
11908
11916
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
11909
11917
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
11910
11918
  "align": "right",
11911
- "visibleOn": "${!isLookup}",
11919
+ "visibleOn": "${!isLookup && !!isObjectListview}",
11912
11920
  "buttons": [
11913
11921
  {
11914
11922
  "label": instance.t('frontend_button_listview_control_label'),
@@ -11953,7 +11961,7 @@ const getDisplayAsButton = function(objectName, defaultEnableSplit){
11953
11961
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
11954
11962
  "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
11955
11963
  "align": "right",
11956
- "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
11964
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup && !!isObjectListview}",
11957
11965
  "buttons": [
11958
11966
  {
11959
11967
  "label": instance.t('frontend_display_as'),
@@ -16628,9 +16636,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
16628
16636
  break;
16629
16637
  case 'percent':
16630
16638
  if(readonly){
16639
+ // convertData = {
16640
+ // type: 'static-tpl',
16641
+ // tpl: Tpl.getUiFieldTpl(field)
16642
+ // }
16631
16643
  convertData = {
16632
- type: 'static-tpl',
16633
- tpl: getUiFieldTpl(field)
16644
+ "type": "static-progress",
16645
+ "name": "progress",
16646
+ pipeIn: (value, data) => {
16647
+ if(value){
16648
+ // 因为例如 1.11 * 100 的值不是111,所以调整下。
16649
+ const result = value*100;
16650
+ return Number(result.toFixed(field.scale));
16651
+ }
16652
+ return value;
16653
+ }
16634
16654
  };
16635
16655
  }else {
16636
16656
  convertData = {
@@ -22370,7 +22390,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
22370
22390
  headerSchema = getObjectListHeader$1(uiSchema, listName, ctx);
22371
22391
  }
22372
22392
  headerSchema.className = "steedos-object-listview-header " + headerSchema.className || "";
22373
- serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
22393
+ serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName, isObjectListview: true });
22374
22394
  if (_$1.has(props, 'objectApiName')) {
22375
22395
  serviceData.objectName = objectApiName;
22376
22396
  }
@@ -24793,6 +24813,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
24793
24813
  disabled: true
24794
24814
  });
24795
24815
  }
24816
+ else if (steedosField.type === 'url' && steedosField.show_as_qr) {
24817
+ Object.assign(schema, {
24818
+ type: "control",
24819
+ body: [
24820
+ {
24821
+ "type": "qr-code",
24822
+ "codeSize": inInputTable ? 64 : 128,
24823
+ "name": steedosField.name
24824
+ }
24825
+ ]
24826
+ });
24827
+ }
24796
24828
  Object.assign(schema, steedosField.amis || {});
24797
24829
  return [2 /*return*/, schema];
24798
24830
  case 19: