@steedos-widgets/amis-lib 6.10.13 → 6.10.14

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
@@ -4663,7 +4663,41 @@ async function getMobileTableColumns(fields, options){
4663
4663
  tpls.push({ field, tpl });
4664
4664
  }
4665
4665
  }
4666
- const url = getNameTplUrl(nameField, options);
4666
+ function getUrlParams(search = window.location.search) {
4667
+ const params = {};
4668
+ const queryString = search.startsWith('?') ? search.slice(1) : search;
4669
+
4670
+ if (!queryString) return params;
4671
+
4672
+ queryString.split('&').forEach(pair => {
4673
+ const [key, value] = pair.split('=');
4674
+ if (key) {
4675
+ const decodedKey = decodeURIComponent(key);
4676
+ const decodedValue = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : '';
4677
+
4678
+ // 处理数组参数(如:?color=red&color=blue)
4679
+ if (params.hasOwnProperty(decodedKey)) {
4680
+ if (Array.isArray(params[decodedKey])) {
4681
+ params[decodedKey].push(decodedValue);
4682
+ } else {
4683
+ params[decodedKey] = [params[decodedKey], decodedValue];
4684
+ }
4685
+ } else {
4686
+ params[decodedKey] = decodedValue;
4687
+ }
4688
+ }
4689
+ });
4690
+
4691
+ return params;
4692
+ }
4693
+
4694
+ const urlParams = getUrlParams();
4695
+
4696
+ let url = getNameTplUrl(nameField, options);
4697
+ if(options.displayAs === 'split'){
4698
+ const additionalFilters = urlParams['additionalFilters'] || '';
4699
+ url = url + `&additionalFilters=${encodeURIComponent(additionalFilters)}`;
4700
+ }
4667
4701
 
4668
4702
  const columnLines = getMobileLines(tpls);
4669
4703
 
@@ -11148,7 +11182,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11148
11182
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11149
11183
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11150
11184
  "tooltipPlacement": "top",
11151
- "className": "bg-white p-2 rounded text-gray-500 list-view-btn-reload",
11185
+ "className": `bg-white p-2 rounded text-gray-500 list-view-btn-reload ${formFactor === 'SMALL' ? 'hidden' : ''}`,
11152
11186
  "label": "",
11153
11187
  "icon": "fa fa-sync",
11154
11188
  // "visibleOn": "${!showFieldsFilter}",
@@ -11229,7 +11263,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11229
11263
  // if(toolbarCount){
11230
11264
  // toolbars.push(toolbarCount);
11231
11265
  // }
11232
- // toolbars.push(toolbarReloadButton);
11266
+ toolbars.push(toolbarReloadButton);
11233
11267
  toolbars.push(toolbarDQuickSearchBox);
11234
11268
  if(toolbarFilter){
11235
11269
  toolbars.push(toolbarFilter);
@@ -11700,7 +11734,6 @@ async function getObjectCRUD(objectSchema, fields, options){
11700
11734
  }, bodyProps);
11701
11735
 
11702
11736
  }
11703
-
11704
11737
  body = defaultsDeep({}, listSchema, body);
11705
11738
  body = await getCrudSchemaWithDataFilter(body, { crudDataFilter, onCrudDataFilter, amisData, env });
11706
11739
 
@@ -19554,12 +19587,25 @@ const getSubmitActions = async (instance, submitEvents) => {
19554
19587
  expression: "${event.data.instanceFormValidate && event.data.approvalFormValidate}"
19555
19588
  },
19556
19589
  {
19557
- "componentId": "",
19558
- "args": {
19559
- "blank": false,
19560
- "url": Router$1.getObjectListViewPath({appId: "${appId}", objectName: "${objectName}", listViewName: "${side_listview_id}"})
19561
- },
19562
- "actionType": "url",
19590
+ "actionType": "wait",
19591
+ "args": {
19592
+ "time": 300
19593
+ }
19594
+ },
19595
+ {
19596
+ "actionType": "custom",
19597
+ "script": `
19598
+ const appId = context.props.data.appId;
19599
+ const objectName = context.props.data.objectName;
19600
+ const side_listview_id = context.props.data.side_listview_id;
19601
+ const additionalFilters = context.props.data.additionalFilters;
19602
+ if(context.props.data.display === 'split'){
19603
+ window.navigate(\`/app/\${appId}/\${objectName}/view/none?side_object=\${objectName}&side_listview_id=\${side_listview_id}&additionalFilters=\${additionalFilters ? encodeURIComponent(additionalFilters) : ''}\`);
19604
+ window.$(".list-view-btn-reload").click();
19605
+ }else{
19606
+ window.navigate(\`/app/\${appId}/\${objectName}/grid/\${side_listview_id}\`);
19607
+ }
19608
+ `,
19563
19609
  expression: "${event.data.instanceFormValidate && event.data.approvalFormValidate}"
19564
19610
  },
