@steedos/service-plugin-amis 2.2.36 → 2.2.37

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.
@@ -0,0 +1,94 @@
1
+ /*
2
+ * @Author: baozhoutao@steedos.com
3
+ * @Date: 2022-05-23 09:53:08
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2022-05-27 11:36:56
6
+ * @Description:
7
+ */
8
+ const objectql = require('@steedos/objectql');
9
+ function getCreatedInfoTpl(){
10
+ return "<div><a href='/app/admin/users/view/${created_by._id}'>${created_by.name}</a> ${_display.created}</div>"
11
+ }
12
+
13
+ function getModifiedInfoTpl(){
14
+ return "<div><a href='/app/admin/users/view/${modified_by._id}'>${modified_by.name}</a> ${_display.modified}</div>"
15
+ }
16
+
17
+ function getDateTpl(field){
18
+ return `<div>\${_display.${field.name}}</div>`
19
+ }
20
+
21
+
22
+ function getDateTimeTpl(field){
23
+ return `<div>\${_display.${field.name}}</div>`
24
+ }
25
+
26
+ function getRefObjectNameFieldName(field){
27
+ const refObject = objectql.getObject(field.reference_to);
28
+ return refObject.NAME_FIELD_KEY;
29
+ }
30
+
31
+ function getSelectTpl(field){
32
+ return `<div>\${_display.${field.name}}</div>`
33
+ }
34
+
35
+ function getLookupTpl(field){
36
+ if(!field.reference_to){
37
+ return getSelectTpl(field)
38
+ }
39
+ const NAME_FIELD_KEY = getRefObjectNameFieldName(field);
40
+ if(field.multiple){
41
+ return `
42
+ <% if (data.${field.name} && data.${field.name}.length) { %><% data.${field.name}.forEach(function(item) { %> <a href="/app/-/${field.reference_to}/view/<%=item._id%>"><%=item.${NAME_FIELD_KEY}%></a> <% }); %><% } %>
43
+ `
44
+ }else{
45
+ return `<a href="/app/-/${field.reference_to}/view/\${${field.name}._id}">\${${field.name}.${NAME_FIELD_KEY}}</a>`
46
+ }
47
+
48
+ }
49
+
50
+ function getSwitchTpl(field){
51
+ return `<% if (data.${field.name}) { %>
52
+ <span class="slds-icon_container slds-icon-utility-check slds-current-color" title="<%=data._display.${field.name}%>">
53
+ <div class="steedos-icon-wrap"><span><svg aria-hidden="true" class="slds-icon_x-small slds-icon slds-icon-text-default" viewBox="0 0 52 52" name="check"><path d="M19.1 42.5L2.6 25.9c-.6-.6-.6-1.6 0-2.2l2.2-2.2c.6-.6 1.6-.6 2.2 0L19.4 34c.4.4 1.1.4 1.5 0L45.2 9.5c.6-.6 1.6-.6 2.2 0l2.2 2.2c.6.6.6 1.6 0 2.2L21.3 42.5c-.6.7-1.6.7-2.2 0z"></path></svg></span></div>
54
+ <span class="slds-assistive-text"><%=data._display.${field.name}%></span>
55
+ </span>
56
+ <% } %>`
57
+ }
58
+
59
+ function getPasswordTpl(field){
60
+ return `<% if (data.${field.name}) { %>
61
+ <span>······</span>
62
+ <% } %>`
63
+ }
64
+
65
+ //TODO
66
+ exports.getPasswordTpl = getPasswordTpl;
67
+ exports.getSwitchTpl = getSwitchTpl;
68
+ exports.getSelectTpl = getSelectTpl;
69
+ exports.getDateTpl = getDateTpl;
70
+ exports.getDateTimeTpl = getDateTimeTpl;
71
+ exports.getLookupTpl = getLookupTpl
72
+ exports.getCreatedInfoTpl = getCreatedInfoTpl
73
+ exports.getModifiedInfoTpl = getModifiedInfoTpl
74
+
75
+ exports.getFieldTpl = function(field){
76
+ switch (field.type) {
77
+ case 'password':
78
+ return getPasswordTpl(field);
79
+ case 'boolean':
80
+ return getSwitchTpl(field);
81
+ case 'select':
82
+ return getSelectTpl(field);
83
+ case 'date':
84
+ return getDateTpl(field);
85
+ case 'datetime':
86
+ return getDateTimeTpl(field);
87
+ case 'lookup':
88
+ return getLookupTpl(field);
89
+ case 'master_detail':
90
+ return getLookupTpl(field);
91
+ default:
92
+ break;
93
+ }
94
+ };
@@ -0,0 +1,15 @@
1
+ function getSvgUrl(source, name) {
2
+ var foo, url;
3
+ foo = name != null ? name.split(".") : void 0;
4
+ if (foo && foo.length > 1) {
5
+ source = foo[0];
6
+ if (!(source != null ? source.endsWith("-sprite") : void 0)) {
7
+ source += "-sprite";
8
+ }
9
+ name = foo[1];
10
+ }
11
+ url = "/assets/icons/" + source + "/svg/symbols.svg#" + name;
12
+ return Creator.getRelativeUrl(url);
13
+ }
14
+
15
+ exports.getSvgUrl = getSvgUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.2.36",
3
+ "version": "2.2.37",
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": "c19065633fb41278b2ab6e244f3d0f6afa08c2f2"
11
+ "gitHead": "f824c11de5f099c1063aa4ef1941fd90666892a3"
12
12
  }
