@steedos-widgets/sortable 6.3.10 → 6.3.11-beta.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.
@@ -20286,18 +20286,24 @@
20286
20286
  /*
20287
20287
  * @Author: baozhoutao@steedos.com
20288
20288
  * @Date: 2022-07-20 16:29:22
20289
- * @LastEditors: liaodaxue
20290
- * @LastEditTime: 2024-01-25 14:44:17
20289
+ * @LastEditors: baozhoutao@steedos.com
20290
+ * @LastEditTime: 2024-11-17 13:05:44
20291
20291
  * @Description:
20292
20292
  */
20293
20293
 
20294
- function getImageFieldUrl(url) {
20295
- if (window.Meteor && window.Meteor.isCordova != true) {
20296
- // '//'的位置
20297
- const doubleSlashIndex = url.indexOf('//');
20298
- const urlIndex = url.indexOf('/', doubleSlashIndex + 2);
20299
- const rootUrl = url.substring(urlIndex);
20300
- return rootUrl;
20294
+ function getImageFieldUrl(url, readonly) {
20295
+ if (window.Meteor) {
20296
+ if(window.Meteor.isCordova != true){
20297
+ // '//'的位置
20298
+ const doubleSlashIndex = url.indexOf('//');
20299
+ const urlIndex = url.indexOf('/', doubleSlashIndex + 2);
20300
+ const rootUrl = url.substring(urlIndex);
20301
+ return rootUrl;
20302
+ }else {
20303
+ if(readonly || url.startsWith('http')){
20304
+ return `${url}?token=${window.btoa(JSON.stringify({ authToken : Builder.settings.context.authToken }))}`
20305
+ }
20306
+ }
20301
20307
  }
20302
20308
  return url;
20303
20309
  }
@@ -20306,13 +20312,29 @@
20306
20312
  window.getImageFieldUrl = getImageFieldUrl;
20307
20313
  }
20308
20314
 
20315
+
20316
+
20317
+ // js color
20318
+
20319
+ function toGrayscale(r, g, b){
20320
+ return (
20321
+ 0.2126 * r +
20322
+ 0.7152 * g +
20323
+ 0.0722 * b
20324
+ );
20325
+ }
20326
+
20327
+ function isLight(r, g, b){
20328
+ // 专业的亮度是 > 255 / 2. 此处的阈值调整为200
20329
+ return toGrayscale(r, g, b) > 200
20330
+ }
20331
+
20309
20332
  function getContrastColor(bgColor) {
20310
20333
  var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
20311
20334
  var r = parseInt(backgroundColor.substr(0, 2), 16);
20312
20335
  var g = parseInt(backgroundColor.substr(2, 2), 16);
20313
20336
  var b = parseInt(backgroundColor.substr(4, 2), 16);
20314
- var brightness = (r * 299 + g * 587 + b * 114) / 1000;
20315
- return brightness < 128 ? "#ffffff" : "#000000";
20337
+ return isLight(r, g, b) ? "#000000" : "#ffffff";
20316
20338
  }
20317
20339
 
20318
20340
  function getLookupListView(refObjectConfig) {
@@ -20421,7 +20443,7 @@
20421
20443
  if(optionColor && optionColor != "undefined"){
20422
20444
  const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
20423
20445
  const color = getContrastColor(background);
20424
- const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
20446
+ const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem;font-size:14px';
20425
20447
  map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
20426
20448
  }else {
20427
20449
  map[optionValue] = option.label;
@@ -20835,7 +20857,7 @@
20835
20857
  * @Author: baozhoutao@steedos.com
20836
20858
  * @Date: 2022-10-28 14:15:09
20837
20859
  * @LastEditors: baozhoutao@steedos.com
20838
- * @LastEditTime: 2024-08-19 16:26:58
20860
+ * @LastEditTime: 2024-11-14 10:50:01
20839
20861
  * @Description:
20840
20862
  */
20841
20863
 
@@ -20894,6 +20916,7 @@
20894
20916
  "title": "&nbsp;",
20895
20917
  "headerClassName": "hidden",
20896
20918
  "size": "lg",
20919
+ "width": "70%",
20897
20920
  "bodyClassName": "p-0 m-0 bg-gray-100",
20898
20921
  "closeOnEsc": true,
20899
20922
  "closeOnOutside": true,
@@ -20933,13 +20956,13 @@
20933
20956
  if(type === 'file'){
20934
20957
  return window.Meteor?.isCordova ? {
20935
20958
  "type": "control",
20936
- "body": {
20959
+ "body": steedosField.multiple ? {
20937
20960
  "type": "each",
20938
20961
  "name": "_display." + steedosField.name,
20939
20962
  "items": {
20940
20963
  "type": "tpl",
20941
20964
  "tpl": "${name}",
20942
- "className": "antd-Button--link inline-block",
20965
+ "className": "antd-Button--link inline-block mr-2",
20943
20966
  "onEvent": {
20944
20967
  "click": {
20945
20968
  "actions": [
@@ -20954,6 +20977,24 @@
20954
20977
  }
20955
20978
  }
20956
20979
  }
20980
+ } : {
20981
+ "type": "tpl",
20982
+ "tpl": "${_display." + steedosField.name + ".name}",
20983
+ "className": "antd-Button--link inline-block",
20984
+ "onEvent": {
20985
+ "click": {
20986
+ "actions": [
20987
+ {
20988
+ "script": `
20989
+ const data = event.data._display.${steedosField.name};
20990
+ Steedos.cordovaDownload(encodeURI(data.url), data.name);
20991
+ `,
20992
+ "actionType": "custom"
20993
+ }
20994
+ ],
20995
+ "weight": 0
20996
+ }
20997
+ }
20957
20998
  }
20958
20999
  } : {
20959
21000
  // type: amisFieldType,
@@ -21968,6 +22009,7 @@
21968
22009
  "title": "&nbsp;",
21969
22010
  "headerClassName": "hidden",
21970
22011
  "size": "lg",
22012
+ "width": "70%",
21971
22013
  "bodyClassName": "p-0 m-0 bg-gray-100",
21972
22014
  "closeOnEsc": true,
21973
22015
  "closeOnOutside": true,
@@ -22621,7 +22663,7 @@
22621
22663
  /*
22622
22664
  img/avatar字段值添加URL前缀使其在amis中正常显示图片。
22623
22665
  */
22624
- function getScriptForAddUrlPrefixForImgFields(fields){
22666
+ function getScriptForAddUrlPrefixForImgFields(fields, readonly){
22625
22667
  let imgFieldsKeys = [];
22626
22668
  let imgFields = {};
22627
22669
  fields.forEach((item)=>{
@@ -22649,12 +22691,12 @@
22649
22691
  if(fieldProps.multiple){
22650
22692
  if(imgFieldDisplayValue instanceof Array){
22651
22693
  data[item] = imgFieldDisplayValue.map((i)=>{
22652
- const url = window.getImageFieldUrl(i.url);
22694
+ const url = window.getImageFieldUrl(i.url, ${readonly});
22653
22695
  return url;
22654
22696
  });
22655
22697
  }
22656
22698
  }else{
22657
- const url = imgFieldDisplayValue && window.getImageFieldUrl(imgFieldDisplayValue.url);
22699
+ const url = imgFieldDisplayValue && window.getImageFieldUrl(imgFieldDisplayValue.url, ${readonly});
22658
22700
  data[item] = url;
22659
22701
  }
22660
22702
  }
@@ -27374,7 +27416,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
27374
27416
  // }
27375
27417
  // 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
27376
27418
  convertData = {
27377
- type: "input-date-range",
27419
+ type: "input-datetime-range",
27378
27420
  inputFormat: "YYYY-MM-DD HH:mm",
27379
27421
  format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
27380
27422
  tpl: readonly ? getDateTimeTpl(field) : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-widgets/sortable",
3
- "version": "6.3.10",
3
+ "version": "6.3.11-beta.11",
4
4
  "main": "dist/sortable.cjs.js",
5
5
  "module": "dist/sortable.esm.js",
6
6
  "unpkg": "dist/sortable.umd.js",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@dnd-kit/core": "^6.0.5",
47
47
  "@dnd-kit/sortable": "^7.0.1",
48
- "@steedos-widgets/amis-lib": "6.3.10"
48
+ "@steedos-widgets/amis-lib": "6.3.11-beta.11"
49
49
  },
50
- "gitHead": "96594583a24bfe3051611eb3573e05dd135287aa"
50
+ "gitHead": "f0f24add9a8427e1715a5a6f9a765a1725ed0581"
51
51
  }