19565
19611
  {
@@ -21026,10 +21072,6 @@ const getFlowFormSchema = async (instance, box) => {
21026
21072
  onEvent: {
21027
21073
  "@data.@instanceDetail.changed": {
21028
21074
  actions: [
21029
- {
21030
- actionType: "custom",
21031
- script:"debugger;",
21032
- },
21033
21075
  {
21034
21076
  componentId:"u:instancePage",
21035
21077
  actionType: "reload"
@@ -21038,6 +21080,10 @@ const getFlowFormSchema = async (instance, box) => {
21038
21080
  },
21039
21081
  "inited": {
21040
21082
  "actions": [
21083
+ {
21084
+ actionType: 'broadcast',
21085
+ eventName: "recordLoaded"
21086
+ },
21041
21087
  {
21042
21088
  "actionType": "setValue",
21043
21089
  "componentId": "instance_form",
@@ -21087,6 +21133,9 @@ const getFlowFormSchema = async (instance, box) => {
21087
21133
  };
21088
21134
  };
21089
21135
 
21136
+ const flowVersionCache = new Map();
21137
+ const formVersionCache = new Map();
21138
+
21090
21139
  const getMoment = ()=>{
21091
21140
  if(window.amisRequire){
21092
21141
  return window.amisRequire("moment");
@@ -21137,17 +21186,29 @@ const getApproveValues = ({ instance, trace, step, approve, box }) => {
21137
21186
  };
21138
21187
 
21139
21188
  const getFlowVersion = async (instance) => {
21140
- const result = await fetchAPI$1(`/api/workflow/flow/${instance.flow._id}/version/${instance.flow_version}`, {
21141
- method: "get"
21142
- });
21143
- return result;
21189
+ const cacheKey = `${instance.flow._id}_${instance.flow_version}`;
21190
+
21191
+ if (!flowVersionCache.has(cacheKey)) {
21192
+ const result = await fetchAPI$1(`/api/workflow/flow/${instance.flow._id}/version/${instance.flow_version}`, {
21193
+ method: "get"
21194
+ });
21195
+ flowVersionCache.set(cacheKey, result);
21196
+ }
21197
+
21198
+ return flowVersionCache.get(cacheKey);
21144
21199
  };
21145
21200
 
21146
21201
  const getFormVersion = async (instance) => {
21147
- const result = await fetchAPI$1(`/api/workflow/form/${instance.form._id}/version/${instance.form_version}`, {
21148
- method: "get"
21149
- });
21150
- return result;
21202
+ const cacheKey = `${instance.form._id}_${instance.form_version}`;
21203
+
21204
+ if (!formVersionCache.has(cacheKey)) {
21205
+ const result = await fetchAPI$1(`/api/workflow/form/${instance.form._id}/version/${instance.form_version}`, {
21206
+ method: "get"
21207
+ });
21208
+ formVersionCache.set(cacheKey, result);
21209
+ }
21210
+
21211
+ return formVersionCache.get(cacheKey);
21151
21212
  };
21152
21213
 
21153
21214
  const getStep = ({ flowVersion, stepId }) => {
@@ -21204,12 +21265,29 @@ const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
21204
21265
  return true;
21205
21266
  };
21206
21267
 
21268
+ // 缓存存储
21269
+ const signCache = new Map();
21207
21270
  const getSpaceUserSign = async (space, handler) => {
21271
+ // 生成缓存键
21272
+ const cacheKey = `${space}_${handler}`;
21273
+
21274
+ // 检查缓存
21275
+ if (signCache.has(cacheKey)) {
21276
+ return signCache.get(cacheKey);
21277
+ }
21278
+
21279
+ // 调用API
21208
21280
  const result = await fetchAPI$1(`/api/v1/space_user_signs?filters=[["space","=","${space}"],["user","=","${handler}"]]&fields=["sign"]`);
21281
+
21282
+ let sign = null;
21209
21283
  if (result?.data?.items && result.data.items.length > 0) {
21210
- return result.data.items[0].sign;
21284
+ sign = result.data.items[0].sign;
21211
21285
  }
21212
- return null;
21286
+
21287
+ // 写入缓存
21288
+ signCache.set(cacheKey, sign);
21289
+
21290
+ return sign;
21213
21291
  };
21214
21292
 
21215
21293
  const getInstanceInfo = async (props) => {