@steedos-widgets/amis-object 3.6.2-beta.5 → 3.6.2-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.
@@ -4556,9 +4556,9 @@ var frontend_display_type_is_split = "分栏视图";
4556
4556
  var frontend_display_as = "显示为";
4557
4557
  var frontend_record_sum = "个项目";
4558
4558
  var frontend_button_reload_tooltip = "刷新";
4559
- var frontend_button_search_tooltip = "筛选";
4559
+ var frontend_button_search_tooltip = "搜索";
4560
4560
  var frontend_fields_filter_button_search = "搜索";
4561
- var frontend_fields_filter_button_settings = "设置搜索项";
4561
+ var frontend_fields_filter_button_settings = "选择搜索项";
4562
4562
  var frontend_button_listview_control_tooltip = "列表视图控制";
4563
4563
  var frontend_button_listview_control_label = "列表视图控制";
4564
4564
  var frontend_listview_control_columns = "显示的列";
@@ -5212,12 +5212,11 @@ async function getTableColumns$1(fields, options){
5212
5212
  //增加quickEdit属性,实现快速编辑
5213
5213
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
5214
5214
  let className = "";
5215
- //crud内默认换行
5216
- // if(field.wrap != true){
5217
- // className += " whitespace-nowrap "
5218
- // }else{
5219
- // className += " break-words "
5220
- // }
5215
+ if(field.wrap != true){
5216
+ className += " whitespace-nowrap ";
5217
+ }else {
5218
+ className += " break-words ";
5219
+ }
5221
5220
  let columnItem;
5222
5221
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
5223
5222
  const previewFileScript = `
@@ -5749,7 +5748,7 @@ async function getTableSchema$1(fields, options){
5749
5748
  }
5750
5749
  return {
5751
5750
  mode: "cards",
5752
- perPageAvailable: [5, 10, 20, 50, 100, 500],
5751
+ perPageAvailable: [20, 50, 100, 500],
5753
5752
  name: "thelist",
5754
5753
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
5755
5754
  className: "",
@@ -5782,7 +5781,7 @@ async function getTableSchema$1(fields, options){
5782
5781
 
5783
5782
  return {
5784
5783
  mode: "table",
5785
- perPageAvailable: [5, 10, 20, 50, 100, 500],
5784
+ perPageAvailable: [20, 50, 100, 500],
5786
5785
  name: "thelist",
5787
5786
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
5788
5787
  className: "",
@@ -6288,7 +6287,7 @@ function getReadonlyFormAdaptor(object, fields, options){
6288
6287
  payload.data.__objectName = "${object.name}";
6289
6288
  payload.data.record = record;
6290
6289
 
6291
- payload.data.name = record.${object.NAME_FIELD_KEY || 'name'};
6290
+ payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
6292
6291
  payload.data._master = {
6293
6292
  record: record,
6294
6293
  objectName: "${object.name}",
@@ -6443,7 +6442,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
6443
6442
  cache: API_CACHE,
6444
6443
  requestAdaptor: `
6445
6444
  // 所有不想在network请求中发送的数据都应该从data中分离出来,data变量只需要留下query才需要发送出去
6446
- var { recordId, objectName, uiSchema, global, context, ...data} = api.data;
6445
+ var { recordId, objectName, uiSchema, global, context, _master, ...data} = api.data;
6447
6446
  if(!recordId){
6448
6447
  // 新建则不请求任何数据
6449
6448
  data.query = "{data:" + objectName + "(filters: " + JSON.stringify(["_id", "=", null]) + ", top: 1){_id}}";
@@ -6518,15 +6517,17 @@ async function getEditFormInitApi(object, recordId, fields, options){
6518
6517
  }
6519
6518
  // data下的变量需要在保存接口(getSaveApi)中被删除。
6520
6519
  payload.data = {
6521
- ...initialValues
6520
+ ...initialValues,
6521
+ editFormInited: true
6522
6522
  }
6523
6523
  ${options.initApiAdaptor || ''}
6524
+ // console.log('getEditFormInitApi======>', payload);
6524
6525
  return payload;
6525
6526
  `,
6526
- responseData: {
6527
- initialValues: "$$",
6528
- editFormInited: true
6529
- },
6527
+ // responseData: {
6528
+ // initialValues: "$$",
6529
+ // editFormInited: true
6530
+ // },
6530
6531
  data: data,
6531
6532
  headers: {
6532
6533
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
@@ -9816,8 +9817,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9816
9817
  },
9817
9818
  {
9818
9819
  "type": "tpl",
9819
- "tpl": "${name}",
9820
- // "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
9820
+ "tpl": "${NAME_FIELD_VALUE}",
9821
9821
  "inline": false,
9822
9822
  "wrapperComponent": "",
9823
9823
  "className": "record-detail-header-name leading-5 text-xl font-bold"
@@ -9904,7 +9904,6 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9904
9904
  type: 'service',
9905
9905
  id: `page_readonly_${name}_header`,
9906
9906
  name: `page`,
9907
- data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
9908
9907
  body: body,
9909
9908
  className: ''
9910
9909
  }
@@ -11111,7 +11110,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11111
11110
  {
11112
11111
  "type": "search-box",
11113
11112
  "name": keywordsSearchBoxName,
11114
- "placeholder": "搜索此列表",
11113
+ "placeholder": "快捷搜索",
11115
11114
  "value": crudKeywords,
11116
11115
  // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
11117
11116
  "clearAndSubmit": true,
@@ -11712,7 +11711,9 @@ async function getObjectCRUD(objectSchema, fields, options){
11712
11711
  return payload;
11713
11712
  `
11714
11713
  },
11715
- rowClassNameExpr: options.rowClassNameExpr
11714
+ // 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
11715
+ // 使用表达式给tr添加初始选中状态
11716
+ rowClassNameExpr: options.rowClassNameExpr || "<%= data._id === data.recordId ? 'steedos-record-tr steedos-record-tr-' + data._id + ' steedos-record-selected' : 'steedos-record-tr steedos-record-tr-' + data._id %>"
11716
11717
  }, bodyProps);
