@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.esm.js CHANGED
@@ -2165,257 +2165,92 @@ const getSchema$2 = (uiSchema) => {
2165
2165
  title: i18next.t('frontend_import_data'),
2166
2166
  body: [
2167
2167
  {
2168
- type: "form",
2169
- mode: "edit",
2170
- persistData: false,
2171
- promptPageLeave: true,
2172
- name: "form_edit_data_import",
2173
- debug: false,
2174
- title: "",
2175
- submitText: "",
2176
- api: {
2177
- method: "post",
2178
- url: "${context.rootUrl}/graphql",
2179
- data: {
2180
- objectName: "queue_import_history",
2181
- $: "$$",
2182
- },
2183
- requestAdaptor:
2184
- "\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 ",
2185
- responseData: {
2186
- recordId: "${record._id}",
2187
- },
2188
- adaptor:
2189
- "console.log('payload', payload)\n return payload;\n ",
2190
- headers: {
2191
- Authorization:
2192
- "Bearer ${context.tenantId},${context.authToken}",
2193
- },
2194
- dataType: "json",
2168
+ "type": "steedos-object-form",
2169
+ "label": "对象表单",
2170
+ "objectApiName": "queue_import_history",
2171
+ "recordId": "",
2172
+ "mode": "edit",
2173
+ "layout": "normal",
2174
+ "defaultData":{
2175
+ "object_name": "${objectName}"
2195
2176
  },
2196
- initFetch: true,
2197
- body: [
2198
- {
2199
- type: "fieldSet",
2200
- title: i18next.t('frontend_field_group_generalization'),
2201
- collapsable: true,
2202
- body: [
2203
- {
2204
- name: "object_name",
2205
- label: i18next.t('frontend_import_data_object_name'),
2206
- required: false,
2207
- type: "select",
2208
- joinValues: false,
2209
- extractValue: true,
2210
- autoComplete: {
2211
- method: "post",
2212
- url: "${context.rootUrl}/graphql",
2213
- data: {
2214
- orderBy: "${orderBy}",
2215
- orderDir: "${orderDir}",
2216
- pageNo: "${page}",
2217
- pageSize: "${perPage}",
2218
- query:
2219
- "{options:objects(filters: {__filters}, top: {__top}){_id label:label value:name},count:objects__count(filters:{__filters})}",
2220
- $term: "$term",
2221
- $value: "$object_name.name",
2222
- $: "$$",
2223
- rfield: "${object_name}",
2224
- },
2225
- headers: {
2226
- Authorization:
2227
- "Bearer ${context.tenantId},${context.authToken}",
2228
- },
2229
- requestAdaptor:
2230
- "\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 ",
2231
- },
2232
- className: "m-1",
2233
- labelClassName: "text-left",
2234
- clearValueOnHidden: false,
2235
- id: "u:04295fee3896",
2236
- multiple: false,
2237
- hidden: true,
2238
- },
2239
- {
2240
- name: "queue_import",
2241
- label: i18next.t('frontend_import_data_queue_import'),
2242
- required: true,
2243
- type: "picker",
2244
- labelField: "description",
2245
- valueField: "_id",
2246
- modalMode: "dialog",
2247
- source: {
2248
- method: "post",
2249
- url: "${context.rootUrl}/graphql",
2250
- data: {
2251
- orderBy: "${orderBy}",
2252
- orderDir: "${orderDir}",
2253
- pageNo: "${page}",
2254
- pageSize: "${perPage}",
2255
- query:
2256
- '{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})}',
2257
- $term: "$term",
2258
- $self: "$$",
2177
+ "fieldsExtend":{
2178
+ "object_name": {
2179
+ "amis": {
2180
+ "hidden": true
2181
+ }
2182
+ }
2183
+ },
2184
+ "form": {
2185
+ debug: false,
2186
+ resetAfterSubmit: false,
2187
+ initApi: {
2188
+ url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
2189
+ sendOn: 'this.recordId',
2190
+ responseData: {
2191
+ importState: "${state}"
2192
+ }
2193
+ },
2194
+ interval: 3000,
2195
+ stopAutoRefreshWhen: "this.importState === 'finished'",
2196
+ initFetch: false,
2197
+ onEvent: {
2198
+ inited: {
2199
+ weight: 0,
2200
+ actions: [
2201
+ {
2202
+ "actionType": "broadcast",
2203
+ "args": {
2204
+ "eventName": `@data.changed.${uiSchema.name}`
2259
2205
  },
2260
- headers: {
2261
- Authorization:
2262
- "Bearer ${context.tenantId},${context.authToken}",
2206
+ "data": {
2207
+ "objectName": `${uiSchema.name}`,
2208
+ "displayAs": "${displayAs}",
2209
+ "recordId": "xxxx" //不可以省略,否则会进入进入记录详细页面
2263
2210
  },
2264
- requestAdaptor:
2265
- "\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 ",
2266
- adaptor:
2267
- "\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 ",
2211
+ "expression": "this.importState === 'finished'"
2268
2212
  },
2269
- size: "lg",
2270
- pickerSchema: {
2271
- mode: "table",
2272
- name: "thelist",
2273
- draggable: false,
2274
- headerToolbar: ["reload"],
2275
- defaultParams: {
2276
- perPage: 20,
2277
- },
2278
- columns: [
2279
- {
2280
- name: "_index",
2281
- type: "text",
2282
- width: 32,
2283
- placeholder: "",
2284
- },
2285
- {
2286
- name: "description",
2287
- label: i18next.t('frontend_import_data_queue_import_description'),
2288
- type: "tpl",
2289
- tpl: '<a href="/app/undefined/undefined/view/${undefined}">${description}</a>',
2290
- className: "whitespace-nowrap",
2291
- html: null,
2292
- },
2293
- {
2294
- name: "object_name",
2295
- label: i18next.t('frontend_import_data_object_name'),
2296
- type: "tpl",
2297
- tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
2298
- className: "whitespace-nowrap",
2299
- html: null,
2300
- },
2301
- {
2302
- name: "encoding",
2303
- label: i18next.t('frontend_import_data_queue_import_encoding'),
2304
- type: "tpl",
2305
- tpl: "<div>${_display.encoding}</div>",
2306
- className: "whitespace-nowrap",
2307
- html: null,
2308
- },
2309
- {
2310
- name: "template_url",
2311
- label: i18next.t('frontend_import_data_queue_import_template_url'),
2312
- type: "button-group",
2313
- buttons: [
2314
- {
2315
- type: "button",
2316
- label: i18next.t('frontend_download'),
2317
- visibleOn: "${template_url}",
2318
- level: "link",
2319
- actionType: "download",
2320
- api:{
2321
- url: "${template_url}",
2322
- method: "get",
2323
- headers: {
2324
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
2325
- }
2326
- }
2327
- }
2328
- ],
2329
- options: {
2330
- html: true
2213
+ {
2214
+ "actionType": "closeDialog",
2215
+ "expression": "this.importState === 'finished'"
2216
+ }
2217
+ ]
2218
+ },
2219
+ submitSucc: {
2220
+ weight: 0,
2221
+ actions: [
2222
+ {
2223
+ args: {
2224
+ api: {
2225
+ url: "${context.rootUrl}/api/data/initiateImport",
2226
+ method: "post",
2227
+ data: {
2228
+ eventData: "${event.data}",
2229
+ },
2230
+ dataType: "json",
2231
+ requestAdaptor:
2232
+ "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
2233
+ adaptor:
2234
+ "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
2235
+ headers: {
2236
+ Authorization:
2237
+ "Bearer ${context.tenantId},${context.authToken}",
2331
2238
  },
2332
- className: "whitespace-nowrap",
2333
- },
2334
- null,
2335
- ],
2336
- syncLocation: false,
2337
- keepItemSelectionOnPageChange: true,
2338
- checkOnItemClick: false,
2339
- autoFillHeight: false,
2340
- },
2341
- joinValues: false,
2342
- extractValue: true,
2343
- className: "m-1",
2344
- labelClassName: "text-left",
2345
- clearValueOnHidden: true,
2346
- id: "u:401df27113e0",
2347
- },
2348
- {
2349
- name: "file",
2350
- label: i18next.t('frontend_import_data_file'),
2351
- required: true,
2352
- type: "input-file",
2353
- accept: ".xlsx,.xls",
2354
- className: "m-1",
2355
- labelClassName: "text-left",
2356
- clearValueOnHidden: true,
2357
- useChunk: false,
2358
- receiver: {
2359
- method: "post",
2360
- url: "${context.rootUrl}/s3/files",
2361
- data: {
2362
- $: "$$",
2363
- context: "${context}",
2364
- },
2365
- adaptor:
2366
- '\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 ',
2367
- headers: {
2368
- Authorization:
2369
- "Bearer ${context.tenantId},${context.authToken}",
2370
- },
2371
- },
2372
- id: "u:0213f2cc365b",
2373
- },
2374
- ],
2375
- id: "u:4899c260d667",
2376
- },
2377
- ],
2378
- panelClassName: "m-0 sm:rounded-lg shadow-none",
2379
- bodyClassName: "p-0",
2380
- className: "p-4 sm:p-0 steedos-amis-form",
2381
- label: "对象表单",
2382
- objectApiName: "queue_import_history",
2383
- id: "u:e4ef598eed61",
2384
- onEvent: {
2385
- submitSucc: {
2386
- weight: 0,
2387
- actions: [
2388
- {
2389
- args: {
2390
- api: {
2391
- url: "${context.rootUrl}/api/data/initiateImport",
2392
- method: "post",
2393
- data: {
2394
- eventData: "${event.data}",
2395
2239
  },
2396
- dataType: "json",
2397
- requestAdaptor:
2398
- "\napi.data = {\n importObjectHistoryId: api.body.eventData.result.data.recordId\n}\nreturn api;",
2399
- adaptor:
2400
- "payload.status = payload.status === 'success' ? 0 : payload.status;\nconsole.log(\"payload ssss==>\", payload)\nreturn payload;",
2401
- headers: {
2402
- Authorization:
2403
- "Bearer ${context.tenantId},${context.authToken}",
2240
+ messages: {
2241
+ success: i18next.t('frontend_import_data_message_success'),
2242
+ failed: i18next.t('frontend_import_data_message_failed'),
2404
2243
  },
2405
2244
  },
2406
- messages: {
2407
- success: i18next.t('frontend_import_data_message_success'),
2408
- failed: i18next.t('frontend_import_data_message_failed'),
2409
- },
2245
+ actionType: "ajax",
2246
+ expression: "event.data.result",
2410
2247
  },
2411
- actionType: "ajax",
2412
- expression: "event.data.result",
2413
- },
2414
- ],
2248
+ ],
2249
+ },
2415
2250
  },
2416
- },
2417
- closeDialogOnSubmit: true,
2418
- },
2251
+ closeDialogOnSubmit: false,
2252
+ }
2253
+ }
2419
2254
  ],
2420
2255
  id: "u:dc05498d3bd4",
2421
2256
  closeOnEsc: false,
@@ -2605,7 +2440,7 @@ const StandardButtons = {
2605
2440
  getStandardImportData: async (uiSchema, ctx)=>{
2606
2441
  return {
2607
2442
  type: 'amis_button',
2608
- amis_schema: await getSchema$2()
2443
+ amis_schema: await getSchema$2(uiSchema)
2609
2444
  }
2610
2445
  },
2611
2446
  getStandardOpenView: async (uiSchema, ctx)=>{
@@ -2635,7 +2470,7 @@ function getButtonVisibleOn$1(button){
2635
2470
  visible = button._visible;
2636
2471
  }
2637
2472
 
2638
- if(___default.isBoolean(visible)){
2473
+ if(_$1.isBoolean(visible)){
2639
2474
  visible = visible.toString();
2640
2475
  }
2641
2476
 
@@ -2663,7 +2498,7 @@ function getButtonVisibleOn$1(button){
2663
2498
 
2664
2499
  const getButtonVisible = (button, ctx) => {
2665
2500
  if (button._visible) {
2666
- if (___default.startsWith(___default.trim(button._visible), "function")) {
2501
+ if (_$1.startsWith(_$1.trim(button._visible), "function")) {
2667
2502
  window.eval("var fun = " + button._visible);
2668
2503
  button.visible = fun;
2669
2504
  } else if (isExpression(button._visible)) {
@@ -2678,7 +2513,7 @@ const getButtonVisible = (button, ctx) => {
2678
2513
  };
2679
2514
  }
2680
2515
  }
2681
- if (___default.isFunction(button.visible)) {
2516
+ if (_$1.isFunction(button.visible)) {
2682
2517
  try {
2683
2518
  return button.visible(ctx);
2684
2519
  } catch (error) {
@@ -2700,7 +2535,7 @@ const standardButtonsTodo = {
2700
2535
  } = this;
2701
2536
  const listViewRef = SteedosUI?.getRef(scopeId || listViewId).getComponentById(`listview_${uiSchema.name}`);
2702
2537
 
2703
- if(___default.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
2538
+ if(_$1.isEmpty(listViewRef.props.store.toJSON().selectedItems)){
2704
2539
  listViewRef.handleAction({}, {
2705
2540
  "actionType": "toast",
2706
2541
  "toast": {
@@ -2727,19 +2562,19 @@ const standardButtonsTodo = {
2727
2562
  */
2728
2563
  const getButtons = (uiSchema, ctx) => {
2729
2564
  const disabledButtons = uiSchema.permissions && uiSchema.permissions.disabled_actions;
2730
- let buttons = ___default.sortBy(___default.values(uiSchema.actions), "sort");
2731
- if (___default.has(uiSchema, "allow_customActions")) {
2732
- buttons = ___default.filter(buttons, (button) => {
2733
- return ___default.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
2565
+ let buttons = _$1.sortBy(_$1.values(uiSchema.actions), "sort");
2566
+ if (_$1.has(uiSchema, "allow_customActions")) {
2567
+ buttons = _$1.filter(buttons, (button) => {
2568
+ return _$1.include(uiSchema.allow_customActions, button.name); // || _.include(_.keys(Creator.getObject('base').actions) || {}, button.name)
2734
2569
  });
2735
2570
  }
2736
- if (___default.has(uiSchema, "exclude_actions")) {
2737
- buttons = ___default.filter(buttons, (button) => {
2738
- return !___default.include(uiSchema.exclude_actions, button.name);
2571
+ if (_$1.has(uiSchema, "exclude_actions")) {
2572
+ buttons = _$1.filter(buttons, (button) => {
2573
+ return !_$1.include(uiSchema.exclude_actions, button.name);
2739
2574
  });
2740
2575
  }
2741
2576
 
2742
- ___default.each(buttons, (button) => {
2577
+ _$1.each(buttons, (button) => {
2743
2578
  button.objectName = uiSchema.name;
2744
2579
  if (
2745
2580
  ctx.isMobile &&
@@ -2758,7 +2593,7 @@ const getButtons = (uiSchema, ctx) => {
2758
2593
  ctx.isMobile &&
2759
2594
  ["cms_files", "cfs.files.filerecord"].indexOf(uiSchema.name) > -1
2760
2595
  ) {
2761
- ___default.map(buttons, (button) => {
2596
+ _$1.map(buttons, (button) => {
2762
2597
  if (button.name === "standard_edit") {
2763
2598
  button.on = "record_more";
2764
2599
  }
@@ -2768,14 +2603,14 @@ const getButtons = (uiSchema, ctx) => {
2768
2603
  });
2769
2604
  }
2770
2605
 
2771
- return ___default.filter(buttons, (button) => {
2772
- return ___default.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
2606
+ return _$1.filter(buttons, (button) => {
2607
+ return _$1.indexOf(disabledButtons, button.name) < 0 && button.name != 'standard_query';
2773
2608
  });
2774
2609
  };
2775
2610
 
2776
2611
  const getListViewButtons = (uiSchema, ctx) => {
2777
2612
  const buttons = getButtons(uiSchema, ctx);
2778
- const listButtons = ___default.filter(buttons, (button) => {
2613
+ const listButtons = _$1.filter(buttons, (button) => {
2779
2614
  return button.on == "list";
2780
2615
  });
2781
2616
  return listButtons;
@@ -2783,23 +2618,23 @@ const getListViewButtons = (uiSchema, ctx) => {
2783
2618
 
2784
2619
  const getObjectDetailButtons = (uiSchema, ctx) => {
2785
2620
  const buttons = getButtons(uiSchema, ctx);
2786
- const detailButtons = ___default.filter(buttons, (button) => {
2621
+ const detailButtons = _$1.filter(buttons, (button) => {
2787
2622
  return button.on == "record" || button.on == "record_only";
2788
2623
  });
2789
- return ___default.sortBy(detailButtons, "sort");
2624
+ return _$1.sortBy(detailButtons, "sort");
2790
2625
  };
2791
2626
 
2792
2627
  const getObjectDetailMoreButtons = (uiSchema, ctx) => {
2793
2628
  const buttons = getButtons(uiSchema, ctx);
2794
- const moreButtons = ___default.filter(buttons, (button) => {
2629
+ const moreButtons = _$1.filter(buttons, (button) => {
2795
2630
  return button.on == "record_more" || button.on == "record_only_more";
2796
2631
  });
2797
- return ___default.sortBy(moreButtons, "sort");
2632
+ return _$1.sortBy(moreButtons, "sort");
2798
2633
  };
2799
2634
 
2800
2635
  const getListViewItemButtons = async (uiSchema, ctx)=>{
2801
2636
  const buttons = getButtons(uiSchema, ctx);
2802
- const listButtons = ___default.filter(buttons, (button) => {
2637
+ const listButtons = _$1.filter(buttons, (button) => {
2803
2638
  return button.on == "record" || button.on == "list_item" || button.on === 'record_more';
2804
2639
  });
2805
2640
  return listButtons;
@@ -2816,7 +2651,7 @@ const getObjectRelatedListButtons = (uiSchema, ctx)=>{
2816
2651
  // });
2817
2652
  // return relatedListButtons;
2818
2653
  const buttons = getButtons(uiSchema, ctx);
2819
- const listButtons = ___default.filter(buttons, (button) => {
2654
+ const listButtons = _$1.filter(buttons, (button) => {
2820
2655
  return button.on == "list";
2821
2656
  });
2822
2657
  return listButtons;
@@ -2833,7 +2668,7 @@ const getButton = async (objectName, buttonName, ctx)=>{
2833
2668
  const uiSchema = await getUISchema(objectName);
2834
2669
  if(uiSchema){
2835
2670
  const buttons = await getButtons(uiSchema, ctx);
2836
- const button = ___default.find(buttons, (button)=>{
2671
+ const button = _$1.find(buttons, (button)=>{
2837
2672
  return button.name === buttonName
2838
2673
  });
2839
2674
 
@@ -2919,13 +2754,13 @@ const execute = (button, props) => {
2919
2754
  return; //TODO 弹出提示未配置todo
2920
2755
  }
2921
2756
 
2922
- if (___default.isString(button.todo)) {
2923
- if (___default.startsWith(___default.trim(button.todo), "function")) {
2757
+ if (_$1.isString(button.todo)) {
2758
+ if (_$1.startsWith(_$1.trim(button.todo), "function")) {
2924
2759
  window.eval("var fun = " + button.todo);
2925
2760
  button.todo = fun;
2926
2761
  }
2927
2762
  }
2928
- if (___default.isFunction(button.todo)) {
2763
+ if (_$1.isFunction(button.todo)) {
2929
2764
  const todoThis = {
2930
2765
  objectName: props.objectName,
2931
2766
  object_name: props.objectName,
@@ -2950,7 +2785,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2950
2785
  recordId: recordId,
2951
2786
  objectName: name
2952
2787
  });
2953
- let amisButtonsSchema = ___default.map(buttons, (button) => {
2788
+ let amisButtonsSchema = _$1.map(buttons, (button) => {
2954
2789
  return {
2955
2790
  type: 'steedos-object-button',
2956
2791
  name: button.name,
@@ -2960,7 +2795,7 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
2960
2795
  }
2961
2796
  });
2962
2797
  let moreButtonsVisibleOn = '';
2963
- let dropdownButtons = ___default.map(moreButtons, (button, index) => {
2798
+ let dropdownButtons = _$1.map(moreButtons, (button, index) => {
2964
2799
  if(index === 0){
2965
2800
  moreButtonsVisibleOn = getButtonVisibleOn$1(button);
2966
2801
  }else {
@@ -3003,11 +2838,11 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
3003
2838
  "vertical": true,
3004
2839
  "tiled": true,
3005
2840
  "buttons": [
3006
- ...___default.map(buttons, (button)=>{
2841
+ ..._$1.map(buttons, (button)=>{
3007
2842
  button.className += ' w-full';
3008
2843
  return button;
3009
2844
  }),
3010
- ...___default.map(moreButtons, (button)=>{
2845
+ ..._$1.map(moreButtons, (button)=>{
3011
2846
  button.className += ' w-full';
3012
2847
  return button;
3013
2848
  })
@@ -3069,7 +2904,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3069
2904
  "vertical": true,
3070
2905
  "tiled": true,
3071
2906
  "buttons": [
3072
- ...___default.map(buttons, (button)=>{
2907
+ ..._$1.map(buttons, (button)=>{
3073
2908
  return {
3074
2909
  type: 'steedos-object-button',
3075
2910
  name: button.name,
@@ -3098,7 +2933,7 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
3098
2933
  }
3099
2934
  }
3100
2935
  }else {
3101
- return ___default.map(buttons, (button) => {
2936
+ return _$1.map(buttons, (button) => {
3102
2937
  return {
3103
2938
  type: 'steedos-object-button',
3104
2939
  name: button.name,
@@ -3131,7 +2966,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
3131
2966
  "vertical": true,
3132
2967
  "tiled": true,
3133
2968
  "buttons": [
3134
- ...___default.map(buttons, (button)=>{
2969
+ ..._$1.map(buttons, (button)=>{
3135
2970
  return {
3136
2971
  type: 'steedos-object-button',
3137
2972
  name: button.name,
@@ -3160,7 +2995,7 @@ const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
3160
2995
  }
3161
2996
  }
3162
2997
  }else {
3163
- return ___default.map(buttons, (button) => {
2998
+ return _$1.map(buttons, (button) => {
3164
2999
  return {
3165
3000
  type: 'steedos-object-button',
3166
3001
  name: button.name,
@@ -5245,6 +5080,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
5245
5080
 
5246
5081
  return {
5247
5082
  "type": "tooltip-wrapper",
5083
+ "id": "steedos_crud_toolbar_quick_search",
5248
5084
  "align": "right",
5249
5085
  "title": "",
5250
5086
  "content": "可搜索字段:" + searchableFieldsLabel.join(","),
@@ -5366,7 +5202,8 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5366
5202
  }
5367
5203
  ]
5368
5204
  }
5369
- }
5205
+ },
5206
+ "id": "steedos_crud_toolbar_filter"
5370
5207
  };
5371
5208
  }
5372
5209
  let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
@@ -5710,12 +5547,11 @@ const getReferenceTo = async (field)=>{
5710
5547
  }
5711
5548
  };
5712
5549
 
5713
- function getLookupSapceUserTreeSchema(){
5714
- const tree = [{
5550
+ function getLookupSapceUserTreeSchema(isMobile){
5551
+ const treeSchema = {
5715
5552
  "type": "input-tree",
5716
- "className": "",
5553
+ "className":"steedos-select-user-tree",
5717
5554
  "inputClassName": "p-0",
5718
- "id": "u:7fd77b7915b0",
5719
5555
  "source": {
5720
5556
  "method": "post",
5721
5557
  "url": "${context.rootUrl}/graphql",
@@ -5746,6 +5582,10 @@ function getLookupSapceUserTreeSchema(){
5746
5582
  });
5747
5583
  listView.handleFilterSubmit(Object.assign({}, filterFormValues));
5748
5584
  `
5585
+ },
5586
+ {
5587
+ "actionType": "custom",
5588
+ "script": " if(window.innerWidth < 768){ document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open'); }"
5749
5589
  }
5750
5590
  ]
5751
5591
  }
@@ -5770,18 +5610,56 @@ function getLookupSapceUserTreeSchema(){
5770
5610
  "placeholder": "查找部门"
5771
5611
  },
5772
5612
  "unfoldedLevel": 2,
5773
- "style": {
5774
- "max-height": "100%",
5775
- "position": "absolute",
5776
- "left": "-330px",
5777
- "width": "320px",
5778
- "bottom": 0,
5779
- "top": "0",
5780
- "overflow": "auto",
5781
- "min-height":"300px"
5782
- },
5783
5613
  "originPosition": "left-top"
5784
- }];
5614
+ };
5615
+ const tree = [];
5616
+ if(isMobile){
5617
+ tree.push({
5618
+ type: "action",
5619
+ body:[
5620
+ {
5621
+ type: "action",
5622
+ body:[
5623
+ treeSchema
5624
+ ],
5625
+ className:"h-full w-[240px]"
5626
+ }
5627
+ ],
5628
+ className: "absolute inset-0 steedos-select-user-sidebar",
5629
+ "onEvent": {
5630
+ "click": {
5631
+ "actions": [
5632
+ {
5633
+ "actionType": "custom",
5634
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.remove('steedos-select-user-sidebar-open')"
5635
+ }
5636
+ ]
5637
+ }
5638
+ },
5639
+ id: "steedos_crud_toolbar_select_user_tree"
5640
+ });
5641
+ tree.push({
5642
+ "type": "button",
5643
+ "label": "组织",
5644
+ "icon": "fa fa-sitemap",
5645
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5646
+ "align": "left",
5647
+ "onEvent": {
5648
+ "click": {
5649
+ "actions": [
5650
+ {
5651
+ "actionType": "custom",
5652
+ "script": "document.querySelector('.steedos-select-user-sidebar').classList.toggle('steedos-select-user-sidebar-open')"
5653
+ }
5654
+ ]
5655
+ }
5656
+ },
5657
+ "id": "steedos_crud_toolbar_organization_button"
5658
+ });
5659
+ }else {
5660
+ tree.push(treeSchema);
5661
+ }
5662
+
5785
5663
  return tree;
5786
5664
  }
5787
5665
 
@@ -6045,13 +5923,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
6045
5923
  pickerSchema.affixHeader = false;
6046
5924
 
6047
5925
  var headerToolbarItems = [];
6048
- if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
6049
- headerToolbarItems = getLookupSapceUserTreeSchema();
6050
- pickerSchema["style"] = {
6051
- "margin-left":"330px",
6052
- "min-height": "300px"
6053
- };
6054
- pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
5926
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
5927
+ headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
5928
+ pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
6055
5929
  }
6056
5930
 
6057
5931
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
@@ -6147,6 +6021,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
6147
6021
  pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
6148
6022
  }
6149
6023
 
6024
+ if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && isMobile){
6025
+ //手机端选人控件只保留部分toolbar
6026
+ pickerSchema.headerToolbar = pickerSchema.headerToolbar && pickerSchema.headerToolbar.filter(function(item){
6027
+ 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){
6028
+ return true;
6029
+ }else {
6030
+ return false;
6031
+ }
6032
+ });
6033
+ pickerSchema.footerToolbar = ["pagination"];
6034
+ }
6035
+
6150
6036
  const data = {
6151
6037
  type: getAmisStaticFieldType('picker', readonly),
6152
6038
  modalTitle: i18next.t('frontend_form_please_select') + " " + refObjectConfig.label,
@@ -6626,6 +6512,12 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
6626
6512
  "receiver": "${context.rootUrl}/s3/images",
6627
6513
  "name": field.name,
6628
6514
  "options": {
6515
+ "menu": {
6516
+ "insert": {
6517
+ "title": "Insert",
6518
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
6519
+ }
6520
+ },
6629
6521
  "plugins": [
6630
6522
  "autoresize"
6631
6523
  ],
@@ -6640,6 +6532,14 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
6640
6532
  return {
6641
6533
  "type": "input-rich-text",
6642
6534
  "receiver": "${context.rootUrl}/s3/images",
6535
+ "options":{
6536
+ "menu": {
6537
+ "insert": {
6538
+ "title": "Insert",
6539
+ "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
6540
+ }
6541
+ }
6542
+ },
6643
6543
  "name": field.name
6644
6544
  }
6645
6545
  // return {
@@ -7883,7 +7783,10 @@ function getFieldWidth(width){
7883
7783
  }
7884
7784
 
7885
7785
  async function getTableColumns(fields, options){
7886
- const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
7786
+ const columns = [];
7787
+ if(!options.isLookup){
7788
+ columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
7789
+ }
7887
7790
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
7888
7791
 
7889
7792
  for (const field of fields) {