@steedos-widgets/amis-lib 1.3.0-beta.11 → 1.3.0-beta.13
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/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +326 -410
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +326 -410
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +59 -41
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/editor.d.ts +19 -1
- package/dist/types/lib/converter/amis/fields/index.d.ts +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +87 -61
- package/dist/types/lib/converter/amis/fields/table.d.ts +1 -24
- package/dist/types/schema/standard_import_data.amis.d.ts +62 -227
- package/dist/types/standard/button.d.ts +62 -227
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -2192,257 +2192,92 @@ const getSchema$2 = (uiSchema) => {
|
|
|
2192
2192
|
title: i18next__default["default"].t('frontend_import_data'),
|
|
2193
2193
|
body: [
|
|
2194
2194
|
{
|
|
2195
|
-
type: "form",
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
api: {
|
|
2204
|
-
method: "post",
|
|
2205
|
-
url: "${context.rootUrl}/graphql",
|
|
2206
|
-
data: {
|
|
2207
|
-
objectName: "queue_import_history",
|
|
2208
|
-
$: "$$",
|
|
2209
|
-
},
|
|
2210
|
-
requestAdaptor:
|
|
2211
|
-
"\n const formData = api.data.$;\n for (key in formData){\n // image、select等字段清空值后保存的空字符串转换为null。\n if(formData[key] === ''){\n formData[key] = null;\n }\n }\n const objectName = api.data.objectName;\n const fieldsName = Object.keys(formData);\n delete formData.created;\n delete formData.created_by;\n delete formData.modified;\n delete formData.modified_by;\n delete formData._display;\n delete formData.success_count;\ndelete formData.failure_count;\ndelete formData.total_count;\ndelete formData.start_time;\ndelete formData.end_time;\ndelete formData.state;\ndelete formData.error;\ndelete formData.created;\ndelete formData.created_by;\ndelete formData.modified;\ndelete formData.modified_by;\n \n \n let fileFieldsKeys = [\"file\"];\n let fileFields = {\"file\":{\"name\":\"file\"}};\n fileFieldsKeys.forEach((item)=>{\n let fileFieldValue = formData[item];\n if(fileFieldValue){\n // 因为表单初始化接口的接收适配器中为file字段值重写了值及格式(为了字段编辑时正常显示附件名、点击附件名正常下载),所以保存时还原(为了字段值保存时正常保存id)。\n if(fileFields[item].multiple){\n if(fileFieldValue instanceof Array && fileFieldValue.length){\n formData[item] = fileFieldValue.map((value)=>{ \n if(typeof value === 'object'){\n return value.value;\n }else{\n return value;\n }\n });\n }\n }else{\n formData[item] = typeof fileFieldValue === 'object' ? fileFieldValue.value : fileFieldValue;\n }\n }\n })\n \n let query = `mutation{record: ${objectName}__insert(doc: {__saveData}){_id}}`;\n if(formData.recordId && formData.recordId !='new'){\n query = `mutation{record: ${objectName}__update(id: \"${formData._id}\", doc: {__saveData}){_id}}`;\n };\n delete formData._id;\n let __saveData = JSON.stringify(JSON.stringify(formData));\n \n api.data = {query: query.replace('{__saveData}', __saveData)};\n return api;\n ",
|
|
2212
|
-
responseData: {
|
|
2213
|
-
recordId: "${record._id}",
|
|
2214
|
-
},
|
|
2215
|
-
adaptor:
|
|
2216
|
-
"console.log('payload', payload)\n return payload;\n ",
|
|
2217
|
-
headers: {
|
|
2218
|
-
Authorization:
|
|
2219
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2220
|
-
},
|
|
2221
|
-
dataType: "json",
|
|
2195
|
+
"type": "steedos-object-form",
|
|
2196
|
+
"label": "对象表单",
|
|
2197
|
+
"objectApiName": "queue_import_history",
|
|
2198
|
+
"recordId": "",
|
|
2199
|
+
"mode": "edit",
|
|
2200
|
+
"layout": "normal",
|
|
2201
|
+
"defaultData":{
|
|
2202
|
+
"object_name": "${objectName}"
|
|
2222
2203
|
},
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
},
|
|
2252
|
-
headers: {
|
|
2253
|
-
Authorization:
|
|
2254
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2255
|
-
},
|
|
2256
|
-
requestAdaptor:
|
|
2257
|
-
"\n var filters = '[]';\n var top = 10;\n if(api.data.$term){\n filters = '[\"name\", \"contains\", \"'+ api.data.$term +'\"]';\n }else if(api.data.$value){\n filters = '[\"_id\", \"=\", \"'+ api.data.$value +'\"]';\n }\n api.data.query = api.data.query.replace(/{__filters}/g, filters).replace('{__top}', top);\n return api;\n ",
|
|
2258
|
-
},
|
|
2259
|
-
className: "m-1",
|
|
2260
|
-
labelClassName: "text-left",
|
|
2261
|
-
clearValueOnHidden: false,
|
|
2262
|
-
id: "u:04295fee3896",
|
|
2263
|
-
multiple: false,
|
|
2264
|
-
hidden: true,
|
|
2265
|
-
},
|
|
2266
|
-
{
|
|
2267
|
-
name: "queue_import",
|
|
2268
|
-
label: i18next__default["default"].t('frontend_import_data_queue_import'),
|
|
2269
|
-
required: true,
|
|
2270
|
-
type: "picker",
|
|
2271
|
-
labelField: "description",
|
|
2272
|
-
valueField: "_id",
|
|
2273
|
-
modalMode: "dialog",
|
|
2274
|
-
source: {
|
|
2275
|
-
method: "post",
|
|
2276
|
-
url: "${context.rootUrl}/graphql",
|
|
2277
|
-
data: {
|
|
2278
|
-
orderBy: "${orderBy}",
|
|
2279
|
-
orderDir: "${orderDir}",
|
|
2280
|
-
pageNo: "${page}",
|
|
2281
|
-
pageSize: "${perPage}",
|
|
2282
|
-
query:
|
|
2283
|
-
'{rows:queue_import(filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"){_id,description,object_name,encoding,template_url,_display:_ui{object_name,encoding}},count:queue_import__count(filters:{__filters})}',
|
|
2284
|
-
$term: "$term",
|
|
2285
|
-
$self: "$$",
|
|
2204
|
+
"fieldsExtend":{
|
|
2205
|
+
"object_name": {
|
|
2206
|
+
"amis": {
|
|
2207
|
+
"hidden": true
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
},
|
|
2211
|
+
"form": {
|
|
2212
|
+
debug: false,
|
|
2213
|
+
resetAfterSubmit: false,
|
|
2214
|
+
initApi: {
|
|
2215
|
+
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
2216
|
+
sendOn: 'this.recordId',
|
|
2217
|
+
responseData: {
|
|
2218
|
+
importState: "${state}"
|
|
2219
|
+
}
|
|
2220
|
+
},
|
|
2221
|
+
interval: 3000,
|
|
2222
|
+
stopAutoRefreshWhen: "this.importState === 'finished'",
|
|
2223
|
+
initFetch: false,
|
|
2224
|
+
onEvent: {
|
|
2225
|
+
inited: {
|
|
2226
|
+
weight: 0,
|
|
2227
|
+
actions: [
|
|
2228
|
+
{
|
|
2229
|
+
"actionType": "broadcast",
|
|
2230
|
+
"args": {
|
|
2231
|
+
"eventName": `@data.changed.${uiSchema.name}`
|
|
2286
2232
|
},
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2233
|
+
"data": {
|
|
2234
|
+
"objectName": `${uiSchema.name}`,
|
|
2235
|
+
"displayAs": "${displayAs}",
|
|
2236
|
+
"recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
|
|
2290
2237
|
},
|
|
2291
|
-
|
|
2292
|
-
"\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value && selfData.value.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
|
|
2293
|
-
adaptor:
|
|
2294
|
-
"\n const enable_tree = undefined;\n if(enable_tree){\n const records = payload.data.rows;\n const treeRecords = [];\n const getChildren = (records, childrenIds)=>{\n if(!childrenIds){\n return;\n }\n const children = _.filter(records, (record)=>{\n return _.includes(childrenIds, record._id)\n });\n _.each(children, (item)=>{\n if(item.children){\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n _.each(records, (record)=>{\n if(!record.parent){\n treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));\n }\n });\n payload.data.rows = treeRecords;\n }\n return payload;\n ",
|
|
2238
|
+
"expression": "this.importState === 'finished'"
|
|
2295
2239
|
},
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
name: "object_name",
|
|
2322
|
-
label: i18next__default["default"].t('frontend_import_data_object_name'),
|
|
2323
|
-
type: "tpl",
|
|
2324
|
-
tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
|
|
2325
|
-
className: "whitespace-nowrap",
|
|
2326
|
-
html: null,
|
|
2327
|
-
},
|
|
2328
|
-
{
|
|
2329
|
-
name: "encoding",
|
|
2330
|
-
label: i18next__default["default"].t('frontend_import_data_queue_import_encoding'),
|
|
2331
|
-
type: "tpl",
|
|
2332
|
-
tpl: "<div>${_display.encoding}</div>",
|
|
2333
|
-
className: "whitespace-nowrap",
|
|
2334
|
-
html: null,
|
|
2335
|
-
},
|
|
2336
|
-
{
|
|
2337
|
-
name: "template_url",
|
|
2338
|
-
label: i18next__default["default"].t('frontend_import_data_queue_import_template_url'),
|
|
2339
|
-
type: "button-group",
|
|
2340
|
-
buttons: [
|
|
2341
|
-
{
|
|
2342
|
-
type: "button",
|
|
2343
|
-
label: i18next__default["default"].t('frontend_download'),
|
|
2344
|
-
visibleOn: "${template_url}",
|
|
2345
|
-
level: "link",
|
|
2346
|
-
actionType: "download",
|
|
2347
|
-
api:{
|
|
2348
|
-
url: "${template_url}",
|
|
2349
|
-
method: "get",
|
|
2350
|
-
headers: {
|
|
2351
|
-
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
],
|
|
2356
|
-
options: {
|
|
2357
|
-
html: true
|
|
2240
|
+
{
|
|
2241
|
+
"actionType": "closeDialog",
|
|
2242
|
+
"expression": "this.importState === 'finished'"
|
|
2243
|
+
}
|
|
2244
|
+
]
|
|
2245
|
+
},
|
|
2246
|
+
submitSucc: {
|
|
2247
|
+
weight: 0,
|
|
2248
|
+
actions: [
|
|
2249
|
+
{
|
|
2250
|
+
args: {
|
|
2251
|
+
api: {
|
|
2252
|
+
url: "${context.rootUrl}/api/data/initiateImport",
|
|
2253
|
+
method: "post",
|
|
2254
|
+
data: {
|
|
2255
|
+
eventData: "${event.data}",
|
|
2256
|
+
},
|
|
2257
|
+
dataType: "json",
|
|
2258
|
+
requestAdaptor:
|
|
2259
|
+
"\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
|
|
2260
|
+
adaptor:
|
|
2261
|
+
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
2262
|
+
headers: {
|
|
2263
|
+
Authorization:
|
|
2264
|
+
"Bearer ${context.tenantId},${context.authToken}",
|
|
2358
2265
|
},
|
|
2359
|
-
className: "whitespace-nowrap",
|
|
2360
|
-
},
|
|
2361
|
-
null,
|
|
2362
|
-
],
|
|
2363
|
-
syncLocation: false,
|
|
2364
|
-
keepItemSelectionOnPageChange: true,
|
|
2365
|
-
checkOnItemClick: false,
|
|
2366
|
-
autoFillHeight: false,
|
|
2367
|
-
},
|
|
2368
|
-
joinValues: false,
|
|
2369
|
-
extractValue: true,
|
|
2370
|
-
className: "m-1",
|
|
2371
|
-
labelClassName: "text-left",
|
|
2372
|
-
clearValueOnHidden: true,
|
|
2373
|
-
id: "u:401df27113e0",
|
|
2374
|
-
},
|
|
2375
|
-
{
|
|
2376
|
-
name: "file",
|
|
2377
|
-
label: i18next__default["default"].t('frontend_import_data_file'),
|
|
2378
|
-
required: true,
|
|
2379
|
-
type: "input-file",
|
|
2380
|
-
accept: ".xlsx,.xls",
|
|
2381
|
-
className: "m-1",
|
|
2382
|
-
labelClassName: "text-left",
|
|
2383
|
-
clearValueOnHidden: true,
|
|
2384
|
-
useChunk: false,
|
|
2385
|
-
receiver: {
|
|
2386
|
-
method: "post",
|
|
2387
|
-
url: "${context.rootUrl}/s3/files",
|
|
2388
|
-
data: {
|
|
2389
|
-
$: "$$",
|
|
2390
|
-
context: "${context}",
|
|
2391
|
-
},
|
|
2392
|
-
adaptor:
|
|
2393
|
-
'\n const { context } = api.body; \n var rootUrl = context.rootUrl + "/api/files/files/";\n payload = {\n status: response.status == 200 ? 0 : response.status,\n msg: response.statusText,\n data: {\n value: payload._id,\n name: payload.original.name,\n url: rootUrl + payload._id,\n }\n }\n return payload;\n ',
|
|
2394
|
-
headers: {
|
|
2395
|
-
Authorization:
|
|
2396
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2397
|
-
},
|
|
2398
|
-
},
|
|
2399
|
-
id: "u:0213f2cc365b",
|
|
2400
|
-
},
|
|
2401
|
-
],
|
|
2402
|
-
id: "u:4899c260d667",
|
|
2403
|
-
},
|
|
2404
|
-
],
|
|
2405
|
-
panelClassName: "m-0 sm:rounded-lg shadow-none",
|
|
2406
|
-
bodyClassName: "p-0",
|
|
2407
|
-
className: "p-4 sm:p-0 steedos-amis-form",
|
|
2408
|
-
label: "对象表单",
|
|
2409
|
-
objectApiName: "queue_import_history",
|
|
2410
|
-
id: "u:e4ef598eed61",
|
|
2411
|
-
onEvent: {
|
|
2412
|
-
submitSucc: {
|
|
2413
|
-
weight: 0,
|
|
2414
|
-
actions: [
|
|
2415
|
-
{
|
|
2416
|
-
args: {
|
|
2417
|
-
api: {
|
|
2418
|
-
url: "${context.rootUrl}/api/data/initiateImport",
|
|
2419
|
-
method: "post",
|
|
2420
|
-
data: {
|
|
2421
|
-
eventData: "${event.data}",
|
|
2422
2266
|
},
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
adaptor:
|
|
2427
|
-
"payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
|
|
2428
|
-
headers: {
|
|
2429
|
-
Authorization:
|
|
2430
|
-
"Bearer ${context.tenantId},${context.authToken}",
|
|
2267
|
+
messages: {
|
|
2268
|
+
success: i18next__default["default"].t('frontend_import_data_message_success'),
|
|
2269
|
+
failed: i18next__default["default"].t('frontend_import_data_message_failed'),
|
|
2431
2270
|
},
|
|
2432
2271
|
},
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
failed: i18next__default["default"].t('frontend_import_data_message_failed'),
|
|
2436
|
-
},
|
|
2272
|
+
actionType: "ajax",
|
|
2273
|
+
expression: "event.data.result",
|
|
2437
2274
|
},
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
},
|
|
2441
|
-
],
|
|
2275
|
+
],
|
|
2276
|
+
},
|
|
2442
2277
|
},
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
}
|
|
2278
|
+
closeDialogOnSubmit: false,
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2446
2281
|
],
|
|
2447
2282
|
id: "u:dc05498d3bd4",
|
|
2448
2283
|
closeOnEsc: false,
|
|
@@ -2632,7 +2467,7 @@ const StandardButtons = {
|
|
|
2632
2467
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
2633
2468
|
return {
|
|
2634
2469
|
type: 'amis_button',
|
|
2635
|
-
amis_schema: await getSchema$2()
|
|
2470
|
+
amis_schema: await getSchema$2(uiSchema)
|
|
2636
2471
|
}
|
|
2637
2472
|
},
|
|
2638
2473
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
@@ -2662,7 +2497,7 @@ function getButtonVisibleOn$1(button){
|
|
|
2662
2497
|
visible = button._visible;
|
|
2663
2498
|
}
|
|
2664
2499
|
|
|
2665
|
-
if(
|
|
2500
|
+
if(___namespace.isBoolean(visible)){
|
|
2666
2501
|
visible = visible.toString();
|
|
2667
2502
|
}
|
|
2668
2503
|
|
|
@@ -2690,7 +2525,7 @@ function getButtonVisibleOn$1(button){
|
|
|
2690
2525
|
|
|
2691
2526
|
const getButtonVisible = (button, ctx) => {
|
|
2692
2527
|
if (button._visible) {
|
|
2693
|
-
if (
|
|
2528
|
+
if (___namespace.startsWith(___namespace.trim(button._visible), "function")) {
|
|
2694
2529
|
window.eval("var fun = " + button._visible);
|
|
2695
2530
|
button.visible = fun;
|
|
2696
2531
|
} else if (isExpression(button._visible)) {
|
|
@@ -2705,7 +2540,7 @@ const getButtonVisible = (button, ctx) => {
|
|
|
2705
2540
|
};
|
|
2706
2541
|
}
|
|
2707
2542
|
}
|
|
2708
|
-
if (
|
|
2543
|
+
if (___namespace.isFunction(button.visible)) {
|
|
2709
2544
|
try {
|
|
2710
2545
|
return button.visible(ctx);
|
|
2711
2546
|
} catch (error) {
|
|
@@ -2727,7 +2562,7 @@ const standardButtonsTodo = {
|
|
|
2727
2562
|
} = this;
|
|
2728
2563
|
const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
|
|
2729
2564
|
|
|
2730
|
-
if(
|
|
2565
|
+
if(___namespace.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
|
|
2731
2566
|
listViewRef.handleAction({}, {
|
|
2732
2567
|
"actionType": "toast",
|
|
2733
2568
|
"toast": {
|
|
@@ -2754,19 +2589,19 @@ const standardButtonsTodo = {
|
|
|
2754
2589
|
*/
|
|
2755
2590
|
const getButtons = (uiSchema, ctx) => {
|
|
2756
2591
|
const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
|
|
2757
|
-
let buttons =
|
|
2758
|
-
if (
|
|
2759
|
-
buttons =
|
|
2760
|
-
return
|
|
2592
|
+
let buttons = ___namespace.sortBy(___namespace.values(uiSchema.actions), "sort");
|
|
2593
|
+
if (___namespace.has(uiSchema, "allow_customActions")) {
|
|
2594
|
+
buttons = ___namespace.filter(buttons, (button) => {
|
|
2595
|
+
return ___namespace.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
|
|
2761
2596
|
});
|
|
2762
2597
|
}
|
|
2763
|
-
if (
|
|
2764
|
-
buttons =
|
|
2765
|
-
return !
|
|
2598
|
+
if (___namespace.has(uiSchema, "exclude_actions")) {
|
|
2599
|
+
buttons = ___namespace.filter(buttons, (button) => {
|
|
2600
|
+
return !___namespace.include(uiSchema.exclude_actions, button.name);
|
|
2766
2601
|
});
|
|
2767
2602
|
}
|
|
2768
2603
|
|
|
2769
|
-
|
|
2604
|
+
___namespace.each(buttons, (button) => {
|
|
2770
2605
|
button.objectName = uiSchema.name;
|
|
2771
2606
|
if (
|
|
2772
2607
|
ctx.isMobile &&
|
|
@@ -2785,7 +2620,7 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
2785
2620
|
ctx.isMobile &&
|
|
2786
2621
|
["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
|
|
2787
2622
|
) {
|
|
2788
|
-
|
|
2623
|
+
___namespace.map(buttons, (button) => {
|
|
2789
2624
|
if (button.name === "standard_edit") {
|
|
2790
2625
|
button.on = "record_more";
|
|
2791
2626
|
}
|
|
@@ -2795,14 +2630,14 @@ const getButtons = (uiSchema, ctx) => {
|
|
|
2795
2630
|
});
|
|
2796
2631
|
}
|
|
2797
2632
|
|
|
2798
|
-
return
|
|
2799
|
-
return
|
|
2633
|
+
return ___namespace.filter(buttons, (button) => {
|
|
2634
|
+
return ___namespace.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
|
|
2800
2635
|
});
|
|
2801
2636
|
};
|
|
2802
2637
|
|
|
2803
2638
|
const getListViewButtons = (uiSchema, ctx) => {
|
|
2804
2639
|
const buttons = getButtons(uiSchema, ctx);
|
|
2805
|
-
const listButtons =
|
|
2640
|
+
const listButtons = ___namespace.filter(buttons, (button) => {
|
|
2806
2641
|
return button.on == "list";
|
|
2807
2642
|
});
|
|
2808
2643
|
return listButtons;
|
|
@@ -2810,23 +2645,23 @@ const getListViewButtons = (uiSchema, ctx) => {
|
|
|
2810
2645
|
|
|
2811
2646
|
const getObjectDetailButtons = (uiSchema, ctx) => {
|
|
2812
2647
|
const buttons = getButtons(uiSchema, ctx);
|
|
2813
|
-
const detailButtons =
|
|
2648
|
+
const detailButtons = ___namespace.filter(buttons, (button) => {
|
|
2814
2649
|
return button.on == "record" || button.on == "record_only";
|
|
2815
2650
|
});
|
|
2816
|
-
return
|
|
2651
|
+
return ___namespace.sortBy(detailButtons, "sort");
|
|
2817
2652
|
};
|
|
2818
2653
|
|
|
2819
2654
|
const getObjectDetailMoreButtons = (uiSchema, ctx) => {
|
|
2820
2655
|
const buttons = getButtons(uiSchema, ctx);
|
|
2821
|
-
const moreButtons =
|
|
2656
|
+
const moreButtons = ___namespace.filter(buttons, (button) => {
|
|
2822
2657
|
return button.on == "record_more" || button.on == "record_only_more";
|
|
2823
2658
|
});
|
|
2824
|
-
return
|
|
2659
|
+
return ___namespace.sortBy(moreButtons, "sort");
|
|
2825
2660
|
};
|
|
2826
2661
|
|
|
2827
2662
|
const getListViewItemButtons = async (uiSchema, ctx)=>{
|
|
2828
2663
|
const buttons = getButtons(uiSchema, ctx);
|
|
2829
|
-
const listButtons =
|
|
2664
|
+
const listButtons = ___namespace.filter(buttons, (button) => {
|
|
2830
2665
|
return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
|
|
2831
2666
|
});
|
|
2832
2667
|
return listButtons;
|
|
@@ -2843,7 +2678,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
|
|
|
2843
2678
|
// });
|
|
2844
2679
|
// return relatedListButtons;
|
|
2845
2680
|
const buttons = getButtons(uiSchema, ctx);
|
|
2846
|
-
const listButtons =
|
|
2681
|
+
const listButtons = ___namespace.filter(buttons, (button) => {
|
|
2847
2682
|
return button.on == "list";
|
|
2848
2683
|
});
|
|
2849
2684
|
return listButtons;
|
|
@@ -2860,7 +2695,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
2860
2695
|
const uiSchema = await getUISchema(objectName);
|
|
2861
2696
|
if(uiSchema){
|
|
2862
2697
|
const buttons = await getButtons(uiSchema, ctx);
|
|
2863
|
-
const button =
|
|
2698
|
+
const button = ___namespace.find(buttons, (button)=>{
|
|
2864
2699
|
return button.name === buttonName
|
|
2865
2700
|
});
|
|
2866
2701
|
|
|
@@ -2946,13 +2781,13 @@ const execute = (button, props) => {
|
|
|
2946
2781
|
return; //TODO 弹出提示未配置todo
|
|
2947
2782
|
}
|
|
2948
2783
|
|
|
2949
|
-
if (
|
|
2950
|
-
if (
|
|
2784
|
+
if (___namespace.isString(button.todo)) {
|
|
2785
|
+
if (___namespace.startsWith(___namespace.trim(button.todo), "function")) {
|
|
2951
2786
|
window.eval("var fun = " + button.todo);
|
|
2952
2787
|
button.todo = fun;
|
|
2953
2788
|
}
|
|
2954
2789
|
}
|
|
2955
|
-
if (
|
|
2790
|
+
if (___namespace.isFunction(button.todo)) {
|
|
2956
2791
|
const todoThis = {
|
|
2957
2792
|
objectName: props.objectName,
|
|
2958
2793
|
object_name: props.objectName,
|
|
@@ -2977,7 +2812,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2977
2812
|
recordId: recordId,
|
|
2978
2813
|
objectName: name
|
|
2979
2814
|
});
|
|
2980
|
-
let amisButtonsSchema =
|
|
2815
|
+
let amisButtonsSchema = ___namespace.map(buttons, (button) => {
|
|
2981
2816
|
return {
|
|
2982
2817
|
type: 'steedos-object-button',
|
|
2983
2818
|
name: button.name,
|
|
@@ -2987,7 +2822,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
2987
2822
|
}
|
|
2988
2823
|
});
|
|
2989
2824
|
let moreButtonsVisibleOn = '';
|
|
2990
|
-
let dropdownButtons =
|
|
2825
|
+
let dropdownButtons = ___namespace.map(moreButtons, (button, index) => {
|
|
2991
2826
|
if(index === 0){
|
|
2992
2827
|
moreButtonsVisibleOn = getButtonVisibleOn$1(button);
|
|
2993
2828
|
}else {
|
|
@@ -3030,11 +2865,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
3030
2865
|
"vertical": true,
|
|
3031
2866
|
"tiled": true,
|
|
3032
2867
|
"buttons": [
|
|
3033
|
-
...
|
|
2868
|
+
...___namespace.map(buttons, (button)=>{
|
|
3034
2869
|
button.className += ' w-full';
|
|
3035
2870
|
return button;
|
|
3036
2871
|
}),
|
|
3037
|
-
...
|
|
2872
|
+
...___namespace.map(moreButtons, (button)=>{
|
|
3038
2873
|
button.className += ' w-full';
|
|
3039
2874
|
return button;
|
|
3040
2875
|
})
|
|
@@ -3096,7 +2931,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3096
2931
|
"vertical": true,
|
|
3097
2932
|
"tiled": true,
|
|
3098
2933
|
"buttons": [
|
|
3099
|
-
...
|
|
2934
|
+
...___namespace.map(buttons, (button)=>{
|
|
3100
2935
|
return {
|
|
3101
2936
|
type: 'steedos-object-button',
|
|
3102
2937
|
name: button.name,
|
|
@@ -3125,13 +2960,13 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3125
2960
|
}
|
|
3126
2961
|
}
|
|
3127
2962
|
}else {
|
|
3128
|
-
return
|
|
2963
|
+
return ___namespace.map(buttons, (button) => {
|
|
3129
2964
|
return {
|
|
3130
2965
|
type: 'steedos-object-button',
|
|
3131
2966
|
name: button.name,
|
|
3132
2967
|
objectName: button.objectName,
|
|
3133
2968
|
visibleOn: getButtonVisibleOn$1(button),
|
|
3134
|
-
className: `button_${button.name}
|
|
2969
|
+
className: `button_${button.name}`
|
|
3135
2970
|
}
|
|
3136
2971
|
});
|
|
3137
2972
|
}
|
|
@@ -3158,7 +2993,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3158
2993
|
"vertical": true,
|
|
3159
2994
|
"tiled": true,
|
|
3160
2995
|
"buttons": [
|
|
3161
|
-
...
|
|
2996
|
+
...___namespace.map(buttons, (button)=>{
|
|
3162
2997
|
return {
|
|
3163
2998
|
type: 'steedos-object-button',
|
|
3164
2999
|
name: button.name,
|
|
@@ -3187,7 +3022,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
3187
3022
|
}
|
|
3188
3023
|
}
|
|
3189
3024
|
}else {
|
|
3190
|
-
return
|
|
3025
|
+
return ___namespace.map(buttons, (button) => {
|
|
3191
3026
|
return {
|
|
3192
3027
|
type: 'steedos-object-button',
|
|
3193
3028
|
name: button.name,
|
|
@@ -5272,6 +5107,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
5272
5107
|
|
|
5273
5108
|
return {
|
|
5274
5109
|
"type": "tooltip-wrapper",
|
|
5110
|
+
"id": "steedos_crud_toolbar_quick_search",
|
|
5275
5111
|
"align": "right",
|
|
5276
5112
|
"title": "",
|
|
5277
5113
|
"content": "可搜索字段:" + searchableFieldsLabel.join(","),
|
|
@@ -5303,76 +5139,134 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5303
5139
|
if(isMobile){
|
|
5304
5140
|
showDisplayAs = false;
|
|
5305
5141
|
}
|
|
5142
|
+
let toolbarCount;
|
|
5143
|
+
if(!hiddenCount){
|
|
5144
|
+
toolbarCount = {
|
|
5145
|
+
"type": "tpl",
|
|
5146
|
+
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5147
|
+
};
|
|
5148
|
+
}
|
|
5149
|
+
let toolbarReloadButton;
|
|
5306
5150
|
if(formFactor === 'SMALL'){
|
|
5307
|
-
const onReloadScript = `
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
`;
|
|
5151
|
+
// const onReloadScript = `
|
|
5152
|
+
// const scope = event.context.scoped;
|
|
5153
|
+
// var listView = scope.parent.getComponents().find(function(n){
|
|
5154
|
+
// return n.props.type === "crud";
|
|
5155
|
+
// });
|
|
5156
|
+
// listView.handleChangePage(1);
|
|
5157
|
+
// `;
|
|
5158
|
+
// toolbarReloadButton = {
|
|
5159
|
+
// // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
5160
|
+
// "type": "button",
|
|
5161
|
+
// "align": "right",
|
|
5162
|
+
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5163
|
+
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5164
|
+
// "tooltipPlacement": "top",
|
|
5165
|
+
// "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5166
|
+
// "label": "",
|
|
5167
|
+
// "icon": "fa fa-sync",
|
|
5168
|
+
// "visibleOn": "${!showFieldsFilter}",
|
|
5169
|
+
// "onEvent": {
|
|
5170
|
+
// "click": {
|
|
5171
|
+
// "actions": [
|
|
5172
|
+
// {
|
|
5173
|
+
// "actionType": "custom",
|
|
5174
|
+
// "script": onReloadScript
|
|
5175
|
+
// }
|
|
5176
|
+
// ]
|
|
5177
|
+
// }
|
|
5178
|
+
// },
|
|
5179
|
+
// };
|
|
5180
|
+
|
|
5181
|
+
// 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
|
|
5182
|
+
toolbarReloadButton = {
|
|
5183
|
+
"type": "reload",
|
|
5184
|
+
"align": "right",
|
|
5185
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5186
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5187
|
+
"tooltip":"",
|
|
5188
|
+
"tooltipPlacement": "top",
|
|
5189
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5190
|
+
};
|
|
5191
|
+
}
|
|
5192
|
+
else {
|
|
5193
|
+
toolbarReloadButton = {
|
|
5194
|
+
"type": "reload",
|
|
5195
|
+
"align": "right",
|
|
5196
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5197
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5198
|
+
"tooltip":"",
|
|
5199
|
+
"tooltipPlacement": "top",
|
|
5200
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5201
|
+
};
|
|
5202
|
+
}
|
|
5203
|
+
let toolbarFilter;
|
|
5204
|
+
if(filterVisible){
|
|
5205
|
+
toolbarFilter ={
|
|
5206
|
+
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5207
|
+
"icon": "fa fa-filter",
|
|
5208
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5209
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5210
|
+
// "tooltipPlacement": "top",
|
|
5211
|
+
"type": "button",
|
|
5212
|
+
"badge": {
|
|
5213
|
+
"offset": [
|
|
5214
|
+
-5,
|
|
5215
|
+
1
|
|
5216
|
+
],
|
|
5217
|
+
"size":8,
|
|
5218
|
+
"animation": true,
|
|
5219
|
+
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5220
|
+
},
|
|
5221
|
+
"align": "right",
|
|
5222
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5223
|
+
"onEvent": {
|
|
5224
|
+
"click": {
|
|
5225
|
+
"actions": [
|
|
5226
|
+
{
|
|
5227
|
+
"actionType": "custom",
|
|
5228
|
+
"script": onFieldsFilterToggleScript
|
|
5229
|
+
}
|
|
5230
|
+
]
|
|
5231
|
+
}
|
|
5232
|
+
},
|
|
5233
|
+
"id": "steedos_crud_toolbar_filter"
|
|
5234
|
+
};
|
|
5235
|
+
}
|
|
5236
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
5237
|
+
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
5238
|
+
|
|
5239
|
+
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
5240
|
+
// 当出现空的.antd-Crud-toolbar-item dom时会影响toolbar元素的maring-right css样式计算,如果有动态需要应该加到动态数组变量toolbars中
|
|
5241
|
+
let toolbars = [];
|
|
5242
|
+
if(formFactor === 'SMALL'){
|
|
5243
|
+
if(toolbarCount){
|
|
5244
|
+
toolbars.push(toolbarCount);
|
|
5245
|
+
}
|
|
5246
|
+
toolbars.push(toolbarReloadButton);
|
|
5247
|
+
if(toolbarFilter){
|
|
5248
|
+
toolbars.push(toolbarFilter);
|
|
5249
|
+
}
|
|
5250
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5251
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5314
5252
|
return [
|
|
5315
5253
|
// "bulkActions",
|
|
5316
5254
|
...(headerToolbarItems || []),
|
|
5317
|
-
|
|
5318
|
-
"type": "tpl",
|
|
5319
|
-
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5320
|
-
},
|
|
5321
|
-
{
|
|
5322
|
-
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5323
|
-
"type": "button",
|
|
5324
|
-
"align": "right",
|
|
5325
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5326
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5327
|
-
"tooltipPlacement": "top",
|
|
5328
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5329
|
-
"label": "",
|
|
5330
|
-
"icon": "fa fa-sync",
|
|
5331
|
-
"visibleOn": "${!showFieldsFilter}",
|
|
5332
|
-
"onEvent": {
|
|
5333
|
-
"click": {
|
|
5334
|
-
"actions": [
|
|
5335
|
-
{
|
|
5336
|
-
"actionType": "custom",
|
|
5337
|
-
"script": onReloadScript
|
|
5338
|
-
}
|
|
5339
|
-
]
|
|
5340
|
-
}
|
|
5341
|
-
},
|
|
5342
|
-
},
|
|
5343
|
-
filterVisible ? {
|
|
5344
|
-
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5345
|
-
"icon": "fa fa-search",
|
|
5346
|
-
"type": "button",
|
|
5347
|
-
"tooltipPlacement": "top",
|
|
5348
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5349
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5350
|
-
"badge": {
|
|
5351
|
-
"offset": [
|
|
5352
|
-
-5,
|
|
5353
|
-
1
|
|
5354
|
-
],
|
|
5355
|
-
"size":8,
|
|
5356
|
-
"animation": true,
|
|
5357
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5358
|
-
},
|
|
5359
|
-
"align": "right",
|
|
5360
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5361
|
-
"onEvent": {
|
|
5362
|
-
"click": {
|
|
5363
|
-
"actions": [
|
|
5364
|
-
{
|
|
5365
|
-
"actionType": "custom",
|
|
5366
|
-
"script": onFieldsFilterToggleScript
|
|
5367
|
-
}
|
|
5368
|
-
]
|
|
5369
|
-
}
|
|
5370
|
-
}
|
|
5371
|
-
} : {},
|
|
5372
|
-
getDisplayAsButton(mainObject?.name),
|
|
5373
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName })
|
|
5255
|
+
...toolbars,
|
|
5374
5256
|
]
|
|
5375
5257
|
}else {
|
|
5258
|
+
if(toolbarCount){
|
|
5259
|
+
toolbars.push(toolbarCount);
|
|
5260
|
+
}
|
|
5261
|
+
if(toolbarFilter){
|
|
5262
|
+
toolbars.push(toolbarFilter);
|
|
5263
|
+
}
|
|
5264
|
+
toolbars.push(toolbarReloadButton);
|
|
5265
|
+
if(mainObject?.permissions?.allowCreateListViews){
|
|
5266
|
+
toolbars.push(getSettingListviewToolbarButtonSchema());
|
|
5267
|
+
}
|
|
5268
|
+
toolbars.push(toolbarDisplayAsButton);
|
|
5269
|
+
toolbars.push(toolbarDQuickSearchBox);
|
|
5376
5270
|
return [
|
|
5377
5271
|
// "filter-toggler",
|
|
5378
5272
|
...(headerToolbarItems || []),
|
|
@@ -5381,56 +5275,12 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
5381
5275
|
"type": "columns-toggler",
|
|
5382
5276
|
"className": "hidden"
|
|
5383
5277
|
},
|
|
5278
|
+
...toolbars,
|
|
5384
5279
|
// {
|
|
5385
5280
|
// "type": "columns-toggler",
|
|
5386
5281
|
// "className": "mr-2"
|
|
5387
5282
|
// },
|
|
5388
|
-
hiddenCount ? {} : {
|
|
5389
|
-
"type": "tpl",
|
|
5390
|
-
"tpl": "${count} " + i18next__default["default"].t('frontend_record_sum')
|
|
5391
|
-
},
|
|
5392
|
-
filterVisible ? {
|
|
5393
|
-
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5394
|
-
"icon": "fa fa-filter",
|
|
5395
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5396
|
-
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5397
|
-
// "tooltipPlacement": "top",
|
|
5398
|
-
"type": "button",
|
|
5399
|
-
"badge": {
|
|
5400
|
-
"offset": [
|
|
5401
|
-
-5,
|
|
5402
|
-
1
|
|
5403
|
-
],
|
|
5404
|
-
"size":8,
|
|
5405
|
-
"animation": true,
|
|
5406
|
-
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
5407
|
-
},
|
|
5408
|
-
"align": "right",
|
|
5409
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5410
|
-
"onEvent": {
|
|
5411
|
-
"click": {
|
|
5412
|
-
"actions": [
|
|
5413
|
-
{
|
|
5414
|
-
"actionType": "custom",
|
|
5415
|
-
"script": onFieldsFilterToggleScript
|
|
5416
|
-
}
|
|
5417
|
-
]
|
|
5418
|
-
}
|
|
5419
|
-
}
|
|
5420
|
-
} : {},
|
|
5421
|
-
{
|
|
5422
|
-
"type": "reload",
|
|
5423
|
-
"align": "right",
|
|
5424
|
-
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5425
|
-
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5426
|
-
"tooltip":"",
|
|
5427
|
-
"tooltipPlacement": "top",
|
|
5428
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5429
|
-
},
|
|
5430
5283
|
// getExportExcelToolbarButtonSchema(),
|
|
5431
|
-
mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
|
|
5432
|
-
getDisplayAsButton(mainObject?.name),
|
|
5433
|
-
getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName }),
|
|
5434
5284
|
// {
|
|
5435
5285
|
// "type": "drag-toggler",
|
|
5436
5286
|
// "align": "right"
|
|
@@ -5724,12 +5574,11 @@ const getReferenceTo = async (field)=>{
|
|
|
5724
5574
|
}
|
|
5725
5575
|
};
|
|
5726
5576
|
|
|
5727
|
-
function getLookupSapceUserTreeSchema(){
|
|
5728
|
-
const
|
|
5577
|
+
function getLookupSapceUserTreeSchema(isMobile){
|
|
5578
|
+
const treeSchema = {
|
|
5729
5579
|
"type": "input-tree",
|
|
5730
|
-
"className":
|
|
5580
|
+
"className":"steedos-select-user-tree",
|
|
5731
5581
|
"inputClassName": "p-0",
|
|
5732
|
-
"id": "u:7fd77b7915b0",
|
|
5733
5582
|
"source": {
|
|
5734
5583
|
"method": "post",
|
|
5735
5584
|
"url": "${context.rootUrl}/graphql",
|
|
@@ -5760,6 +5609,10 @@ function getLookupSapceUserTreeSchema(){
|
|
|
5760
5609
|
});
|
|
5761
5610
|
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
5762
5611
|
`
|
|
5612
|
+
},
|
|
5613
|
+
{
|
|
5614
|
+
"actionType": "custom",
|
|
5615
|
+
"script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
|
|
5763
5616
|
}
|
|
5764
5617
|
]
|
|
5765
5618
|
}
|
|
@@ -5784,18 +5637,56 @@ function getLookupSapceUserTreeSchema(){
|
|
|
5784
5637
|
"placeholder": "查找部门"
|
|
5785
5638
|
},
|
|
5786
5639
|
"unfoldedLevel": 2,
|
|
5787
|
-
"style": {
|
|
5788
|
-
"max-height": "100%",
|
|
5789
|
-
"position": "absolute",
|
|
5790
|
-
"left": "-330px",
|
|
5791
|
-
"width": "320px",
|
|
5792
|
-
"bottom": 0,
|
|
5793
|
-
"top": "0",
|
|
5794
|
-
"overflow": "auto",
|
|
5795
|
-
"min-height":"300px"
|
|
5796
|
-
},
|
|
5797
5640
|
"originPosition": "left-top"
|
|
5798
|
-
}
|
|
5641
|
+
};
|
|
5642
|
+
const tree = [];
|
|
5643
|
+
if(isMobile){
|
|
5644
|
+
tree.push({
|
|
5645
|
+
type: "action",
|
|
5646
|
+
body:[
|
|
5647
|
+
{
|
|
5648
|
+
type: "action",
|
|
5649
|
+
body:[
|
|
5650
|
+
treeSchema
|
|
5651
|
+
],
|
|
5652
|
+
className:"h-full w-[240px]"
|
|
5653
|
+
}
|
|
5654
|
+
],
|
|
5655
|
+
className: "absolute inset-0 steedos-select-user-sidebar",
|
|
5656
|
+
"onEvent": {
|
|
5657
|
+
"click": {
|
|
5658
|
+
"actions": [
|
|
5659
|
+
{
|
|
5660
|
+
"actionType": "custom",
|
|
5661
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
|
|
5662
|
+
}
|
|
5663
|
+
]
|
|
5664
|
+
}
|
|
5665
|
+
},
|
|
5666
|
+
id: "steedos_crud_toolbar_select_user_tree"
|
|
5667
|
+
});
|
|
5668
|
+
tree.push({
|
|
5669
|
+
"type": "button",
|
|
5670
|
+
"label": "组织",
|
|
5671
|
+
"icon": "fa fa-sitemap",
|
|
5672
|
+
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5673
|
+
"align": "left",
|
|
5674
|
+
"onEvent": {
|
|
5675
|
+
"click": {
|
|
5676
|
+
"actions": [
|
|
5677
|
+
{
|
|
5678
|
+
"actionType": "custom",
|
|
5679
|
+
"script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
|
|
5680
|
+
}
|
|
5681
|
+
]
|
|
5682
|
+
}
|
|
5683
|
+
},
|
|
5684
|
+
"id": "steedos_crud_toolbar_organization_button"
|
|
5685
|
+
});
|
|
5686
|
+
}else {
|
|
5687
|
+
tree.push(treeSchema);
|
|
5688
|
+
}
|
|
5689
|
+
|
|
5799
5690
|
return tree;
|
|
5800
5691
|
}
|
|
5801
5692
|
|
|
@@ -6059,13 +5950,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6059
5950
|
pickerSchema.affixHeader = false;
|
|
6060
5951
|
|
|
6061
5952
|
var headerToolbarItems = [];
|
|
6062
|
-
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
"margin-left":"330px",
|
|
6066
|
-
"min-height": "300px"
|
|
6067
|
-
};
|
|
6068
|
-
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
5953
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
5954
|
+
headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
|
|
5955
|
+
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
6069
5956
|
}
|
|
6070
5957
|
|
|
6071
5958
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
@@ -6161,6 +6048,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6161
6048
|
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
6162
6049
|
}
|
|
6163
6050
|
|
|
6051
|
+
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
|
|
6052
|
+
//手机端选人控件只保留部分toolbar
|
|
6053
|
+
pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
|
|
6054
|
+
if(["steedos_crud_toolbar_quick_search","steedos_crud_toolbar_filter","steedos_crud_toolbar_select_user_tree","steedos_crud_toolbar_organization_button"].indexOf(item.id) > -1){
|
|
6055
|
+
return true;
|
|
6056
|
+
}else {
|
|
6057
|
+
return false;
|
|
6058
|
+
}
|
|
6059
|
+
});
|
|
6060
|
+
pickerSchema.footerToolbar = ["pagination"];
|
|
6061
|
+
}
|
|
6062
|
+
|
|
6164
6063
|
const data = {
|
|
6165
6064
|
type: getAmisStaticFieldType('picker', readonly),
|
|
6166
6065
|
modalTitle: i18next__default["default"].t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
@@ -6640,6 +6539,12 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
6640
6539
|
"receiver": "${context.rootUrl}/s3/images",
|
|
6641
6540
|
"name": field.name,
|
|
6642
6541
|
"options": {
|
|
6542
|
+
"menu": {
|
|
6543
|
+
"insert": {
|
|
6544
|
+
"title": "Insert",
|
|
6545
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
6546
|
+
}
|
|
6547
|
+
},
|
|
6643
6548
|
"plugins": [
|
|
6644
6549
|
"autoresize"
|
|
6645
6550
|
],
|
|
@@ -6654,6 +6559,14 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
6654
6559
|
return {
|
|
6655
6560
|
"type": "input-rich-text",
|
|
6656
6561
|
"receiver": "${context.rootUrl}/s3/images",
|
|
6562
|
+
"options":{
|
|
6563
|
+
"menu": {
|
|
6564
|
+
"insert": {
|
|
6565
|
+
"title": "Insert",
|
|
6566
|
+
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
6567
|
+
}
|
|
6568
|
+
}
|
|
6569
|
+
},
|
|
6657
6570
|
"name": field.name
|
|
6658
6571
|
}
|
|
6659
6572
|
// return {
|
|
@@ -7427,7 +7340,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
7427
7340
|
convertData.className = 'm-1';
|
|
7428
7341
|
}
|
|
7429
7342
|
if(readonly){
|
|
7430
|
-
convertData.className = `${convertData.className}
|
|
7343
|
+
convertData.className = `${convertData.className} border-b`;
|
|
7431
7344
|
}
|
|
7432
7345
|
if(readonly){
|
|
7433
7346
|
convertData.quickEdit = false;
|
|
@@ -7897,7 +7810,10 @@ function getFieldWidth(width){
|
|
|
7897
7810
|
}
|
|
7898
7811
|
|
|
7899
7812
|
async function getTableColumns(fields, options){
|
|
7900
|
-
const columns = [
|
|
7813
|
+
const columns = [];
|
|
7814
|
+
if(!options.isLookup){
|
|
7815
|
+
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
7816
|
+
}
|
|
7901
7817
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
7902
7818
|
|
|
7903
7819
|
for (const field of fields) {
|