11717
11718
 
11718
11719
  }
@@ -11727,7 +11728,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11727
11728
 
11728
11729
  if(body.columns && options.formFactor != 'SMALL'){
11729
11730
  //将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
11730
- body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${}"});
11731
+ body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
11731
11732
  }
11732
11733
 
11733
11734
  if (defaults) {
@@ -11862,9 +11863,7 @@ async function getObjectForm(objectSchema, ctx){
11862
11863
  id: `service_${formSchema.id}`,
11863
11864
  className: 'p-0',
11864
11865
  name: `page_edit_${recordId}`,
11865
- api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
11866
11866
  data:{
11867
- editFormInited: false,
11868
11867
  ...amisData
11869
11868
  },
11870
11869
  // data: {global: getGlobalData('edit'), recordId: recordId, objectName: objectSchema.name, context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
@@ -11873,8 +11872,9 @@ async function getObjectForm(objectSchema, ctx){
11873
11872
  body: [defaultsDeep({}, formSchema, {
11874
11873
  type: "form",
11875
11874
  mode: layout,
11875
+ initApi: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
11876
11876
  data: {
11877
- "&": "${initialValues}"
11877
+ editFormInited: false,
11878
11878
  },
11879
11879
  labelAlign,
11880
11880
  persistData: false,
@@ -11888,11 +11888,15 @@ async function getObjectForm(objectSchema, ctx){
11888
11888
  submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
11889
11889
  api: await getSaveApi(objectSchema, recordId, fields, ctx),
11890
11890
  initFetch: recordId != 'new',
11891
- body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
11891
+ body: {
11892
+ type: 'wrapper',
11893
+ className: 'p-0 m-0',
11894
+ body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
11895
+ hiddenOn: "${editFormInited != true}",
11896
+ },
11892
11897
  panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
11893
11898
  bodyClassName: 'p-0',
11894
11899
  className: 'steedos-amis-form',
11895
- hiddenOn: "${editFormInited != true}",
11896
11900
  onEvent: {
11897
11901
  "submitSucc": {
11898
11902
  "weight": 0,
@@ -12504,7 +12508,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
12504
12508
  * @Author: baozhoutao@steedos.com
12505
12509
  * @Date: 2022-07-05 15:55:39
12506
12510
  * @LastEditors: baozhoutao@steedos.com
12507
- * @LastEditTime: 2024-01-15 15:50:40
12511
+ * @LastEditTime: 2024-01-16 11:14:34
12508
12512
  * @Description:
12509
12513
  */
12510
12514
 
@@ -13058,88 +13062,73 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
13058
13062
  }
13059
13063
  }
13060
13064
 
13061
- async function getRecordServiceSchema(objectName, appId, props = {}) {
13065
+ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
13062
13066
  const uiSchema = await getUISchema(objectName);
13063
13067
  const fields = _$1__default.values(uiSchema.fields);
13068
+ const serviceId = `u:steedos-record-service-${objectName}`;
13064
13069
  return {
13065
13070
  uiSchema,
13066
13071
  amisSchema: {
13067
- "type": "service",
13068
- className: 'steedos-record-service p-0 md:p-2',
13069
- api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
13070
- "body": {
13071
- "type": "wrapper",
13072
- "className": "p-0 m-0",
13073
- "body": [],
13074
- "hiddenOn": "${recordLoaded != true}"
13075
- },
13076
- data: {
13077
- "_master.objectName": "${objectName}",
13078
- "_master.recordId": "${recordId}",
13079
- ...(props.data || {})
13080
- },
13081
- "style": {
13082
- // "padding": "var(--Page-body-padding)",
13083
- ...props.style
13084
- },
13072
+ type: 'service',
13073
+ className: "p-0 m-0",
13085
13074
  onEvent: {
13086
13075
  [`@data.changed.${objectName}`]: {
13087
- "actions": [
13088
- {
13089
- "actionType": "reload",
13090
- "expression": "this.__deletedRecord != true"
13091
- },
13092
- {
13093
- "actionType": "custom",
13094
- "script": "window.goBack()",
13095
- "expression": "this.__deletedRecord === true"
13096
- }
13097
- ]
13098
- },
13099
- // 如果定义了fetchInited,则无法接收到广播事件@data.changed
13100
- // "fetchInited": {
13101
- // "weight": 0,
13102
- // "actions": [
13103
- // // {
13104
- // // actionType: 'broadcast',
13105
- // // eventName: "recordLoaded",
13106
- // // args: {
13107
- // // eventName: "recordLoaded"
13108
- // // },
13109
- // // data: {
13110
- // // objectName: "${event.data.__objectName}",
13111
- // // record: "${event.data.__record}"
13112
- // // },
13113
- // // expression: "${event.data.__response.error != true}"
13114
- // // },
13115
- // {
13116
- // "actionType": "setValue",
13117
- // "args": {
13118
- // value: {
13119
- // "recordLoaded": true,
13120
- // }
13121
- // },
13122
- // expression: "${event.data.__response.error != true}"
13123
- // }
13124
- // ]
13125
- // },
13126
- "recordLoaded": {
13127
13076
  "actions": [
13128
13077
  {
13129
13078
  "actionType": "reload",
13130
- "data": {
13131
- "name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
13132
- "_master.record": `\${record}`,
13133
- // 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
13134
- "_master.objectName": "${objectName}",
13135
- "_master.recordId": "${recordId}"
13136
- }
13079
+ "componentId": serviceId,
13080
+ "expression": "this.__deletedRecord != true"
13081
+ },
13082
+ {
13083
+ "actionType": "custom",
13084
+ "script": "window.goBack()",
13085
+ "expression": "this.__deletedRecord === true"
13137
13086
  }
13138
13087
  ]
13139
13088
  },
13140
- ...props.onEvent
13089
+ },
13090
+ body: {
13091
+ "type": "service",
13092
+ id: serviceId,
13093
+ className: 'steedos-record-service p-0 md:p-2',
13094
+ api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
13095
+ body: {
13096
+ "type": "wrapper",
13097
+ "className": "p-0 m-0",
13098
+ "body": body || [],
13099
+ "hiddenOn": "${recordLoaded != true}"
13100
+ },
13101
+ data: {
13102
+ "_master.objectName": "${objectName}",
13103
+ "_master.recordId": "${recordId}",
13104
+ ...(props.data || {})
13105
+ },
13106
+ "style": {
13107
+ // "padding": "var(--Page-body-padding)",
13108
+ ...props.style
13109
+ },
13110
+ onEvent: {
13111
+ // 如果定义了fetchInited,则无法接收到广播事件@data.changed
13112
+ "fetchInited": {
13113
+ "weight": 0,
13114
+ "actions": [
13115
+ {
13116
+ actionType: 'broadcast',
13117
+ eventName: "recordLoaded",
13118
+ data: {
13119
+ objectName: "${event.data.__objectName}",
13120
+ record: "${event.data.record}"
13121
+ },
13122
+ expression: "${event.data.__response.error != true}"
13123
+ },
13124
+ ]
13125
+ },
13126
+ ...props.onEvent
13127
+ }
13141
13128
  }
13142
13129
  }
13130
+
13131
+
13143
13132
  }
13144
13133
  }
13145
13134
 
@@ -16035,7 +16024,7 @@ async function getFormBody(permissionFields, formFields, ctx){
16035
16024
  * @Author: 殷亮辉 yinlianghui@hotoa.com
16036
16025
  * @Date: 2023-11-15 09:50:22
16037
16026
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
16038
- * @LastEditTime: 2024-01-15 17:50:02
16027
+ * @LastEditTime: 2024-01-16 14:58:51
16039
16028
  */
16040
16029
 
16041
16030
  /**
@@ -16972,39 +16961,45 @@ const getAmisInputTableSchema = async (props) => {
16972
16961
  if (!props.primaryKey) {
16973
16962
  props.primaryKey = "_id";
16974
16963
  }
16964
+ let showOperation = props.showOperation;
16965
+ if(showOperation !== false){
16966
+ showOperation = true;
16967
+ }
16975
16968
  let serviceId = getComponentId("table_service", props.id);
16976
16969
  let buttonsForColumnOperations = [];
16977
16970
  let inlineEditMode = props.inlineEditMode;
16978
16971
  let showAsInlineEditMode = inlineEditMode && props.editable;
16979
- if (props.editable) {
16980
- let showEditButton = true;
16981
- if (showAsInlineEditMode) {
16982
- // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
16983
- showEditButton = true;
16984
- // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
16985
- // if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16986
- // showEditButton = true;
16987
- // }
16988
- // else {
16989
- // showEditButton = false;
16990
- // }
16972
+ if(showOperation){
16973
+ if (props.editable) {
16974
+ let showEditButton = true;
16975
+ if (showAsInlineEditMode) {
16976
+ // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
16977
+ showEditButton = true;
16978
+ // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
16979
+ // if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16980
+ // showEditButton = true;
16981
+ // }
16982
+ // else {
16983
+ // showEditButton = false;
16984
+ // }
16985
+ }
16986
+ // 编辑时显示编辑按钮
16987
+ if (showEditButton) {
16988
+ let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
16989
+ buttonsForColumnOperations.push(buttonEditSchema);
16990
+ }
16991
+ }
16992
+ else {
16993
+ // 只读时显示查看按钮
16994
+ // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
16995
+ let buttonViewSchema = await getButtonView(props);
16996
+ buttonsForColumnOperations.push(buttonViewSchema);
16991
16997
  }
16992
- // 编辑时显示编辑按钮
16993
- if (showEditButton) {
16994
- let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
16995
- buttonsForColumnOperations.push(buttonEditSchema);
16998
+ if (props.removable) {
16999
+ let buttonDeleteSchema = await getButtonDelete(props);
17000
+ buttonsForColumnOperations.push(buttonDeleteSchema);
16996
17001
  }
16997
17002
  }
16998
- else {
16999
- // 只读时显示查看按钮
17000
- // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
17001
- let buttonViewSchema = await getButtonView(props);
17002
- buttonsForColumnOperations.push(buttonViewSchema);
17003
- }
17004
- if (props.removable) {
17005
- let buttonDeleteSchema = await getButtonDelete(props);
17006
- buttonsForColumnOperations.push(buttonDeleteSchema);
17007
- }
17008
17003
  let inputTableSchema = {
17009
17004
  "type": "input-table",
17010
17005
  "label": props.label,
@@ -17051,7 +17046,7 @@ const getAmisInputTableSchema = async (props) => {
17051
17046
  return item.depend_on;
17052
17047
  });
17053
17048
  if (isAnyFieldHasDependOn) {
17054
- // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式
17049
+ // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式,因为strictMode模式下,dependOn的字段值变更后,不会rerender整个子表
17055
17050
  Object.assign(inputTableSchema, {
17056
17051
  strictMode: false
17057
17052
  });
@@ -17156,7 +17151,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
17156
17151
  // 获取
17157
17152
  async function getRecordPageInitSchema(objectApiName){
17158
17153
  const relatedList = await getObjectRelatedList(objectApiName);
17159
- const uiSchema = await getUISchema(objectApiName);
17154
+ await getUISchema(objectApiName);
17160
17155
  let body = [
17161
17156
  // detailHeaderAmisSchema,
17162
17157
  {
@@ -17164,28 +17159,7 @@ async function getRecordPageInitSchema(objectApiName){
17164
17159
  "label": "标题面板",
17165
17160
  "objectApiName": "${objectName}",
17166
17161
  "recordId": "${recordId}",
17167
- "onEvent": {
17168
- "recordLoaded": {
17169
- "actions": [
17170
- {
17171
- "actionType": "setValue",
17172
- "args": {
17173
- "value": {
17174
- "recordLoaded": true,
17175
- }
17176
- }
17177
- },
17178
- {
17179
- "actionType": "reload",
17180
- "data": {
17181
- "name": `\${record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
17182
- "record": `\${record}`,
17183
- "recordLoaded": true,
17184
- }
17185
- }
17186
- ]
17187
- }
17188
- }
17162
+ "onEvent": {}
17189
17163
  }
17190
17164
  ];
17191
17165
  let contentBody = {
@@ -20062,7 +20036,7 @@ var AmisObjectButton = function (props) {
20062
20036
  if (schema && className) {
20063
20037
  schema.className = schema.className + ' steedos-object-button ' + className;
20064
20038
  }
20065
- var renderData = Object.assign(data, { objectName: objectName, app_id: appId, className: className });
20039
+ var renderData = Object.assign({}, { objectName: objectName, app_id: appId, className: className });
20066
20040
  if (data._id) {
20067
20041
  renderData.recordId = data._id;
20068
20042
  }
@@ -20555,7 +20529,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
20555
20529
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
20556
20530
  },
20557
20531
  "requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
20558
- "adaptor": "\n // console.log('service listview schemaApi adaptor....', api.body); \n let { appId, objectName, defaultListName: listName, display, formFactor: defaultFormFactor, uiSchema} = api.body;\n if(api.body.listName){\n listName = api.body.listName;\n }\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n listViewSchemaProps.displayAs = display;\n // console.log(\"====listViewSchemaProps===>\", listName, display, listViewSchemaProps)\n const crud_mode = listView.crud_mode;\n if(crud_mode){\n if(!listViewSchemaProps.defaults.listSchema.mode){\n // \u8FD9\u91CC\u4F18\u5148\u8BA4\u5FAE\u9875\u9762\u4E2D\u4E3A\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\uFF0C\n // \u53EA\u6709\u7EC4\u4EF6\u4E2D\u672A\u914D\u7F6E\u8BE5\u5C5E\u6027\u65F6\u624D\u53D6\u5143\u6570\u636E\u4E2D\u4E3A\u5F53\u524D\u5217\u8868\u89C6\u56FE\u914D\u7F6E\u7684crud_mode\u5C5E\u6027\u4F5C\u4E3Acrud\u7684mode\u503C\n // \u4E0D\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u662F\u56E0\u4E3A\u5728\u754C\u9762\u4E0A\u65B0\u5EFA\u7F16\u8F91\u5217\u8868\u89C6\u56FE\u65F6\uFF0Ccrud_mode\u5B57\u6BB5\u503C\u9ED8\u8BA4\u503C\u662Ftable\uFF0C\u8FD9\u4F1A\u8BA9\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u4E2D\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u4E0D\u751F\u6548\n // \u5982\u679C\u60F3\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u53EA\u8981\u628A\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u6E05\u9664\u5373\u53EF\n listViewSchemaProps.defaults.listSchema.mode = crud_mode;\n }\n }\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n try{\n const uiSchema = schema.uiSchema;\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n if(listView){\n window.Steedos && window.Steedos.setDocumentTitle && window.Steedos.setDocumentTitle({pageName: listView.label || listView.name})\n }\n }catch(e){\n console.error(e)\n }\n payload.data = schema.amisSchema;\n console.log(\"payload================>\", payload)\n resolve(payload)\n });\n });\n ")
20532
+ "adaptor": "\n // console.log('service listview schemaApi adaptor....', api.body); \n let { appId, objectName, defaultListName: listName, display, formFactor: defaultFormFactor, uiSchema} = api.body;\n if(api.body.listName){\n listName = api.body.listName;\n }\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n listViewSchemaProps.displayAs = display;\n // console.log(\"====listViewSchemaProps===>\", listName, display, listViewSchemaProps)\n const crud_mode = listView.crud_mode;\n if(crud_mode){\n if(!listViewSchemaProps.defaults.listSchema.mode){\n // \u8FD9\u91CC\u4F18\u5148\u8BA4\u5FAE\u9875\u9762\u4E2D\u4E3A\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\uFF0C\n // \u53EA\u6709\u7EC4\u4EF6\u4E2D\u672A\u914D\u7F6E\u8BE5\u5C5E\u6027\u65F6\u624D\u53D6\u5143\u6570\u636E\u4E2D\u4E3A\u5F53\u524D\u5217\u8868\u89C6\u56FE\u914D\u7F6E\u7684crud_mode\u5C5E\u6027\u4F5C\u4E3Acrud\u7684mode\u503C\n // \u4E0D\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u662F\u56E0\u4E3A\u5728\u754C\u9762\u4E0A\u65B0\u5EFA\u7F16\u8F91\u5217\u8868\u89C6\u56FE\u65F6\uFF0Ccrud_mode\u5B57\u6BB5\u503C\u9ED8\u8BA4\u503C\u662Ftable\uFF0C\u8FD9\u4F1A\u8BA9\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u4E2D\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u4E0D\u751F\u6548\n // \u5982\u679C\u60F3\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u53EA\u8981\u628A\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u6E05\u9664\u5373\u53EF\n listViewSchemaProps.defaults.listSchema.mode = crud_mode;\n }\n }\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n try{\n const uiSchema = schema.uiSchema;\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n if(listView){\n window.Steedos && window.Steedos.setDocumentTitle && window.Steedos.setDocumentTitle({pageName: listView.label || listView.name})\n }\n }catch(e){\n console.error(e)\n }\n payload.data = schema.amisSchema;\n resolve(payload)\n });\n });\n ")
20559
20533
  },
20560
20534
  // "body": body,
20561
20535
  // "data": serviceData
@@ -20713,31 +20687,15 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
20713
20687
  }); };
20714
20688
 
20715
20689
  var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20716
- var _a, className, schemaFilter, showButtons, showBackButton, objectUiSchema, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
20690
+ var _a, className, schemaFilter, showButtons, showBackButton, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
20717
20691
  return __generator(this, function (_d) {
20718
20692
  switch (_d.label) {
20719
20693
  case 0:
20720
20694
  _a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 bg-gray-100 border-b sm:rounded sm:border border-gray-300 p-0' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
20721
20695
  return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
20722
20696
  case 1:
20723
- objectUiSchema = _d.sent();
20724
- defaultOnEvent = {
20725
- "recordLoaded": {
20726
- "actions": [
20727
- {
20728
- "actionType": "reload",
20729
- "data": {
20730
- "name": "${event.data.record.".concat((objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.NAME_FIELD_KEY) || 'name', "}"),
20731
- "record": "${event.data.record}",
20732
- "_id": "\${event.data.record._id}",
20733
- "recordId": "\${event.data.record._id}",
20734
- "recordLoaded": true,
20735
- },
20736
- "expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
20737
- }
20738
- ]
20739
- }
20740
- };
20697
+ _d.sent();
20698
+ defaultOnEvent = {};
20741
20699
  props.$schema, recordId = props.recordId, _b = props.onEvent, onEvent = _b === void 0 ? defaultOnEvent : _b, _c = props.showRecordTitle, showRecordTitle = _c === void 0 ? true : _c;
20742
20700
  objectApiName = props.objectApiName || "space_users";
20743
20701
  return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton })];
@@ -20807,7 +20765,7 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
20807
20765
  * @Author: baozhoutao@steedos.com
20808
20766
  * @Date: 2022-12-08 10:32:17
20809
20767
  * @LastEditors: baozhoutao@steedos.com
20810
- * @LastEditTime: 2024-01-15 15:52:55
20768
+ * @LastEditTime: 2024-01-16 14:09:23
20811
20769
  * @Description:
20812
20770
  */
20813
20771
  var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -20826,16 +20784,16 @@ var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void
20826
20784
  if (props.$$editor) {
20827
20785
  options.isEditor = true;
20828
20786
  }
20829
- return [4 /*yield*/, getRecordServiceSchema(objectApiName, appId, options)];
20787
+ return [4 /*yield*/, getRecordServiceSchema(objectApiName, appId, options, body)];
20830
20788
  case 1:
20831
20789
  schema = (_b.sent()).amisSchema;
20832
- if (body) {
20833
- schema.body.body = body;
20834
- }
20835
20790
  if (className) {
20836
20791
  schema.className = className;
20837
20792
  }
20838
20793
  if (style) {
20794
+ if (!schema.style) {
20795
+ schema.style = {};
20796
+ }
20839
20797
  Object.assign(schema.style, style);
20840
20798
  }
20841
20799
  // console.log(`AmisRecordService====schema==>`, schema)
@@ -22096,13 +22054,13 @@ function getAmisStaticFieldType(type, data_type, options) {
22096
22054
  return "switch";
22097
22055
  }
22098
22056
  else if (type === 'currency') {
22099
- return "number";
22057
+ return "input-number";
22100
22058
  }
22101
22059
  else if (type === 'autonumber') {
22102
22060
  return "input-text"; //不可以用text,因为会出现字段label显示不出来的问题
22103
22061
  }
22104
22062
  else if (type === 'percent') {
22105
- return "number";
22063
+ return "input-number";
22106
22064
  }
22107
22065
  else if (type === 'formula' || type === 'summary') {
22108
22066
  return getAmisStaticFieldType(data_type, null, options);
@@ -22156,7 +22114,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22156
22114
  }
22157
22115
  _m.label = 1;
22158
22116
  case 1:
22159
- _m.trys.push([1, 23, , 24]);
22117
+ _m.trys.push([1, 24, , 25]);
22160
22118
  if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
22161
22119
  defaultSource = {
22162
22120
  "method": "post",
@@ -22332,7 +22290,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22332
22290
  // console.log(`steedos field [lookup] schema:`, schema)
22333
22291
  return [2 /*return*/, schema];
22334
22292
  case 7:
22335
- if (!fStatic) return [3 /*break*/, 20];
22293
+ if (!fStatic) return [3 /*break*/, 21];
22336
22294
  if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 9];
22337
22295
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
22338
22296
  case 8:
@@ -22384,47 +22342,47 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22384
22342
  timeFormat: 'HH:mm',
22385
22343
  format: '1970-01-01THH:mm:00.000[Z]',
22386
22344
  });
22387
- return [3 /*break*/, 19];
22345
+ return [3 /*break*/, 20];
22388
22346
  case 10:
22389
22347
  if (!(steedosField.type === "percent")) return [3 /*break*/, 11];
22390
22348
  Object.assign(schema, {
22391
22349
  "percent": steedosField.scale ? steedosField.scale : true
22392
22350
  });
22393
- return [3 /*break*/, 19];
22351
+ return [3 /*break*/, 20];
22394
22352
  case 11:
22395
22353
  if (!(steedosField.type === "password")) return [3 /*break*/, 12];
22396
22354
  Object.assign(schema, {
22397
22355
  "revealPassword": false //没生效,需要用样式隐藏
22398
22356
  });
22399
- return [3 /*break*/, 19];
22357
+ return [3 /*break*/, 20];
22400
22358
  case 12:
22401
22359
  if (!(steedosField.type === "select")) return [3 /*break*/, 13];
22402
22360
  Object.assign(schema, {
22403
22361
  "placeholder": ""
22404
22362
  });
22405
- return [3 /*break*/, 19];
22363
+ return [3 /*break*/, 20];
22406
22364
  case 13:
22407
22365
  if (!(steedosField.type === "color")) return [3 /*break*/, 14];
22408
22366
  Object.assign(schema, {
22409
22367
  "defaultColor": null
22410
22368
  });
22411
- return [3 /*break*/, 19];
22369
+ return [3 /*break*/, 20];
22412
22370
  case 14:
22413
- if (!(steedosField.type === "number")) return [3 /*break*/, 15];
22371
+ if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 15];
22414
22372
  // amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
22415
22373
  Object.assign(schema, {
22416
22374
  "precision": steedosField.scale || 0
22417
22375
  });
22418
- return [3 /*break*/, 19];
22376
+ return [3 /*break*/, 20];
22419
22377
  case 15:
22420
22378
  if (!(steedosField.type === "table")) return [3 /*break*/, 16];
22421
22379
  if (steedosField.subFields) {
22422
22380
  tableFields = [];
22423
22381
  try {
22424
- for (_c = __values(field.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
22382
+ for (_c = __values(steedosField.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
22425
22383
  subField = _d.value;
22426
22384
  if (!subField.name.endsWith(".$")) {
22427
- subFieldName = subField.name.replace("".concat(field._prefix || '').concat(field.name, ".$."), '').replace("".concat(field.name, "."), '');
22385
+ subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
22428
22386
  // const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
22429
22387
  tableFields.push(Object.assign({}, subField, { name: subFieldName }));
22430
22388
  }
@@ -22439,7 +22397,6 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22439
22397
  }
22440
22398
  Object.assign(schema, {
22441
22399
  type: 'steedos-input-table',
22442
- showIndex: true,
22443
22400
  editable: false,
22444
22401
  addable: false,
22445
22402
  removable: false,
@@ -22450,7 +22407,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22450
22407
  }
22451
22408
  });
22452
22409
  }
22453
- return [3 /*break*/, 19];
22410
+ return [3 /*break*/, 20];
22454
22411
  case 16:
22455
22412
  if (!(steedosField.type === "image")) return [3 /*break*/, 17];
22456
22413
  Object.assign(schema, {
@@ -22483,7 +22440,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22483
22440
  return value;
22484
22441
  }
22485
22442
  });
22486
- return [3 /*break*/, 19];
22443
+ return [3 /*break*/, 20];
22487
22444
  case 17:
22488
22445
  if (!(steedosField.type === "file")) return [3 /*break*/, 19];
22489
22446
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
@@ -22492,9 +22449,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22492
22449
  // convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
22493
22450
  return [2 /*return*/, _m.sent()];
22494
22451
  case 19:
22452
+ if (steedosField.type === 'formula' || steedosField.type === 'summary') {
22453
+ if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
22454
+ Object.assign(schema, {
22455
+ "precision": steedosField.scale || 0
22456
+ });
22457
+ }
22458
+ }
22459
+ _m.label = 20;
22460
+ case 20:
22495
22461
  Object.assign(schema, steedosField.amis || {});
22496
22462
  return [2 /*return*/, schema];
22497
- case 20:
22463
+ case 21:
22498
22464
  fieldAmis = steedosField.amis || {};
22499
22465
  if (!props.data.hasOwnProperty("_display")) {
22500
22466
  // 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
@@ -22552,16 +22518,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22552
22518
  }
22553
22519
  }
22554
22520
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
22555
- case 21:
22521
+ case 22:
22556
22522
  schema = _m.sent();
22557
22523
  // console.log(`AmisSteedosField return schema`, schema)
22558
22524
  return [2 /*return*/, schema];
22559
- case 22: return [3 /*break*/, 24];
22560
- case 23:
22525
+ case 23: return [3 /*break*/, 25];
22526
+ case 24:
22561
22527
  error_1 = _m.sent();
22562
22528
  console.log("error", error_1);
22563
- return [3 /*break*/, 24];
22564
- case 24: return [2 /*return*/, null];
22529
+ return [3 /*break*/, 25];
22530
+ case 25: return [2 /*return*/, null];
22565
22531
  }
22566
22532
  });
22567
22533
  }); };
