@ztocwst/rc-pro-materials 0.2.10 → 0.2.12

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.
@@ -155,7 +155,7 @@ var TableRenderer = function TableRenderer(props) {
155
155
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
156
156
  while (1) switch (_context2.prev = _context2.next) {
157
157
  case 0:
158
- columns = handleColumns(option, expressions, onLink);
158
+ columns = handleColumns(option, expressions, linkPage, onLink);
159
159
  (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
160
160
  case 2:
161
161
  case "end":
@@ -54,7 +54,7 @@ export type ExpressionsType = any[] | [];
54
54
  /**
55
55
  * 根据维度指标获取表格列
56
56
  */
57
- export declare const handleColumns: (option: DimTargetChangeOptionType, expressions?: ExpressionsType, onLink?: (v: linkParamsType) => void) => {
57
+ export declare const handleColumns: (option: DimTargetChangeOptionType, expressions?: ExpressionsType, linkPage?: TypeChartSettingProps[], onLink?: (v: linkParamsType) => void) => {
58
58
  title: import("antd/es/checkbox/Group").CheckboxValueType;
59
59
  dataIndex: string;
60
60
  ellipsis: boolean;
@@ -171,10 +171,10 @@ export var handleValueFormat = function handleValueFormat(value, record, find, c
171
171
  /**
172
172
  * 根据维度指标获取表格列
173
173
  */
174
- export var handleColumns = function handleColumns(option, expressions, onLink) {
174
+ export var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
175
175
  var dimTarget = [].concat(option.dimension, option.index);
176
176
  return dimTarget.map(function (title) {
177
- var _find3, _find3$link, _find4, _find5, _title$toString;
177
+ var _find3, _find3$link, _find4, _find5, _find6, _title$toString;
178
178
  var find;
179
179
  var dataIndex;
180
180
  var condition;
@@ -201,16 +201,23 @@ export var handleColumns = function handleColumns(option, expressions, onLink) {
201
201
 
202
202
  var _ref4 = ((_find3 = find) === null || _find3 === void 0 ? void 0 : (_find3$link = _find3.link) === null || _find3$link === void 0 ? void 0 : _find3$link.split(separator)) || [],
203
203
  dataSetName = _ref4[0];
204
+ var index;
205
+ if ((_find4 = find) !== null && _find4 !== void 0 && _find4.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
206
+ index = linkPage.findIndex(function (link) {
207
+ return "" + link.dataSetName + separator + link.title === find.link;
208
+ });
209
+ }
204
210
  return {
205
211
  title: title,
206
212
  dataIndex: dataIndex,
207
213
  ellipsis: true,
208
- sorter: (_find4 = find) === null || _find4 === void 0 ? void 0 : _find4.sorted,
209
- width: ((_find5 = find) === null || _find5 === void 0 ? void 0 : _find5.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
214
+ sorter: (_find5 = find) === null || _find5 === void 0 ? void 0 : _find5.sorted,
215
+ width: ((_find6 = find) === null || _find6 === void 0 ? void 0 : _find6.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
210
216
  render: function render(value, record) {
211
217
  return handleValueFormat(value, record, find, condition, function () {
212
218
  return onLink({
213
219
  dataSetName: dataSetName,
220
+ index: index,
214
221
  record: record
215
222
  });
216
223
  });
package/es/style.js CHANGED
@@ -11,6 +11,7 @@ import 'antd/lib/tabs/style';
11
11
  import 'antd/lib/checkbox/style';
12
12
  import 'antd/lib/radio/style';
13
13
  import 'antd/lib/spin/style';
14
+ import 'antd/lib/carousel/style';
14
15
  import 'antd/es/statistic/style';
15
16
  import 'antd/es/progress/style';
16
17
  import 'antd/es/table/style';
@@ -115,7 +115,7 @@ var processInitialValue = function processInitialValue(e) {
115
115
  });
116
116
  };
117
117
  export var processFormProps = function processFormProps(props) {
118
- var _ref3, _config$columns, _config$columns$filte, _Object$keys;
118
+ var _ref3;
119
119
  var columns = props.columns,
120
120
  submitter = props.submitter,
121
121
  labelColWidth = props.labelColWidth,
@@ -179,19 +179,22 @@ export var processFormProps = function processFormProps(props) {
179
179
  span: span,
180
180
  layoutType: layoutType
181
181
  }, restProps ? processJsonOrFunctionProps(restProps) : {}));
182
- var resetFields = config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : (_config$columns$filte = _config$columns.filter(function (e) {
183
- return !(e !== null && e !== void 0 && e.initialValue);
184
- })) === null || _config$columns$filte === void 0 ? void 0 : _config$columns$filte.reduce(function (prev, next) {
185
- var _next$dataIndex;
186
- // eslint-disable-next-line no-param-reassign
187
- prev[(_next$dataIndex = next === null || next === void 0 ? void 0 : next.dataIndex) !== null && _next$dataIndex !== void 0 ? _next$dataIndex : ''] = undefined;
188
- return prev;
189
- }, {});
190
182
 
191
183
  // 每次变更重置
192
- if ((_Object$keys = Object.keys(resetFields)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
193
- var _formRef$current;
194
- (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.setFieldsValue(resetFields);
184
+ if (formRef !== null && formRef !== void 0 && formRef.current) {
185
+ var _config$columns, _config$columns$filte, _Object$keys;
186
+ var resetFields = config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : (_config$columns$filte = _config$columns.filter(function (e) {
187
+ return !(e !== null && e !== void 0 && e.initialValue);
188
+ })) === null || _config$columns$filte === void 0 ? void 0 : _config$columns$filte.reduce(function (prev, next) {
189
+ var _next$dataIndex;
190
+ // eslint-disable-next-line no-param-reassign
191
+ prev[(_next$dataIndex = next === null || next === void 0 ? void 0 : next.dataIndex) !== null && _next$dataIndex !== void 0 ? _next$dataIndex : ''] = undefined;
192
+ return prev;
193
+ }, {});
194
+ if ((_Object$keys = Object.keys(resetFields)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
195
+ var _formRef$current;
196
+ formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.setFieldsValue(resetFields);
197
+ }
195
198
  }
196
199
  return config;
197
200
  };
@@ -160,7 +160,7 @@ var TableRenderer = function TableRenderer(props) {
160
160
  return _regenerator["default"].wrap(function _callee2$(_context2) {
161
161
  while (1) switch (_context2.prev = _context2.next) {
162
162
  case 0:
163
- columns = (0, _tableRenderer.handleColumns)(option, expressions, onLink);
163
+ columns = (0, _tableRenderer.handleColumns)(option, expressions, linkPage, onLink);
164
164
  (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
165
165
  case 2:
166
166
  case "end":
@@ -54,7 +54,7 @@ export type ExpressionsType = any[] | [];
54
54
  /**
55
55
  * 根据维度指标获取表格列
56
56
  */
57
- export declare const handleColumns: (option: DimTargetChangeOptionType, expressions?: ExpressionsType, onLink?: (v: linkParamsType) => void) => {
57
+ export declare const handleColumns: (option: DimTargetChangeOptionType, expressions?: ExpressionsType, linkPage?: TypeChartSettingProps[], onLink?: (v: linkParamsType) => void) => {
58
58
  title: import("antd/es/checkbox/Group").CheckboxValueType;
59
59
  dataIndex: string;
60
60
  ellipsis: boolean;
@@ -179,10 +179,10 @@ exports.handleValueFormat = handleValueFormat;
179
179
  /**
180
180
  * 根据维度指标获取表格列
181
181
  */
182
- var handleColumns = function handleColumns(option, expressions, onLink) {
182
+ var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
183
183
  var dimTarget = [].concat(option.dimension, option.index);
184
184
  return dimTarget.map(function (title) {
185
- var _find3, _find3$link, _find4, _find5, _title$toString;
185
+ var _find3, _find3$link, _find4, _find5, _find6, _title$toString;
186
186
  var find;
187
187
  var dataIndex;
188
188
  var condition;
@@ -209,16 +209,23 @@ var handleColumns = function handleColumns(option, expressions, onLink) {
209
209
 
210
210
  var _ref4 = ((_find3 = find) === null || _find3 === void 0 ? void 0 : (_find3$link = _find3.link) === null || _find3$link === void 0 ? void 0 : _find3$link.split(_dataCommon.separator)) || [],
211
211
  dataSetName = _ref4[0];
212
+ var index;
213
+ if ((_find4 = find) !== null && _find4 !== void 0 && _find4.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
214
+ index = linkPage.findIndex(function (link) {
215
+ return "" + link.dataSetName + _dataCommon.separator + link.title === find.link;
216
+ });
217
+ }
212
218
  return {
213
219
  title: title,
214
220
  dataIndex: dataIndex,
215
221
  ellipsis: true,
216
- sorter: (_find4 = find) === null || _find4 === void 0 ? void 0 : _find4.sorted,
217
- width: ((_find5 = find) === null || _find5 === void 0 ? void 0 : _find5.width) || (0, _dataCommon.computeWidth)(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
222
+ sorter: (_find5 = find) === null || _find5 === void 0 ? void 0 : _find5.sorted,
223
+ width: ((_find6 = find) === null || _find6 === void 0 ? void 0 : _find6.width) || (0, _dataCommon.computeWidth)(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
218
224
  render: function render(value, record) {
219
225
  return handleValueFormat(value, record, find, condition, function () {
220
226
  return onLink({
221
227
  dataSetName: dataSetName,
228
+ index: index,
222
229
  record: record
223
230
  });
224
231
  });
@@ -119,7 +119,7 @@ var processInitialValue = function processInitialValue(e) {
119
119
  });
120
120
  };
121
121
  var processFormProps = function processFormProps(props) {
122
- var _ref3, _config$columns, _config$columns$filte, _Object$keys;
122
+ var _ref3;
123
123
  var columns = props.columns,
124
124
  submitter = props.submitter,
125
125
  labelColWidth = props.labelColWidth,
@@ -183,19 +183,22 @@ var processFormProps = function processFormProps(props) {
183
183
  span: span,
184
184
  layoutType: layoutType
185
185
  }, restProps ? (0, _lib.processJsonOrFunctionProps)(restProps) : {}));
186
- var resetFields = config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : (_config$columns$filte = _config$columns.filter(function (e) {
187
- return !(e !== null && e !== void 0 && e.initialValue);
188
- })) === null || _config$columns$filte === void 0 ? void 0 : _config$columns$filte.reduce(function (prev, next) {
189
- var _next$dataIndex;
190
- // eslint-disable-next-line no-param-reassign
191
- prev[(_next$dataIndex = next === null || next === void 0 ? void 0 : next.dataIndex) !== null && _next$dataIndex !== void 0 ? _next$dataIndex : ''] = undefined;
192
- return prev;
193
- }, {});
194
186
 
195
187
  // 每次变更重置
196
- if ((_Object$keys = Object.keys(resetFields)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
197
- var _formRef$current;
198
- (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.setFieldsValue(resetFields);
188
+ if (formRef !== null && formRef !== void 0 && formRef.current) {
189
+ var _config$columns, _config$columns$filte, _Object$keys;
190
+ var resetFields = config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : (_config$columns$filte = _config$columns.filter(function (e) {
191
+ return !(e !== null && e !== void 0 && e.initialValue);
192
+ })) === null || _config$columns$filte === void 0 ? void 0 : _config$columns$filte.reduce(function (prev, next) {
193
+ var _next$dataIndex;
194
+ // eslint-disable-next-line no-param-reassign
195
+ prev[(_next$dataIndex = next === null || next === void 0 ? void 0 : next.dataIndex) !== null && _next$dataIndex !== void 0 ? _next$dataIndex : ''] = undefined;
196
+ return prev;
197
+ }, {});
198
+ if ((_Object$keys = Object.keys(resetFields)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
199
+ var _formRef$current;
200
+ formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.setFieldsValue(resetFields);
201
+ }
199
202
  }
200
203
  return config;
201
204
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztocwst/rc-pro-materials",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
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.onmicrosoft.cn/@ztocwst/rc-pro-materials@0.2.10/build/lowcode/assets-prod.json"
89
+ "materialSchema": "https://npm.onmicrosoft.cn/@ztocwst/rc-pro-materials@0.2.12/build/lowcode/assets-prod.json"
90
90
  },
91
- "homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.10/build/index.html",
91
+ "homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.12/build/index.html",
92
92
  "publishConfig": {
93
93
  "registry": "https://registry.npmjs.org/",
94
94
  "access": "public"