@ztocwst/rc-pro-materials 0.2.18 → 0.2.20

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.
@@ -6,7 +6,8 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import { useEffect, useState, useRef, useContext, useImperativeHandle } from 'react';
7
7
  import { ProTable, RcConfigContext } from '@ztocwst/rc-pro';
8
8
  import { ArrowLeftOutlined } from '@ant-design/icons';
9
- import { tableConfigDefault, separator, timeUnit, getMaxWidth, handleQueryParams, getReportData } from "../../data-common.helper";
9
+ import moment from 'moment';
10
+ import { tableConfigDefault, dateStart, separator, timeUnit, getType, getMaxWidth, handleQueryParams, getReportData } from "../../data-common.helper";
10
11
  import { handleDimTargetFormat, handleColumns } from "../table-renderer/table-renderer.helper";
11
12
  import "./index.less";
12
13
  var linkStateDefault = {
@@ -75,7 +76,7 @@ var LinkRenderer = function LinkRenderer(props) {
75
76
  return function () {
76
77
  handleClearInterval();
77
78
  };
78
- }, [linkState.dataSetName, linkState.index, linkState.custom, linkState.autoLoad]);
79
+ }, [linkState]);
79
80
 
80
81
  // 获取表头
81
82
  var handleGetColumns = function handleGetColumns(stateParams) {
@@ -118,7 +119,7 @@ var LinkRenderer = function LinkRenderer(props) {
118
119
  queryKeys = Object.keys(queryCache);
119
120
  if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
120
121
  queryKeys.forEach(function (k) {
121
- // 查看是否有绑定关联关系
122
+ // 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
122
123
  var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
123
124
  return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
124
125
  });
@@ -127,9 +128,18 @@ var LinkRenderer = function LinkRenderer(props) {
127
128
  // 参数为时间时会出现多个绑定关系
128
129
  queryBindFilter.forEach(function (item) {
129
130
  var key = item.sourceQueryKey;
131
+ // "值"(当前查询条件的"值")
132
+ var value = queryCache[k];
130
133
  if (key) {
131
- // "值"(当前查询条件的"值")
132
- query[key] = queryCache[k];
134
+ // 类型为时间时 处理
135
+ if (getType(value) === 'array' && value.length === 2 && value.some(function (d) {
136
+ return moment(d).isValid();
137
+ })) {
138
+ var i = key.includes(dateStart) ? 0 : 1;
139
+ query[key] = value[i];
140
+ } else {
141
+ query[key] = value;
142
+ }
133
143
  }
134
144
  });
135
145
  } else {
@@ -260,8 +270,8 @@ var LinkRenderer = function LinkRenderer(props) {
260
270
  index: index
261
271
  });
262
272
  /** 当前进入与上次进入link页不同时需要清空数据 */
263
- var isSource = "" + stateData.dataSetName + separator + index === "" + linkState.dataSetName + separator + (linkState === null || linkState === void 0 ? void 0 : linkState.index);
264
- var isSame = JSON.stringify(stateData === null || stateData === void 0 ? void 0 : stateData.record) === JSON.stringify(linkState === null || linkState === void 0 ? void 0 : linkState.record);
273
+ var isSource = "" + paramsState.dataSetName + separator + index === "" + linkState.dataSetName + separator + (linkState === null || linkState === void 0 ? void 0 : linkState.index);
274
+ var isSame = JSON.stringify(paramsState === null || paramsState === void 0 ? void 0 : paramsState.record) === JSON.stringify(linkState === null || linkState === void 0 ? void 0 : linkState.record);
265
275
  if (!currentState.custom && (!isSource || !isSame)) {
266
276
  var _tableRef$current2, _tableRef$current2$up;
267
277
  (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$up = _tableRef$current2.updateDataSource) === null || _tableRef$current2$up === void 0 ? void 0 : _tableRef$current2$up.call(_tableRef$current2, []);
@@ -7,7 +7,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { useRef, useState, useEffect, useImperativeHandle, useContext } from 'react';
9
9
  import { ProTable, RcConfigContext } from '@ztocwst/rc-pro';
10
- import { tableConfigDefault, separator, timeUnit, handleQueryParams, getReportData } from "../../data-common.helper";
10
+ import moment from 'moment';
11
+ import { tableConfigDefault, dateStart, separator, timeUnit, getType, handleQueryParams, getReportData } from "../../data-common.helper";
11
12
  import { handleColumns, handleValueFormat, getDimTargetData } from "./table-renderer.helper";
12
13
  import DimTarget from "../dim-target";
13
14
  import LinkRenderer from "../link-renderer";
@@ -190,12 +191,33 @@ var TableRenderer = function TableRenderer(props) {
190
191
  var queryKeys = Object.keys(queryCache);
191
192
  if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
192
193
  queryKeys.forEach(function (k) {
193
- var _queryBind$find;
194
- // "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
195
- var key = (queryBind === null || queryBind === void 0 ? void 0 : (_queryBind$find = queryBind.find(function (item) {
194
+ // 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
195
+ var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
196
196
  return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
197
- })) === null || _queryBind$find === void 0 ? void 0 : _queryBind$find.sourceQueryKey) || k;
198
- query[key] = queryCache[k];
197
+ });
198
+ // "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
199
+ if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
200
+ // 参数为时间时会出现多个绑定关系
201
+ queryBindFilter.forEach(function (item) {
202
+ var key = item.sourceQueryKey;
203
+ // "值"(当前查询条件的"值")
204
+ var value = queryCache[k];
205
+ if (key) {
206
+ // 类型为时间时 处理
207
+ if (getType(value) === 'array' && value.length === 2 && value.some(function (d) {
208
+ return moment(d).isValid();
209
+ })) {
210
+ var i = key.includes(dateStart) ? 0 : 1;
211
+ query[key] = value[i];
212
+ } else {
213
+ query[key] = value;
214
+ }
215
+ }
216
+ });
217
+ } else {
218
+ // "值"(当前查询条件的"值")
219
+ query[k] = queryCache[k];
220
+ }
199
221
  });
200
222
  }
