@steedos-widgets/amis-object 1.2.9 → 1.2.10

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.
@@ -393,6 +393,9 @@ body {
393
393
  .-mb-4 {
394
394
  margin-bottom: -1rem
395
395
  }
396
+ .mr-4 {
397
+ margin-right: 1rem
398
+ }
396
399
  .mr-2 {
397
400
  margin-right: 0.5rem
398
401
  }
@@ -408,9 +411,6 @@ body {
408
411
  .ml-4 {
409
412
  margin-left: 1rem
410
413
  }
411
- .mr-4 {
412
- margin-right: 1rem
413
- }
414
414
  .-ml-px {
415
415
  margin-left: -1px
416
416
  }
@@ -510,12 +510,12 @@ body {
510
510
  .w-14 {
511
511
  width: 3.5rem
512
512
  }
513
- .w-6 {
514
- width: 1.5rem
515
- }
516
513
  .w-4 {
517
514
  width: 1rem
518
515
  }
516
+ .w-6 {
517
+ width: 1.5rem
518
+ }
519
519
  .w-20 {
520
520
  width: 5rem
521
521
  }
@@ -1133,9 +1133,6 @@ body {
1133
1133
  right: 30px;
1134
1134
  background: transparent;
1135
1135
  }
1136
- .antd-Table-toolbar .antd-Crud-loadMore .antd-Button.is-disabled {
1137
- display: none;
1138
- }
1139
1136
  @media (max-width: 576px) {
1140
1137
  .steedos-record-detail-related-lists .steedos-record-related-list .steedos-object-table .antd-Table-footToolbar {
1141
1138
  display: none;
@@ -767,11 +767,28 @@
767
767
 
768
768
  };
769
769
 
770
+ /*
771
+ * @Author: baozhoutao@steedos.com
772
+ * @Date: 2022-07-20 16:29:22
773
+ * @LastEditors: Please set LastEditors
774
+ * @LastEditTime: 2023-05-18 15:22:51
775
+ * @Description:
776
+ */
777
+
778
+ function getContrastColor(bgColor) {
779
+ var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
780
+ var r = parseInt(backgroundColor.substr(0, 2), 16);
781
+ var g = parseInt(backgroundColor.substr(2, 2), 16);
782
+ var b = parseInt(backgroundColor.substr(4, 2), 16);
783
+ var brightness = (r * 299 + g * 587 + b * 114) / 1000;
784
+ return brightness < 128 ? "#ffffff" : "#000000";
785
+ }
786
+
770
787
  /*
771
788
  * @Author: baozhoutao@steedos.com
772
789
  * @Date: 2022-05-23 09:53:08
773
- * @LastEditors: baozhoutao@steedos.com
774
- * @LastEditTime: 2023-04-10 11:22:54
790
+ * @LastEditors: Please set LastEditors
791
+ * @LastEditTime: 2023-05-18 16:34:39
775
792
  * @Description:
776
793
  */
777
794
 
@@ -824,6 +841,21 @@
824
841
  function getSelectTpl(field){
825
842
  return `<div>\${_display.${field.name}}</div>`
826
843
  }
844
+ function getSelectMap(selectOptions){
845
+ let map = {};
846
+ ___default.forEach(selectOptions,(option)=>{
847
+ const optionValue = option.value + '';
848
+ if(option.color){
849
+ const background = option.color.charAt(0) === '#' ? option.color : '#'+option.color;
850
+ const color = getContrastColor(background);
851
+ const optionColorStyle = 'background:'+background+';color:'+color;
852
+ map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
853
+ }else {
854
+ map[optionValue] = option.label;
855
+ }
856
+ });
857
+ return map;
858
+ }
827
859
 
828
860
  function getNameTplUrl(field, ctx){
829
861
  if(ctx.objectName === 'cms_files'){
@@ -3783,8 +3815,8 @@
3783
3815
  },
3784
3816
  "body":[{
3785
3817
  "type": "button",
3786
- "visibleOn": "${window:innerWidth > 768 && window:historyPaths.length > 1}",
3787
- "className":"flex mr-2",
3818
+ "visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
3819
+ "className":"flex mr-4",
3788
3820
  "onEvent": {
3789
3821
  "click": {
3790
3822
  "actions": [
@@ -3801,7 +3833,7 @@
3801
3833
  "category": "utility",
3802
3834
  "name": "back",
3803
3835
  "colorVariant": "default",
3804
- "className": "slds-button_icon slds-global-header__icon"
3836
+ "className": "slds-button_icon slds-global-header__icon w-4"
3805
3837
  }
3806
3838
  ]
3807
3839
  }]
@@ -4769,7 +4801,7 @@
4769
4801
  {
4770
4802
  "dialog": {
4771
4803
  "type": "dialog",
4772
- "title": "弹框标题",
4804
+ "title": "默认排序规则",
4773
4805
  "data": {
4774
4806
  "&": "$$",
4775
4807
  "targetObjectName": "${objectName}",
@@ -6369,23 +6401,6 @@ else{
6369
6401
  return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
6370
6402
  };
6371
6403
 
6372
- /*
6373
- * @Author: baozhoutao@steedos.com
6374
- * @Date: 2022-07-20 16:29:22
6375
- * @LastEditors: Please set LastEditors
6376
- * @LastEditTime: 2023-05-11 11:19:54
6377
- * @Description:
6378
- */
6379
-
6380
- function getContrastColor(bgColor) {
6381
- var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
6382
- var r = parseInt(backgroundColor.substr(0, 2), 16);
6383
- var g = parseInt(backgroundColor.substr(2, 2), 16);
6384
- var b = parseInt(backgroundColor.substr(4, 2), 16);
6385
- var brightness = (r * 299 + g * 587 + b * 114) / 1000;
6386
- return brightness >= 128 ? "#000000" : "#ffffff";
6387
- }
6388
-
6389
6404
  const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
6390
6405
  // const Lookup = require('./lookup');
6391
6406
 
@@ -6576,19 +6591,7 @@ else{
6576
6591
  // break;
6577
6592
  case 'select':
6578
6593
  if(readonly){
6579
- const selectOptions = field.options;
6580
- let map = {};
6581
- ___default__namespace.forEach(selectOptions,(option)=>{
6582
- const optionValue = option.value + '';
6583
- if(option.color){
6584
- const background = '#'+option.color;
6585
- const color = getContrastColor(background);
6586
- const optionColorStyle = 'background:'+background+';color:'+color;
6587
- map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
6588
- }else {
6589
- map[optionValue] = option.label;
6590
- }
6591
- });
6594
+ const map = getSelectMap(field.options);
6592
6595
  convertData = {
6593
6596
  type: "static-mapping",
6594
6597
  name: field.name,
@@ -7287,7 +7290,8 @@ else{
7287
7290
  data.global = "${global}";
7288
7291
  data.context = "${context}";
7289
7292
  data.defaultData = "${defaultData}";
7290
-
7293
+ data._master = "${_master}";
7294
+
7291
7295
  return {
7292
7296
  method: "post",
7293
7297
  url: getApi$2() + '&objectName=${objectName}' ,
@@ -7353,7 +7357,7 @@ else{
7353
7357
  formInitialValuesFun = new Function("return " + formInitialValuesFun)();
7354
7358
  }
7355
7359
  if(typeof formInitialValuesFun === "function"){
7356
- initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global})
7360
+ initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global, master: api.body._master })
7357
7361
  }
7358
7362
  }
7359
7363
  catch(ex){
@@ -8009,19 +8013,7 @@ else{
8009
8013
  }, field.amis, {name: field.name}));
8010
8014
  }
8011
8015
  else if(field.type === 'select'){
8012
- const selectOptions = field.options;
8013
- let map = {};
8014
- ___default.forEach(selectOptions,(option)=>{
8015
- const optionValue = option.value + '';
8016
- if(option.color){
8017
- const background = '#'+option.color;
8018
- const color = getContrastColor(background);
8019
- const optionColorStyle = 'background:'+background+';color:'+color;
8020
- map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
8021
- }else {
8022
- map[optionValue] = option.label;
8023
- }
8024
- });
8016
+ const map = getSelectMap(field.options);
8025
8017
  columns.push(Object.assign({}, {
8026
8018
  type: "mapping",
8027
8019
  name: field.name,
@@ -8574,11 +8566,10 @@ else{
8574
8566
  if(api.data.$self._isRelated){
8575
8567
  const self = api.data.$self;
8576
8568
  const relatedKey = self.relatedKey;
8577
- const recordId = self.recordId;
8578
8569
  const refField = self.uiSchema.fields[relatedKey];
8579
8570
  const masterRecord = self._master.record;
8580
8571
  const masterObjectName = self._master.objectName;
8581
- let relatedValue = recordId;
8572
+ let relatedValue = self._master.recordId;
8582
8573
  if(refField.reference_to_field && refField.reference_to_field != '_id'){
8583
8574
  relatedValue = masterRecord[refField.reference_to_field]
8584
8575
  }
@@ -14980,7 +14971,7 @@ else{
14980
14971
  * @Author: baozhoutao@steedos.com
14981
14972
  * @Date: 2022-09-01 14:44:57
14982
14973
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
14983
- * @LastEditTime: 2023-05-17 17:26:22
14974
+ * @LastEditTime: 2023-05-18 22:39:31
14984
14975
  * @Description:
14985
14976
  */
14986
14977
  var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -15040,7 +15031,7 @@ else{
15040
15031
  },
15041
15032
  {
15042
15033
  "type": "button",
15043
- "visibleOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}",
15034
+ "visibleOn": "${window:innerWidth < 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id)}",
15044
15035
  "className": "flex",
15045
15036
  "onEvent": {
15046
15037
  "click": {
@@ -15066,7 +15057,7 @@ else{
15066
15057
  "className": 'block h-10 w-auto mr-4',
15067
15058
  "type": "tpl",
15068
15059
  "tpl": "<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='".concat(logoSrc, "'></a>"),
15069
- "hiddenOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}"
15060
+ "hiddenOn": "${window:innerWidth < 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id)}"
15070
15061
  },
15071
15062
  ],
15072
15063
  },