@steedos/service-plugin-amis 2.4.15-beta.2 → 2.5.0-beta.10

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.
@@ -6,251 +6,303 @@
6
6
 
7
7
  ; (function () {
8
8
 
9
- try {
10
- window['attrAccept'] = function (file, acceptedFiles) {
11
- if (file && acceptedFiles) {
12
- var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
13
- var fileName = file.name || '';
14
- var mimeType = (file.type || '').toLowerCase();
15
- var baseMimeType = mimeType.replace(/\/.*$/, '');
16
- return acceptedFilesArray.some(function (type) {
17
- var validType = type.trim().toLowerCase();
18
-
19
- if (validType.charAt(0) === '.') {
20
- return fileName.toLowerCase().endsWith(validType);
21
- } else if (validType.endsWith('/*')) {
22
- // This is something like a image/* mime type
23
- return baseMimeType === validType.replace(/\/.*$/, '');
24
- }
25
-
26
- return mimeType === validType;
27
- });
9
+ try {
10
+ window['attrAccept'] = function (file, acceptedFiles) {
11
+ if (file && acceptedFiles) {
12
+ var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
13
+ var fileName = file.name || '';
14
+ var mimeType = (file.type || '').toLowerCase();
15
+ var baseMimeType = mimeType.replace(/\/.*$/, '');
16
+ return acceptedFilesArray.some(function (type) {
17
+ var validType = type.trim().toLowerCase();
18
+
19
+ if (validType.charAt(0) === '.') {
20
+ return fileName.toLowerCase().endsWith(validType);
21
+ } else if (validType.endsWith('/*')) {
22
+ // This is something like a image/* mime type
23
+ return baseMimeType === validType.replace(/\/.*$/, '');
24
+ }
25
+
26
+ return mimeType === validType;
27
+ });
28
+ }
29
+
30
+ return true;
28
31
  }
29
-
30
- return true;
31
- }
32
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
- } catch (error) {
38
- console.error(error)
39
- };
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
+ } catch (error) {
38
+ console.error(error)
39
+ };
40
+
41
+ const getAmisLng = ()=>{
42
+ var locale = Creator.USER_CONTEXT ? Creator.USER_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
+ }
40
52
 
41
- const getAmisLng = ()=>{
42
- var locale = Creator.USER_CONTEXT ? Creator.USER_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
- }
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 amisLib = amisRequire('amis');
63
+ const registerMap = {
64
+ renderer: amisLib.Renderer,
65
+ formitem: amisLib.FormItem,
66
+ options: amisLib.OptionsControl,
67
+ };
52
68
 
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 amisLib = amisRequire('amis');
63
- const registerMap = {
64
- renderer: amisLib.Renderer,
65
- formitem: amisLib.FormItem,
66
- options: amisLib.OptionsControl,
67
- };
69
+ const amisComps = lodash.filter(Builder.registry['meta-components'], function(item){ return item.componentName && item.amis?.render});
70
+
71
+ lodash.each(amisComps,(comp)=>{
72
+ const Component = Builder.components.find(item => item.name === comp.componentName);
73
+ if (Component && !AmisRenderers.includes(comp.amis?.render.type)){
74
+ try {
75
+ let AmisWrapper = Component.class
76
+ AmisRenderers.push(comp.amis?.render.type);
77
+ if(comp.componentType === 'amisSchema'){
78
+ let amisReact = amisRequire('react');
79
+ AmisWrapper = function(props){
80
+ // console.log(`AmisWrapper===>`, props)
81
+ const { $schema, body, render } = props
82
+ const [schema, setSchema] = amisReact.useState(null);
83
+ amisReact.useEffect(()=>{
84
+ // console.log("AmisWrapper===>==useEffect==", comp.amis.render.type, JSON.stringify(props.data?.recordId))
85
+ const result = Component.class(props);
86
+ if(result.then && typeof result.then === 'function'){
87
+ result.then((data)=>{
88
+ // console.log("AmisWrapper===>==useEffect==setSchema", data)
89
+ setSchema(data);
90
+ })
91
+ }else{
92
+ // console.log("AmisWrapper===>==useEffect==result", result)
93
+ setSchema(result)
94
+ }
95
+ }, [JSON.stringify($schema)]) //, JSON.stringify(props.data)
68
96
 
69
- const amisComps = lodash.filter(Builder.registry['meta-components'], function(item){ return item.componentName && item.amis?.render});
70
-
71
- lodash.each(amisComps,(comp)=>{
72
- const Component = Builder.components.find(item => item.name === comp.componentName);
73
- if (Component && !AmisRenderers.includes(comp.amis?.render.type)){
74
- try {
75
- let AmisWrapper = Component.class
76
- AmisRenderers.push(comp.amis?.render.type);
77
- if(comp.componentType === 'amisSchema'){
78
- let amisReact = amisRequire('react');
79
- AmisWrapper = function(props){
80
- // console.log(`AmisWrapper===>`, props)
81
- const { $schema, body, render } = props
82
- const [schema, setSchema] = amisReact.useState(null);
83
- amisReact.useEffect(()=>{
84
- // console.log("AmisWrapper===>==useEffect==", comp.amis.render.type, JSON.stringify(props.data?.recordId))
85
- const result = Component.class(props);
86
- if(result.then && typeof result.then === 'function'){
87
- result.then((data)=>{
88
- // console.log("AmisWrapper===>==useEffect==setSchema", data)
89
- setSchema(data);
90
- })
91
- }else{
92
- // console.log("AmisWrapper===>==useEffect==result", result)
93
- setSchema(result)
94
- }
95
- }, [JSON.stringify($schema)]) //, JSON.stringify(props.data)
97
+ if (!schema)
98
+ return render('body', {
99
+ "type": "wrapper",
100
+ "className": "h-full flex items-center justify-center",
101
+ "body": {
102
+ "type": "spinner",
103
+ "show": true
104
+ }
105
+ })
96
106
 
97
- if (!schema)
98
- return render('body', {
99
- "type": "wrapper",
100
- "className": "h-full flex items-center justify-center",
101
- "body": {
102
- "type": "spinner",
103
- "show": true
107
+ if (props.env.enableAMISDebug && schema) {
108
+ console.groupCollapsed(`[steedos render ${comp.amis?.render.type}]`);
109
+ console.trace('Component: ', props, 'Generated Amis Schema: ', schema);
110
+ console.groupEnd();
104
111
  }
105
- })
106
-
107
- if (props.env.enableAMISDebug && schema) {
108
- console.groupCollapsed(`[steedos render ${comp.amis?.render.type}]`);
109
- console.trace('Component: ', props, 'Generated Amis Schema: ', schema);
110
- console.groupEnd();
112
+ return amisReact.createElement(amisReact.Fragment, null, amisReact.createElement(amisReact.Fragment, null, schema && render ? render('body', schema) : ''));
111
113
  }
112
- return amisReact.createElement(amisReact.Fragment, null, amisReact.createElement(amisReact.Fragment, null, schema && render ? render('body', schema) : ''));
113
114
  }
115
+ // 注册amis渲染器
116
+ let asset = comp.amis.render;
117
+ if (!registerMap[asset.usage]) {
118
+ console.error(
119
+ `自定义组件注册失败,不存在${asset.usage}自定义组件类型。`, comp
120
+ );
121
+ } else {
122
+ registerMap[asset.usage]({
123
+ test: new RegExp(`(^|\/)${asset.type}`),
124
+ type: asset.type,
125
+ weight: asset.weight,
126
+ autoVar: true,
127
+ })(AmisWrapper);
128
+ // 记录当前创建的amis自定义组件
129
+ console.info('注册了一个自定义amis组件:', {
130
+ type: asset.type,
131
+ weight: asset.weight,
132
+ component: AmisWrapper,
133
+ framework: asset.framework,
134
+ usage: asset.usage,
135
+ });
114
136
  }
115
- // 注册amis渲染器
116
- let asset = comp.amis.render;
117
- if (!registerMap[asset.usage]) {
118
- console.error(
119
- `自定义组件注册失败,不存在${asset.usage}自定义组件类型。`, comp
120
- );
121
- } else {
122
- registerMap[asset.usage]({
123
- test: new RegExp(`(^|\/)${asset.type}`),
124
- type: asset.type,
125
- weight: asset.weight,
126
- autoVar: true,
127
- })(AmisWrapper);
128
- // 记录当前创建的amis自定义组件
129
- console.info('注册了一个自定义amis组件:', {
130
- type: asset.type,
131
- weight: asset.weight,
132
- component: AmisWrapper,
133
- framework: asset.framework,
134
- usage: asset.usage,
135
- });
136
- }
137
- // amisRequire("amis").Renderer(
138
- // {
139
- // type: comp.amis?.render.type,
140
- // weight: comp.amis?.render.weight,
141
- // autoVar: true,
142
- // }
143
- // )(AmisWrapper);
144
- } catch(e){console.error(e)}
145
- }
146
- });
137
+ // amisRequire("amis").Renderer(
138
+ // {
139
+ // type: comp.amis?.render.type,
140
+ // weight: comp.amis?.render.weight,
141
+ // autoVar: true,
142
+ // }
143
+ // )(AmisWrapper);
144
+ } catch(e){console.error(e)}
145
+ }
146
+ });
147
147
 
148
- const normalizeLink = (to, location = window.location) => {
149
- to = to || '';
150
-
151
- if (to && to[0] === '#') {
152
- to = location.pathname + location.search + to;
153
- } else if (to && to[0] === '?') {
154
- to = location.pathname + to;
155
- }
156
-
157
- const idx = to.indexOf('?');
158
- const idx2 = to.indexOf('#');
159
- let pathname = ~idx
160
- ? to.substring(0, idx)
161
- : ~idx2
162
- ? to.substring(0, idx2)
163
- : to;
164
- let search = ~idx ? to.substring(idx, ~idx2 ? idx2 : undefined) : '';
165
- let hash = ~idx2 ? to.substring(idx2) : location.hash;
166
-
167
- if (!pathname) {
168
- pathname = location.pathname;
169
- } else if (pathname[0] != '/' && !/^https?\:\/\//.test(pathname)) {
170
- let relativeBase = location.pathname;
171
- const paths = relativeBase.split('/');
172
- paths.pop();
173
- let m;
174
- while ((m = /^\.\.?\//.exec(pathname))) {
175
- if (m[0] === '../') {
176
- paths.pop();
148
+ const normalizeLink = (to, location = window.location) => {
149
+ to = to || '';
150
+
151
+ if (to && to[0] === '#') {
152
+ to = location.pathname + location.search + to;
153
+ } else if (to && to[0] === '?') {
154
+ to = location.pathname + to;
155
+ }
156
+
157
+ const idx = to.indexOf('?');
158
+ const idx2 = to.indexOf('#');
159
+ let pathname = ~idx
160
+ ? to.substring(0, idx)
161
+ : ~idx2
162
+ ? to.substring(0, idx2)
163
+ : to;
164
+ let search = ~idx ? to.substring(idx, ~idx2 ? idx2 : undefined) : '';
165
+ let hash = ~idx2 ? to.substring(idx2) : location.hash;
166
+
167
+ if (!pathname) {
168
+ pathname = location.pathname;
169
+ } else if (pathname[0] != '/' && !/^https?\:\/\//.test(pathname)) {
170
+ let relativeBase = location.pathname;
171
+ const paths = relativeBase.split('/');
172
+ paths.pop();
173
+ let m;
174
+ while ((m = /^\.\.?\//.exec(pathname))) {
175
+ if (m[0] === '../') {
176
+ paths.pop();
177
+ }
178
+ pathname = pathname.substring(m[0].length);
177
179
  }
178
- pathname = pathname.substring(m[0].length);
180
+ pathname = paths.concat(pathname).join('/');
179
181
  }
180
- pathname = paths.concat(pathname).join('/');
181
- }
182
-
183
- return pathname + search + hash;
184
- };
185
- const isCurrentUrl = (to, ctx)=>{
186
- try {
187
- if (!to) {
188
- return false;
189
- }
190
- const pathname = window.location.pathname;
191
- const link = normalizeLink(to, {
192
- ...location,
193
- pathname,
194
- hash: ''
195
- });
196
-
197
- if (!~link.indexOf('http') && ~link.indexOf(':')) {
198
- let strict = ctx && ctx.strict;
199
- return match(link, {
200
- decode: decodeURIComponent,
201
- strict: typeof strict !== 'undefined' ? strict : true
202
- })(pathname);
182
+
183
+ return pathname + search + hash;
184
+ };
185
+ const isCurrentUrl = (to, ctx)=>{
186
+ try {
187
+ if (!to) {
188
+ return false;
189
+ }
190
+ const pathname = window.location.pathname;
191
+ const link = normalizeLink(to, {
192
+ ...location,
193
+ pathname,
194
+ hash: ''
195
+ });
196
+
197
+ if (!~link.indexOf('http') && ~link.indexOf(':')) {
198
+ let strict = ctx && ctx.strict;
199
+ return match(link, {
200
+ decode: decodeURIComponent,
201
+ strict: typeof strict !== 'undefined' ? strict : true
202
+ })(pathname);
203
+ }
204
+ return decodeURI(pathname) === link || decodeURI(pathname).startsWith(`${link}/`);
205
+ } catch (error) {
206
+ console.error(`error`, error)
203
207
  }
204
- return decodeURI(pathname) === link || decodeURI(pathname).startsWith(`${link}/`);
205
- } catch (error) {
206
- console.error(`error`, error)
207
208
  }
208
- }
209
- AmisEnv = {
210
- // getModalContainer: (props)=>{
211
- // let div = document.querySelector("#amisModalContainer");
212
- // if(!div){
213
- // div = document.createElement('div');
214
- // div.className="amis-scope";
215
- // div.style.height='0px';
216
- // div.id="amisModalContainer";
217
- // document.body.appendChild(div)
218
- // }
219
- // return div;
220
- // },
221
- jumpTo: (to, action) => {
222
- if (to === 'goBack') {
223
- return window.history.back();
224
- }
209
+ AmisEnv = {
210
+ // getModalContainer: (props)=>{
211
+ // let div = document.querySelector("#amisModalContainer");
212
+ // if(!div){
213
+ // div = document.createElement('div');
214
+ // div.className="amis-scope";
215
+ // div.style.height='0px';
216
+ // div.id="amisModalContainer";
217
+ // document.body.appendChild(div)
218
+ // }
219
+ // return div;
220
+ // },
221
+ jumpTo: (to, action) => {
222
+ if (to === 'goBack') {
223
+ return window.history.back();
224
+ }
225
225
 
226
- to = normalizeLink(to);
226
+ to = normalizeLink(to);
227
227
 
228
- if (action && action.actionType === 'url') {
229
- action.blank === false ? (window.location.href = to) : window.open(to);
230
- return;
231
- }
228
+ if (action && action.actionType === 'url') {
229
+ action.blank === false ? (window.location.href = to) : window.open(to);
230
+ return;
231
+ }
232
+
233
+ // 主要是支持 nav 中的跳转
234
+ if (action && to && action.target) {
235
+ window.open(to, action.target);
236
+ return;
237
+ }
232
238
 
233
- // 主要是支持 nav 中的跳转
234
- if (action && to && action.target) {
235
- window.open(to, action.target);
236
- return;
239
+ if (/^https?:\/\//.test(to)) {
240
+ window.location.replace(to);
241
+ } else {
242
+ FlowRouter.go(to);
243
+ }
244
+ },
245
+ theme: 'antd',
246
+ isCurrentUrl: isCurrentUrl,
247
+ };
248
+ // 已弃用
249
+ const AmisRender = function (props) {
250
+ let env = props.env;
251
+ const schema = props.schema;
252
+ const data = props.data;
253
+ const name = props.name;
254
+ const refName = schema.name || schema.id;
255
+ if(SteedosUI.refs[refName]){
256
+ if(SteedosUI.refs[refName].unmount){
257
+ try {
258
+ SteedosUI.refs[refName].unmount()
259
+ } catch (Exception) {
260
+ }
261
+ }else{
262
+ console.log(`not find amis scope unmount`)
263
+ }
237
264
  }
238
265
 
239
- if (/^https?:\/\//.test(to)) {
240
- window.location.replace(to);
241
- } else {
242
- FlowRouter.go(to);
266
+ if(props.pageType === 'form'){
267
+ env = Object.assign({
268
+ getModalContainer: ()=>{
269
+ return document.querySelector('.amis-scope');
270
+ }
271
+ }, env);
243
272
  }
244
- },
245
- theme: 'antd',
246
- isCurrentUrl: isCurrentUrl,
247
- };
248
- // 已弃用
249
- const AmisRender = function (props) {
250
- let env = props.env;
251
- const schema = props.schema;
252
- const data = props.data;
253
- const name = props.name;
273
+ schema.scopeRef = (ref) => {
274
+ try {
275
+ if(!window.amisScopes){
276
+ window.amisScopes = {};
277
+ }
278
+ if(name){
279
+ window.amisScopes[name] = ref;
280
+ }
281
+ } catch (error) {
282
+ console.error('error', error)
283
+ }
284
+
285
+ return scoped = ref
286
+ }
287
+
288
+
289
+ let amisReact = amisRequire('react');
290
+
291
+ amisReact.useEffect(()=>{
292
+ const amisScope = amisRequire('amis/embed').embed(`.steedos-amis-render-scope-${name}`,schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
293
+ const refName = schema.name || schema.id;
294
+ if(window.SteedosUI && refName){
295
+ SteedosUI.refs[refName] = amisScope;
296
+ }
297
+ }, [])
298
+ return amisReact.createElement("div", {
299
+ className: "amis-scope"
300
+ }, amisReact.createElement("div", {
301
+ className: `steedos-amis-render-scope-${name}`
302
+ }));
303
+ };
304
+
305
+ window.renderAmis = function (root, schema, data, env) {
254
306
  const refName = schema.name || schema.id;
255
307
  if(SteedosUI.refs[refName]){
256
308
  if(SteedosUI.refs[refName].unmount){
@@ -263,13 +315,13 @@
263
315
  }
264
316
  }
265
317
 
266
- if(props.pageType === 'form'){
267
- env = Object.assign({
268
- getModalContainer: ()=>{
269
- return document.querySelector('.amis-scope');
270
- }
271
- }, env);
272
- }
318
+ // if(props.pageType === 'form'){
319
+ // env = Object.assign({
320
+ // getModalContainer: ()=>{
321
+ // return document.querySelector('.amis-scope');
322
+ // }
323
+ // }, env);
324
+ // }
273
325
  schema.scopeRef = (ref) => {
274
326
  try {
275
327
  if(!window.amisScopes){
@@ -285,103 +337,51 @@
285
337
  return scoped = ref
286
338
  }
287
339
 
288
-
289
- let amisReact = amisRequire('react');
290
-
291
- amisReact.useEffect(()=>{
292
- const amisScope = amisRequire('amis/embed').embed(`.steedos-amis-render-scope-${name}`,schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
293
- const refName = schema.name || schema.id;
294
- if(window.SteedosUI && refName){
295
- SteedosUI.refs[refName] = amisScope;
296
- }
297
- }, [])
298
- return amisReact.createElement("div", {
299
- className: "amis-scope"
300
- }, amisReact.createElement("div", {
301
- className: `steedos-amis-render-scope-${name}`
302
- }));
303
- };
304
-
305
- window.renderAmis = function (root, schema, data, env) {
306
- const refName = schema.name || schema.id;
307
- if(SteedosUI.refs[refName]){
308
- if(SteedosUI.refs[refName].unmount){
309
- try {
310
- SteedosUI.refs[refName].unmount()
311
- } catch (Exception) {
312
- }
313
- }else{
314
- console.log(`not find amis scope unmount`)
315
- }
316
- }
317
-
318
- // if(props.pageType === 'form'){
319
- // env = Object.assign({
320
- // getModalContainer: ()=>{
321
- // return document.querySelector('.amis-scope');
322
- // }
323
- // }, env);
324
- // }
325
- schema.scopeRef = (ref) => {
326
- try {
327
- if(!window.amisScopes){
328
- window.amisScopes = {};
329
- }
330
- if(name){
331
- window.amisScopes[name] = ref;
332
- }
333
- } catch (error) {
334
- console.error('error', error)
340
+ const amisScope = amisRequire('amis/embed').embed(root, schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
341
+ if(window.SteedosUI && refName){
342
+ SteedosUI.refs[refName] = amisScope;
343
+ SteedosUI.refs[refName].__$schema = schema;
335
344
  }
336
-
337
- return scoped = ref
338
- }
339
-
340
- const amisScope = amisRequire('amis/embed').embed(root, schema, {data, name, locale: getAmisLng()}, Object.assign({}, AmisEnv, env))
341
- if(window.SteedosUI && refName){
342
- SteedosUI.refs[refName] = amisScope;
343
- SteedosUI.refs[refName].__$schema = schema;
344
- }
345
- };
345
+ };
346
346
 
347
- const initMonaco = ()=>{
347
+ const initMonaco = ()=>{
348
348
 
349
- // const { detect } = require('detect-browser');
349
+ // const { detect } = require('detect-browser');
350
350
 
351
- // const browser = detect();
351
+ // const browser = detect();
352
352
 
353
- // // 低于86版的chrome 不支持code类型字段及功能
354
- // if (browser && browser.name === 'chrome' && Number(browser.version.split(".")[0]) < 86) {
355
- // return Promise.resolve(true)
356
- // }
353
+ // // 低于86版的chrome 不支持code类型字段及功能
354
+ // if (browser && browser.name === 'chrome' && Number(browser.version.split(".")[0]) < 86) {
355
+ // return Promise.resolve(true)
356
+ // }
357
357
 
358
- // // 手机版暂不支持code类型字段.
359
- // if(Meteor.isCordova){
360
- // return Promise.resolve(true)
361
- // }else{
362
- // return Builder.initMonaco()
363
- // }
358
+ // // 手机版暂不支持code类型字段.
359
+ // if(Meteor.isCordova){
360
+ // return Promise.resolve(true)
361
+ // }else{
362
+ // return Builder.initMonaco()
363
+ // }
364
364
 
365
- return Promise.resolve(true)
366
- }
367
- //Amis SDK 中已清理了monaco, 所以这里需要提前注册,否则会导致amis code类型报错
368
- initMonaco().catch((err)=>{
369
- console.error(`Builder.initMonaco error: ${err}`);
370
- }).finally(()=>{
371
- const language = getAmisLng()
372
- axios.get(`/translations/amis/${language}.json`).then((res)=>{
373
- amisRequire("amis").registerLocale(`${language}`, res.data)
374
- Builder.registerComponent(AmisRender, {
375
- name: 'Amis',
376
- inputs: [
377
- { name: 'schema', type: 'object' },
378
- { name: 'data', type: 'object' },
379
- { name: 'name', type: 'string' }
380
- ]
381
- });
382
- })
383
- });
384
- });
385
- // });
365
+ return Promise.resolve(true)
366
+ }
367
+ //Amis SDK 中已清理了monaco, 所以这里需要提前注册,否则会导致amis code类型报错
368
+ initMonaco().catch((err)=>{
369
+ console.error(`Builder.initMonaco error: ${err}`);
370
+ }).finally(()=>{
371
+ const language = getAmisLng()
372
+ axios.get(`/translations/amis/${language}.json`).then((res)=>{
373
+ amisRequire("amis").registerLocale(`${language}`, res.data)
374
+ Builder.registerComponent(AmisRender, {
375
+ name: 'Amis',
376
+ inputs: [
377
+ { name: 'schema', type: 'object' },
378
+ { name: 'data', type: 'object' },
379
+ { name: 'name', type: 'string' }
380
+ ]
381
+ });
382
+ })
383
+ });
384
+ });
385
+ // });
386
386
 
387
387
  })();
@@ -234,15 +234,15 @@ module.exports = {
234
234
  */
235
235
  const relatedListObjects = [];
236
236
  const relationsInfo = await object.getRelationsInfo();
237
- let details = relationsInfo && relationsInfo.details;
238
- const lookupDetails = relationsInfo && relationsInfo.lookup_details;
239
- details = _.union(details, lookupDetails);
237
+ const details = relationsInfo && relationsInfo.details;
238
+ // const lookupDetails = relationsInfo && relationsInfo.lookup_details;
239
+ // const relatedLists = _.union(details, lookupDetails);
240
240
 
241
241
  _.each(details, function(related){
242
242
  /*related可能是一个lookup_details,它是对象而不是字符串,从中取出key值*/
243
- if(typeof related !== "string"){
244
- relatedListObjects.push(related.objectName)
245
- }
243
+ // if(typeof related !== "string"){
244
+ // relatedListObjects.push(related.objectName)
245
+ // }
246
246
  let foo = related.split('.');
247
247
  let rObjectName = foo[0];
248
248
  relatedListObjects.push(rObjectName);
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-05-19 11:38:30
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2023-04-19 13:20:20
4
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
5
+ * @LastEditTime: 2023-03-15 17:37:05
6
6
  * @Description:
7
7
  */
8
8
  const PageSchema = require('./utils/page-schema');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.4.15-beta.2",
3
+ "version": "2.5.0-beta.10",
4
4
  "main": "package.service.js",
5
5
  "scripts": {
6
6
  "build": "yarn build:tailwind-base && yarn build:tailwind",
@@ -13,7 +13,7 @@
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
- "gitHead": "12a38495b498f270c96d571e9fb4216d3df64d49",
16
+ "gitHead": "d751a4f5d4d6872b19a615769fe2484fc803ee82",
17
17
  "devDependencies": {
18
18
  "tailwindcss": "3.2.4"
19
19
  }
@@ -89,10 +89,6 @@
89
89
  margin: 0px
90
90
  }
91
91
 
92
- .m-3 {
93
- margin: 0.75rem
94
- }
95
-
96
92
  .mx-4 {
97
93
  margin-left: 1rem;
98
94
  margin-right: 1rem
@@ -200,11 +196,23 @@
200
196
  width: 50%
201
197
  }
202
198
 
199
+ .w-96 {
200
+ width: 24rem
201
+ }
202
+
203
203
  .min-w-max {
204
204
  min-width: -moz-max-content;
205
205
  min-width: max-content
206
206
  }
207
207
 
208
+ .min-w-\[240px\] {
209
+ min-width: 240px
210
+ }
211
+
212
+ .min-w-\[200px\] {
213
+ min-width: 200px
214
+ }
215
+
208
216
  .flex-none {
209
217
  flex: none
210
218
  }
@@ -213,6 +221,10 @@
213
221
  flex: 1 1 0%
214
222
  }
215
223
 
224
+ .flex-shrink-0 {
225
+ flex-shrink: 0
226
+ }
227
+
216
228
  .-translate-x-0 {
217
229
  --tw-translate-x: -0px;
218
230
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
@@ -259,6 +271,10 @@
259
271
  overflow-y: auto
260
272
  }
261
273
 
274
+ .rounded {
275
+ border-radius: 0.25rem
276
+ }
277
+
262
278
  .border-b-\[3px\] {
263
279
  border-bottom-width: 3px
264
280
  }
@@ -290,11 +306,26 @@
290
306
  border-color: rgb(203 213 225 / var(--tw-border-opacity))
291
307
  }
292
308
 
309
+ .border-gray-200 {
310
+ --tw-border-opacity: 1;
311
+ border-color: rgb(229 231 235 / var(--tw-border-opacity))
312
+ }
313
+
314
+ .border-gray-300 {
315
+ --tw-border-opacity: 1;
316
+ border-color: rgb(209 213 219 / var(--tw-border-opacity))
317
+ }
318
+
293
319
  .bg-white {
294
320
  --tw-bg-opacity: 1;
295
321
  background-color: rgb(255 255 255 / var(--tw-bg-opacity))
296
322
  }
297
323
 
324
+ .bg-gray-100 {
325
+ --tw-bg-opacity: 1;
326
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity))
327
+ }
328
+
298
329
  .p-0 {
299
330
  padding: 0px
300
331
  }
@@ -303,6 +334,10 @@
303
334
  padding: 1rem
304
335
  }
305
336
 
337
+ .p-2 {
338
+ padding: 0.5rem
339
+ }
340
+
306
341
  .px-4 {
307
342
  padding-left: 1rem;
308
343
  padding-right: 1rem
@@ -394,6 +429,11 @@
394
429
  color: rgb(0 0 0 / var(--tw-text-opacity))
395
430
  }
396
431
 
432
+ .text-gray-500 {
433
+ --tw-text-opacity: 1;
434
+ color: rgb(107 114 128 / var(--tw-text-opacity))
435
+ }
436
+
397
437
  .underline {
398
438
  text-decoration-line: underline
399
439
  }
@@ -432,6 +472,11 @@
432
472
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)
433
473
  }
434
474
 
475
+ .focus\:outline-none:focus {
476
+ outline: 2px solid transparent;
477
+ outline-offset: 2px
478
+ }
479
+
435
480
  @media (min-width: 640px) {
436
481
  .sm\:mt-\[90px\] {
437
482
  margin-top: 90px
@@ -462,6 +507,10 @@
462
507
  border-color: rgb(209 213 219 / var(--tw-border-opacity))
463
508
  }
464
509
 
510
+ .sm\:p-3 {
511
+ padding: 0.75rem
512
+ }
513
+
465
514
  .sm\:shadow {
466
515
  --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
467
516
  --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
@@ -473,4 +522,20 @@
473
522
  .lg\:z-50 {
474
523
  z-index: 50
475
524
  }
525
+
526
+ .lg\:order-first {
527
+ order: -9999
528
+ }
529
+
530
+ .lg\:order-last {
531
+ order: 9999
532
+ }
533
+
534
+ .lg\:flex {
535
+ display: flex
536
+ }
537
+
538
+ .lg\:flex-col {
539
+ flex-direction: column
540
+ }
476
541
  }