@steedos/service-plugin-amis 3.0.0-beta.13 → 3.0.0-beta.131

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.
@@ -30,10 +30,7 @@ const draftsApiAdaptor = `
30
30
  }
31
31
  }
32
32
  var instance = payload.inserts[0];
33
- var url = Steedos.absoluteUrl("/app/" + FlowRouter.current().params.app_id + "/instances/view/" + instance._id + "?display=" + (Steedos.Page.getDisplay('instances') || '') + "&side_object=instances&side_listview_id=draft");
34
- // 这里不可以直接openWindow,因为手机浏览器上打不开新窗口,迁移到下面的afterDrafts脚本中,在custom动作单独执行openWindow才行
35
- // Steedos.openWindow(url);
36
- // if(!Steedos.isMobile()){ FlowRouter.reload();}
33
+ var url = Steedos.absoluteUrl("/app/" + context.app_id + "/instances/view/" + instance._id + "?display=" + (Steedos.Page.getDisplay('instances') || '') + "&side_object=instances&side_listview_id=draft");
37
34
  payload.draftUrl = url;
38
35
  return payload;
39
36
  `;
@@ -41,7 +38,7 @@ const draftsApiAdaptor = `
41
38
  const afterDrafts = `
42
39
  var url = event.data.draftUrl;
43
40
  Steedos.openWindow(url);
44
- if(!Steedos.isMobile()){ FlowRouter.reload();}
41
+ window.navigate(0);
45
42
  `;
46
43
 
47
44
  amisLib.registerAction('steedos_actions_standard_approve', {
@@ -49,7 +46,7 @@ amisLib.registerAction('steedos_actions_standard_approve', {
49
46
  return amisLib.runActions([
50
47
  {
51
48
  "actionType": "custom",
52
- "script": "var objectName = event.data.objectName || event.data.object_name;const flows = lodash.filter(Creator.object_workflows, (item) => { return item.object_name == objectName && (!item.sync_direction || item.sync_direction == 'both' || item.sync_direction == 'obj_to_ins') })\n\nevent.setData({ ...event.data, ...{ flows: flows, flowCount: flows.length } })\n\n"
49
+ "script": "var objectName = event.data.objectName || event.data.object_name;const flows = lodash.filter(Steedos.object_workflows, (item) => { return item.object_name == objectName && (!item.sync_direction || item.sync_direction == 'both' || item.sync_direction == 'obj_to_ins') })\n\nevent.setData({ ...event.data, ...{ flows: flows, flowCount: flows.length } })\n\n"
53
50
  },
54
51
  {
55
52
  "actionType": "ajax",
@@ -132,7 +129,7 @@ amisLib.registerAction('steedos_actions_standard_approve', {
132
129
  "url": "${context.rootUrl}/api/object/workflow/drafts",
133
130
  "method": "post",
134
131
  "requestAdaptor":"api.data = {\n \'Instances\': [{\n \'flow\': api.body.flowId,\n \'applicant\': api.body.context.userId,\n \'space\': api.body.context.tenantId,\n \'record_ids\': [{ o: api.body.objectName, ids: [api.body.recordId] }]\n }]\n}\n\nreturn api;",
135
- "adaptor":"\nif (payload.error) { \n return {\n status: 2,\n msg: payload.error\n }\n}\nconst instance = payload.inserts[0];\nSteedos.openWindow(Steedos.absoluteUrl(\'/app/\' + FlowRouter.current().params.app_id + \'/instances/view/\' + instance._id + \'?display=\' + (Steedos.Page.getDisplay('instances') || '') + \'&side_object=instances&side_listview_id=draft\'))\nFlowRouter.reload();\nreturn payload;",
132
+ "adaptor":"\nif (payload.error) { \n return {\n status: 2,\n msg: payload.error\n }\n}\nconst instance = payload.inserts[0];\nSteedos.openWindow(Steedos.absoluteUrl(\'/app/\' + context.app_id + \'/instances/view/\' + instance._id + \'?display=\' + (Steedos.Page.getDisplay('instances') || '') + \'&side_object=instances&side_listview_id=draft\'))\nwindow.navigate(0);\nreturn payload;",
136
133
  "messages": {},
137
134
  "headers": {
138
135
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
@@ -29,432 +29,8 @@
29
29
 
30
30
  return true;
31
31
  }
32
-
33
- // 加载Amis SDK: 如果直接放到body中会导致 meteor 编译后的 cordova.js 加载报错
34
- // let amisSDKScript = document.createElement("script");
35
- // amisSDKScript.setAttribute("src", Steedos.absoluteUrl('/unpkg.com/amis/sdk/sdk.js'));
36
- // document.getElementsByTagName("head")[0].appendChild(amisSDKScript);
37
32
  } catch (error) {
38
33
  console.error(error)
39
34
  };
40
35
 
41
- const getAmisLng = ()=>{
42
- var locale = Builder.settings.context.user ? Builder.settings.context.user.language : null;
43
- if(locale){
44
- locale = locale.replace('_', '-');
45
- locale = locale === 'en' ? 'en-US' : locale;
46
- locale = locale === 'zh' ? 'zh-CN' : locale;
47
- locale = locale === 'cn' ? 'zh-CN' : locale;
48
- return locale
49
- }
50
- return 'zh-CN'
51
- }
52
-
53
- // 此处不能使用import, client js 编译时会将import 转为require, 导致加载失败
54
- // import('/unpkg.com/@steedos-ui/amis/dist/amis-sdk.umd.min.js').then(() => {
55
- Promise.all([
56
- waitForThing(window, 'assetsLoaded'),
57
- waitForThing(window, 'amis'),
58
- ]).then(()=>{
59
- // window.React = window.__React;
60
- // window.ReactDOM = window.__ReactDOM;
61
- const AmisRenderers = [];
62
- let amis = (window.amisRequire && window.amisRequire('amis')) || window.Amis;
63
- let amisVersion = amis && amis.version;
64
- if(amisVersion){
65
- const amisVersionClassName = "amis-" + amisVersion.split(".")[0] + "-" + amisVersion.split(".")[1];
66
- document.getElementsByTagName('body')[0].className += " " + amisVersionClassName;
67
- }
68
- let amisLib = amisRequire('amis');
69
- amisLib.registerFilter('t', function (key,param) {
70
- return typeof key === 'string' ? window.t(key,param) : key;
71
- });
72
- const registerMap = {
73
- renderer: amisLib.Renderer,
74
- formitem: amisLib.FormItem,
75
- options: amisLib.OptionsControl,
76
- };
77
-
78
- const amisComps = lodash.filter(Builder.registry['meta-components'], function(item){ return item.componentName && item.amis && item.amis.render});
79
-
80
- lodash.each(amisComps,(comp)=>{
81
- const Component = Builder.components.find(item => item.name === comp.componentName);
82
- var type = null;
83
- if(comp.amis){
84
- type = comp.amis.render.type
85
- }
86
- if (Component && !AmisRenderers.includes(type)){
87
- try {
88
- let AmisWrapper = Component.class
89
- AmisRenderers.push(type);
90
- if(comp.componentType === 'amisSchema'){
91
- let amisReact = amisRequire('react');
92
- AmisWrapper = function(props){
93
- // console.log(`AmisWrapper===>`, props)
94
- const { $schema, body, render } = props
95
- const [schema, setSchema] = amisReact.useState(null);
96
- amisReact.useEffect(()=>{
97
- // console.log("AmisWrapper===>==useEffect==", comp.amis.render.type, JSON.stringify(props.data?.recordId))
98
- const result = Component.class(props);
99
- if(result.then && typeof result.then === 'function'){
100
- result.then((data)=>{
101
- // console.log("AmisWrapper===>==useEffect==setSchema", data)
102
- setSchema(data);
103
- })
104
- }else{
105
- // console.log("AmisWrapper===>==useEffect==result", result)
106
- setSchema(result)
107
- }
108
- }, [JSON.stringify($schema)]) //, JSON.stringify(props.data)
109
-
110
- if (!schema)
111
- return;
112
- // return render('body', {
113
- // "type": "wrapper",
114
- // "className": "h-full flex items-center justify-center",
115
- // "body": {
116
- // "type": "spinner",
117
- // "show": true
118
- // }
119
- // })
120
-
121
- if (props.env.enableAMISDebug && schema) {
122
- console.groupCollapsed(`[steedos render ${type}]`);
123
- console.trace('Component: ', props, 'Generated Amis Schema: ', schema);
124
- console.groupEnd();
125
- }
126
- return amisReact.createElement(amisReact.Fragment, null, amisReact.createElement(amisReact.Fragment, null, schema && render ? render('body', schema) : ''));
127
- }
128
- }
129
- // 注册amis渲染器
130
- let asset = comp.amis.render;
131
- if (!registerMap[asset.usage]) {
132
- console.error(
133
- `自定义组件注册失败,不存在${asset.usage}自定义组件类型。`, comp
134
- );
135
- } else {
136
- registerMap[asset.usage]({
137
- test: new RegExp(`(^|\/)${asset.type}`),
138
- type: asset.type,
139
- weight: asset.weight,
140
- autoVar: true,
141
- })(AmisWrapper);
142
- // 记录当前创建的amis自定义组件
143
- console.debug('注册了一个自定义amis组件:', {
144
- type: asset.type,
145
- weight: asset.weight,
146
- component: AmisWrapper,
147
- framework: asset.framework,
148
- usage: asset.usage,
149
- });
150
- }
151
- // amisRequire("amis").Renderer(
152
- // {
153
- // type: comp.amis?.render.type,
154
- // weight: comp.amis?.render.weight,
155
- // autoVar: true,
156
- // }
157
- // )(AmisWrapper);
158
- } catch(e){console.error(e)}
159
- }
160
- });
161
-
162
- const normalizeLink = (to, location = window.location) => {
163
- to = to || '';
164
-
165
- if (to && to[0] === '#') {
166
- to = location.pathname + location.search + to;
167
- } else if (to && to[0] === '?') {
168
- to = location.pathname + to;
169
- }
170
-
171
- const idx = to.indexOf('?');
172
- const idx2 = to.indexOf('#');
173
- let pathname = ~idx
174
- ? to.substring(0, idx)
175
- : ~idx2
176
- ? to.substring(0, idx2)
177
- : to;
178
- let search = ~idx ? to.substring(idx, ~idx2 ? idx2 : undefined) : '';
179
- let hash = ~idx2 ? to.substring(idx2) : location.hash;
180
-
181
- if (!pathname) {
182
- pathname = location.pathname;
183
- } else if (pathname[0] != '/' && !/^https?\:\/\//.test(pathname)) {
184
- let relativeBase = location.pathname;
185
- const paths = relativeBase.split('/');
186
- paths.pop();
187
- let m;
188
- while ((m = /^\.\.?\//.exec(pathname))) {
189
- if (m[0] === '../') {
190
- paths.pop();
191
- }
192
- pathname = pathname.substring(m[0].length);
193
- }
194
- pathname = paths.concat(pathname).join('/');
195
- }
196
-
197
- return pathname + search + hash;
198
- };
199
- const isCurrentUrl = (to, ctx)=>{
200
- try {
201
- if (!to) {
202
- return false;
203
- }
204
- const pathname = window.location.pathname;
205
- const link = normalizeLink(to, {
206
- ...location,
207
- pathname,
208
- hash: ''
209
- });
210
-
211
- if (!~link.indexOf('http') && ~link.indexOf(':')) {
212
- let strict = ctx && ctx.strict;
213
- return match(link, {
214
- decode: decodeURIComponent,
215
- strict: typeof strict !== 'undefined' ? strict : true
216
- })(pathname);
217
- }
218
- return decodeURI(pathname) === link || decodeURI(pathname).startsWith(`${link}/`);
219
- } catch (error) {
220
- console.error(`error`, error)
221
- }
222
- }
223
- AmisEnv = {
224
- // getModalContainer: (props)=>{
225
- // let div = document.querySelector("#amisModalContainer");
226
- // if(!div){
227
- // div = document.createElement('div');
228
- // div.className="amis-scope";
229
- // div.style.height='0px';
230
- // div.id="amisModalContainer";
231
- // document.body.appendChild(div)
232
- // }
233
- // return div;
234
- // },
235
- // 如果这里不配置env.notify,那么会走amis 默认的env.notify,它会造成随机把toast组件dom插入到不同的scope容器内(应该是插入到最后一个加载的scope),这在苹果手机上可能会造成弹出的通知z-index不生效的情况,出现通知被档住的问题
236
- notify: (type, msg)=>{
237
- var tpl = msg.props && msg.props.schema.tpl;
238
- if(tpl){
239
- SteedosUI.message[type](tpl)
240
- }else if(typeof msg == 'string'){
241
- SteedosUI.message[type](msg)
242
- }else{
243
- console.warn('notify', type, msg)
244
- }
245
- },
246
- jumpTo: (to, action) => {
247
- if (to === 'goBack') {
248
- return window.history.back();
249
- }
250
-
251
- to = normalizeLink(to);
252
-
253
- if (action && action.actionType === 'url') {
254
- action.blank === false ? (window.location.href = to) : window.open(to);
255
- return;
256
- }
257
-
258
- // 主要是支持 nav 中的跳转
259
- if (action && to && action.target) {
260
- if(Meteor.isCordova && to.indexOf('http') != 0){
261
- window.open(Steedos.absoluteUrl(to), action.target);
262
- return;
263
- }else{
264
- window.open(to, action.target);
265
- return;
266
- }
267
- }
268
-
269
- if (/^https?:\/\//.test(to)) {
270
- window.location.replace(to);
271
- } else {
272
- FlowRouter.go(to);
273
- }
274
- },
275
- theme: 'antd',
276
- isCurrentUrl: isCurrentUrl,
277
- requestAdaptor: (config)=>{
278
- if(config.allowCredentials == false){
279
- config.withCredentials = false;
280
- delete config.allowCredentials
281
- }
282
- // url是相对路径
283
- if(config.url && (!/^http[s]?:\/\//i.test(config.url))){
284
- if(Meteor.isCordova){
285
- config.url = Meteor.absoluteUrl(config.url)
286
- }
287
-
288
- if(!config.headers){
289
- config.headers = {}
290
- }
291
-
292
- if(!config.headers.Authorization && Builder.settings.context && Builder.settings.context.tenantId && Builder.settings.context.authToken){
293
- config.headers.Authorization = `Bearer ${Builder.settings.context.tenantId},${Builder.settings.context.authToken}`;
294
- }
295
- }else if(config.url && Meteor.isCordova && Builder.settings.context && Builder.settings.context.rootUrl && config.url.startsWith(Builder.settings.context.rootUrl)){
296
- // 是绝对路径,且是cordova环境, 且以root url开头, 则自动处理认证
297
- if(Meteor.isCordova){
298
- if(!config.headers){
299
- config.headers = {}
300
- }
301
-
302
- if(!config.headers.Authorization && Builder.settings.context && Builder.settings.context.tenantId && Builder.settings.context.authToken){
303
- config.headers.Authorization = `Bearer ${Builder.settings.context.tenantId},${Builder.settings.context.authToken}`;
304
- }
305
- }
306
- }
307
- return config;
308
- },
309
- responseAdaptor: function(api, payload, query, request, response){
310
- if(payload.statusCode === 500 && payload.message){
311
- payload = {
312
- "status": payload.statusCode,
313
- "msg": payload.message
314
- }
315
- }
316
- return payload;
317
- }
318
- };
319
- // 已弃用
320
- const AmisRender = function (props) {
321
- let env = props.env;
322
- const schema = props.schema;
323
- const data = props.data;
324
- const name = props.name;
325
- const refName = schema.name || schema.id;
326
- if(SteedosUI.refs[refName]){
327
- if(SteedosUI.refs[refName].unmount){
328
- try {
329
- SteedosUI.refs[refName].unmount()
330
- } catch (Exception) {
331
- }
332
- }else{
333
- console.log(`not find amis scope unmount`)
334
- }
335
- }
336
-
337
- if(props.pageType === 'form'){
338
- env = Object.assign({
339
- getModalContainer: ()=>{
340
- return document.querySelector('.amis-scope');
341
- }
342
- }, env);
343
- }
344
- schema.scopeRef = (ref) => {
345
- try {
346
- if(!window.amisScopes){
347
- window.amisScopes = {};
348
- }
349
- if(name){
350
- window.amisScopes[name] = ref;
351
- }
352
- } catch (error) {
353
- console.error('error', error)
354
- }
355
-
356
- return scoped = ref
357
- }
358
-
359
-
360
- let amisReact = amisRequire('react');
361
-
362
- amisReact.useEffect(()=>{
363
- const amisScope = amisRequire('amis/embed').embed(`.steedos-amis-render-scope-${name}`,schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
364
- const refName = schema.name || schema.id;
365
- if(window.SteedosUI && refName){
366
- SteedosUI.refs[refName] = amisScope;
367
- }
368
- }, [])
369
- return amisReact.createElement("div", {
370
- className: "amis-scope"
371
- }, amisReact.createElement("div", {
372
- className: `steedos-amis-render-scope-${name}`
373
- }));
374
- };
375
-
376
- window.renderAmis = function (root, schema, data, env) {
377
- // console.log("===window.renderAmis===root, env===", root, env);
378
- // console.log("===window.renderAmis===data===", data);
379
- const refName = schema.name || schema.id;
380
- if(SteedosUI.refs[refName]){
381
- if(SteedosUI.refs[refName].unmount){
382
- try {
383
- SteedosUI.refs[refName].unmount()
384
- } catch (Exception) {
385
- }
386
- }else{
387
- console.log(`not find amis scope unmount`)
388
- }
389
- }
390
-
391
- // if(props.pageType === 'form'){
392
- // env = Object.assign({
393
- // getModalContainer: ()=>{
394
- // return document.querySelector('.amis-scope');
395
- // }
396
- // }, env);
397
- // }
398
- schema.scopeRef = (ref) => {
399
- try {
400
- if(!window.amisScopes){
401
- window.amisScopes = {};
402
- }
403
- if(name){
404
- window.amisScopes[name] = ref;
405
- }
406
- } catch (error) {
407
- console.error('error', error)
408
- }
409
-
410
- return scoped = ref
411
- }
412
-
413
- const amisScope = amisRequire('amis/embed').embed(root, schema, {data, name, locale: getAmisLng()}, Object.assign({getModalContainer: ()=>{ return document.querySelector('body');}}, AmisEnv, env))
414
- if(window.SteedosUI && refName){
415
- SteedosUI.refs[refName] = amisScope;
416
- SteedosUI.refs[refName].__$schema = schema;
417
- }
418
- };
419
-
420
- const initMonaco = ()=>{
421
-
422
- // const { detect } = require('detect-browser');
423
-
424
- // const browser = detect();
425
-
426
- // // 低于86版的chrome 不支持code类型字段及功能
427
- // if (browser && browser.name === 'chrome' && Number(browser.version.split(".")[0]) < 86) {
428
- // return Promise.resolve(true)
429
- // }
430
-
431
- // // 手机版暂不支持code类型字段.
432
- // if(Meteor.isCordova){
433
- // return Promise.resolve(true)
434
- // }else{
435
- // return Builder.initMonaco()
436
- // }
437
-
438
- return Promise.resolve(true)
439
- }
440
- //Amis SDK 中已清理了monaco, 所以这里需要提前注册,否则会导致amis code类型报错
441
- initMonaco().catch((err)=>{
442
- console.error(`Builder.initMonaco error: ${err}`);
443
- }).finally(()=>{
444
- const language = getAmisLng()
445
- axios.get(`/translations/amis/${language}.json`).then((res)=>{
446
- amisRequire("amis").registerLocale(`${language}`, res.data)
447
- Builder.registerComponent(AmisRender, {
448
- name: 'Amis',
449
- inputs: [
450
- { name: 'schema', type: 'object' },
451
- { name: 'data', type: 'object' },
452
- { name: 'name', type: 'string' }
453
- ]
454
- });
455
- })
456
- });
457
- });
458
- // });
459
-
460
36
  })();
@@ -141,16 +141,19 @@
141
141
  "multiple": false
142
142
  },
143
143
  {
144
- "name": "formula",
145
- "label": "${'action_field_updates.action_field_updates_form.formula' | t}",
146
- "required": false,
147
- "type": "textarea",
148
- "tpl": "<b><%=data.formula%></b>",
144
+ "type": "service",
145
+ "schemaApi": {
146
+ "method": "get",
147
+ "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${target_object}/fields/options",
148
+ "cache": 30000,
149
+ "adaptor": "const field = {label: t('action_field_updates.action_field_updates_form.formula')}; const variables = SteedosUI.getFormulaVariables(payload.data.options);\n var fieldSchema={label: field.label, type:'input-formula', name: 'formula', 'evalMode': false, variableMode: 'tabs', variables: variables, labelRemark: field.inlineHelpText, description: field.description } \n return {...payload, data:fieldSchema};",
150
+ "trackExpression": "${target_object}",
151
+ "sendOn": "${target_object}"
152
+ },
153
+ "dsType": "api",
154
+ "id": "u:508198dbfac7",
149
155
  "className": "col-span-2 m-1",
150
156
  "labelClassName": "text-left",
151
- "clearValueOnHidden": true,
152
- "fieldName": "formula",
153
- "id": "u:20766a86a9f4",
154
157
  "hiddenOn": "this.operation != 'formula'"
155
158
  },
156
159
  {
@@ -76,7 +76,6 @@
76
76
  ],
77
77
  "data": {
78
78
  "context": {
79
- "rootUrl": "http://127.0.0.1:5800"
80
79
  }
81
80
  },
82
81
  "id": "u:3b0de7e88def",
@@ -289,7 +289,7 @@
289
289
  }
290
290
  },
291
291
  "initApiAdaptor": "\nvar data;\nif (recordId) {\n data = payload.data || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.sort = lodash.map(data.sort, (item) => {\n return item.field_name + \":\" + item.order;\n });\n data.searchable_fields = lodash.map(data.searchable_fields, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n } catch (e) { }\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n }\n} else {\n const uiSchema = api.body.uiSchema;\n const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;\n let defaultValues = {};\n _.each(uiSchema && uiSchema.fields, function (field) {\n var value = SteedosUI.getFieldDefaultValue(field, api.body.global);\n if (!_.isNil(value)) {\n defaultValues[field.name] = value;\n }\n });\n if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {\n data = Object.assign({}, defaultValues, defaultData); \n }else{data = Object.assign({}, defaultValues) } \n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };\nreturn payload;",
292
- "apiRequestAdaptor": "delete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nquery = `mutation{record: object_listviews__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: object_listviews__update(id: \"` + formData._id + `\", doc: {__saveData}){_id}}`;\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;",
292
+ "apiRequestAdaptor": "delete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nquery = `mutation{record: object_listviews__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: object_listviews__update(id: \"` + api.body.recordId + `\", doc: {__saveData}){_id}}`;\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;",
293
293
  "id": "u:ce9e3fcc411a"
294
294
  }
295
295
  ],
@@ -304,16 +304,5 @@
304
304
  "initApi": null,
305
305
  "initFetch": null,
306
306
  "id": "u:6ada123f9d4a",
307
- "onEvent": {
308
- "init": {
309
- "weight": 0,
310
- "actions": [
311
- {
312
- "actionType": "custom",
313
- "script": "//初始化时给外层dialog加上类名,使过滤组件popover正常显示\n$('.steedos-object-listview-form-page').closest('.amis-dialog-widget.antd-Modal').addClass('steedos-overflow-visible-dialog');"
314
- }
315
- ]
316
- }
317
- },
318
307
  "className": "steedos-object-listview-form-page"
319
308
  }
@@ -302,8 +302,9 @@ module.exports = {
302
302
  fields: 1
303
303
  }
304
304
  };
305
+ const forceUnHiddenObjectNames = ["cms_files", "tasks", "notes", "events", "instances", "approvals", "process_instance_history", "audit_records"];
305
306
  let objects = _.map(_.filter((allObjects), (obj)=>{
306
- return obj.hidden != true;
307
+ return obj.hidden != true || forceUnHiddenObjectNames.includes(obj.name);
307
308
  }), (obj)=>{
308
309
  return {
309
310
  name: obj.name,
@@ -146,7 +146,8 @@ const getDateTimeOperators = (lng)=>{
146
146
  }
147
147
 
148
148
 
149
- const getFieldOperators = (type, lng)=>{
149
+ const getFieldOperators = (type, lng, ctx = {})=>{
150
+ let { multiple } = ctx;
150
151
  switch (type) {
151
152
  case 'text':
152
153
  return ['equal', 'not_equal', 'like', 'not_like', 'starts_with', 'ends_with']
@@ -162,6 +163,9 @@ const getFieldOperators = (type, lng)=>{
162
163
  case 'lookup':
163
164
  case 'master_detail':
164
165
  case 'select':
166
+ if (multiple){
167
+ return ['select_any_in', 'select_not_any_in']
168
+ }
165
169
  return [ 'select_equals', 'select_not_equals', 'select_any_in', 'select_not_any_in' ]
166
170
  default:
167
171
  return ;
@@ -169,7 +173,7 @@ const getFieldOperators = (type, lng)=>{
169
173
 
170
174
  }
171
175
 
172
- const getField = (objectName, fieldName, type, lng)=>{
176
+ const getField = (objectName, fieldName, type, lng, ctx = {})=>{
173
177
  let field = null;
174
178
  switch (type) {
175
179
  case 'textarea':
@@ -195,7 +199,7 @@ const getField = (objectName, fieldName, type, lng)=>{
195
199
  case 'date':
196
200
  // 华炎魔方中日期字段存的是utc的0点
197
201
  field = {
198
- type: "date",
202
+ type: "text",
199
203
  format: "YYYY-MM-DDT00:00:00+00:00",
200
204
  operators: getFieldOperators("date", lng)
201
205
  };
@@ -203,7 +207,7 @@ const getField = (objectName, fieldName, type, lng)=>{
203
207
  case 'datetime':
204
208
  // 即amis中日期时间控件的format默认值为"YYYY-MM-DDTHH:mm+08:00"正好满足需求
205
209
  field = {
206
- type: "datetime",
210
+ type: "text",
207
211
  operators: getFieldOperators("datetime", lng)
208
212
  };
209
213
  break;
@@ -217,6 +221,11 @@ const getField = (objectName, fieldName, type, lng)=>{
217
221
  break;
218
222
  case 'lookup':
219
223
  case 'master_detail':
224
+ field = {
225
+ type: 'text',
226
+ operators: getFieldOperators("select", lng, ctx)
227
+ };
228
+ break;
220
229
  case 'select':
221
230
  field = {
222
231
  type: 'select',
@@ -230,7 +239,7 @@ const getField = (objectName, fieldName, type, lng)=>{
230
239
  }
231
240
  ,
232
241
  searchable: true,
233
- operators: getFieldOperators("select", lng)
242
+ operators: getFieldOperators("select", lng, ctx)
234
243
  };
235
244
  break;
236
245
  case 'boolean':
@@ -361,7 +370,7 @@ module.exports = {
361
370
  fields.push({
362
371
  label: field.label,
363
372
  name: field.name,
364
- ...getField(objectName, field.name, field.type, lng)
373
+ ...getField(objectName, field.name, field.type, lng, { multiple: field.multiple})
365
374
  })
366
375
  break;
367
376
  }
@@ -41,7 +41,7 @@ const getListPageInitSchema = function (objectApiName) {
41
41
  return {
42
42
  type: 'page',
43
43
  name: getScopeId(objectApiName, "list"),
44
- bodyClassName: '',
44
+ bodyClassName: 'p-0',
45
45
  regions: [
46
46
  "body"
47
47
  ],
@@ -88,7 +88,7 @@ const getRecordPageInitSchema = async function (objectApiName, userSession) {
88
88
  }
89
89
  const content = {
90
90
  "type": "tabs",
91
- "className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
91
+ "className": "steedos-record-tabs bg-white p-4 sm:m-4 sm:shadow sm:rounded",
92
92
  "tabs": [
93
93
  detailed
94
94
  ]
@@ -112,7 +112,7 @@ const getRecordPageInitSchema = async function (objectApiName, userSession) {
112
112
  name: getScopeId(objectApiName, "record_detail"),
113
113
  objectApiName: "${objectName}",
114
114
  bodyClassName: '',
115
- className: "object-detail-page steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full bg-gray-100",
115
+ className: "object-detail-page steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full",
116
116
  regions: [
117
117
  "body"
118
118
  ],