@steedos-widgets/amis-object 6.3.3 → 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.
@@ -1371,6 +1371,9 @@ fieldset.antd-Collapse > legend{
1371
1371
  .md\:overflow-auto {
1372
1372
  overflow: auto
1373
1373
  }
1374
+ .md\:border-b {
1375
+ border-bottom-width: 1px
1376
+ }
1374
1377
  }
1375
1378
  @media (min-width: 1024px) {
1376
1379
  .lg\:z-\[1000\] {
@@ -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
  /*
@@ -10958,7 +10966,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
10958
10966
 
10959
10967
  // console.log('=======================max=========================', max)
10960
10968
 
10961
- if(objectSchema.compactLayouts){
10969
+ if(objectSchema.compactLayouts && objectSchema.compactLayouts.length > 0){
10962
10970
  const details = [];
10963
10971
  _.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
10964
10972
  const field = objectSchema.fields[fieldName];
@@ -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'),
@@ -12154,18 +12162,19 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
12154
12162
  }
12155
12163
  let toolbarReloadButton;
12156
12164
  const onReloadScript = `
12157
- // const scope = event.context.scoped;
12158
- // var listView = scope.parent.getComponents().find(function(n){
12159
- // return n.props.type === "crud";
12160
- // });
12161
- // listView.handleChangePage(1);
12162
-
12163
-
12164
12165
  // 触发搜索,而不是reload,因为使用search-box可以在amissdk是3.6.3-patch.8+实现在非第一页的情况下,快速搜索输入框中过滤条件变更时再点刷新可以自动跳转翻页到第一页
12165
12166
  const scope = event.context.scoped;
12166
12167
  const sb = SteedosUI.getClosestAmisComponentByType(scope, "search-box");
12167
- const sbValue = sb.state.value;
12168
- sb.handleSearch(sbValue);
12168
+ if (sb) {
12169
+ const sbValue = sb.state.value;
12170
+ sb.handleSearch(sbValue);
12171
+ }else{
12172
+ var listView = scope.parent.getComponents().find(function(n){
12173
+ return n.props.type === "crud";
12174
+ });
12175
+ listView.handleChangePage(1);
12176
+ }
12177
+
12169
12178
  `;
12170
12179
  toolbarReloadButton = {
12171
12180
  // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
@@ -16627,9 +16636,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
16627
16636
  break;
16628
16637
  case 'percent':
16629
16638
  if(readonly){
16639
+ // convertData = {
16640
+ // type: 'static-tpl',
16641
+ // tpl: Tpl.getUiFieldTpl(field)
16642
+ // }
16630
16643
  convertData = {
16631
- type: 'static-tpl',
16632
- 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
+ }
16633
16654
  };
16634
16655
  }else {
16635
16656
  convertData = {
@@ -22156,6 +22177,7 @@ var SteedosSkeleton = function (props) {
22156
22177
  }))) : null));
22157
22178
  };
22158
22179
 
22180
+ // md:border-b
22159
22181
  var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
22160
22182
  var $schema, recordId, defaultData, mode, _a, layout, labelAlign, appId, fieldsExtend, _b, excludedFields, _c, fields, _d, form, _e, className, enableInitApi, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, enableTabs, tabsMode, submitSuccActions, data, formDataFilter, onFormDataFilter, env, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, allData, schema, schema, formData;
22161
22183
  return __generator(this, function (_f) {
@@ -22368,7 +22390,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
22368
22390
  headerSchema = getObjectListHeader$1(uiSchema, listName, ctx);
22369
22391
  }
22370
22392
  headerSchema.className = "steedos-object-listview-header " + headerSchema.className || "";
22371
- 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 });
22372
22394
  if (_$1.has(props, 'objectApiName')) {
22373
22395
  serviceData.objectName = objectApiName;
22374
22396
  }
@@ -24791,6 +24813,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
24791
24813
  disabled: true
24792
24814
  });
24793
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
+ }
24794
24828
  Object.assign(schema, steedosField.amis || {});
24795
24829
  return [2 /*return*/, schema];
24796
24830
  case 19: