@steedos-widgets/amis-lib 6.10.34-beta.4 → 6.10.34-beta.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.
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: "",
@@ -14049,6 +14049,12 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
14049
14049
  columnsTogglable: false
14050
14050
  }
14051
14051
  };
14052
+ if (readonly && !_$1.isEmpty(field.amis)){
14053
+ Object.assign(field.amis, {
14054
+ disabled: true,
14055
+ disabledOn: true
14056
+ });
14057
+ }
14052
14058
  // console.log(`convertData ======>`, field, convertData)
14053
14059
  for (const subField of field.subFields) {
14054
14060
  if(!subField.name.endsWith(".$")){
@@ -17131,8 +17137,7 @@ const getNextStepInput = async (instance, nextStepChangeEvents) => {
17131
17137
  required: true,
17132
17138
  // selectFirst: true,
17133
17139
  autoFill: {
17134
- "new_next_step": "${step}",
17135
- "next_users": null
17140
+ "new_next_step": "${step}"
17136
17141
  },
17137
17142
  "source": {
17138
17143
  "url": "/api/workflow/v2/nextStep?judge=${new_judge}",
@@ -18538,7 +18543,6 @@ const getFieldEditTpl = async (field, label)=>{
18538
18543
  tpl.type = "steedos-input-table";
18539
18544
  tpl.addable = field.permission === "editable";
18540
18545
  tpl.editable = tpl.addable;
18541
- tpl.copyable = tpl.addable;
18542
18546
  tpl.removable = tpl.addable;
18543
18547
  if(tpl.addable){
18544
18548
  tpl.actionData = {
@@ -18641,16 +18645,23 @@ const getFieldReadonlyTpl = async (field, label)=>{
18641
18645
  // tpl.format = 'YYYY-MM-DD HH:mm'
18642
18646
  tpl.tpl = `\${${field.code}.name}`;
18643
18647
  }else if(field.type === 'table'){
18644
- tpl.type = "input-table"; //TODO
18645
- tpl.addable = field.permission === "editable";
18646
- tpl.editable = tpl.addable;
18647
- tpl.removable = tpl.addable;
18648
- tpl.copyable = tpl.addable;
18649
- tpl.columns = [];
18648
+ tpl.type = "steedos-input-table";
18649
+ tpl.disabled = true;
18650
+ tpl.autoGeneratePrimaryKeyValue = true;
18651
+ tpl.fields = [];
18650
18652
  for (const sField of field.fields) {
18651
18653
  if (sField.type != "hidden") {
18654
+ sField.permission = "readonly";
18652
18655
  const column = await getTdInputTpl(sField, true);
18653
- tpl.columns.push(column);
18656
+ // console.log('table column', column, sField);
18657
+ if(column.type === 'steedos-field'){
18658
+ if(sField.visibleOn){
18659
+ column.config.visibleOn = sField.visibleOn;
18660
+ }
18661
+ tpl.fields.push(column.config);
18662
+ }else {
18663
+ tpl.fields.push(column);
18664
+ }
18654
18665
  }
18655
18666
  }
18656
18667
  }else if(field.type === 'html'){
@@ -19150,6 +19161,24 @@ const getScrollToBottomAutoOpenApproveDrawerScript = () => {
19150
19161
  `;
19151
19162
  };
19152
19163
 
19164
+ const checkInstanceFlowVersion = async (instance) => {
19165
+ const flow = await fetchAPI$1(`/api/v1/flows/${instance.flow._id}?fields=["name","current._id"]`, {
19166
+ method: "get"
19167
+ });
19168
+ if (flow.data.current._id !== instance.flowVersion._id) {
19169
+ console.log("checkInstanceFlowVersion: flow version changed");
19170
+ return false;
19171
+ }
19172
+ const form = await fetchAPI$1(`/api/v1/forms/${instance.form._id}?fields=["name","current._id"]`, {
19173
+ method: "get"
19174
+ });
19175
+ if (form.data.current._id !== instance.formVersion._id) {
19176
+ console.log("checkInstanceFlowVersion: form version changed");
19177
+ return false;
19178
+ }
19179
+ return true;
19180
+ };
19181
+
19153
19182
  const getFlowFormSchema = async (instance, box) => {
19154
19183
  const formStyle = instance.formVersion.style || "table";
19155
19184
  let formContentSchema;
@@ -19177,7 +19206,28 @@ const getFlowFormSchema = async (instance, box) => {
19177
19206
  nextStepChangeEvents = onEvent?.nextStepChange?.actions || [];
19178
19207
  nextStepUserChangeEvents = onEvent?.nextStepUserChange?.actions || [];
19179
19208
  }
19180
- // if (box == 'inbox' || box == 'draft') {
19209
+ if (box == 'draft' && instance.state === 'draft') {
19210
+ // 草稿调用流程版本接口确认是否有新版本,有则调用一次暂存接口,它会提示升级并自动刷新浏览器
19211
+ let isFlowVersionChecked = await checkInstanceFlowVersion(instance);
19212
+ if (!isFlowVersionChecked) {
19213
+ initedEvents.push({
19214
+ "actionType": "ajax",
19215
+ "api": {
19216
+ "url": "/api/workflow/v2/instance/save",
19217
+ "method": "post",
19218
+ "sendOn": "",
19219
+ "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;",
19220
+ "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')};",
19221
+ "headers": {
19222
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
19223
+ },
19224
+ "data": {
19225
+ "&": "$$"
19226
+ }
19227
+ }
19228
+ });
19229
+ }
19230
+ }
19181
19231
  if ((box == 'inbox' || box == 'draft') && !!!window.disableAutoOpenApproveDrawer) {
19182
19232
  // 滚动条滚动到底部弹出底部签批drawer窗口
19183
19233
  initedEvents.push({