kts-components-document-access-point 1.3.22 → 1.3.26

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.js CHANGED
@@ -618,7 +618,7 @@ var defaultSchema = {
618
618
 
619
619
  var addProperties = /*#__PURE__*/(function () {
620
620
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(s, options) {
621
- var current, properties, values, obj;
621
+ var current, properties, values, info;
622
622
  return regeneratorRuntime.wrap(function _callee$(_context) {
623
623
  while (1) {
624
624
  switch (_context.prev = _context.next) {
@@ -650,18 +650,18 @@ var addProperties = /*#__PURE__*/(function () {
650
650
  return _context.abrupt("return");
651
651
 
652
652
  case 8:
653
- // 对象 还是 数组
653
+ info = current.items ? current.items : current; // let obj: any;
654
+ // 创建 properties (对象 还是 数组)
655
+
654
656
  if (current.type === 'object') {
655
657
  if (!current.properties) current.properties = {};
656
- obj = current.properties;
657
658
  } else if (current.type === 'array' && current.items) {
658
659
  if (!current.items.properties) current.items.properties = {};
659
- obj = current.items.properties;
660
660
  }
661
661
 
662
- if (!current.required) current.required = [];
663
- values.required && current.required.push(values.$name);
664
- obj[values.$name] = {
662
+ if (!info.required) info.required = [];
663
+ values.required && info.required.push(values.$name);
664
+ info.properties[values.$name] = {
665
665
  alias: values.title,
666
666
  detailed: values.description,
667
667
  $ref: properties.$id,
@@ -671,7 +671,7 @@ var addProperties = /*#__PURE__*/(function () {
671
671
  s.schema.definitions[properties.$name] = properties;
672
672
  s.schema = _objectSpread2({}, s.schema);
673
673
 
674
- case 14:
674
+ case 15:
675
675
  case "end":
676
676
  return _context.stop();
677
677
  }
@@ -699,12 +699,13 @@ var editProperties = /*#__PURE__*/(function () {
699
699
  return _context.abrupt("return");
700
700
 
701
701
  case 2:
702
- editProperties = options.editProperties, properties = options.properties, current = options.current; // 对象数据
702
+ editProperties = options.editProperties, properties = options.properties;
703
+ current = options.current.properties ? options.current : options.current.items; // 对象数据
703
704
 
704
705
  current.properties[properties.$name].alias = properties.title;
705
706
  current.properties[properties.$name].detailed = properties.description; // 设置必填
706
707
 
707
- required = current.required;
708
+ required = current.required || (current.required = []);
708
709
 
709
710
  if (properties.required) {
710
711
  if (required.indexOf(properties.$name) < 0) {
@@ -765,7 +766,7 @@ var editProperties = /*#__PURE__*/(function () {
765
766
 
766
767
  s.schema = _objectSpread2({}, s.schema);
767
768
 
768
- case 17:
769
+ case 18:
769
770
  case "end":
770
771
  return _context.stop();
771
772
  }
@@ -780,48 +781,64 @@ var editProperties = /*#__PURE__*/(function () {
780
781
 
781
782
  var delProperties = /*#__PURE__*/(function () {
782
783
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(s, options) {
783
- var _s$propertyTableState, _s$propertyTableState2, _s$propertyTableState3;
784
+ var _s$propertyTableState, _s$propertyTableState2;
785
+
786
+ var current, _del, key;
784
787
 
785
- var properties;
786
788
  return regeneratorRuntime.wrap(function _callee$(_context) {
787
789
  while (1) {
788
790
  switch (_context.prev = _context.next) {
789
791
  case 0:
790
- if (options) {
791
- _context.next = 2;
792
- break;
793
- }
794
-
795
- return _context.abrupt("return");
796
-
797
- case 2:
798
- properties = ((_s$propertyTableState = s.propertyTableState.current) === null || _s$propertyTableState === void 0 ? void 0 : _s$propertyTableState.items) ? (_s$propertyTableState2 = s.propertyTableState.current) === null || _s$propertyTableState2 === void 0 ? void 0 : _s$propertyTableState2.items.properties : (_s$propertyTableState3 = s.propertyTableState.current) === null || _s$propertyTableState3 === void 0 ? void 0 : _s$propertyTableState3.properties; // 删除必填
799
-
800
- (function () {
801
- var p = options.required.indexOf(options.value.$name);
802
- options.required.splice(p, 1);
803
- })(); // 删除引用
804
-
792
+ _del = function _del2(current, name, refName) {
793
+ // 删除必填
794
+ (function () {
795
+ if (!current.required) return;
796
+ var p = current.required.indexOf(name);
797
+ current.required.splice(p, 1);
798
+ })(); // 删除引用
799
+
800
+
801
+ (function () {
802
+ if (!current.properties) return;
803
+ delete current.properties[name];
804
+ s.schema.definitions[refName].$count--;
805
+ })(); // 删除孩子
806
+
807
+
808
+ (function () {
809
+ var items = s.schema.definitions[refName].items;
810
+ var current = items ? items : s.schema.definitions[refName];
811
+ var properties = current.properties;
812
+ if (!properties) return;
813
+
814
+ for (var _name in properties) {
815
+ _del(current, _name, properties[_name].$refName);
816
+ }
817
+ })();
818
+ };
805
819
 
806
- if (properties) {
807
- _context.next = 6;
820
+ if (!(!options || !s.propertyTableState.current)) {
821
+ _context.next = 3;
808
822
  break;
809
823
  }
810
824
 
811
825
  return _context.abrupt("return");
812
826
 
813
- case 6:
814
- delete properties[options.value.$name]; // 删除对象
827
+ case 3:
828
+ current = ((_s$propertyTableState = s.propertyTableState.current) === null || _s$propertyTableState === void 0 ? void 0 : _s$propertyTableState.items) ? (_s$propertyTableState2 = s.propertyTableState.current) === null || _s$propertyTableState2 === void 0 ? void 0 : _s$propertyTableState2.items : s.propertyTableState.current;
815
829
 
816
- s.schema.definitions[options.value.$refName].$count--;
830
+ _del(current, options.value.$name, options.value.$refName);
817
831
 
818
- if (s.schema.definitions[options.value.$refName].$count <= 0) {
819
- delete s.schema.definitions[options.value.$refName];
832
+ // 删除对象
833
+ for (key in s.schema.definitions) {
834
+ if (s.schema.definitions[key].$count <= 0) {
835
+ delete s.schema.definitions[key];
836
+ }
820
837
  }
821
838
 
822
839
  s.schema = _objectSpread2({}, s.schema);
823
840
 
824
- case 10:
841
+ case 7:
825
842
  case "end":
826
843
  return _context.stop();
827
844
  }
@@ -1092,19 +1109,7 @@ var AddPropertyButton = (function () {
1092
1109
  items: getItems(_objectSpread2(_objectSpread2({}, values), {}, {
1093
1110
  $name: name
1094
1111
  })),
1095
- // required: values.required,
1096
1112
  description: values.description,
1097
- // rules: values.isArray ? [{
1098
- // _index: 0,
1099
- // name: '数组容量校验',
1100
- // checkType: 'control',
1101
- // message: '数组超过最大容量',
1102
- // algorithm: 'array-0',
1103
- // minItems: values.minItems ? parseInt(values.minItems) : undefined,
1104
- // maxItems: values.maxItems ? parseInt(values.maxItems) : undefined,
1105
- // exclusiveMinItems: values.exclusiveMinItems,
1106
- // exclusiveMaxItems: values.exclusiveMaxItems,
1107
- // }] : [],
1108
1113
  rules: values.isArray ? [{
1109
1114
  _index: 0,
1110
1115
  name: '数组容量校验(Min)',
@@ -1604,6 +1609,7 @@ var useTableProps = (function () {
1604
1609
 
1605
1610
  var current = s.propertyTableState.current;
1606
1611
  if (!current) return [];
1612
+ var info = current.items ? current.items : current;
1607
1613
  var properties = current.type === 'object' ? current.properties : (_current$items = current.items) === null || _current$items === void 0 ? void 0 : _current$items.properties;
1608
1614
  if (!properties) return [];
1609
1615
  return Object.entries(properties).map(function (e) {
@@ -1612,7 +1618,7 @@ var useTableProps = (function () {
1612
1618
  $name: e[0]
1613
1619
  }),
1614
1620
  ref: s.schema.definitions[e[1].$refName],
1615
- required: current.required || []
1621
+ required: info.required || []
1616
1622
  };
1617
1623
  });
1618
1624
  }, []);
@@ -1794,16 +1800,19 @@ var EditProperty = (function () {
1794
1800
  }, _callee3);
1795
1801
  })), [current, controller, editProperties]);
1796
1802
  React__default['default'].useEffect(function () {
1803
+ var _info$required;
1804
+
1797
1805
  if (!editProperties) return;
1806
+ var info = (current === null || current === void 0 ? void 0 : current.items) ? current === null || current === void 0 ? void 0 : current.items : current;
1798
1807
  setIsArray(!!editProperties.ref.items);
1799
1808
  form.setFieldsValue({
1800
1809
  $name: editProperties.value.$name,
1801
1810
  title: editProperties.value.alias,
1802
1811
  isArray: !!editProperties.ref.items,
1803
- required: editProperties.required.indexOf(editProperties.value.$name) >= 0,
1812
+ required: ((_info$required = info === null || info === void 0 ? void 0 : info.required) !== null && _info$required !== void 0 ? _info$required : []).indexOf(editProperties.value.$name) >= 0,
1804
1813
  description: editProperties.value.detailed,
1805
1814
  type: initType(editProperties.ref)
1806
- });
1815
+ }); // 数组的设置
1807
1816
 
1808
1817
  if (!!editProperties.ref.items && editProperties.ref.rules) {
1809
1818
  var values = _objectSpread2(_objectSpread2({}, editProperties.ref.rules[0]), editProperties.ref.rules[1]);
@@ -1826,7 +1835,7 @@ var EditProperty = (function () {
1826
1835
  return function () {
1827
1836
  setIsChangeType(false);
1828
1837
  };
1829
- }, [editProperties, form]);
1838
+ }, [editProperties, form, current]);
1830
1839
  var submitButton = React__default['default'].useMemo(function () {
1831
1840
  if (isChangeType) {
1832
1841
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX4.Popconfirm, {
@@ -2550,16 +2559,14 @@ var DelRuleButton = (function (props) {
2550
2559
  while (1) {
2551
2560
  switch (_context.prev = _context.next) {
2552
2561
  case 0:
2553
- debugger;
2554
-
2555
2562
  if (s.ruleState.ruleProperties) {
2556
- _context.next = 3;
2563
+ _context.next = 2;
2557
2564
  break;
2558
2565
  }
2559
2566
 
2560
2567
  return _context.abrupt("return");
2561
2568
 
2562
- case 3:
2569
+ case 2:
2563
2570
  if (s.ruleState.ruleProperties.ref.items) {
2564
2571
  (_s$ruleState$ruleProp = s.ruleState.ruleProperties.ref.items.rules) === null || _s$ruleState$ruleProp === void 0 ? void 0 : _s$ruleState$ruleProp.splice(props.index, 1);
2565
2572
  s.ruleState.ruleProperties.ref.items.rules = (_s$ruleState$ruleProp2 = (_s$ruleState$ruleProp3 = s.ruleState.ruleProperties.ref.items.rules) === null || _s$ruleState$ruleProp3 === void 0 ? void 0 : _s$ruleState$ruleProp3.slice()) !== null && _s$ruleState$ruleProp2 !== void 0 ? _s$ruleState$ruleProp2 : [];
@@ -2568,7 +2575,7 @@ var DelRuleButton = (function (props) {
2568
2575
  s.ruleState.ruleProperties.ref.rules = (_s$ruleState$ruleProp5 = (_s$ruleState$ruleProp6 = s.ruleState.ruleProperties.ref.rules) === null || _s$ruleState$ruleProp6 === void 0 ? void 0 : _s$ruleState$ruleProp6.slice()) !== null && _s$ruleState$ruleProp5 !== void 0 ? _s$ruleState$ruleProp5 : [];
2569
2576
  }
2570
2577
 
2571
- case 4:
2578
+ case 3:
2572
2579
  case "end":
2573
2580
  return _context.stop();
2574
2581
  }
@@ -3479,17 +3486,19 @@ var PageHeader = (function () {
3479
3486
  mode: "multiple"
3480
3487
  }
3481
3488
  },
3482
- '[beginCreateTime,endCreateTime]': {
3483
- key: "[beginCreateTime,endCreateTime]",
3484
- name: "[beginCreateTime,endCreateTime]",
3489
+ createTime: {
3485
3490
  type: "daterange",
3486
- title: "创建时间"
3491
+ title: "创建时间",
3492
+ 'x-props': {
3493
+ extendsFields: ['beginCreateTime', 'endCreateTime']
3494
+ }
3487
3495
  },
3488
- '[beginSendTime,endSendTime]': {
3489
- key: "[beginSendTime,endSendTime]",
3490
- name: "[beginSendTime,endSendTime]",
3496
+ sendTime: {
3491
3497
  type: "daterange",
3492
- title: "更新时间"
3498
+ title: "更新时间",
3499
+ 'x-props': {
3500
+ extendsFields: ['beginSendTime', 'endSendTime']
3501
+ }
3493
3502
  }
3494
3503
  }
3495
3504
  };
@@ -3553,11 +3562,12 @@ var PageHeader = (function () {
3553
3562
  enum: profileEnum,
3554
3563
  visible: false
3555
3564
  },
3556
- '[beginCreateTime,endCreateTime]': {
3557
- key: "[beginCreateTime,endCreateTime]",
3558
- name: "[beginCreateTime,endCreateTime]",
3565
+ createTime: {
3559
3566
  type: "daterange",
3560
- title: "发布时间"
3567
+ title: "发布时间",
3568
+ 'x-props': {
3569
+ extendsFields: ['beginCreateTime', 'endCreateTime']
3570
+ }
3561
3571
  } // '[beginSendTime,endSendTime]': {
3562
3572
  // key: "[beginSendTime,endSendTime]",
3563
3573
  // name: "[beginSendTime,endSendTime]",
@@ -3926,7 +3936,7 @@ function validaterule(props) {
3926
3936
  return moment__default['default'](text).format('YYYY-MM-DD HH:mm');
3927
3937
  }
3928
3938
  }, {
3929
- title: '最近更新时间',
3939
+ title: '更新时间',
3930
3940
  dataIndex: 'updateAt',
3931
3941
  render: function render(text) {
3932
3942
  return moment__default['default'](text).format('YYYY-MM-DD HH:mm');
@@ -6501,11 +6511,12 @@ var Header = (function () {
6501
6511
  "value": 2
6502
6512
  }]
6503
6513
  },
6504
- '[beginCreateTime,endCreateTime]': {
6505
- key: "[beginCreateTime,endCreateTime]",
6506
- name: "[beginCreateTime,endCreateTime]",
6514
+ createTime: {
6507
6515
  type: "daterange",
6508
- title: "创建时间"
6516
+ title: "创建时间",
6517
+ 'x-props': {
6518
+ extendsFields: ['beginCreateTime', 'endCreateTime']
6519
+ }
6509
6520
  } // '[beginUpdateTime,endUpdateTime]': {
6510
6521
  // key: "[beginUpdateTime,endUpdateTime]",
6511
6522
  // name: "[beginUpdateTime,endUpdateTime]",
@@ -6968,11 +6979,12 @@ var Header$1 = (function () {
6968
6979
  "value": 2
6969
6980
  }]
6970
6981
  },
6971
- '[beginCreateTime,endCreateTime]': {
6972
- key: "[beginCreateTime,endCreateTime]",
6973
- name: "[beginCreateTime,endCreateTime]",
6982
+ createTime: {
6974
6983
  type: "daterange",
6975
- title: "创建时间"
6984
+ title: "创建时间",
6985
+ 'x-props': {
6986
+ extendsFields: ['beginCreateTime', 'endCreateTime']
6987
+ }
6976
6988
  } // '[beginUpdateTime,endUpdateTime]': {
6977
6989
  // key: "[beginUpdateTime,endUpdateTime]",
6978
6990
  // name: "[beginUpdateTime,endUpdateTime]",
@@ -16,7 +16,7 @@
16
16
  window.routerBase = "/";
17
17
  </script>
18
18
  <script>
19
- //! umi version: 3.5.17
19
+ //! umi version: 3.5.19
20
20
  </script>
21
21
  <script>
22
22
  !(function () {
@@ -16,7 +16,7 @@
16
16
  window.routerBase = "/";
17
17
  </script>
18
18
  <script>
19
- //! umi version: 3.5.17
19
+ //! umi version: 3.5.19
20
20
  </script>
21
21
  <script>
22
22
  !(function () {