@steedos-widgets/amis-lib 6.10.34-beta.5 → 6.10.34-beta.7

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
@@ -1214,8 +1214,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1214
1214
  /*
1215
1215
  * @Author: baozhoutao@steedos.com
1216
1216
  * @Date: 2022-10-28 14:15:09
1217
- * @LastEditors: baozhoutao@steedos.com
1218
- * @LastEditTime: 2025-02-13 09:31:02
1217
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1218
+ * @LastEditTime: 2025-12-12 16:47:28
1219
1219
  * @Description:
1220
1220
  */
1221
1221
 
@@ -1363,7 +1363,7 @@ const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
1363
1363
  // <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
1364
1364
  // <% });} %>`
1365
1365
  "type": "control",
1366
- "name": "",//control若存在name,内部each组件的source则会获取不到内容
1366
+ // "name": "",//control若存在name,内部each组件的source则会获取不到内容 //加上这个空nmae字段会造成列表页面报错 TypeError: Unexpected token } in 1:3,移除后原issue #6977 经测试并没有问题
1367
1367
  "body": {
1368
1368
  type: 'each',
1369
1369
  placeholder: "",
@@ -7327,30 +7327,30 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
7327
7327
  let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
7328
7328
  const reg = new RegExp('_', 'g');
7329
7329
  const standardIcon = icon && icon.replace(reg, '-');
7330
- const standardNewButton = _.find(amisButtonsSchema, { name: "standard_new" });
7330
+ _.find(amisButtonsSchema, { name: "standard_new" });
7331
7331
  const buttonSchema = [{
7332
7332
  "type": "flex",
7333
7333
  "items": amisButtonsSchema,
7334
- "visibleOn": "${display == 'split'?false:true}"
7334
+ // "visibleOn": "${display == 'split'?false:true}"
7335
7335
  }];
7336
- if(ctx.formFactor !== 'SMALL'){
7337
- const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
7338
- buttonSchema.push({
7339
- "type": "flex",
7340
- "items":[
7341
- standardNewButton,
7342
- (restButtons.length > 0) && {
7343
- "type": "dropdown-button",
7344
- "buttons": restButtons,
7345
- "className": " ml-1",
7346
- "menuClassName": "p-none split-dropdown-buttons",
7347
- "align": "right",
7348
- "size": "sm"
7349
- }
7350
- ],
7351
- "visibleOn": "${display == 'split'?true:false}"
7352
- });
7353
- }
7336
+ // if(ctx.formFactor !== 'SMALL'){
7337
+ // const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[]
7338
+ // buttonSchema.push({
7339
+ // "type": "flex",
7340
+ // "items":[
7341
+ // standardNewButton,
7342
+ // (restButtons.length > 0) && {
7343
+ // "type": "dropdown-button",
7344
+ // "buttons": restButtons,
7345
+ // "className": " ml-1",
7346
+ // "menuClassName": "p-none split-dropdown-buttons",
7347
+ // "align": "right",
7348
+ // "size": "sm"
7349
+ // }
7350
+ // ],
7351
+ // "visibleOn": "${display == 'split'?true:false}"
7352
+ // })
7353
+ // }
7354
7354
  const listviewNewButton = getNewListviewButtonSchema();
7355
7355
  listviewNewButton.visibleOn = "global.user.is_space_admin";
7356
7356
  return {
@@ -8753,11 +8753,12 @@ function adaptor(){
8753
8753
  const getSettingListviewToolbarButtonSchema = ()=>{
8754
8754
  return {
8755
8755
  "type": "dropdown-button",
8756
+ "hideCaret": true,
8756
8757
  "trigger": "click",
8757
8758
  "icon": "fa fa-cog",
8758
8759
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8759
8760
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
8760
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
8761
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded !text-gray-500",
8761
8762
  "align": "right",
8762
8763
  "visibleOn": "${!isLookup && !!isObjectListview}",
8763
8764
  "buttons": [
@@ -8800,9 +8801,10 @@ const getDisplayAsButton = function(objectName, defaultEnableSplit){
8800
8801
  return {
8801
8802
  "type": "dropdown-button",
8802
8803
  "icon": "fa fa-table-columns",
8804
+ "hideCaret": true,
8803
8805
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8804
8806
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
8805
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
8807
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded !text-gray-500",
8806
8808
  "align": "right",
8807
8809
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup && !!isObjectListview}",
8808
8810
  "buttons": [
@@ -9028,7 +9030,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
9028
9030
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
9029
9031
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
9030
9032
  "tooltipPlacement": "top",
9031
- "className": `bg-white p-2 rounded text-gray-500 list-view-btn-reload ${formFactor === 'SMALL' ? 'hidden' : ''}`,
9033
+ "className": `bg-white p-2 rounded !text-gray-500 list-view-btn-reload ${formFactor === 'SMALL' ? 'hidden' : ''}`,
9032
9034
  "label": "",
9033
9035
  "icon": "fa fa-sync",
9034
9036
  // "visibleOn": "${!showFieldsFilter}",
@@ -9085,7 +9087,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
9085
9087
  "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
9086
9088
  },
9087
9089
  "align": "right",
9088
- "className": "bg-white p-2 rounded text-gray-500",
9090
+ "className": "bg-white p-2 rounded !text-gray-500",
9089
9091
  "onEvent": {
9090
9092
  "click": {
9091
9093
  "actions": [
@@ -17137,8 +17139,7 @@ const getNextStepInput = async (instance, nextStepChangeEvents) => {
17137
17139
  required: true,
17138
17140
  // selectFirst: true,
17139
17141
  autoFill: {
17140
- "new_next_step": "${step}",
17141
- "next_users": null
17142
+ "new_next_step": "${step}"
17142
17143
  },
17143
17144
  "source": {
17144
17145
  "url": "/api/workflow/v2/nextStep?judge=${new_judge}",
@@ -19162,6 +19163,24 @@ const getScrollToBottomAutoOpenApproveDrawerScript = () => {
19162
19163
  `;
19163
19164
  };
19164
19165
 
19166
+ const checkInstanceFlowVersion = async (instance) => {
19167
+ const flow = await fetchAPI$1(`/api/v1/flows/${instance.flow._id}?fields=["name","current._id"]`, {
19168
+ method: "get"
19169
+ });
19170
+ if (flow.data.current._id !== instance.flowVersion._id) {
19171
+ console.log("checkInstanceFlowVersion: flow version changed");
19172
+ return false;
19173
+ }
19174
+ const form = await fetchAPI$1(`/api/v1/forms/${instance.form._id}?fields=["name","current._id"]`, {
19175
+ method: "get"
19176
+ });
19177
+ if (form.data.current._id !== instance.formVersion._id) {
19178
+ console.log("checkInstanceFlowVersion: form version changed");
19179
+ return false;
19180
+ }
19181
+ return true;
19182
+ };
19183
+
19165
19184
  const getFlowFormSchema = async (instance, box) => {
19166
19185
  const formStyle = instance.formVersion.style || "table";
19167
19186
  let formContentSchema;
@@ -19189,7 +19208,28 @@ const getFlowFormSchema = async (instance, box) => {
19189
19208
  nextStepChangeEvents = onEvent?.nextStepChange?.actions || [];
19190
19209
  nextStepUserChangeEvents = onEvent?.nextStepUserChange?.actions || [];
19191
19210
  }
19192
- // if (box == 'inbox' || box == 'draft') {
19211
+ if (box == 'draft' && instance.state === 'draft') {
19212
+ // 草稿调用流程版本接口确认是否有新版本,有则调用一次暂存接口,它会提示升级并自动刷新浏览器
19213
+ let isFlowVersionChecked = await checkInstanceFlowVersion(instance);
19214
+ if (!isFlowVersionChecked) {
19215
+ initedEvents.push({
19216
+ "actionType": "ajax",
19217
+ "api": {
19218
+ "url": "/api/workflow/v2/instance/save",
19219
+ "method": "post",
19220
+ "sendOn": "",
19221
+ "requestAdaptor": "var _SteedosUI$getRef$get, _approveValues$next_s;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues(); const _formValues = JSON.parse(JSON.stringify(formValues)); if(_formValues){delete _formValues.__applicant} \nconst approveValues = (_SteedosUI$getRef$get = context._scoped.getComponentById(\"instance_approval\")) === null || _SteedosUI$getRef$get === void 0 ? void 0 : _SteedosUI$getRef$get.getValues();\nlet nextUsers = approveValues === null || approveValues === void 0 ? void 0 : approveValues.next_users;\nif (_.isString(nextUsers)) {\n nextUsers = [approveValues.next_users];\n}\nconst instance = context.record;\nconst body = {\n instance: {\n _id: instance._id,\n applicant: context.__applicant,\n submitter: formValues.submitter,\n traces: [{\n _id: instance.trace._id,\n step: instance.step._id,\n approves: [{\n _id: instance.approve._id,\n next_steps: [{\n step: approveValues === null || approveValues === void 0 || (_approveValues$next_s = approveValues.next_step) === null || _approveValues$next_s === void 0 ? void 0 : _approveValues$next_s._id,\n users: nextUsers\n }],\n description: approveValues === null || approveValues === void 0 ? void 0 : approveValues.suggestion,\n values: _formValues\n }]\n }]\n }\n};\napi.data = body;\nreturn api;",
19222
+ "adaptor": "if (payload.instance == \"upgraded\") { window.setTimeout(function(){ window.location.reload(); }, 2000); return {...payload, status: 1, msg: t('instance_action_instance_save_msg_upgraded')}; } \n return payload.instance === true ? {...payload, status: 0, msg: ''} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
19223
+ "headers": {
19224
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
19225
+ },
19226
+ "data": {
19227
+ "&": "$$"
19228
+ }
19229
+ }
19230
+ });
19231
+ }
19232
+ }
19193
19233
  if ((box == 'inbox' || box == 'draft') && !!!window.disableAutoOpenApproveDrawer) {
19194
19234
  // 滚动条滚动到底部弹出底部签批drawer窗口
19195
19235
  initedEvents.push({