201
223
 
@@ -231,12 +231,14 @@ export var handleColumns = function handleColumns(option, expressions, linkPage,
231
231
  };
232
232
  });
233
233
  if (option !== null && option !== void 0 && (_option$actionJson = option.actionJson) !== null && _option$actionJson !== void 0 && _option$actionJson.custom) {
234
+ var _columns$fn;
234
235
  var _ref5 = (option === null || option === void 0 ? void 0 : option.actionJson) || {},
235
236
  isFixed = _ref5.isFixed,
236
237
  fixed = _ref5.fixed,
237
238
  _render = _ref5.render,
238
239
  values = _objectWithoutPropertiesLoose(_ref5, _excluded);
239
- columns.push(_extends({}, values, {
240
+ var fn = fixed === 'left' ? 'unshift' : 'push';
241
+ (_columns$fn = columns[fn]) === null || _columns$fn === void 0 ? void 0 : _columns$fn.call(columns, _extends({}, values, {
240
242
  dataIndex: 'action',
241
243
  fixed: isFixed ? fixed || isFixed : false,
242
244
  render: function render(_, record) {
@@ -6,6 +6,8 @@ export declare const tableConfigDefault: {
6
6
  hideDefRowSelection: boolean;
7
7
  columns: any[];
8
8
  };
9
+ /** 时间区间 开始键包含的字符串 */
10
+ export declare const dateStart = "_start";
9
11
  /** 字符串拼接分割符 */
10
12
  export declare const separator = "***";
11
13
  /** 时间单位 */
@@ -14,6 +16,11 @@ export declare const timeUnit: number;
14
16
  export declare const BETWEEN = "<=,<";
15
17
  /** 数据类型 */
16
18
  export type valueType = number | string | null | undefined;
19
+ /**
20
+ * 获取数据类型
21
+ * @param {any} value
22
+ */
23
+ export declare const getType: (value: any) => string;
17
24
  /**
18
25
  * 计算宽
19
26
  * @param length
@@ -14,6 +14,9 @@ export var tableConfigDefault = {
14
14
  columns: []
15
15
  };
16
16
 
17
+ /** 时间区间 开始键包含的字符串 */
18
+ export var dateStart = '_start';
19
+
17
20
  /** 字符串拼接分割符 */
18
21
  export var separator = '***';
19
22
 
@@ -22,8 +25,20 @@ export var timeUnit = 60 * 1000;
22
25
 
23
26
  /** 介于 前闭后开 */
24
27
  export var BETWEEN = '<=,<';
28
+
25
29
  /** 数据类型 */
26
30
 
31
+ /**
32
+ * 获取数据类型
33
+ * @param {any} value
34
+ */
35
+ export var getType = function getType(value) {
36
+ var type = typeof value;
37
+ if (type !== 'object') return type;
38
+ var string = Object.prototype.toString.call(value);
39
+ return string.replace(/^\[object (\S+)\]$/, '$1').toLocaleLowerCase();
40
+ };
41
+
27
42
  /**
28
43
  * 计算宽
29
44
  * @param length
@@ -157,7 +172,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
157
172
  };
158
173
 
159
174
  // mock
160
- var token = 'scm:tenant:token:2:9:64174758CFF5CA5921E1EC31750DDBDC';
175
+ var token = 'scm:tenant:token:2:104:DB0D80CD71B76AF4A8858729478BA945';
161
176
 
162
177
  /** 获取维度指标 */
163
178
  export var getDimTarget = /*#__PURE__*/function () {
@@ -1,18 +1,17 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["scroll", "value", "onChange", "restEditableProps", "restRecordCreatorProps", "restFieldProps", "restFormProps", "FormItemProps", "fieldProps", "columns", "editable", "render", "recordCreatorProps", "locale"],
4
- _excluded2 = ["editable"];
3
+ var _excluded = ["scroll", "value", "onChange", "restEditableProps", "restRecordCreatorProps", "FormItemProps", "fieldProps", "columns", "editable", "render", "recordCreatorProps", "locale"],
4
+ _excluded2 = ["restFormProps"],
5
+ _excluded3 = ["restFieldProps"],
6
+ _excluded4 = ["editable"];
5
7
  import { processJsonOrFunctionProps } from "../../../lib";
6
8
  var processTableProps = function processTableProps(props) {
7
- console.log(props, 2);
8
9
  var processObjectValue = function processObjectValue(obj) {
9
10
  var scroll = obj.scroll,
10
11
  value = obj.value,
11
12
  onChange = obj.onChange,
12
13
  restEditableProps = obj.restEditableProps,
13
14
  restRecordCreatorProps = obj.restRecordCreatorProps,
14
- restFieldProps = obj.restFieldProps,
15
- restFormProps = obj.restFormProps,
16
15
  FormItemProps = obj.FormItemProps,
17
16
  fieldProps = obj.fieldProps,
18
17
  columns = obj.columns,
@@ -21,6 +20,12 @@ var processTableProps = function processTableProps(props) {
21
20
  recordCreatorProps = obj.recordCreatorProps,
22
21
  locale = obj.locale,
23
22
  rest = _objectWithoutPropertiesLoose(obj, _excluded);
23
+ var _ref = FormItemProps !== null && FormItemProps !== void 0 ? FormItemProps : {},
24
+ restFormProps = _ref.restFormProps,
25
+ restFormItemProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
26
+ var _ref2 = fieldProps !== null && fieldProps !== void 0 ? fieldProps : {},
27
+ restFieldProps = _ref2.restFieldProps,
28
+ restFieldItemProps = _objectWithoutPropertiesLoose(_ref2, _excluded3);
24
29
  return _extends({}, locale ? {
25
30
  locale: processJsonOrFunctionProps(locale)
26
31
  } : {}, scroll ? {
@@ -36,13 +41,13 @@ var processTableProps = function processTableProps(props) {
36
41
  } : {}, render ? {
37
42
  render: render
38
43
  } : {}, FormItemProps ? {
39
- formItemProps: _extends({}, FormItemProps, typeof restFormProps === 'function' ? restFormProps === null || restFormProps === void 0 ? void 0 : restFormProps() : restFormProps)
44
+ formItemProps: _extends({}, restFormItemProps, typeof restFormProps === 'function' ? restFormProps === null || restFormProps === void 0 ? void 0 : restFormProps() : restFormProps)
40
45
  } : {}, fieldProps ? {
41
- fieldProps: _extends({}, fieldProps, typeof restFieldProps === 'function' ? restFieldProps === null || restFieldProps === void 0 ? void 0 : restFieldProps() : restFieldProps)
46
+ fieldProps: _extends({}, restFieldItemProps, typeof restFieldProps === 'function' ? restFieldProps === null || restFieldProps === void 0 ? void 0 : restFieldProps() : restFieldProps)
42
47
  } : {}, columns !== null && columns !== void 0 && columns.length ? {
43
48
  columns: columns === null || columns === void 0 ? void 0 : columns.map(function (v) {
44
49
  var columnsEditable = v.editable,
45
- restColumns = _objectWithoutPropertiesLoose(v, _excluded2);
50
+ restColumns = _objectWithoutPropertiesLoose(v, _excluded4);
46
51
  return _extends({}, editable ? {
47
52
  editable: columnsEditable
48
53
  } : {}, processObjectValue(restColumns));
@@ -54,11 +59,13 @@ var processTableProps = function processTableProps(props) {
54
59
  return processObjectValue(e);
55
60
  });
56
61
  }
57
- return processObjectValue(props);
62
+ var data = processObjectValue(props);
63
+ console.log(data, 'editTable Props');
64
+ return data;
58
65
  };
59
66
  export var processEditTableProps = function processEditTableProps(props, extra) {
60
- var _ref = extra !== null && extra !== void 0 ? extra : {},
61
- proEditableFormRef = _ref.proEditableFormRef;
67
+ var _ref3 = extra !== null && extra !== void 0 ? extra : {},
68
+ proEditableFormRef = _ref3.proEditableFormRef;
62
69
  return _extends({}, processTableProps(props), {
63
70
  proEditableFormRef: proEditableFormRef
64
71
  });
@@ -11,6 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var _react = require("react");
12
12
  var _rcPro = require("@ztocwst/rc-pro");
13
13
  var _icons = require("@ant-design/icons");
14
+ var _moment = _interopRequireDefault(require("moment"));
14
15
  var _dataCommon = require("../../data-common.helper");
15
16
  var _tableRenderer = require("../table-renderer/table-renderer.helper");
16
17
  require("./index.less");
@@ -80,7 +81,7 @@ var LinkRenderer = function LinkRenderer(props) {
80
81
  return function () {
81
82
  handleClearInterval();
82
83
  };
83
- }, [linkState.dataSetName, linkState.index, linkState.custom, linkState.autoLoad]);
84
+ }, [linkState]);
84
85
 
85
86
  // 获取表头
86
87
  var handleGetColumns = function handleGetColumns(stateParams) {
@@ -123,7 +124,7 @@ var LinkRenderer = function LinkRenderer(props) {
123
124
  queryKeys = Object.keys(queryCache);
124
125
  if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
125
126
  queryKeys.forEach(function (k) {
126
- // 查看是否有绑定关联关系
127
+ // 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
127
128
  var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
128
129
  return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
129
130
  });
@@ -132,9 +133,18 @@ var LinkRenderer = function LinkRenderer(props) {
132
133
  // 参数为时间时会出现多个绑定关系
133
134
  queryBindFilter.forEach(function (item) {
134
135
  var key = item.sourceQueryKey;
136
+ // "值"(当前查询条件的"值")
137
+ var value = queryCache[k];
135
138
  if (key) {
136
- // "值"(当前查询条件的"值")
137
- query[key] = queryCache[k];
139
+ // 类型为时间时 处理
140
+ if ((0, _dataCommon.getType)(value) === 'array' && value.length === 2 && value.some(function (d) {
141
+ return (0, _moment["default"])(d).isValid();
142
+ })) {
143
+ var i = key.includes(_dataCommon.dateStart) ? 0 : 1;
144
+ query[key] = value[i];
145
+ } else {
146
+ query[key] = value;
147
+ }
138
148
  }
139
149
  });
140
150
  } else {
@@ -265,8 +275,8 @@ var LinkRenderer = function LinkRenderer(props) {
265
275
  index: index
266
276
  });
267
277
  /** 当前进入与上次进入link页不同时需要清空数据 */
268
- var isSource = "" + stateData.dataSetName + _dataCommon.separator + index === "" + linkState.dataSetName + _dataCommon.separator + (linkState === null || linkState === void 0 ? void 0 : linkState.index);
269
- var isSame = JSON.stringify(stateData === null || stateData === void 0 ? void 0 : stateData.record) === JSON.stringify(linkState === null || linkState === void 0 ? void 0 : linkState.record);
278
+ var isSource = "" + paramsState.dataSetName + _dataCommon.separator + index === "" + linkState.dataSetName + _dataCommon.separator + (linkState === null || linkState === void 0 ? void 0 : linkState.index);
279
+ var isSame = JSON.stringify(paramsState === null || paramsState === void 0 ? void 0 : paramsState.record) === JSON.stringify(linkState === null || linkState === void 0 ? void 0 : linkState.record);
270
280
  if (!currentState.custom && (!isSource || !isSame)) {
271
281
  var _tableRef$current2, _tableRef$current2$up;
272
282
  (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$up = _tableRef$current2.updateDataSource) === null || _tableRef$current2$up === void 0 ? void 0 : _tableRef$current2$up.call(_tableRef$current2, []);
@@ -9,6 +9,7 @@ var _table = _interopRequireDefault(require("antd/lib/table"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _react = require("react");
11
11
  var _rcPro = require("@ztocwst/rc-pro");
12
+ var _moment = _interopRequireDefault(require("moment"));
12
13
  var _dataCommon = require("../../data-common.helper");
13
14
  var _tableRenderer = require("./table-renderer.helper");
14
15
  var _dimTarget = _interopRequireDefault(require("../dim-target"));
@@ -195,12 +196,33 @@ var TableRenderer = function TableRenderer(props) {
195
196
  var queryKeys = Object.keys(queryCache);
196
197
  if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
197
198
  queryKeys.forEach(function (k) {
198
- var _queryBind$find;
199
- // "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
200
- var key = (queryBind === null || queryBind === void 0 ? void 0 : (_queryBind$find = queryBind.find(function (item) {
199
+ // 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
200
+ var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
201
201
  return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
202
- })) === null || _queryBind$find === void 0 ? void 0 : _queryBind$find.sourceQueryKey) || k;
203
- query[key] = queryCache[k];
202
+ });
203
+ // "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
204
+ if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
205
+ // 参数为时间时会出现多个绑定关系
206
+ queryBindFilter.forEach(function (item) {
207
+ var key = item.sourceQueryKey;
208
+ // "值"(当前查询条件的"值")
209
+ var value = queryCache[k];
210
+ if (key) {
211
+ // 类型为时间时 处理
212
+ if ((0, _dataCommon.getType)(value) === 'array' && value.length === 2 && value.some(function (d) {
213
+ return (0, _moment["default"])(d).isValid();
214
+ })) {
215
+ var i = key.includes(_dataCommon.dateStart) ? 0 : 1;
216
+ query[key] = value[i];
217
+ } else {
218
+ query[key] = value;
219
+ }
220
+ }
221
+ });
222
+ } else {
223
+ // "值"(当前查询条件的"值")
224
+ query[k] = queryCache[k];
225
+ }
204
226
  });
205
227
  }
206
228
 
@@ -239,12 +239,14 @@ var handleColumns = function handleColumns(option, expressions, linkPage, onLink
239
239
  };
240
240
  });
241
241
  if (option !== null && option !== void 0 && (_option$actionJson = option.actionJson) !== null && _option$actionJson !== void 0 && _option$actionJson.custom) {
242
+ var _columns$fn;
242
243
  var _ref5 = (option === null || option === void 0 ? void 0 : option.actionJson) || {},
243
244
  isFixed = _ref5.isFixed,
244
245
  fixed = _ref5.fixed,
245
246
  _render = _ref5.render,
246
247
  values = (0, _objectWithoutPropertiesLoose2["default"])(_ref5, _excluded);
247
- columns.push((0, _extends2["default"])({}, values, {
248
+ var fn = fixed === 'left' ? 'unshift' : 'push';
249
+ (_columns$fn = columns[fn]) === null || _columns$fn === void 0 ? void 0 : _columns$fn.call(columns, (0, _extends2["default"])({}, values, {
248
250
  dataIndex: 'action',
249
251
  fixed: isFixed ? fixed || isFixed : false,
250
252
  render: function render(_, record) {
@@ -6,6 +6,8 @@ export declare const tableConfigDefault: {
6
6
  hideDefRowSelection: boolean;
7
7
  columns: any[];
8
8
  };
9
+ /** 时间区间 开始键包含的字符串 */
10
+ export declare const dateStart = "_start";
9
11
  /** 字符串拼接分割符 */
10
12
  export declare const separator = "***";
11
13
  /** 时间单位 */
@@ -14,6 +16,11 @@ export declare const timeUnit: number;
14
16
  export declare const BETWEEN = "<=,<";
15
17
  /** 数据类型 */
16
18
  export type valueType = number | string | null | undefined;
19
+ /**
20
+ * 获取数据类型
21
+ * @param {any} value
22
+ */
23
+ export declare const getType: (value: any) => string;
17
24
  /**
18
25
  * 计算宽
19
26
  * @param length
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.timeUnit = exports.tableConfigDefault = exports.separator = exports.saveDimTarget = exports.handleThousand = exports.handleQueryParams = exports.handlePercent = exports.handleLink = exports.handleDecimal = exports.handleCondition = exports.getReportData = exports.getMaxWidth = exports.getDimTarget = exports.computeWidth = exports.BETWEEN = void 0;
5
+ exports.timeUnit = exports.tableConfigDefault = exports.separator = exports.saveDimTarget = exports.handleThousand = exports.handleQueryParams = exports.handlePercent = exports.handleLink = exports.handleDecimal = exports.handleCondition = exports.getType = exports.getReportData = exports.getMaxWidth = exports.getDimTarget = exports.dateStart = exports.computeWidth = exports.BETWEEN = void 0;
6
6
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
7
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -18,8 +18,12 @@ var tableConfigDefault = {
18
18
  columns: []
19
19
  };
20
20
 
21
- /** 字符串拼接分割符 */
21
+ /** 时间区间 开始键包含的字符串 */
22
22
  exports.tableConfigDefault = tableConfigDefault;
23
+ var dateStart = '_start';
24
+
25
+ /** 字符串拼接分割符 */
26
+ exports.dateStart = dateStart;
23
27
  var separator = '***';
24
28
 
25
29
  /** 时间单位 */
@@ -29,13 +33,26 @@ var timeUnit = 60 * 1000;
29
33
  /** 介于 前闭后开 */
30
34
  exports.timeUnit = timeUnit;
31
35
  var BETWEEN = '<=,<';
36
+
32
37
  /** 数据类型 */
33
38
  exports.BETWEEN = BETWEEN;
39
+ /**
40
+ * 获取数据类型
41
+ * @param {any} value
42
+ */
43
+ var getType = function getType(value) {
44
+ var type = typeof value;
45
+ if (type !== 'object') return type;
46
+ var string = Object.prototype.toString.call(value);
47
+ return string.replace(/^\[object (\S+)\]$/, '$1').toLocaleLowerCase();
48
+ };
49
+
34
50
  /**
35
51
  * 计算宽
36
52
  * @param length
37
53
  * @param width
38
54
  */
55
+ exports.getType = getType;
39
56
  var computeWidth = function computeWidth(length, width) {
40
57
  if (width === void 0) {
41
58
  width = 40;
@@ -172,7 +189,7 @@ var handleCondition = function handleCondition(value, handledValue, conditions)
172
189
 
173
190
  // mock
174
191
  exports.handleCondition = handleCondition;
175
- var token = 'scm:tenant:token:2:9:64174758CFF5CA5921E1EC31750DDBDC';
192
+ var token = 'scm:tenant:token:2:104:DB0D80CD71B76AF4A8858729478BA945';
176
193
 
177
194
  /** 获取维度指标 */
178
195
  var getDimTarget = /*#__PURE__*/function () {
@@ -6,18 +6,17 @@ exports.processEditTableProps = void 0;
6
6
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
7
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
8
8
  var _lib = require("../../../lib");
9
- var _excluded = ["scroll", "value", "onChange", "restEditableProps", "restRecordCreatorProps", "restFieldProps", "restFormProps", "FormItemProps", "fieldProps", "columns", "editable", "render", "recordCreatorProps", "locale"],
10
- _excluded2 = ["editable"];
9
+ var _excluded = ["scroll", "value", "onChange", "restEditableProps", "restRecordCreatorProps", "FormItemProps", "fieldProps", "columns", "editable", "render", "recordCreatorProps", "locale"],
10
+ _excluded2 = ["restFormProps"],
11
+ _excluded3 = ["restFieldProps"],
12
+ _excluded4 = ["editable"];
11
13
  var processTableProps = function processTableProps(props) {
12
- console.log(props, 2);
13
14
  var processObjectValue = function processObjectValue(obj) {
14
15
  var scroll = obj.scroll,
15
16
  value = obj.value,
16
17
  onChange = obj.onChange,
17
18
  restEditableProps = obj.restEditableProps,
18
19
  restRecordCreatorProps = obj.restRecordCreatorProps,
19
- restFieldProps = obj.restFieldProps,
20
- restFormProps = obj.restFormProps,
21
20
  FormItemProps = obj.FormItemProps,
22
21
  fieldProps = obj.fieldProps,
23
22
  columns = obj.columns,
@@ -26,6 +25,12 @@ var processTableProps = function processTableProps(props) {
26
25
  recordCreatorProps = obj.recordCreatorProps,
27
26
  locale = obj.locale,
28
27
  rest = (0, _objectWithoutPropertiesLoose2["default"])(obj, _excluded);
28
+ var _ref = FormItemProps !== null && FormItemProps !== void 0 ? FormItemProps : {},
29
+ restFormProps = _ref.restFormProps,
30
+ restFormItemProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded2);
31
+ var _ref2 = fieldProps !== null && fieldProps !== void 0 ? fieldProps : {},
32
+ restFieldProps = _ref2.restFieldProps,
33
+ restFieldItemProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, _excluded3);
29
34
  return (0, _extends2["default"])({}, locale ? {
30
35
  locale: (0, _lib.processJsonOrFunctionProps)(locale)
31
36
  } : {}, scroll ? {
@@ -41,13 +46,13 @@ var processTableProps = function processTableProps(props) {
41
46
  } : {}, render ? {
42
47
  render: render
43
48
  } : {}, FormItemProps ? {
44
- formItemProps: (0, _extends2["default"])({}, FormItemProps, typeof restFormProps === 'function' ? restFormProps === null || restFormProps === void 0 ? void 0 : restFormProps() : restFormProps)
49
+ formItemProps: (0, _extends2["default"])({}, restFormItemProps, typeof restFormProps === 'function' ? restFormProps === null || restFormProps === void 0 ? void 0 : restFormProps() : restFormProps)
45
50
  } : {}, fieldProps ? {
46
- fieldProps: (0, _extends2["default"])({}, fieldProps, typeof restFieldProps === 'function' ? restFieldProps === null || restFieldProps === void 0 ? void 0 : restFieldProps() : restFieldProps)
51
+ fieldProps: (0, _extends2["default"])({}, restFieldItemProps, typeof restFieldProps === 'function' ? restFieldProps === null || restFieldProps === void 0 ? void 0 : restFieldProps() : restFieldProps)
47
52
  } : {}, columns !== null && columns !== void 0 && columns.length ? {
48
53
  columns: columns === null || columns === void 0 ? void 0 : columns.map(function (v) {
49
54
  var columnsEditable = v.editable,
50
- restColumns = (0, _objectWithoutPropertiesLoose2["default"])(v, _excluded2);
55
+ restColumns = (0, _objectWithoutPropertiesLoose2["default"])(v, _excluded4);
51
56
  return (0, _extends2["default"])({}, editable ? {
52
57
  editable: columnsEditable
53
58
  } : {}, processObjectValue(restColumns));
@@ -59,11 +64,13 @@ var processTableProps = function processTableProps(props) {
59
64
  return processObjectValue(e);
60
65
  });
61
66
  }
62
- return processObjectValue(props);
67
+ var data = processObjectValue(props);
68
+ console.log(data, 'editTable Props');
69
+ return data;
63
70
  };
64
71
  var processEditTableProps = function processEditTableProps(props, extra) {
65
- var _ref = extra !== null && extra !== void 0 ? extra : {},
66
- proEditableFormRef = _ref.proEditableFormRef;
72
+ var _ref3 = extra !== null && extra !== void 0 ? extra : {},
73
+ proEditableFormRef = _ref3.proEditableFormRef;
67
74
  return (0, _extends2["default"])({}, processTableProps(props), {
68
75
  proEditableFormRef: proEditableFormRef
69
76
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztocwst/rc-pro-materials",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "description": "@ztocwst/rc-pro-materials",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -86,9 +86,9 @@
86
86
  },
87
87
  "componentConfig": {
88
88
  "isComponentLibrary": true,
89
- "materialSchema": "https://npm.ztocwst.com/@ztocwst/rc-pro-materials@0.2.18/build/lowcode/assets-prod.json"
89
+ "materialSchema": "https://npm.ztocwst.com/@ztocwst/rc-pro-materials@0.2.20/build/lowcode/assets-prod.json"
90
90
  },
91
- "homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.18/build/index.html",
91
+ "homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.20/build/index.html",
92
92
  "publishConfig": {
93
93
  "registry": "https://registry.npmjs.org/",
94
94
  "access": "public"