@steedos/service-plugin-amis 2.2.4

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ ### Amis 插件
2
+ - 支持 Amis 渲染 Page
3
+ - 支持 Amis 编辑器
@@ -0,0 +1,47 @@
1
+ ; (function () {
2
+ try {
3
+ let amisStyle = document.createElement("link");
4
+ amisStyle.setAttribute("rel", "stylesheet");
5
+ amisStyle.setAttribute("type", "text/css");
6
+ amisStyle.setAttribute("href", "/amis/amis.css");
7
+ document.getElementsByTagName("head")[0].appendChild(amisStyle);
8
+ } catch (error) {
9
+ console.error(error)
10
+ }
11
+ import('/amis/sdk/sdk.noreact.js').then(() => {
12
+ //处理mobx多个实例问题
13
+ try {
14
+ let mobx = amisRequire('mobx');
15
+ mobx.configure({ isolateGlobalState: true })
16
+ } catch (error) {
17
+
18
+ }
19
+
20
+ let React = window.React || amisRequire("react");
21
+
22
+ // Register amis render
23
+ var Amis = function (props) {
24
+ var schema = props.schema, data = props.data;
25
+ return React.createElement(React.Fragment, null,
26
+ React.createElement("div", { id: "amis-root" }),
27
+ // amisRequire('amis').render(schema, data, {theme: 'cxd'}))
28
+ function () {
29
+ setTimeout(function () {
30
+ amisRequire('amis/embed').embed('#amis-root', schema, {
31
+ data
32
+ })
33
+ }, 100)
34
+ }()
35
+ );
36
+ };
37
+
38
+ Builder.register('PageRender', {
39
+ name: 'Amis',
40
+ component: Amis,
41
+ inputs: [
42
+ { name: 'schema', type: 'object' },
43
+ { name: 'data', type: 'object' },
44
+ ]
45
+ })
46
+ });
47
+ })();
@@ -0,0 +1,12 @@
1
+ (function () {
2
+ try {
3
+ var styleCss = $(`<style>
4
+ .steedos .creator-content-wrapper .steedos-page .page-header-wrapper{
5
+ display: none;
6
+ }
7
+ </style>`);
8
+ $("head").append(styleCss);
9
+ } catch (error) {
10
+ console.log(error);
11
+ }
12
+ })();
@@ -0,0 +1,11 @@
1
+ name: render_engine
2
+ type: select
3
+ label: 渲染器
4
+ defaultValue: amis
5
+ options:
6
+ - label: Amis
7
+ value: amis
8
+ - label: Redash
9
+ value: redash
10
+ required: true
11
+ sort_no: 125
@@ -0,0 +1,2 @@
1
+ extend: pages
2
+ name: pages
@@ -0,0 +1,68 @@
1
+ module.exports = {
2
+ name: "amis",
3
+ mixins: [],
4
+ /**
5
+ * Settings
6
+ */
7
+ settings: {
8
+
9
+ },
10
+
11
+ /**
12
+ * Dependencies
13
+ */
14
+ dependencies: [],
15
+
16
+ /**
17
+ * Actions
18
+ */
19
+ actions: {
20
+ getDefaultSchema: {
21
+ async handler(ctx) {
22
+ // const userSession = ctx.meta.user;
23
+ // const { type, app, objectApiName, recordId, formFactor } = ctx.params;
24
+ return this.getDefaultSchema();
25
+ }
26
+ }
27
+ },
28
+
29
+ /**
30
+ * Events
31
+ */
32
+ events: {
33
+
34
+ },
35
+
36
+ /**
37
+ * Methods
38
+ */
39
+ methods: {
40
+ getDefaultSchema: {
41
+ handler() {
42
+
43
+
44
+ }
45
+ }
46
+ },
47
+
48
+ /**
49
+ * Service created lifecycle event handler
50
+ */
51
+ async created() {
52
+
53
+ },
54
+
55
+ /**
56
+ * Service started lifecycle event handler
57
+ */
58
+ async started() {
59
+
60
+ },
61
+
62
+ /**
63
+ * Service stopped lifecycle event handler
64
+ */
65
+ async stopped() {
66
+
67
+ }
68
+ };
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@steedos/service-plugin-amis",
3
+ "version": "2.2.4",
4
+ "main": "package.service.js",
5
+ "scripts": {},
6
+ "license": "MIT",
7
+ "private": false,
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "gitHead": "a0c0e8d900f7f4fd2045d976b36c9bef465a6ce3"
12
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ const project = require('./package.json');
3
+ const packageName = project.name;
4
+ const packageLoader = require('@steedos/service-package-loader');
5
+ const _ = require(`lodash`);
6
+ const express = require('express');
7
+ const path = require('path');
8
+
9
+ /**
10
+ * @typedef {import('moleculer').Context} Context Moleculer's Context
11
+ * 软件包服务启动后也需要抛出事件。
12
+ */
13
+ module.exports = {
14
+ name: packageName,
15
+ namespace: "steedos",
16
+ mixins: [packageLoader],
17
+ /**
18
+ * Settings
19
+ */
20
+ settings: {
21
+ packageInfo: {
22
+ path: __dirname,
23
+ name: this.name,
24
+ },
25
+ initBuilderRouter: false
26
+ },
27
+
28
+ /**
29
+ * Dependencies
30
+ */
31
+ dependencies: ['~packages-@steedos/service-pages'],
32
+
33
+ /**
34
+ * Actions
35
+ */
36
+ actions: {
37
+
38
+ },
39
+
40
+ /**
41
+ * Events
42
+ */
43
+ events: {
44
+ 'steedos-server.started': async function (ctx) {
45
+ this.initBuilderRouter();
46
+ }
47
+ },
48
+
49
+ /**
50
+ * Methods
51
+ */
52
+ methods: {
53
+ initBuilderRouter: {
54
+ handler() {
55
+ if (this.settings.initBuilderRouter) {
56
+ return;
57
+ }
58
+ this.settings.initBuilderRouter = true;
59
+ try {
60
+ const router = express.Router();
61
+ let publicPath = path.join(__dirname, 'public');
62
+ let routerPath = "";
63
+ if (__meteor_runtime_config__.ROOT_URL_PATH_PREFIX) {
64
+ routerPath = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
65
+ }
66
+ const cacheTime = 86400000 * 1; // one day
67
+ router.use(routerPath, express.static(publicPath, { maxAge: cacheTime }));
68
+ WebApp.rawConnectHandlers.use(router);
69
+ } catch (error) {
70
+ console.error(error)
71
+ this.settings.initBuilderRouter = false;
72
+ }
73
+ }
74
+ },
75
+ },
76
+
77
+ /**
78
+ * Service created lifecycle event handler
79
+ */
80
+ async created() {
81
+
82
+ },
83
+
84
+ /**
85
+ * Service started lifecycle event handler
86
+ */
87
+ async started() {
88
+ this.initBuilderRouter();
89
+ },
90
+
91
+ /**
92
+ * Service stopped lifecycle event handler
93
+ */
94
+ async stopped() {
95
+
96
+ }
97
+ };
@@ -0,0 +1,29 @@
1
+ @import '/amis/sdk/sdk.css';
2
+
3
+
4
+ /* .amis-routes-wrapper{
5
+ width: 100%;
6
+ } */
7
+
8
+ .amis-scope{
9
+ background: none;
10
+ }
11
+
12
+ .amis-scope svg {
13
+ display: inline !important;
14
+ vertical-align: initial !important;
15
+ }
16
+
17
+ /* .row-main{
18
+ border-radius: 0.25rem
19
+ } */
20
+
21
+ .amis-scope .a-Form-item--horizontal.col-span-2 .a-Form-itemColumn--2 {
22
+ flex: 0 0 calc(8.33333333335% - 2px);
23
+ max-width: calc(8.33333333335% - 2px);
24
+ }
25
+
26
+ .a-Table svg {
27
+ display: inline !important;
28
+ vertical-align: initial !important;
29
+ }