@@ -1,5 +1,3 @@
1
- /* @import '/amis/sdk/sdk.css'; */
2
-
3
1
  @import '/unpkg.com/amis@1.8.0/lib/themes/default.css';
4
2
 
5
3
  @import '/unpkg.com/amis@1.8.0/lib/themes/antd.css';
@@ -9,10 +7,10 @@
9
7
  width: 100%;
10
8
  } */
11
9
 
12
- .amis-scope{
10
+ .page-template-root{
11
+ height: 100%;
13
12
  background: #ffffff;
14
13
  }
15
-
16
14
  .amis-scope svg {
17
15
  display: inline !important;
18
16
  vertical-align: initial !important;
@@ -34,4 +32,58 @@ body{
34
32
  .a-Table svg {
35
33
  display: inline !important;
36
34
  vertical-align: initial !important;
35
+ }
36
+
37
+ .ant-modal-root .amis-scope .antd-Panel-footerWrap{
38
+ position: sticky;
39
+ width: 100%;
40
+ bottom: 0px;
41
+ background: #ffffff
42
+ }
43
+
44
+ .amis-scope .antd-Modal-content{
45
+ max-height: calc(100vh - 200px);
46
+ }
47
+
48
+ .amis-scope .antd-Modal-content .antd-Modal-body{
49
+ height: calc(100% - 108px);
50
+ overflow: auto;
51
+ }
52
+
53
+ .amis-scope .antd-Select-option > label {
54
+ display: block;
55
+ min-width: 100px;
56
+ }
57
+
58
+ .steedos-amis-form .antd-Collapse .antd-Form--normal{
59
+ display: grid!important;
60
+ grid-template-columns: repeat(2,minmax(0,1fr))!important;
61
+ grid-row-gap: 1rem!important;
62
+ row-gap: 1rem!important;
63
+ grid-column-gap: 1.5rem!important;
64
+ -moz-column-gap: 1.5rem!important;
65
+ column-gap: 1.5rem!important;
66
+ }
67
+
68
+ /* fix checkbox 隐藏时导致滚动条异常 */
69
+ .steedos-amis-form .antd-Collapse .antd-Form--normal .antd-Checkbox input{
70
+ position: fixed;
71
+ }
72
+
73
+ .steedos-amis-form .antd-Select-option{
74
+ width: 100% !important;
75
+ }
76
+
77
+ @media (max-width: 768px) {
78
+ .steedos-amis-form::before{
79
+ border-bottom: none;
80
+ }
81
+
82
+ .steedos-amis-form .antd-Collapse .antd-Form--normal{
83
+ grid-template-columns: none !important;
84
+ }
85
+
86
+ .ant-modal-root .amis-scope .antd-Panel-footerWrap{
87
+ position: fixed;
88
+ }
37
89
  }