@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.
@@ -53981,18 +53981,24 @@ const Router = {
53981
53981
  /*
53982
53982
  * @Author: baozhoutao@steedos.com
53983
53983
  * @Date: 2022-07-20 16:29:22
53984
- * @LastEditors: liaodaxue
53985
- * @LastEditTime: 2024-01-25 14:44:17
53984
+ * @LastEditors: baozhoutao@steedos.com
53985
+ * @LastEditTime: 2024-11-17 13:05:44
53986
53986
  * @Description:
53987
53987
  */
53988
53988
 
53989
- function getImageFieldUrl(url) {
53990
- if (window.Meteor && window.Meteor.isCordova != true) {
53991
- // '//'的位置
53992
- const doubleSlashIndex = url.indexOf('//');
53993
- const urlIndex = url.indexOf('/', doubleSlashIndex + 2);
53994
- const rootUrl = url.substring(urlIndex);
53995
- return rootUrl;
53989
+ function getImageFieldUrl(url, readonly) {
53990
+ if (window.Meteor) {
53991
+ if(window.Meteor.isCordova != true){
53992
+ // '//'的位置
53993
+ const doubleSlashIndex = url.indexOf('//');
53994
+ const urlIndex = url.indexOf('/', doubleSlashIndex + 2);
53995
+ const rootUrl = url.substring(urlIndex);
53996
+ return rootUrl;
53997
+ }else {
53998
+ if(readonly || url.startsWith('http')){
53999
+ return `${url}?token=${window.btoa(JSON.stringify({ authToken : Builder.settings.context.authToken }))}`
54000
+ }
54001
+ }
53996
54002
  }
53997
54003
  return url;
53998
54004
  }
@@ -54001,13 +54007,29 @@ if(typeof window != 'undefined'){
54001
54007
  window.getImageFieldUrl = getImageFieldUrl;
54002
54008
  }
54003
54009
 
54010
+
54011
+
54012
+ // js color
54013
+
54014
+ function toGrayscale(r, g, b){
54015
+ return (
54016
+ 0.2126 * r +
54017
+ 0.7152 * g +
54018
+ 0.0722 * b
54019
+ );
54020
+ }
54021
+
54022
+ function isLight(r, g, b){
54023
+ // 专业的亮度是 > 255 / 2. 此处的阈值调整为200
54024
+ return toGrayscale(r, g, b) > 200
54025
+ }
54026
+
54004
54027
  function getContrastColor(bgColor) {
54005
54028
  var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
54006
54029
  var r = parseInt(backgroundColor.substr(0, 2), 16);
54007
54030
  var g = parseInt(backgroundColor.substr(2, 2), 16);
54008
54031
  var b = parseInt(backgroundColor.substr(4, 2), 16);
54009
- var brightness = (r * 299 + g * 587 + b * 114) / 1000;
54010
- return brightness < 128 ? "#ffffff" : "#000000";
54032
+ return isLight(r, g, b) ? "#000000" : "#ffffff";
54011
54033
  }
54012
54034
 
54013
54035
  function getLookupListView(refObjectConfig) {
@@ -54116,7 +54138,7 @@ function getSelectMap(selectOptions){
54116
54138
  if(optionColor && optionColor != "undefined"){
54117
54139
  const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
54118
54140
  const color = getContrastColor(background);
54119
- const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
54141
+ const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem;font-size:14px';
54120
54142
  map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
54121
54143
  }else {
54122
54144
  map[optionValue] = option.label;
@@ -54530,7 +54552,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
54530
54552
  * @Author: baozhoutao@steedos.com
54531
54553
  * @Date: 2022-10-28 14:15:09
54532
54554
  * @LastEditors: baozhoutao@steedos.com
54533
- * @LastEditTime: 2024-08-19 16:26:58
54555
+ * @LastEditTime: 2024-11-14 10:50:01
54534
54556
  * @Description:
54535
54557
  */
54536
54558
 
@@ -54589,6 +54611,7 @@ async function getLookupLinkOnClick(field, options) {
54589
54611
  "title": "&nbsp;",
54590
54612
  "headerClassName": "hidden",
54591
54613
  "size": "lg",
54614
+ "width": "70%",
54592
54615
  "bodyClassName": "p-0 m-0 bg-gray-100",
54593
54616
  "closeOnEsc": true,
54594
54617
  "closeOnOutside": true,
@@ -54628,13 +54651,13 @@ const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
54628
54651
  if(type === 'file'){
54629
54652
  return window.Meteor?.isCordova ? {
54630
54653
  "type": "control",
54631
- "body": {
54654
+ "body": steedosField.multiple ? {
54632
54655
  "type": "each",
54633
54656
  "name": "_display." + steedosField.name,
54634
54657
  "items": {
54635
54658
  "type": "tpl",
54636
54659
  "tpl": "${name}",
54637
- "className": "antd-Button--link inline-block",
54660
+ "className": "antd-Button--link inline-block mr-2",
54638
54661
  "onEvent": {
54639
54662
  "click": {
54640
54663
  "actions": [
@@ -54649,6 +54672,24 @@ const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
54649
54672
  }
54650
54673
  }
54651
54674
  }
54675
+ } : {
54676
+ "type": "tpl",
54677
+ "tpl": "${_display." + steedosField.name + ".name}",
54678
+ "className": "antd-Button--link inline-block",
54679
+ "onEvent": {
54680
+ "click": {
54681
+ "actions": [
54682
+ {
54683
+ "script": `
54684
+ const data = event.data._display.${steedosField.name};
54685
+ Steedos.cordovaDownload(encodeURI(data.url), data.name);
54686
+ `,
54687
+ "actionType": "custom"
54688
+ }
54689
+ ],
54690
+ "weight": 0
54691
+ }
54692
+ }
54652
54693
  }
54653
54694
  } : {
54654
54695
  // type: amisFieldType,
@@ -55663,6 +55704,7 @@ async function getColumnItemOnClick(field, options){
55663
55704
  "title": "&nbsp;",
55664
55705
  "headerClassName": "hidden",
55665
55706
  "size": "lg",
55707
+ "width": "70%",
55666
55708
  "bodyClassName": "p-0 m-0 bg-gray-100",
55667
55709
  "closeOnEsc": true,
55668
55710
  "closeOnOutside": true,
@@ -56316,7 +56358,7 @@ async function getTableSchema$1(object, fields, options){
56316
56358
  /*
56317
56359
  img/avatar字段值添加URL前缀使其在amis中正常显示图片。
56318
56360
  */
56319
- function getScriptForAddUrlPrefixForImgFields(fields){
56361
+ function getScriptForAddUrlPrefixForImgFields(fields, readonly){
56320
56362
  let imgFieldsKeys = [];
56321
56363
  let imgFields = {};
56322
56364
  fields.forEach((item)=>{
@@ -56344,12 +56386,12 @@ function getScriptForAddUrlPrefixForImgFields(fields){
56344
56386
  if(fieldProps.multiple){
56345
56387
  if(imgFieldDisplayValue instanceof Array){
56346
56388
  data[item] = imgFieldDisplayValue.map((i)=>{
56347
- const url = window.getImageFieldUrl(i.url);
56389
+ const url = window.getImageFieldUrl(i.url, ${readonly});
56348
56390
  return url;
56349
56391
  });
56350
56392
  }
56351
56393
  }else{
56352
- const url = imgFieldDisplayValue && window.getImageFieldUrl(imgFieldDisplayValue.url);
56394
+ const url = imgFieldDisplayValue && window.getImageFieldUrl(imgFieldDisplayValue.url, ${readonly});
56353
56395
  data[item] = url;
56354
56396
  }
56355
56397
  }
@@ -61069,7 +61111,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
61069
61111
  // }
61070
61112
  // 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
61071
61113
  convertData = {
61072
- type: "input-date-range",
61114
+ type: "input-datetime-range",
61073
61115
  inputFormat: "YYYY-MM-DD HH:mm",
61074
61116
  format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
61075
61117
  tpl: readonly ? getDateTimeTpl(field) : null,