@steedos/service-plugin-amis 2.2.16 → 2.2.19

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/LICENSE.txt CHANGED
@@ -15,8 +15,8 @@ On request, licenses under different terms are available.
15
15
  Project templates can be found in the folders steedos-projects/
16
16
 
17
17
  Source code of enterprise features are files that
18
- * are in folders named "ee" or end with "_ee", or in subfolders of such folders.
19
- * contain the strings "_ee" in its filename name.
18
+ * are in folders named "ee" or start with "ee_", or in subfolders of such folders.
19
+ * contain the strings "ee_" in its filename name.
20
20
  The files can be found by running the command `find . -iname ee -or -iname "*_ee*" -or -iname "*ee_*"`
21
21
 
22
22
  STEEDOS TRADEMARK GUIDELINES
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  ; (function () {
8
+
8
9
  try {
9
10
  let amisStyle = document.createElement("link");
10
11
  amisStyle.setAttribute("rel", "stylesheet");
@@ -13,48 +14,62 @@
13
14
  document.getElementsByTagName("head")[0].appendChild(amisStyle);
14
15
  } catch (error) {
15
16
  console.error(error)
16
- }
17
+ };
18
+
17
19
  import('/amis/sdk/sdk.noreact.js').then(() => {
18
20
 
19
- //处理mobx多个实例问题
20
- // try {
21
- // let mobx = amisRequire('mobx');
22
- // mobx.configure({ isolateGlobalState: true })
23
- // } catch (error) {
21
+ Promise.all([
22
+ waitForThing(window, 'assetsLoaded'),
23
+ waitForThing(window, 'React'),
24
+ waitForThing(window, 'Builder'),
25
+ waitForThing(window, 'amisRequire'),
26
+ ]).then(()=>{
24
27
 
25
- // }
28
+ window.SAmisReners = [];
26
29
 
27
- let React = window.React || amisRequire("react");
30
+ const amisComps = lodash.filter(Builder.registry['meta-components'], function(item){ return item.componentName && item.amis?.render});
31
+
32
+ let amisLib = amisRequire('amis');
33
+
34
+ lodash.each(amisComps,(comp)=>{
35
+ const Component = Builder.components.find(item => item.name === comp.componentName);
36
+ if (Component && !SAmisReners.includes(comp.amis?.render.type)){
37
+ try {
38
+ SAmisReners.push(comp.amis?.render.type);
39
+ amisLib.Renderer(
40
+ {
41
+ type: comp.amis?.render.type,
42
+ weight: comp.amis?.render.weight
43
+ }
44
+ )(Component.class);
45
+ } catch(e){console.log(e)}
46
+ }
47
+ })
28
48
 
29
- // Register amis render
30
- var Amis = function (props) {
31
- var schema = props.schema, data = props.data;
32
- return React.createElement(React.Fragment, null,
33
- React.createElement("div", { id: "amis-root" }),
34
- // amisRequire('amis').render(schema, data, {theme: 'cxd'}))
35
- function () {
36
- setTimeout(function () {
37
- amisRequire('amis/embed').embed('#amis-root', schema, {
38
- data
39
- })
40
- }, 100)
41
- }()
42
- );
43
- };
49
+ // Register amis render
50
+ var Amis = function (props) {
51
+ var schema = props.schema, data = props.data;
52
+ return React.createElement(React.Fragment, null,
53
+ React.createElement("div", { id: "amis-root" }),
54
+ // amisRequire('amis').render(schema, data, {theme: 'cxd'}))
55
+ function () {
56
+ setTimeout(function () {
57
+ amisRequire('amis/embed').embed('#amis-root', schema, {
58
+ data
59
+ })
60
+ }, 100)
61
+ }()
62
+ );
63
+ };
44
64
 
45
- //等待Builder加载完成
46
- waitForThing(window, 'Builder').then(()=>{
47
- //等待amis组件加载完成
48
- waitForThing(window, 'amisComponentsLoaded').then(()=>{
49
- Builder.registerComponent(Amis, {
50
- name: 'Amis',
51
- inputs: [
52
- { name: 'schema', type: 'object' },
53
- { name: 'data', type: 'object' },
54
- ]
55
- });
56
- })
57
- })
65
+ Builder.registerComponent(Amis, {
66
+ name: 'Amis',
67
+ inputs: [
68
+ { name: 'schema', type: 'object' },
69
+ { name: 'data', type: 'object' },
70
+ ]
71
+ });
72
+ });
58
73
  });
59
74
 
60
75
  })();
@@ -4,29 +4,10 @@
4
4
  * @Description: 基于steedos builder 实现 Amis组件的动态注册
5
5
  */
6
6
 
7
- window.SAmisReners = [];
8
7
 
9
8
  window.addEventListener('message', function (event) {
10
9
  const { data } = event;
11
- if (data.type === 'builder.register') {
12
- if(data.data?.type === 'remote-assets'){
13
- const amisComps = lodash.filter(Builder.registry['meta-components'], function(item){ return item.componentName && item.amis?.render});
14
- let amisLib = amisRequire('amis');
15
- lodash.each(amisComps,(comp)=>{
16
- const Component = Builder.components.find(item => item.name === comp.componentName);
17
- if (Component && !SAmisReners.includes(comp.amis?.render.type)){
18
- try {
19
- SAmisReners.push(comp.amis?.render.type);
20
- amisLib.Renderer(
21
- {
22
- type: comp.amis?.render.type,
23
- weight: comp.amis?.render.weight
24
- }
25
- )(Component.class);
26
- } catch(e){console.log(e)}
27
- }
28
- })
29
- window.amisComponentsLoaded = true;
30
- }
31
- }
32
- });
10
+ if (data.type === 'builder.assetsLoaded') {
11
+ window.assetsLoaded = true;
12
+ }
13
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.2.16",
3
+ "version": "2.2.19",
4
4
  "main": "package.service.js",
5
5
  "scripts": {},
6
6
  "license": "MIT",
@@ -8,5 +8,5 @@
8
8
  "publishConfig": {
9
9
  "access": "public"
10
10
  },
11
- "gitHead": "cb243763c0b81f01c414c617725583bdc831ee9f"
11
+ "gitHead": "952067d4517fd07335b75c63fec4700f18db73ec"
12
12
  }