@steedos/service-plugin-amis 3.0.2-beta.9 → 3.0.3-beta.1
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.
|
@@ -293,7 +293,18 @@
|
|
|
293
293
|
},
|
|
294
294
|
"initApiAdaptor": "\nvar data;\nif (recordId) {\n data = payload.data || { _filters_type_controller: 'conditions' };\n //数据格式转换\n if (data) {\n data.sort = lodash.map(data.sort, (item) => {\n return item.field_name + \":\" + item.order;\n });\n data.searchable_fields = lodash.map(data.searchable_fields, 'field');\n\n if (data.filters && lodash.isString(data.filters)) {\n try {\n data.filters = JSON.parse(data.filters);\n } catch (e) { }\n }\n\n if (data.filters && lodash.isString(data.filters)) {\n data._filters_type_controller = 'function';\n } else {\n data._filters_type_controller = 'conditions'\n }\n\n if (data._filters_type_controller === 'conditions') {\n data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);\n } else {\n data._filters_function = data.filters;\n }\n }\n} else {\n const uiSchema = api.body.uiSchema;\n const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;\n let defaultValues = {};\n _.each(uiSchema && uiSchema.fields, function (field) {\n var value = SteedosUI.getFieldDefaultValue(field, api.body.global);\n if (!_.isNil(value)) {\n defaultValues[field.name] = value;\n }\n });\n if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {\n data = Object.assign({}, defaultValues, defaultData); \n }else{data = Object.assign({}, defaultValues) } \n}\nfor (key in data) {\n if (data[key] === null) {\n delete data[key];\n }\n}\npayload.data = data;\ndelete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };\nreturn payload;",
|
|
295
295
|
"apiRequestAdaptor": "delete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\ndelete formData._display;\n\n//数据格式转换\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\n\nformData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {\n return { field: item };\n});\n\nif (!formData._filters_type_controller) {\n formData._filters_type_controller = 'conditions';\n}\n\nif (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {\n formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);\n // formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);\n} else {\n formData.filters = formData._filters_function || null;\n}\n\ndelete formData._filters_type_controller;\ndelete formData._filters_conditions;\ndelete formData._filters_function;\n\nformData.crud_mode = formData.type === 'cards' ? 'cards' : 'table';\n\nquery = `mutation{record: object_listviews__insert(doc: {__saveData}){_id}}`;\nif (formData.recordId) {\n query = `mutation{record: object_listviews__update(id: \"` + api.body.recordId + `\", doc: {__saveData}){_id}}`;\n};\n__saveData = JSON.stringify(JSON.stringify(formData));\n\napi.data = { query: query.replace('{__saveData}', __saveData) };\nreturn api;",
|
|
296
|
-
"id": "u:ce9e3fcc411a"
|
|
296
|
+
"id": "u:ce9e3fcc411a",
|
|
297
|
+
"onEvent": {
|
|
298
|
+
"validateError": {
|
|
299
|
+
"actions": [
|
|
300
|
+
{
|
|
301
|
+
"actionType": "custom",
|
|
302
|
+
"script": "/**\n * 校验失败时自动跳转的智能脚本 (包含当前 Tab 判断)\n */\n\n// 1. 获取 Form 组件和存储\nconst formComponent = event.context.scoped.getComponentById('form_object_listviews');\nif (!formComponent) {\n console.error('未找到 Form 组件,请检查 ID: form_object_listviews');\n return;\n}\n\nconst fs = formComponent.props.store;\nconst errors = fs.errors;\n\nif (!errors || Object.keys(errors).length === 0) {\n return;\n}\n\nconst errorFields = Object.keys(errors);\nlet targetTabIndex = -1;\n\n// 2. 获取 Tabs 组件实例\n// 注意:这里使用了您提供的 SteedosUI 辅助方法来获取 tabsComponent\nconst tabsComponent = SteedosUI.getClosestAmisComponentByType(formComponent.context, \"tabs\")\n\nif (!tabsComponent) {\n console.error('未找到 Tabs 组件');\n return;\n}\n\nconst tabs = tabsComponent.props.tabs;\n\n// 3. 遍历 Tabs 配置,查找第一个包含失败字段的 Tab 索引\nfor (let i = 0; i < tabs.length; i++) {\n const tabBodyItems = Array.isArray(tabs[i].body) ? tabs[i].body : [];\n for (const item of tabBodyItems) {\n if (item.name && errorFields.includes(item.name)) {\n targetTabIndex = i;\n break;\n }\n }\n\n if (targetTabIndex !== -1) {\n break;\n }\n}\n\n// 4. 执行跳转操作,并检查是否已在目标 Tab\nif (targetTabIndex !== -1) {\n if (tabsComponent.switchTo) {\n // 关键优化:检查当前 Tab 索引\n // 注意:tabsComponent.currentIndex() 必须是 Tabs 组件实例提供的方法\n const currentTabIndex = tabsComponent.currentIndex();\n\n if (currentTabIndex !== targetTabIndex) {\n // 只有当目标 Tab 索引与当前索引不同时才执行跳转\n tabsComponent.switchTo(targetTabIndex);\n console.log(`校验失败字段 ${errorFields[0]} 自动跳转到 Tab 索引: ${targetTabIndex} (${tabs[targetTabIndex].title})`);\n } else {\n console.log(`校验失败字段 ${errorFields[0]} 位于当前 Tab (${targetTabIndex}),无需跳转。`);\n }\n } else {\n console.warn('Tabs 组件实例缺少 switchTo 方法。');\n }\n} else {\n console.log('校验失败字段不在已知的任何 Tab 页签中。');\n}",
|
|
303
|
+
"args": {}
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
297
308
|
}
|
|
298
309
|
],
|
|
299
310
|
"regions": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3-beta.1",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:tailwind-base && yarn build:tailwind",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "e5cbf2415d4a1efef6ec7ab9c39dc1037772781a",
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"tailwindcss": "^3.4.17"
|
|
18
18
|
}
|
|
@@ -102,11 +102,6 @@
|
|
|
102
102
|
margin-bottom: 0.5rem
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
.my-4 {
|
|
106
|
-
margin-top: 1rem;
|
|
107
|
-
margin-bottom: 1rem
|
|
108
|
-
}
|
|
109
|
-
|
|
110
105
|
.-mt-3 {
|
|
111
106
|
margin-top: -0.75rem
|
|
112
107
|
}
|
|
@@ -127,14 +122,6 @@
|
|
|
127
122
|
margin-left: 0.5rem
|
|
128
123
|
}
|
|
129
124
|
|
|
130
|
-
.ml-4 {
|
|
131
|
-
margin-left: 1rem
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.mr-1 {
|
|
135
|
-
margin-right: 0.25rem
|
|
136
|
-
}
|
|
137
|
-
|
|
138
125
|
.mr-4 {
|
|
139
126
|
margin-right: 1rem
|
|
140
127
|
}
|
|
@@ -207,8 +194,8 @@
|
|
|
207
194
|
width: 100%
|
|
208
195
|
}
|
|
209
196
|
|
|
210
|
-
.min-w-\[
|
|
211
|
-
min-width:
|
|
197
|
+
.min-w-\[260px\] {
|
|
198
|
+
min-width: 260px
|
|
212
199
|
}
|
|
213
200
|
|
|
214
201
|
.max-w-4xl {
|
|
@@ -283,6 +270,10 @@
|
|
|
283
270
|
border-bottom-width: 1px
|
|
284
271
|
}
|
|
285
272
|
|
|
273
|
+
.border-r {
|
|
274
|
+
border-right-width: 1px
|
|
275
|
+
}
|
|
276
|
+
|
|
286
277
|
.border-none {
|
|
287
278
|
border-style: none
|
|
288
279
|
}
|