@kmkf-fe-packages/services-components 0.7.5-alpha.1 → 0.7.5-alpha.3

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.
@@ -10,11 +10,11 @@ import React from 'react';
10
10
  import { Cascader } from 'antd';
11
11
  import intersection from 'lodash/intersection';
12
12
  import GetFormItem from "../GetFormItem";
13
- import { findLabelBySelectValue, transMultSelectOptions } from '@kmkf-fe-packages/kmkf-utils';
13
+ import { findLabelBySelectValue, transMultSelectOptions, tree } from '@kmkf-fe-packages/kmkf-utils';
14
14
  import ItemView from "../../commonComponents/ItemView";
15
15
  import { isNull, filterFn as _filterFn } from '@kmkf-fe-packages/kmkf-utils';
16
16
  import { SYMBOL } from "../../constant";
17
- var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(options) {
17
+ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(_options) {
18
18
  var _this = this;
19
19
  _classCallCheck(this, BasicCascader);
20
20
  _defineProperty(this, "name", void 0);
@@ -88,6 +88,7 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(options) {
88
88
  });
89
89
  _defineProperty(this, "filterConfig", function (item) {
90
90
  var _item$config;
91
+ var options = transMultSelectOptions((item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.options) || []);
91
92
  return {
92
93
  searchDefaultConditions: SYMBOL.eq,
93
94
  type: item.type,
@@ -97,7 +98,7 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(options) {
97
98
  // 过滤组件名称
98
99
  filterComponentType: 'Cascader',
99
100
  props: {
100
- options: transMultSelectOptions((item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.options) || []),
101
+ options: options,
101
102
  fieldNames: {
102
103
  label: 'label',
103
104
  value: 'actived',
@@ -111,15 +112,23 @@ var BasicCascader = /*#__PURE__*/_createClass(function BasicCascader(options) {
111
112
  },
112
113
  formatFilterValue: function formatFilterValue(val) {
113
114
  if ((val === null || val === void 0 ? void 0 : val.length) > 0) {
114
- return "{\"actived\": \"".concat(val[val.length - 1], "\"}");
115
+ var node = tree.findNodeByValue(options, 'actived', val[val.length - 1]);
116
+ if (node) {
117
+ var label = node.label,
118
+ actived = node.actived;
119
+ return JSON.stringify({
120
+ label: label,
121
+ actived: actived
122
+ });
123
+ }
115
124
  }
116
125
  }
117
126
  };
118
127
  });
119
- this.name = options.name;
120
- this.id = options.id;
121
- this.type = options.type;
122
- this.componentConfig = options.componentConfig;
128
+ this.name = _options.name;
129
+ this.id = _options.id;
130
+ this.type = _options.type;
131
+ this.componentConfig = _options.componentConfig;
123
132
  this.rules = [];
124
133
  this.children = [];
125
134
  this.isCombinationComponent = false;
@@ -19,17 +19,6 @@ declare class BasicDataTime implements ComponentInterface {
19
19
  getComponentValue: (r: Record) => any;
20
20
  renderExport: (value: any, record: Record) => any;
21
21
  editRender: () => React.JSX.Element;
22
- filterConfig: (item: ColumnConfig) => {
23
- searchDefaultConditions: "between";
24
- type: string;
25
- id: string;
26
- name: string;
27
- filterComponentType: "Date";
28
- props: {
29
- options: any[];
30
- };
31
- filterFn: (value: string[]) => (i: Record) => boolean;
32
- formatFilterValue: (val: Array<any>) => number[] | undefined;
33
- };
22
+ filterConfig: (item: ColumnConfig) => any;
34
23
  }
35
24
  export default BasicDataTime;
@@ -81,8 +81,9 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
81
81
  });
82
82
  });
83
83
  _defineProperty(this, "filterConfig", function (item) {
84
- var _item$config;
85
- return {
84
+ var _item$config, _item$config2;
85
+ var dateType = item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.dateType;
86
+ var obj = {
86
87
  searchDefaultConditions: SYMBOL.between,
87
88
  type: item.type,
88
89
  id: "".concat(item.id, "_dateTime"),
@@ -91,22 +92,26 @@ var BasicDataTime = /*#__PURE__*/_createClass(function BasicDataTime(options) {
91
92
  // 过滤组件名称
92
93
  filterComponentType: 'Date',
93
94
  props: {
94
- options: (item === null || item === void 0 ? void 0 : (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.options) || []
95
+ options: (item === null || item === void 0 ? void 0 : (_item$config2 = item.config) === null || _item$config2 === void 0 ? void 0 : _item$config2.options) || []
95
96
  },
96
97
  filterFn: function filterFn(value) {
97
98
  return function (i) {
98
99
  var recordDateTime = _filterFn.filterTableListItemColumnValue(i, item.id, 'dateTime');
99
100
  return _filterFn.filterDateFn(value, recordDateTime);
100
101
  };
101
- },
102
- formatFilterValue: function formatFilterValue(val) {
103
- if ((val === null || val === void 0 ? void 0 : val.length) > 0) {
104
- return val === null || val === void 0 ? void 0 : val.map(function (v) {
105
- return moment(v).valueOf();
106
- });
107
- }
108
102
  }
103
+ // TODO: 自定义时间类型特殊,不需要转换,直接使用 YYYY-MM-DD HH:mm:ss格式查询
104
+ // formatFilterValue: (val: Array<any>) => {
105
+ // if (val?.length > 0) {
106
+ // return val?.map(v => moment(v).valueOf())
107
+ // }
108
+ // }
109
109
  };
110
+
111
+ if (dateType !== null && dateType !== void 0 && dateType.includes('RANGE')) {
112
+ obj.componentDataType = 'dateArray';
113
+ }
114
+ return obj;
110
115
  });
111
116
  this.name = options.name;
112
117
  this.id = options.id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/services-components",
3
- "version": "0.7.5-alpha.1",
3
+ "version": "0.7.5-alpha.3",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -26,8 +26,8 @@
26
26
  "father": "^4.1.7"
27
27
  },
28
28
  "dependencies": {
29
- "@kmkf-fe-packages/basic-components": "^0.7.5-alpha.0",
30
- "@kmkf-fe-packages/kmkf-utils": "^0.7.5-alpha.0"
29
+ "@kmkf-fe-packages/basic-components": "^0.7.5-alpha.2",
30
+ "@kmkf-fe-packages/kmkf-utils": "^0.7.5-alpha.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@ant-design/icons": "^4.7.0",
@@ -40,5 +40,5 @@
40
40
  "gitHooks": {
41
41
  "pre-commit": "lint-staged"
42
42
  },
43
- "gitHead": "7f9016686b2b926e85d250403edb149795c26de1"
43
+ "gitHead": "17e96c7ac6992e753abdb89b66f7b291b1f61d9e"
44
44
  }