@steedos/service-plugin-amis 2.6.2-beta.30 → 2.6.2-beta.32

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.
@@ -13,7 +13,9 @@
13
13
  "tab_items": {
14
14
  "amis": {
15
15
  "name": "tab_items",
16
- "type": "crud",
16
+ "type": "steedos-input-table",
17
+ "label": "",
18
+ "showIndex": true,
17
19
  "source": "${tab_items}",
18
20
  "strictMode": true,
19
21
  "affixHeader": false,
@@ -22,68 +24,49 @@
22
24
  "removable": true,
23
25
  "draggable": false,
24
26
  "headerToolbarClassName": "px-1 pb-3",
25
- "columns": [
27
+ "fields": [
26
28
  {
27
- "name": "index",
28
- "label": "${'apps.apps_form.tab_number'| t}",
29
- "type": "tpl",
30
- "tpl": "${index+1}",
31
- "className": "w-10",
32
- "id": "u:c59784421c37"
33
- },
34
- {
35
- "name": "tab_name_label",
36
29
  "label": "${'apps.apps_form.tab' | t}",
37
- "type": "tpl",
38
- "id": "u:b95c69a1cd84",
39
- "tpl": "${tabs_options|filter:value:equals:tab_name|pick:label}"
30
+ "type": "lookup",
31
+ "multiple": false,
32
+ "is_wide": false,
33
+ "required": true,
34
+ "reference_to": "tabs",
35
+ "reference_to_field": "name",
36
+ "sort_no": 30,
37
+ "name": "tab_name",
38
+ "hidden": false,
39
+ "readonly": false,
40
+ "disabled": false,
41
+ "_prefix": "tab_items."
40
42
  },
41
43
  {
42
- "name": "group",
43
44
  "label": "${'apps.apps_form.tab_grouping' | t}",
44
- "id": "u:e532b1949676",
45
- "quickEdit": {
45
+ "name": "group",
46
+ "_prefix": "tab_items.",
47
+ "type": "text",
48
+ "amis": {
46
49
  "type": "select",
47
- "name": "group",
48
- "className": "m-0",
50
+ "source": "${tab_groups|pick:group_name}",
49
51
  "onEvent": {
50
52
  "change": {
51
53
  "actions": [
52
54
  {
53
55
  "actionType": "custom",
54
- "script": "const tabGroupKey = \"group\";const getTabsSortFun = function (groupNames) { return function (m, n) { var tempM = !!m[tabGroupKey] ? 1 : 0; var tempN = !!n[tabGroupKey] ? 1 : 0; if (!m[tabGroupKey] || !n[tabGroupKey]) { return tempM - tempN; } return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]); };};const quickEidtSaveForTab = function (input, prop_name) { const currentPropValue = input.value; const rowValue = input.__super; const formValue = input.__super.__super.__super; const tab_name = rowValue.tab_name; rowValue[prop_name] = currentPropValue; delete rowValue.index; let newTabs = formValue.tab_items.map(function (item) { if (item.tab_name == tab_name) { return Object.assign({}, item, rowValue); } else { return item; } }); const tabGroups = input.__super.__super.tab_groups; const groupNames = _.compact(_.map(tabGroups, \"group_name\")); if (groupNames && groupNames.length) { newTabs.sort(getTabsSortFun(groupNames)); } return { tab_items: newTabs }};const eventData = event.data;const newTabTtemsProp = quickEidtSaveForTab(eventData, \"group\");setTimeout(function () { doAction({ actionType: 'setValue', componentId: \"object_form\", args: { value: newTabTtemsProp } });},300);"
56
+ "script": "const tabGroupKey = \"group\";const getTabsSortFun = function (groupNames) { return function (m, n) { var tempM = !!m[tabGroupKey] ? 1 : 0; var tempN = !!n[tabGroupKey] ? 1 : 0; if (!m[tabGroupKey] || !n[tabGroupKey]) { return tempM - tempN; } return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]); };};const quickEidtSaveForTab = function (input, prop_name) { const currentPropValue = input.value; const rowValue = input.__super; const formValue = input.__super.__super; const tab_name = rowValue.tab_name; rowValue[prop_name] = currentPropValue; delete rowValue.index; let newTabs = formValue.tab_items.map(function (item) { if (item.tab_name == tab_name) { return Object.assign({}, item, rowValue); } else { return item; } }); const tabGroups = input.__super.__super.tab_groups; const groupNames = _.compact(_.map(tabGroups, \"group_name\")); if (groupNames && groupNames.length) { newTabs.sort(getTabsSortFun(groupNames)); } return { tab_items: newTabs }};const eventData = event.data;const newTabTtemsProp = quickEidtSaveForTab(eventData, \"group\");setTimeout(function () { doAction({ actionType: 'setValue', componentId: \"object_form\", args: { value: newTabTtemsProp } });},300);"
55
57
  }
56
58
  ]
57
59
  }
58
60
  },
59
- "source": "${tab_groups|pick:group_name}",
60
- "checkAll": false,
61
- "selectFirst": false,
62
- "searchable": true,
63
- "clearable": true,
64
- "id": "u:8b3d6979e884",
65
- "multiple": false,
66
- "mode": "inline"
61
+ "placeholder": "-"
67
62
  },
68
- "placeholder": "-"
69
- },
70
- {
71
- "name": "tab_name_desktop",
72
- "label": "${'apps.apps_form.tab_desktop' | t}",
73
- "type": "tpl",
74
- "id": "u:b95c69a1cd84",
75
- "tpl": "${tabs_options|filter:value:equals:tab_name|first|pick:desktop|isTrue:'✔':'✘'}",
76
- "placeholder": "-",
77
- "remark": "${'apps.apps_form.tab_desktop_remark' | t}"
78
- },
79
- {
80
- "name": "tab_name_mobile",
81
- "label": "${'apps.apps_form.tab_mobile' | t}",
82
- "type": "tpl",
83
- "id": "u:b95c69a1cd84",
84
- "tpl": "${tabs_options|filter:value:equals:tab_name|first|pick:mobile|isTrue:'✔':'✘'}",
85
- "placeholder": "-",
86
- "remark": "${'apps.apps_form.tab_mobile_remark' | t}"
63
+ "className": "m-0",
64
+ "checkAll": false,
65
+ "selectFirst": false,
66
+ "searchable": true,
67
+ "clearable": true,
68
+ "multiple": false,
69
+ "mode": "inline"
87
70
  }
88
71
  ],
89
72
  "headerToolbar": [
@@ -132,7 +115,7 @@
132
115
  "actions": [
133
116
  {
134
117
  "actionType": "custom",
135
- "script": "const tabGroupKey = 'group';const getTabsSortFun = function (groupNames) { return function (m, n) { var tempM = !!m[tabGroupKey] ? 1 : 0; var tempN = !!n[tabGroupKey] ? 1 : 0; if (!m[tabGroupKey] || !n[tabGroupKey]) { return tempM - tempN; } return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]); };};const clearTabs = function (input) { return { tab_items: [] }};const convertDataForTabs = function (input) { let pickedTabs = input.picked_tabs || []; const superTabs = _.keyBy(input.__super.__super.tab_items, 'tab_name'); if (typeof pickedTabs === 'string') { pickedTabs = pickedTabs.split(','); } const tabOptions = _.keyBy(input.__super.tabs_options, 'value'); const convertedTabs = pickedTabs.map(function (tab_name) { const superTab = superTabs[tab_name]; if (superTab) { return superTab; } else { const tabOption = tabOptions[tab_name]; return { tab_name: tab_name, group: tabOption.group } } }); const tabGroups = input.__super.__super.tab_groups; const groupNames = _.compact(_.map(tabGroups, 'group_name')); if (groupNames && groupNames.length) { convertedTabs.sort(getTabsSortFun(groupNames)); } return { tab_items: convertedTabs }};const eventData = event.data;doAction({ actionType: 'setValue', componentId: 'object_form', args: { value: convertDataForTabs(eventData) }});doAction({ actionType: 'setValue', componentId: 'tabs-options-service', args: { value: convertDataForTabs(eventData) }});"
118
+ "script": "const tabGroupKey = 'group';const getTabsSortFun = function (groupNames) { return function (m, n) { var tempM = !!m[tabGroupKey] ? 1 : 0; var tempN = !!n[tabGroupKey] ? 1 : 0; if (!m[tabGroupKey] || !n[tabGroupKey]) { return tempM - tempN; } return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]); };};const clearTabs = function (input) { return { tab_items: [] }};const convertDataForTabs = function (input) { let pickedTabs = input.picked_tabs || []; const superTabs = _.keyBy(input.__super.tab_items, 'tab_name'); if (typeof pickedTabs === 'string') { pickedTabs = pickedTabs.split(','); } const tabOptions = _.keyBy(input.__super.tabs_options, 'value'); const convertedTabs = pickedTabs.map(function (tab_name) { const superTab = superTabs[tab_name]; if (superTab) { return superTab; } else { const tabOption = tabOptions[tab_name]; return { tab_name: tab_name, group: tabOption.group } } }); const tabGroups = input.__super.tab_groups; const groupNames = _.compact(_.map(tabGroups, 'group_name')); if (groupNames && groupNames.length) { convertedTabs.sort(getTabsSortFun(groupNames)); } return { tab_items: convertedTabs }};const eventData = event.data;doAction({ actionType: 'setValue', componentId: 'object_form', args: { value: convertDataForTabs(eventData) }});doAction({ actionType: 'setValue', componentId: 'tabs-options-service', args: { value: convertDataForTabs(eventData) }});"
136
119
  }
137
120
  ]
138
121
  }
@@ -185,7 +168,7 @@
185
168
  "actions": [
186
169
  {
187
170
  "actionType": "custom",
188
- "script": "const tabGroupKey = 'group';const getTabsSortFun = function (groupNames) { return function (m, n) { var tempM = !!m[tabGroupKey] ? 1 : 0; var tempN = !!n[tabGroupKey] ? 1 : 0; if (!m[tabGroupKey] || !n[tabGroupKey]) { return tempM - tempN; } return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]); };};const clearTabs = function (input) { return { tab_items: [] }};const convertDataForGroups = function(input) { const settingGroups = input.setting_groups || []; const convertedGroups = _.uniqBy(settingGroups.map(function (item) { return { group_name: item.group_name, default_open: item.default_open } }), 'group_name'); const groupNames = _.compact(_.map(convertedGroups, 'group_name')); const tab_items = input.tab_items; tab_items?.sort(getTabsSortFun(groupNames)); return { tab_groups: convertedGroups, tab_items: tab_items }};const eventData = event.data;doAction({ actionType: 'setValue', componentId: 'object_form', args: { value: convertDataForGroups(eventData) }});"
171
+ "script": "const tabGroupKey = 'group';\nconst getTabsSortFun = function (groupNames) {\n return function (m, n) {\n var tempM = !!m[tabGroupKey] ? 1 : 0;\n var tempN = !!n[tabGroupKey] ? 1 : 0;\n if (!m[tabGroupKey] || !n[tabGroupKey]) {\n return tempM - tempN;\n }\n return groupNames.indexOf(m[tabGroupKey]) - groupNames.indexOf(n[tabGroupKey]);\n };\n};\nconst clearTabs = function (input) { return { tab_items: [] } };\nconst convertDataForGroups = function (input) {\n \n const settingGroups = input.setting_groups || [];\n const convertedGroups = _.uniqBy(settingGroups.map(function (item) {\n return { group_name: item.group_name, default_open: item.default_open }\n }), 'group_name');\n const groupNames = _.compact(_.map(convertedGroups, 'group_name'));\n const tab_items = input.tab_items;\n tab_items?.sort(getTabsSortFun(groupNames));\n \n return { tab_groups: convertedGroups, tab_items: tab_items }\n};\nconst eventData = event.data;\ndoAction(\n {\n actionType: 'setValue',\n componentId: 'object_form',\n args: { value: convertDataForGroups(eventData) }\n }\n);"
189
172
  }
190
173
  ]
191
174
  }
@@ -203,7 +186,8 @@
203
186
  "id": "u:111b043b193c"
204
187
  }
205
188
  ],
206
- "messages": {},
189
+ "messages": {
190
+ },
207
191
  "api": {
208
192
  "method": "post",
209
193
  "url": "${context.rootUrl}/graphql",
@@ -215,11 +199,13 @@
215
199
  "headers": {
216
200
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
217
201
  },
218
- "messages": {},
202
+ "messages": {
203
+ },
219
204
  "requestAdaptor": ""
220
205
  }
221
206
  }
222
- ]
207
+ ],
208
+ "id": "u:7949aecf0ca9"
223
209
  }
224
210
  },
225
211
  "objects": {
@@ -265,7 +251,8 @@
265
251
  "source": {
266
252
  "method": "get",
267
253
  "url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/options",
268
- "messages": {},
254
+ "messages": {
255
+ },
269
256
  "headers": {
270
257
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
271
258
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-plugin-amis",
3
- "version": "2.6.2-beta.30",
3
+ "version": "2.6.2-beta.32",
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": "d31db8c7862a211f37fd27d076f01f41cddc58a5",
16
+ "gitHead": "eba59a3b84a4c223c8d7b75b53ba4d1a6ff623e1",
17
17
  "devDependencies": {
18
18
  "tailwindcss": "3.2.4"
19
19
  }
@@ -196,10 +196,6 @@
196
196
  width: 2.25rem
197
197
  }
198
198
 
199
- .w-10 {
200
- width: 2.5rem
201
- }
202
-
203
199
  .w-full {
204
200
  width: 100%
205
201
  }