@steedos-widgets/amis-lib 6.3.11-beta.9 → 6.3.11

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
@@ -389,7 +389,7 @@ const Router = {
389
389
  * @Author: baozhoutao@steedos.com
390
390
  * @Date: 2022-07-20 16:29:22
391
391
  * @LastEditors: baozhoutao@steedos.com
392
- * @LastEditTime: 2024-10-14 13:33:27
392
+ * @LastEditTime: 2024-11-17 13:05:44
393
393
  * @Description:
394
394
  */
395
395
 
@@ -414,13 +414,29 @@ if(typeof window != 'undefined'){
414
414
  window.getImageFieldUrl = getImageFieldUrl;
415
415
  }
416
416
 
417
+
418
+
419
+ // js color
420
+
421
+ function toGrayscale(r, g, b){
422
+ return (
423
+ 0.2126 * r +
424
+ 0.7152 * g +
425
+ 0.0722 * b
426
+ );
427
+ }
428
+
429
+ function isLight(r, g, b){
430
+ // 专业的亮度是 > 255 / 2. 此处的阈值调整为200
431
+ return toGrayscale(r, g, b) > 200
432
+ }
433
+
417
434
  function getContrastColor(bgColor) {
418
435
  var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
419
436
  var r = parseInt(backgroundColor.substr(0, 2), 16);
420
437
  var g = parseInt(backgroundColor.substr(2, 2), 16);
421
438
  var b = parseInt(backgroundColor.substr(4, 2), 16);
422
- var brightness = (r * 299 + g * 587 + b * 114) / 1000;
423
- return brightness < 128 ? "#ffffff" : "#000000";
439
+ return isLight(r, g, b) ? "#000000" : "#ffffff";
424
440
  }
425
441
 
426
442
  function getLookupListView(refObjectConfig) {
@@ -490,7 +506,7 @@ function getComparableAmisVersion() {
490
506
  * @Author: baozhoutao@steedos.com
491
507
  * @Date: 2022-05-23 09:53:08
492
508
  * @LastEditors: baozhoutao@steedos.com
493
- * @LastEditTime: 2024-02-21 17:19:30
509
+ * @LastEditTime: 2024-11-17 13:10:08
494
510
  * @Description:
495
511
  */
496
512
 
@@ -551,7 +567,7 @@ function getSelectMap(selectOptions){
551
567
  if(optionColor && optionColor != "undefined"){
552
568
  const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
553
569
  const color = getContrastColor(background);
554
- const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
570
+ const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem;font-size:14px';
555
571
  map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
556
572
  }else {
557
573
  map[optionValue] = option.label;
@@ -1197,7 +1213,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1197
1213
  * @Author: baozhoutao@steedos.com
1198
1214
  * @Date: 2022-10-28 14:15:09
1199
1215
  * @LastEditors: baozhoutao@steedos.com
1200
- * @LastEditTime: 2024-10-14 14:01:15
1216
+ * @LastEditTime: 2024-11-14 10:50:01
1201
1217
  * @Description:
1202
1218
  */
1203
1219
 
@@ -1256,6 +1272,7 @@ async function getLookupLinkOnClick(field, options) {
1256
1272
  "title": "&nbsp;",
1257
1273
  "headerClassName": "hidden",
1258
1274
  "size": "lg",
1275
+ "width": "70%",
1259
1276
  "bodyClassName": "p-0 m-0 bg-gray-100",
1260
1277
  "closeOnEsc": true,
1261
1278
  "closeOnOutside": true,
@@ -2348,6 +2365,7 @@ async function getColumnItemOnClick(field, options){
2348
2365
  "title": "&nbsp;",
2349
2366
  "headerClassName": "hidden",
2350
2367
  "size": "lg",
2368
+ "width": "70%",
2351
2369
  "bodyClassName": "p-0 m-0 bg-gray-100",
2352
2370
  "closeOnEsc": true,
2353
2371
  "closeOnOutside": true,
@@ -7762,7 +7780,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
7762
7780
  let body = [
7763
7781
  {
7764
7782
  "type": "wrapper",
7765
- "className": "p-4 border-b",
7783
+ "className": "p-4",
7766
7784
  "body": [
7767
7785
  {
7768
7786
  "type": "grid",
@@ -7860,7 +7878,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
7860
7878
  "body": details,
7861
7879
  "hiddenOn": "${recordLoaded != true}"
7862
7880
  },
7863
- "className": "steedos-record-compact-layouts p-4 bg-white compact-layouts border-b"
7881
+ "className": "steedos-record-compact-layouts p-4 pb-2 border-t compact-layouts"
7864
7882
  });
7865
7883
  }
7866
7884
 
@@ -10926,7 +10944,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
10926
10944
  };
10927
10945
  const content = {
10928
10946
  "type": "tabs",
10929
- "className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
10947
+ "className": "steedos-record-tabs bg-white p-4 sm:m-4 sm:shadow sm:rounded",
10930
10948
  "contentClassName": "bg-none",
10931
10949
  "tabs": [
10932
10950
  detailed
@@ -13219,6 +13237,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
13219
13237
  type: "static-mapping",
13220
13238
  name: field.name,
13221
13239
  label: field.label,
13240
+ options: field.options,
13222
13241
  map: map
13223
13242
  };
13224
13243
  }else {