@@ -22804,7 +22770,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
22804
22770
  return __generator(this, function (_a) {
22805
22771
  switch (_a.label) {
22806
22772
  case 0:
22807
- props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey;
22773
+ props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation;
22808
22774
  return [4 /*yield*/, getAmisInputTableSchema(props)];
22809
22775
  case 1:
22810
22776
  amisSchema = _a.sent();
@@ -22949,7 +22915,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
22949
22915
  "actions": [
22950
22916
  {
22951
22917
  "actionType": "custom",
22952
- "script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name})"
22918
+ "script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name}); $('.steedos-record-tr').removeClass('steedos-record-selected');$('.steedos-record-tr-'+event.data.record._id).addClass('steedos-record-selected');"
22953
22919
  }
22954
22920
  ]
22955
22921
  }
@@ -23028,7 +22994,21 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
23028
22994
  "visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
23029
22995
  }
23030
22996
  ]
23031
- }
22997
+ },
22998
+ // onEvent: {
22999
+ // "recordLoaded": {
23000
+ // "actions": [
23001
+ // {
23002
+ // "actionType": "setValue",
23003
+ // "args": {
23004
+ // "value": {
23005
+ // "steedos_selected_recordId": "${event.data.record._id}"
23006
+ // }
23007
+ // }
23008
+ // }
23009
+ // ]
23010
+ // }
23011
+ // }
23032
23012
  }];
23033
23013
  }
23034
23014
  });