@steedos-widgets/amis-lib 1.3.0-beta.12 → 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/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
- mode: "edit",
2197
- persistData: false,
2198
- promptPageLeave: true,
2199
- name: "form_edit_data_import",
2200
- debug: false,
2201
- title: "",
2202
- submitText: "",
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
- initFetch: true,
2224
- body: [
2225
- {
2226
- type: "fieldSet",
2227
- title: i18next__default["default"].t('frontend_field_group_generalization'),
2228
- collapsable: true,
2229
- body: [
2230
- {
2231
- name: "object_name",
2232
- label: i18next__default["default"].t('frontend_import_data_object_name'),
2233
- required: false,
2234
- type: "select",
2235
- joinValues: false,
2236
- extractValue: true,
2237
- autoComplete: {
2238
- method: "post",
2239
- url: "${context.rootUrl}/graphql",
2240
- data: {
2241
- orderBy: "${orderBy}",
2242
- orderDir: "${orderDir}",
2243
- pageNo: "${page}",
2244
- pageSize: "${perPage}",
2245
- query:
2246
- "{options:objects(filters: {__filters}, top: {__top}){_id label:label value:name},count:objects__count(filters:{__filters})}",
2247
- $term: "$term",
2248
- $value: "$object_name.name",
2249
- $: "$$",
2250
- rfield: "${object_name}",
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
- headers: {
2288
- Authorization:
2289
- "Bearer ${context.tenantId},${context.authToken}",
2233
+ "data": {
2234
+ "objectName": `${uiSchema.name}`,
2235
+ "displayAs": "${displayAs}",
2236
+ "recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
2290
2237
  },
2291
- requestAdaptor:
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
- size: "lg",
2297
- pickerSchema: {
2298
- mode: "table",
2299
- name: "thelist",
2300
- draggable: false,
2301
- headerToolbar: ["reload"],
2302
- defaultParams: {
2303
- perPage: 20,
2304
- },
2305
- columns: [
2306
- {
2307
- name: "_index",
2308
- type: "text",
2309
- width: 32,
2310
- placeholder: "",
2311
- },
2312
- {
2313
- name: "description",
2314
- label: i18next__default["default"].t('frontend_import_data_queue_import_description'),
2315
- type: "tpl",
2316
- tpl: '<a href="/app/undefined/undefined/view/${undefined}">${description}</a>',
2317
- className: "whitespace-nowrap",
2318
- html: null,
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
- dataType: "json",
2424
- requestAdaptor:
2425
- "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
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
- messages: {
2434
- success: i18next__default["default"].t('frontend_import_data_message_success'),
2435
- failed: i18next__default["default"].t('frontend_import_data_message_failed'),
2436
- },
2272
+ actionType: "ajax",
2273
+ expression: "event.data.result",
2437
2274
  },
2438
- actionType: "ajax",
2439
- expression: "event.data.result",
2440
- },
2441
- ],
2275
+ ],
2276
+ },
2442
2277
  },
2443
- },
2444
- closeDialogOnSubmit: true,
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(___default["default"].isBoolean(visible)){
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 (___default["default"].startsWith(___default["default"].trim(button._visible), "function")) {
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 (___default["default"].isFunction(button.visible)) {
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(___default["default"].isEmpty(listViewRef.props.store.toJSON().selectedItems)){
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 = ___default["default"].sortBy(___default["default"].values(uiSchema.actions), "sort");
2758
- if (___default["default"].has(uiSchema, "allow_customActions")) {
2759
- buttons = ___default["default"].filter(buttons, (button) => {
2760
- return ___default["default"].include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
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 (___default["default"].has(uiSchema, "exclude_actions")) {
2764
- buttons = ___default["default"].filter(buttons, (button) => {
2765
- return !___default["default"].include(uiSchema.exclude_actions, button.name);
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
- ___default["default"].each(buttons, (button) => {
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
- ___default["default"].map(buttons, (button) => {
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 ___default["default"].filter(buttons, (button) => {
2799
- return ___default["default"].indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
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 = ___default["default"].filter(buttons, (button) => {
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 = ___default["default"].filter(buttons, (button) => {
2648
+ const detailButtons = ___namespace.filter(buttons, (button) => {
2814
2649
  return button.on == "record" || button.on == "record_only";
2815
2650
  });
2816
- return ___default["default"].sortBy(detailButtons, "sort");
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 = ___default["default"].filter(buttons, (button) => {
2656
+ const moreButtons = ___namespace.filter(buttons, (button) => {
2822
2657
  return button.on == "record_more" || button.on == "record_only_more";
2823
2658
  });
2824
- return ___default["default"].sortBy(moreButtons, "sort");
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 = ___default["default"].filter(buttons, (button) => {
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 = ___default["default"].filter(buttons, (button) => {
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 = ___default["default"].find(buttons, (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 (___default["default"].isString(button.todo)) {
2950
- if (___default["default"].startsWith(___default["default"].trim(button.todo), "function")) {
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 (___default["default"].isFunction(button.todo)) {
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 = ___default["default"].map(buttons, (button) => {
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 = ___default["default"].map(moreButtons, (button, index) => {
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
- ...___default["default"].map(buttons, (button)=>{
2868
+ ...___namespace.map(buttons, (button)=>{
3034
2869
  button.className += ' w-full';
3035
2870
  return button;
3036
2871
  }),
3037
- ...___default["default"].map(moreButtons, (button)=>{
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
- ...___default["default"].map(buttons, (button)=>{
2934
+ ...___namespace.map(buttons, (button)=>{
3100
2935
  return {
3101
2936
  type: 'steedos-object-button',
3102
2937
  name: button.name,
@@ -3125,7 +2960,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3125
2960
  }
3126
2961
  }
3127
2962
  }else {
3128
- return ___default["default"].map(buttons, (button) => {
2963
+ return ___namespace.map(buttons, (button) => {
3129
2964
  return {
3130
2965
  type: 'steedos-object-button',
3131
2966
  name: button.name,
@@ -3158,7 +2993,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
3158
2993
  "vertical": true,
3159
2994
  "tiled": true,
3160
2995
  "buttons": [
3161
- ...___default["default"].map(buttons, (button)=>{
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 ___default["default"].map(buttons, (button) => {
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(","),
@@ -5393,7 +5229,8 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5393
5229
  }
5394
5230
  ]
5395
5231
  }
5396
- }
5232
+ },
5233
+ "id": "steedos_crud_toolbar_filter"
5397
5234
  };
5398
5235
  }
5399
5236
  let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
@@ -5737,12 +5574,11 @@ const getReferenceTo = async (field)=>{
5737
5574
  }
5738
5575
  };
5739
5576
 
5740
- function getLookupSapceUserTreeSchema(){
5741
- const tree = [{
5577
+ function getLookupSapceUserTreeSchema(isMobile){
5578
+ const treeSchema = {
5742
5579
  "type": "input-tree",
5743
- "className": "",
5580
+ "className":"steedos-select-user-tree",
5744
5581
  "inputClassName": "p-0",
5745
- "id": "u:7fd77b7915b0",
5746
5582
  "source": {
5747
5583
  "method": "post",
5748
5584
  "url": "${context.rootUrl}/graphql",
@@ -5773,6 +5609,10 @@ function getLookupSapceUserTreeSchema(){
5773
5609
  });
5774
5610
  listView.handleFilterSubmit(Object.assign({}, filterFormValues));
5775
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'); }"
5776
5616
  }
5777
5617
  ]
5778
5618
  }
@@ -5797,18 +5637,56 @@ function getLookupSapceUserTreeSchema(){
5797
5637
  "placeholder": "查找部门"
5798
5638
  },
5799
5639
  "unfoldedLevel": 2,
5800
- "style": {
5801
- "max-height": "100%",
5802
- "position": "absolute",
5803
- "left": "-330px",
5804
- "width": "320px",
5805
- "bottom": 0,
5806
- "top": "0",
5807
- "overflow": "auto",
5808
- "min-height":"300px"
5809
- },
5810
5640
  "originPosition": "left-top"
5811
- }];
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
+
5812
5690
  return tree;
5813
5691
  }
5814
5692
 
@@ -6072,13 +5950,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
6072
5950
  pickerSchema.affixHeader = false;
6073
5951
 
6074
5952
  var headerToolbarItems = [];
6075
- if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
6076
- headerToolbarItems = getLookupSapceUserTreeSchema();
6077
- pickerSchema["style"] = {
6078
- "margin-left":"330px",
6079
- "min-height": "300px"
6080
- };
6081
- 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";
6082
5956
  }
6083
5957
 
6084
5958
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
@@ -6174,6 +6048,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
6174
6048
  pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
6175
6049
  }
6176
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
+
6177
6063
  const data = {
6178
6064
  type: getAmisStaticFieldType('picker', readonly),
6179
6065
  modalTitle: i18next__default["default"].t('frontend_form_please_select') + " " + refObjectConfig.label,
@@ -6653,6 +6539,12 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
6653
6539
  "receiver": "${context.rootUrl}/s3/images",
6654
6540
  "name": field.name,
6655
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
+ },
6656
6548
  "plugins": [
6657
6549
  "autoresize"
6658
6550
  ],
@@ -6667,6 +6559,14 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
6667
6559
  return {
6668
6560
  "type": "input-rich-text",
6669
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
+ },
6670
6570
  "name": field.name
6671
6571
  }
6672
6572
  // return {
@@ -7910,7 +7810,10 @@ function getFieldWidth(width){
7910
7810
  }
7911
7811
 
7912
7812
  async function getTableColumns(fields, options){
7913
- const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
7813
+ const columns = [];
7814
+ if(!options.isLookup){
7815
+ columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
7816
+ }
7914
7817
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
7915
7818
 
7916
7819
  for (const field of fields) {