@steedos-widgets/amis-lib 6.3.0-beta.17 → 6.3.0-beta.18

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.cjs.js CHANGED
@@ -5820,21 +5820,16 @@ const getDropdown = (dropdownButtons)=>{
5820
5820
  "hideCaret": true,
5821
5821
  "className": "mr-0 steedos-mobile-header-drop-down",
5822
5822
  "closeOnClick": true,
5823
- "menuClassName": "buttons-drawer fixed inset-0 bg-none border-0 shadow-none",
5823
+ "menuClassName": "buttons-drawer fixed bg-none border-0 shadow-none",
5824
5824
  "align": "right",
5825
5825
  "body": [
5826
5826
  {
5827
5827
  "type": "action",
5828
5828
  "style": {
5829
- "position": "fixed",
5830
- "top": 0,
5831
- "right": 0,
5832
- "bottom": 0,
5833
- "left": 0,
5834
5829
  "z-index": 1,
5835
5830
  "background": "var(--Drawer-overlay-bg)",
5836
- "height": "unset",
5837
- "width": "unset",
5831
+ "height": "100%",
5832
+ "width": "100%",
5838
5833
  "padding": "0",
5839
5834
  "margin": "0",
5840
5835
  "border-radius": "0"
@@ -6628,6 +6623,217 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6628
6623
  };
6629
6624
  }
6630
6625
 
6626
+ const getNewListviewButtonSchema = ()=>{
6627
+ return {
6628
+ "type": "button",
6629
+ "label": i18next__default["default"].t('frontend_listview_control_new_label'),
6630
+ "className": "steedos-listview-new-button",
6631
+ "onEvent": {
6632
+ "click": {
6633
+ "weight": 0,
6634
+ "actions": [
6635
+ {
6636
+ "dialog": {
6637
+ "type": "dialog",
6638
+ "title": i18next__default["default"].t('frontend_listview_control_new_title'),
6639
+ "data": {
6640
+ //"&":"$$",2.7、2.9、3.0在此处失效
6641
+ "all": "${uiSchema.list_views.all}",
6642
+ "list_view": "${uiSchema.list_views[listName]}",
6643
+ "appId": "${appId}",
6644
+ "global": "${global}",
6645
+ "targetObjectName": "${objectName}",
6646
+ "context": "${context}"
6647
+ },
6648
+ "body": [
6649
+ {
6650
+ "type": "steedos-object-form",
6651
+ "label": "对象表单",
6652
+ "objectApiName": "object_listviews",
6653
+ "recordId": "",
6654
+ "mode": "edit",
6655
+ "layout": "normal",
6656
+ "defaultData": {
6657
+ "&": "${list_view}",
6658
+ "name":"",
6659
+ "label":"",
6660
+ "filters":"",
6661
+ "shared":false,
6662
+ "object_name": "${targetObjectName}",
6663
+ "_id":"",
6664
+ "shared_to": null,
6665
+ "shared_to_organizations": null,
6666
+ "locked": false,
6667
+ "owner": null,
6668
+ "company_id": null,
6669
+ "company_ids": null,
6670
+ "is_system": false
6671
+ },
6672
+ "fieldsExtend": fieldsExtend$5(),
6673
+ "fields": fields$1(),
6674
+ "onEvent": {
6675
+ "submitSucc": {
6676
+ "weight": 0,
6677
+ "actions": [
6678
+ {
6679
+ "args": {
6680
+ // 直接使用recordId不能拿到数据,只能通过result里面拿数据
6681
+ "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
6682
+ "blank": false
6683
+ },
6684
+ "actionType": "url",
6685
+ }
6686
+ ]
6687
+ }
6688
+ },
6689
+ "messages": {
6690
+ "success": i18next__default["default"].t('frontend_listview_control_new_message_success'),
6691
+ "failed": i18next__default["default"].t('frontend_listview_control_new_message_failed')
6692
+ },
6693
+ }
6694
+ ],
6695
+ "showCloseButton": true,
6696
+ "showErrorMsg": true,
6697
+ "showLoading": true,
6698
+ "closeOnEsc": false,
6699
+ "dataMapSwitch": false,
6700
+ "size": "lg"
6701
+ },
6702
+ "actionType": "dialog"
6703
+ }
6704
+ ]
6705
+ }
6706
+ }
6707
+ }
6708
+ };
6709
+
6710
+ function fields$1(){
6711
+ return [
6712
+ "label",
6713
+ "name",
6714
+ "object_name",
6715
+ "filter_scope",
6716
+ "show_count",
6717
+ "columns",
6718
+ "sort",
6719
+ "filters",
6720
+ "mobile_columns",
6721
+ "searchable_fields",
6722
+ "is_system",
6723
+ "shared",
6724
+ "shared_to",
6725
+ "shared_to_organizations"
6726
+ ]
6727
+ }
6728
+
6729
+ function fieldsExtend$5(){
6730
+ return {
6731
+ "group": "",
6732
+ "label": {
6733
+ "group": "",
6734
+ "is_wide": true
6735
+ },
6736
+ "name": {
6737
+ "group": "",
6738
+ "amis": {
6739
+ "hidden": true,
6740
+ "required": false
6741
+ }
6742
+ },
6743
+ "object_name": {
6744
+ "group": "",
6745
+ "amis": {
6746
+ "hidden": true
6747
+ }
6748
+ },
6749
+ "filter_scope": {
6750
+ "group": "",
6751
+ "amis": {
6752
+ "hidden": true,
6753
+ "required": false
6754
+ }
6755
+ },
6756
+ "columns": {
6757
+ "group": "",
6758
+ "amis": {
6759
+ "hidden": true,
6760
+ "required": false
6761
+ }
6762
+ },
6763
+ "mobile_columns":{
6764
+ "group": "",
6765
+ "amis": {
6766
+ "hidden": true,
6767
+ "required": false
6768
+ }
6769
+ },
6770
+ "searchable_fields":{
6771
+ "group": "",
6772
+ "amis": {
6773
+ "hidden": true,
6774
+ "required": false
6775
+ }
6776
+ },
6777
+ "filter_fields": {
6778
+ "group": "",
6779
+ "amis": {
6780
+ "hidden": true,
6781
+ "required": false
6782
+ }
6783
+ },
6784
+ "scrolling_mode": {
6785
+ "group": "",
6786
+ "amis": {
6787
+ "hidden": true,
6788
+ "required": false
6789
+ }
6790
+ },
6791
+ "sort": {
6792
+ "group": "",
6793
+ "amis": {
6794
+ "hidden": true,
6795
+ "required": false
6796
+ }
6797
+ },
6798
+ "show_count": {
6799
+ "group": "",
6800
+ "amis": {
6801
+ "hidden": true,
6802
+ "required": false
6803
+ }
6804
+ },
6805
+ "type": {
6806
+ "group": "",
6807
+ "amis": {
6808
+ "hidden": true,
6809
+ "required": false
6810
+ }
6811
+ },
6812
+ "shared": {
6813
+ "group": "",
6814
+ "amis": {
6815
+ "visibleOn": "${false}"
6816
+ }
6817
+ },
6818
+ "shared_to": {
6819
+ "group": "",
6820
+ "amis":{
6821
+ "type": "radios",
6822
+ "inline": false
6823
+ }
6824
+ },
6825
+ "shared_to_organizations": {
6826
+ "group": ""
6827
+ },
6828
+ "filters": {
6829
+ "group": "",
6830
+ "amis": {
6831
+ "hidden": true
6832
+ }
6833
+ }
6834
+ }
6835
+ }
6836
+
6631
6837
  /**
6632
6838
  * 列表视图顶部第一行amisSchema
6633
6839
  * @param {*} objectSchema 对象UISchema
@@ -6637,38 +6843,504 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
6637
6843
  const { icon, label } = objectSchema;
6638
6844
  const disabled_list_views = objectSchema.permissions.disabled_list_views;
6639
6845
  const listViewButtonOptions = [];
6640
- _$1.each(
6641
- objectSchema.list_views,
6642
- (listView, name) => {
6643
- if(name === "lookup" || (disabled_list_views && disabled_list_views.indexOf(listView._id)>-1)){
6644
- // 内置lookup为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
6645
- return;
6846
+ const initApiAdaptor = `
6847
+ var data;
6848
+ if (recordId) {
6849
+ data = payload.data || { _filters_type_controller: 'conditions' };
6850
+ //数据格式转换
6851
+ if (data) {
6852
+ data.sort = lodash.map(data.sort, (item) => {
6853
+ return item.field_name + ":" + item.order;
6854
+ });
6855
+ data.searchable_fields = lodash.map(data.searchable_fields, 'field');
6856
+
6857
+ if (data.filters && lodash.isString(data.filters)) {
6858
+ try {
6859
+ data.filters = JSON.parse(data.filters);
6860
+ } catch (e) { }
6861
+ }
6862
+
6863
+ if (data.filters && lodash.isString(data.filters)) {
6864
+ data._filters_type_controller = 'function';
6865
+ } else {
6866
+ data._filters_type_controller = 'conditions'
6867
+ }
6868
+
6869
+ if (data._filters_type_controller === 'conditions') {
6870
+ data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);
6871
+ } else {
6872
+ data._filters_function = data.filters;
6873
+ }
6646
6874
  }
6647
- listViewButtonOptions.push({
6648
- type: "button",
6649
- label: listView.label,
6650
- actionType: "link",
6651
- link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
6875
+ } else {
6876
+ const uiSchema = api.body.uiSchema;
6877
+ const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;
6878
+ let defaultValues = {};
6879
+ _.each(uiSchema && uiSchema.fields, function (field) {
6880
+ var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
6881
+ if (!_.isNil(value)) {
6882
+ defaultValues[field.name] = value;
6883
+ }
6652
6884
  });
6885
+ if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {
6886
+ data = Object.assign({}, defaultValues, defaultData);
6887
+ }else{data = Object.assign({}, defaultValues) }
6653
6888
  }
6654
- );
6655
-
6656
- let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
6657
- const reg = new RegExp('_', 'g');
6658
- const standardIcon = icon && icon.replace(reg, '-');
6659
- const standardNewButton = _.find(amisButtonsSchema, { name: "standard_new" });
6660
- const buttonSchema = [{
6661
- "type": "flex",
6662
- "items": amisButtonsSchema,
6663
- "visibleOn": "${display == 'split'?false:true}"
6664
- }];
6665
- if(ctx.formFactor !== 'SMALL'){
6666
- const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
6667
- buttonSchema.push({
6668
- "type": "flex",
6669
- "items":[
6670
- standardNewButton,
6671
- (restButtons.length > 0) && {
6889
+ for (key in data) {
6890
+ if (data[key] === null) {
6891
+ delete data[key];
6892
+ }
6893
+ }
6894
+ payload.data = data;
6895
+ delete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };
6896
+ return payload;
6897
+ `;
6898
+ const apiRequestAdaptor = `
6899
+ delete formData.created;
6900
+ delete formData.created_by;
6901
+ delete formData.modified;
6902
+ delete formData.modified_by;
6903
+ delete formData._display;
6904
+
6905
+ //数据格式转换
6906
+ formData.sort = lodash.map(formData.sort, (item) => {
6907
+ const arr = item.split(':');
6908
+ return { field_name: arr[0], order: arr[1] };
6909
+ });
6910
+
6911
+ formData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {
6912
+ return { field: item };
6913
+ });
6914
+
6915
+ if (!formData._filters_type_controller) {
6916
+ formData._filters_type_controller = 'conditions';
6917
+ }
6918
+
6919
+ if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
6920
+ formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);
6921
+ // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);
6922
+ } else {
6923
+ formData.filters = formData._filters_function || null;
6924
+ }
6925
+
6926
+ delete formData._filters_type_controller;
6927
+ delete formData._filters_conditions;
6928
+ delete formData._filters_function;
6929
+
6930
+ query = \`mutation{record: object_listviews__insert(doc: {__saveData}){_id}}\`;
6931
+ if (formData.recordId) {
6932
+ query = \`mutation{record: object_listviews__update(id: "\` + formData._id + \`", doc: {__saveData}){_id}}\`;
6933
+ };
6934
+ __saveData = JSON.stringify(JSON.stringify(formData));
6935
+
6936
+ api.data = { query: query.replace('{__saveData}', __saveData) };
6937
+ return api;
6938
+ `;
6939
+ _$1.each(
6940
+ objectSchema.list_views,
6941
+ (listView, name) => {
6942
+ if(name === "lookup" || (disabled_list_views && disabled_list_views.indexOf(listView._id)>-1)){
6943
+ // 内置lookup为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
6944
+ return;
6945
+ }
6946
+ listViewButtonOptions.push({
6947
+ type: "button",
6948
+ label: listView.label,
6949
+ body: [
6950
+ {
6951
+ "type": "flex",
6952
+ "alignItems": "center",
6953
+ "justify": "space-between",
6954
+ "items": [
6955
+ {
6956
+ "type": "tpl",
6957
+ "tpl": listView.label
6958
+ },
6959
+ {
6960
+ "type": "button",
6961
+ "className": "steedos-listview-edit-button",
6962
+ "icon": "fa fa-edit",
6963
+ "actionType": "dialog",
6964
+ "hiddenOn": `!((global.user.is_space_admin || global.userId == '${listView.owner || ""}') && !!'${listView.owner || ""}')`,
6965
+ "dialog": {
6966
+ "type": "dialog",
6967
+ "title": "编辑 列表视图",
6968
+ "data": {
6969
+ "object_name": "${objectName}",
6970
+ "recordId": listView._id,
6971
+ "listName": "${listName}",
6972
+ "appId": "${appId}",
6973
+ "context": "${context}",
6974
+ "global": "${global}",
6975
+ "_id": listView._id
6976
+ },
6977
+ "body": [
6978
+ {
6979
+ "type": "steedos-object-form",
6980
+ "label": "对象表单",
6981
+ "objectApiName": "object_listviews",
6982
+ "recordId": "${recordId}",
6983
+ "className": "sm:rounded sm:border-gray-300 bg-white",
6984
+ "layout": "horizontal",
6985
+ "form": {
6986
+ "id": "form_object_listviews"
6987
+ },
6988
+ "mode": "edit",
6989
+ "enableTabs": true,
6990
+ "fields": [
6991
+ "label",
6992
+ "sort_no",
6993
+ "crud_mode",
6994
+ "shared",
6995
+ "shared_to",
6996
+ 'shared_to_organizations',
6997
+ "columns",
6998
+ "columns.$",
6999
+ "columns.$.field",
7000
+ "columns.$.width",
7001
+ "columns.$.wrap",
7002
+ "mobile_columns",
7003
+ "mobile_columns.$",
7004
+ "mobile_columns.$.field",
7005
+ "sort",
7006
+ "sort.$",
7007
+ "sort.$.field_name",
7008
+ "sort.$.order",
7009
+ "filters",
7010
+ "searchable_fields",
7011
+ "searchable_fields.$",
7012
+ "searchable_fields.$.field",
7013
+ ],
7014
+ "tabsMode": "line",
7015
+ "fieldsExtend": {
7016
+ "columns": {
7017
+ "amis": {
7018
+ "showIndex": true,
7019
+ "footerToolbar": [
7020
+ {
7021
+ "type": "button",
7022
+ "label": "${'object_listviews.listview_form.field_set' | t}",
7023
+ "actionType": "dialog",
7024
+ "dialog": {
7025
+ "type": "dialog",
7026
+ "title": "${'object_listviews.listview_form.displayed_columns' | t}",
7027
+ "size": "md",
7028
+ "body": [
7029
+ {
7030
+ "type": "transfer",
7031
+ "options": [
7032
+ ],
7033
+ "multiple": true,
7034
+ "id": "u:92c0b3cccca0",
7035
+ "required": true,
7036
+ "placeholder": "-",
7037
+ "className": "col-span-2 m-0",
7038
+ "checkAll": false,
7039
+ "searchable": true,
7040
+ "sortable": true,
7041
+ "itemHeight": 40,
7042
+ "source": {
7043
+ "method": "get",
7044
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
7045
+ "headers": {
7046
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7047
+ },
7048
+ "requestAdaptor": "",
7049
+ "adaptor": ""
7050
+ },
7051
+ "joinValues": false,
7052
+ "extractValue": true,
7053
+ "name": "columns_quick_select",
7054
+ "value": "${columns|pick:field|split}"
7055
+ }
7056
+ ],
7057
+ "onEvent": {
7058
+ "confirm": {
7059
+ "actions": [
7060
+ {
7061
+ "actionType": "custom",
7062
+ "script": "const columns = [];\nconst columns_quick_select = _.cloneDeep(event.data.columns_quick_select);\n_.forEach(columns_quick_select, function (field) {\n const column_field = _.find(event.data.columns, { field });\n if (column_field) {\n columns.push(column_field)\n } else {\n columns.push({\n field\n })\n }\n});\ndoAction({\n \"componentId\": \"form_object_listviews\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n columns\n }\n }\n});"
7063
+ }
7064
+ ]
7065
+ }
7066
+ }
7067
+ }
7068
+ }
7069
+ ],
7070
+ "addable": false,
7071
+ "draggable": false,
7072
+ "columns": [
7073
+ {
7074
+ "name": "field",
7075
+ "inlineEditMode": false
7076
+ },
7077
+ {
7078
+ "name": "width",
7079
+ "width": 100
7080
+ },
7081
+ {
7082
+ "name": "wrap",
7083
+ "width": 50
7084
+ }
7085
+ ],
7086
+ "enableDialog": false
7087
+ }
7088
+ },
7089
+ "sort": {
7090
+ "label": "",
7091
+ "amis": {
7092
+ "type": "tabs-transfer",
7093
+ "options": [
7094
+ ],
7095
+ "id": "u:32f3e4e73115",
7096
+ "strictMode": true,
7097
+ "itemHeight": 40,
7098
+ "source": {
7099
+ "method": "get",
7100
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
7101
+ "headers": {
7102
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7103
+ },
7104
+ "data": null,
7105
+ "requestAdaptor": "",
7106
+ "adaptor": "",
7107
+ "sendOn": "!!this.object_name"
7108
+ },
7109
+ "visibleOn": "!!this.object_name",
7110
+ "sortable": true,
7111
+ "className": "col-span-2 m-0",
7112
+ "searchable": true,
7113
+ "checkAll": false,
7114
+ "clearValueOnHidden": false,
7115
+ "joinValues": false,
7116
+ "extractValue": true,
7117
+ "en-US": {
7118
+ "label": "Default Sort Order"
7119
+ },
7120
+ "multiple": true
7121
+ }
7122
+ },
7123
+ "filters": {
7124
+ "label": "",
7125
+ "amis": {
7126
+ "type": "group",
7127
+ "body": [
7128
+ {
7129
+ "type": "radios",
7130
+ "label": "${'object_listviews.listview_form.filter_configuration_method' | t}",
7131
+ "name": "_filters_type_controller",
7132
+ "options": [
7133
+ {
7134
+ "label": "${'object_listviews.listview_form.conditions_combination' | t}",
7135
+ "value": "conditions"
7136
+ },
7137
+ {
7138
+ "label": "${'object_listviews.listview_form.javascript' | t}",
7139
+ "value": "function"
7140
+ }
7141
+ ],
7142
+ "id": "u:318671bc196c",
7143
+ "joinValues": true,
7144
+ "className": "col-span-2 m-0",
7145
+ "language": "javascript",
7146
+ "visibleOn": "false",
7147
+ "en-US": {
7148
+ "label": "Controller"
7149
+ }
7150
+ },
7151
+ {
7152
+ "type": "condition-builder",
7153
+ "label": "",
7154
+ "labelClassName": "none",
7155
+ "name": "_filters_conditions",
7156
+ "description": "",
7157
+ "id": "u:a9f2232e30d7",
7158
+ "source": {
7159
+ "method": "get",
7160
+ "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
7161
+ "dataType": "json",
7162
+ "headers": {
7163
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7164
+ }
7165
+ },
7166
+ "disabled": false,
7167
+ "className": "col-span-2 m-0",
7168
+ "visibleOn": "!!this.object_name",
7169
+ "en-US": {
7170
+ "label": "Filters Conditions"
7171
+ }
7172
+ },
7173
+ {
7174
+ "type": "editor",
7175
+ "label": "${'object_listviews.listview_form.javascript' | t}",
7176
+ "name": "_filters_function",
7177
+ "id": "u:84714ec9abba",
7178
+ "visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
7179
+ "className": "col-span-2 m-0",
7180
+ "labelClassName": "hidden"
7181
+ }
7182
+ ]
7183
+ }
7184
+ },
7185
+ "mobile_columns": {
7186
+ "amis": {
7187
+ "showIndex": true,
7188
+ "footerToolbar": [
7189
+ {
7190
+ "type": "button",
7191
+ "label": "${'object_listviews.listview_form.field_set' | t}",
7192
+ "actionType": "dialog",
7193
+ "dialog": {
7194
+ "type": "dialog",
7195
+ "title": "${'object_listviews.listview_form.displayed_columns' | t}",
7196
+ "size": "md",
7197
+ "body": [
7198
+ {
7199
+ "type": "transfer",
7200
+ "options": [
7201
+ ],
7202
+ "multiple": true,
7203
+ "id": "u:92c0b3cccca0",
7204
+ "required": true,
7205
+ "placeholder": "-",
7206
+ "className": "col-span-2 m-0",
7207
+ "itemHeight": 40,
7208
+ "checkAll": false,
7209
+ "searchable": true,
7210
+ "sortable": true,
7211
+ "source": {
7212
+ "method": "get",
7213
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
7214
+ "headers": {
7215
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7216
+ },
7217
+ "requestAdaptor": "",
7218
+ "adaptor": ""
7219
+ },
7220
+ "joinValues": false,
7221
+ "extractValue": true,
7222
+ "name": "columns_quick_select",
7223
+ "value": "${mobile_columns|pick:field|split}"
7224
+ }
7225
+ ],
7226
+ "onEvent": {
7227
+ "confirm": {
7228
+ "actions": [
7229
+ {
7230
+ "actionType": "custom",
7231
+ "script": "const mobile_columns = [];\nconst columns_quick_select = _.cloneDeep(event.data.columns_quick_select);\n_.forEach(columns_quick_select, function (field) {\n const column_field = _.find(event.data.mobile_columns, { field });\n if (column_field) {\n mobile_columns.push(column_field)\n } else {\n mobile_columns.push({\n field\n })\n }\n});\ndoAction({\n \"componentId\": \"form_object_listviews\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n mobile_columns\n }\n }\n});"
7232
+ }
7233
+ ]
7234
+ }
7235
+ }
7236
+ }
7237
+ }
7238
+ ],
7239
+ "columns": [
7240
+ {
7241
+ "name": "field",
7242
+ "inlineEditMode": false
7243
+ }
7244
+ ],
7245
+ "addable": false,
7246
+ "draggable": false,
7247
+ "enableDialog": false
7248
+ }
7249
+ },
7250
+ "searchable_fields": {
7251
+ "label": "",
7252
+ "amis": {
7253
+ "type": "transfer",
7254
+ "options": [
7255
+ ],
7256
+ "selectMode": "list",
7257
+ "searchable": true,
7258
+ "searchApi": "",
7259
+ "sortable": true,
7260
+ "mode": "normal",
7261
+ "searchResultMode": "list",
7262
+ "joinValues": false,
7263
+ "extractValue": true,
7264
+ "itemHeight": 40,
7265
+ "source": {
7266
+ "method": "get",
7267
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
7268
+ "headers": {
7269
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
7270
+ },
7271
+ "data": null,
7272
+ "requestAdaptor": "",
7273
+ "adaptor": "",
7274
+ "sendOn": "!!this.object_name"
7275
+ },
7276
+ "visibleOn": "!!this.object_name",
7277
+ "className": "col-span-2 m-0",
7278
+ "multiple": true,
7279
+ "id": "u:adb91066539e"
7280
+ }
7281
+ },
7282
+ "shared_to": {
7283
+ "amis":{
7284
+ "type": "radios",
7285
+ "inline": false
7286
+ },
7287
+ "group": "",
7288
+ "is_wide": true
7289
+ }
7290
+ },
7291
+ initApiAdaptor,
7292
+ apiRequestAdaptor,
7293
+ "onEvent": {
7294
+ "submitSucc": {
7295
+ "weight": 0,
7296
+ "actions": [
7297
+ {
7298
+ "args": {
7299
+ "url": "${context.rootUrl}/app/${appId}/${object_name}/grid/${name}",
7300
+ "blank": false
7301
+ },
7302
+ "actionType": "url",
7303
+ },
7304
+ ]
7305
+ }
7306
+ },
7307
+ "id": "u:ce9e3fcc411a"
7308
+ }
7309
+ ],
7310
+ "className": "steedos-overflow-visible-dialog",
7311
+ "showCloseButton": true,
7312
+ "showErrorMsg": true,
7313
+ "showLoading": true,
7314
+ "closeOnEsc": false,
7315
+ "dataMapSwitch": false,
7316
+ "size": "lg"
7317
+ }
7318
+ }
7319
+ ]
7320
+ }
7321
+ ],
7322
+ actionType: "link",
7323
+ link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
7324
+ });
7325
+ }
7326
+ );
7327
+
7328
+ let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
7329
+ const reg = new RegExp('_', 'g');
7330
+ const standardIcon = icon && icon.replace(reg, '-');
7331
+ const standardNewButton = _.find(amisButtonsSchema, { name: "standard_new" });
7332
+ const buttonSchema = [{
7333
+ "type": "flex",
7334
+ "items": amisButtonsSchema,
7335
+ "visibleOn": "${display == 'split'?false:true}"
7336
+ }];
7337
+ if(ctx.formFactor !== 'SMALL'){
7338
+ const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
7339
+ buttonSchema.push({
7340
+ "type": "flex",
7341
+ "items":[
7342
+ standardNewButton,
7343
+ (restButtons.length > 0) && {
6672
7344
  "type": "dropdown-button",
6673
7345
  "buttons": restButtons,
6674
7346
  "className": " ml-1",
@@ -6680,6 +7352,8 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
6680
7352
  "visibleOn": "${display == 'split'?true:false}"
6681
7353
  });
6682
7354
  }
7355
+ const listviewNewButton = getNewListviewButtonSchema();
7356
+ listviewNewButton.visibleOn = "global.user.is_space_admin";
6683
7357
  return {
6684
7358
  "type": "grid",
6685
7359
  "columns": [
@@ -6710,14 +7384,17 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
6710
7384
  },
6711
7385
  {
6712
7386
  "type": "dropdown-button",
6713
- "className": "",
7387
+ "className": "steedos-listview-change-button",
6714
7388
  "label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
6715
7389
  "rightIcon": "fa fa-caret-down",
6716
7390
  "size": "sm",
6717
7391
  "hideCaret": true,
6718
7392
  "closeOnClick": true,
6719
7393
  "btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
6720
- "buttons": listViewButtonOptions
7394
+ "buttons": [
7395
+ ...listViewButtonOptions,
7396
+ listviewNewButton
7397
+ ]
6721
7398
  }
6722
7399
  ],
6723
7400
  "md": "",
@@ -7245,216 +7922,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
7245
7922
  async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
7246
7923
  }
7247
7924
 
7248
- const getNewListviewButtonSchema = ()=>{
7249
- return {
7250
- "type": "button",
7251
- "label": i18next__default["default"].t('frontend_listview_control_new_label'),
7252
- "onEvent": {
7253
- "click": {
7254
- "weight": 0,
7255
- "actions": [
7256
- {
7257
- "dialog": {
7258
- "type": "dialog",
7259
- "title": i18next__default["default"].t('frontend_listview_control_new_title'),
7260
- "data": {
7261
- //"&":"$$",2.7、2.9、3.0在此处失效
7262
- "all": "${uiSchema.list_views.all}",
7263
- "list_view": "${uiSchema.list_views[listName]}",
7264
- "appId": "${appId}",
7265
- "global": "${global}",
7266
- "targetObjectName": "${objectName}",
7267
- "context": "${context}"
7268
- },
7269
- "body": [
7270
- {
7271
- "type": "steedos-object-form",
7272
- "label": "对象表单",
7273
- "objectApiName": "object_listviews",
7274
- "recordId": "",
7275
- "mode": "edit",
7276
- "layout": "normal",
7277
- "defaultData": {
7278
- "&": "${list_view}",
7279
- "name":"",
7280
- "label":"",
7281
- "filters":"",
7282
- "shared":false,
7283
- "object_name": "${targetObjectName}",
7284
- "_id":"",
7285
- "shared_to": null,
7286
- "shared_to_organizations": null,
7287
- "locked": false,
7288
- "owner": null,
7289
- "company_id": null,
7290
- "company_ids": null,
7291
- "is_system": false
7292
- },
7293
- "fieldsExtend": fieldsExtend$5(),
7294
- "fields": fields$1(),
7295
- "onEvent": {
7296
- "submitSucc": {
7297
- "weight": 0,
7298
- "actions": [
7299
- {
7300
- "args": {
7301
- // 直接使用recordId不能拿到数据,只能通过result里面拿数据
7302
- "url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
7303
- "blank": false
7304
- },
7305
- "actionType": "url",
7306
- }
7307
- ]
7308
- }
7309
- },
7310
- "messages": {
7311
- "success": i18next__default["default"].t('frontend_listview_control_new_message_success'),
7312
- "failed": i18next__default["default"].t('frontend_listview_control_new_message_failed')
7313
- },
7314
- }
7315
- ],
7316
- "showCloseButton": true,
7317
- "showErrorMsg": true,
7318
- "showLoading": true,
7319
- "closeOnEsc": false,
7320
- "dataMapSwitch": false,
7321
- "size": "lg"
7322
- },
7323
- "actionType": "dialog"
7324
- }
7325
- ]
7326
- }
7327
- }
7328
- }
7329
- };
7330
-
7331
- function fields$1(){
7332
- return [
7333
- "label",
7334
- "name",
7335
- "object_name",
7336
- "filter_scope",
7337
- "show_count",
7338
- "columns",
7339
- "sort",
7340
- "filters",
7341
- "mobile_columns",
7342
- "searchable_fields",
7343
- "is_system",
7344
- "shared",
7345
- "shared_to",
7346
- "shared_to_organizations"
7347
- ]
7348
- }
7349
-
7350
- function fieldsExtend$5(){
7351
- return {
7352
- "group": "",
7353
- "label": {
7354
- "group": "",
7355
- "is_wide": true
7356
- },
7357
- "name": {
7358
- "group": "",
7359
- "amis": {
7360
- "hidden": true,
7361
- "required": false
7362
- }
7363
- },
7364
- "object_name": {
7365
- "group": "",
7366
- "amis": {
7367
- "hidden": true
7368
- }
7369
- },
7370
- "filter_scope": {
7371
- "group": "",
7372
- "amis": {
7373
- "hidden": true,
7374
- "required": false
7375
- }
7376
- },
7377
- "columns": {
7378
- "group": "",
7379
- "amis": {
7380
- "hidden": true,
7381
- "required": false
7382
- }
7383
- },
7384
- "mobile_columns":{
7385
- "group": "",
7386
- "amis": {
7387
- "hidden": true,
7388
- "required": false
7389
- }
7390
- },
7391
- "searchable_fields":{
7392
- "group": "",
7393
- "amis": {
7394
- "hidden": true,
7395
- "required": false
7396
- }
7397
- },
7398
- "filter_fields": {
7399
- "group": "",
7400
- "amis": {
7401
- "hidden": true,
7402
- "required": false
7403
- }
7404
- },
7405
- "scrolling_mode": {
7406
- "group": "",
7407
- "amis": {
7408
- "hidden": true,
7409
- "required": false
7410
- }
7411
- },
7412
- "sort": {
7413
- "group": "",
7414
- "amis": {
7415
- "hidden": true,
7416
- "required": false
7417
- }
7418
- },
7419
- "show_count": {
7420
- "group": "",
7421
- "amis": {
7422
- "hidden": true,
7423
- "required": false
7424
- }
7425
- },
7426
- "type": {
7427
- "group": "",
7428
- "amis": {
7429
- "hidden": true,
7430
- "required": false
7431
- }
7432
- },
7433
- "shared": {
7434
- "group": "",
7435
- "amis": {
7436
- "visibleOn": "${false}"
7437
- }
7438
- },
7439
- "shared_to": {
7440
- "group": "",
7441
- "amis":{
7442
- "type": "radios",
7443
- "inline": false
7444
- }
7445
- },
7446
- "shared_to_organizations": {
7447
- "group": ""
7448
- },
7449
- "filters": {
7450
- "group": "",
7451
- "amis": {
7452
- "hidden": true
7453
- }
7454
- }
7455
- }
7456
- }
7457
-
7458
7925
  const getCopyListviewButtonSchema = ()=>{
7459
7926
  return {
7460
7927
  "type": "button",