@pisell/materials 1.0.497 → 1.0.499

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.
Files changed (133) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +5 -5
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +22 -22
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +21 -21
  11. package/es/components/dataSourceComponents/dataSourceForm/style.less +9 -0
  12. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
  13. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +13 -10
  14. package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
  15. package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
  16. package/es/components/dataSourceComponents/dataSourceForm/utils.js +29 -7
  17. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +7 -3
  18. package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
  19. package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -3
  20. package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +5 -3
  21. package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +5 -3
  22. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
  23. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +15 -6
  24. package/es/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +3 -2
  25. package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +6 -2
  26. package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
  27. package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +6 -2
  28. package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
  29. package/es/components/dataSourceComponents/fields/Input/ReadPretty.js +7 -2
  30. package/es/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
  31. package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +7 -2
  32. package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
  33. package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +11 -5
  34. package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
  35. package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
  36. package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
  37. package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
  38. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
  39. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +1 -1
  40. package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +7 -2
  41. package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
  42. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +8 -3
  43. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
  44. package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
  45. package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
  46. package/es/components/dataSourceComponents/fields/Radio/ReadPretty.js +3 -2
  47. package/es/components/dataSourceComponents/fields/Select/ReadPretty.js +3 -2
  48. package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +6 -2
  49. package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
  50. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
  51. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +291 -252
  52. package/es/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
  53. package/es/components/dataSourceComponents/fields/Upload/constants.js +9 -0
  54. package/es/components/dataSourceComponents/fields/Upload/index.less +49 -0
  55. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
  56. package/es/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
  57. package/es/components/dataSourceComponents/fields/Upload/types.js +1 -0
  58. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
  59. package/es/components/dataSourceComponents/fields/Upload/utils.js +237 -215
  60. package/es/components/dataSourceComponents/fields/index.d.ts +2 -1
  61. package/es/components/dataSourceComponents/fields/index.js +1 -0
  62. package/es/components/page/index.js +2 -6
  63. package/es/locales/en-US.d.ts +9 -0
  64. package/es/locales/en-US.js +10 -1
  65. package/es/locales/zh-CN.d.ts +9 -0
  66. package/es/locales/zh-CN.js +9 -0
  67. package/es/locales/zh-TW.d.ts +9 -0
  68. package/es/locales/zh-TW.js +9 -0
  69. package/lib/components/dataSourceComponents/dataSourceForm/style.less +9 -0
  70. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
  71. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +6 -3
  72. package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
  73. package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
  74. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +21 -6
  75. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +4 -1
  76. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
  77. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -3
  78. package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +5 -1
  79. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +9 -4
  80. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
  81. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +14 -5
  82. package/lib/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +2 -2
  83. package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +11 -2
  84. package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
  85. package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +11 -2
  86. package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
  87. package/lib/components/dataSourceComponents/fields/Input/ReadPretty.js +11 -1
  88. package/lib/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
  89. package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +11 -1
  90. package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
  91. package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +9 -4
  92. package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
  93. package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
  94. package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
  95. package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
  96. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
  97. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +4 -4
  98. package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +11 -1
  99. package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
  100. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +12 -1
  101. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
  102. package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
  103. package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
  104. package/lib/components/dataSourceComponents/fields/Radio/ReadPretty.js +2 -2
  105. package/lib/components/dataSourceComponents/fields/Select/ReadPretty.js +2 -2
  106. package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +11 -2
  107. package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
  108. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
  109. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +319 -247
  110. package/lib/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
  111. package/lib/components/dataSourceComponents/fields/Upload/constants.js +47 -0
  112. package/lib/components/dataSourceComponents/fields/Upload/index.less +49 -0
  113. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
  114. package/lib/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
  115. package/lib/components/dataSourceComponents/fields/Upload/types.js +17 -0
  116. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
  117. package/lib/components/dataSourceComponents/fields/Upload/utils.js +205 -254
  118. package/lib/components/dataSourceComponents/fields/index.d.ts +2 -1
  119. package/lib/components/dataSourceComponents/fields/index.js +1 -0
  120. package/lib/components/page/index.js +2 -2
  121. package/lib/locales/en-US.d.ts +9 -0
  122. package/lib/locales/en-US.js +10 -1
  123. package/lib/locales/zh-CN.d.ts +9 -0
  124. package/lib/locales/zh-CN.js +9 -0
  125. package/lib/locales/zh-TW.d.ts +9 -0
  126. package/lib/locales/zh-TW.js +9 -0
  127. package/lowcode/data-source-form/utils.ts +5 -4
  128. package/lowcode/data-source-table/meta.ts +18 -1
  129. package/lowcode/data-source-table/utils.tsx +14 -13
  130. package/lowcode/form-item-input.json/snippets.ts +16 -0
  131. package/lowcode/form-item-upload/meta.ts +11 -0
  132. package/lowcode/submit-button/meta.ts +10 -0
  133. package/package.json +1 -1
@@ -12,3 +12,12 @@
12
12
  line-height: 24px; /* 150% */
13
13
  }
14
14
  }
15
+
16
+ .pisell-data-source-form-item-view {
17
+ .pisell-lowcode-form-item-label > label {
18
+ font-weight: 400;
19
+ }
20
+ .pisell-lowcode-form-item-control-input {
21
+ min-height: auto;
22
+ }
23
+ }
@@ -17,6 +17,7 @@ export interface SubmitButtonProps extends ButtonProps {
17
17
  enable: boolean;
18
18
  icon: React.ReactNode;
19
19
  title: string;
20
+ showAfterSubmit?: boolean;
20
21
  };
21
22
  refreshData?: boolean;
22
23
  afterSubmitType?: 'none' | 'close' | 'showModal' | 'showNotification';
@@ -29,8 +29,6 @@ var SubmitButton = function SubmitButton(props) {
29
29
  afterSubmitModalConfig = props.afterSubmitModalConfig,
30
30
  afterSubmitNotificationConfig = props.afterSubmitNotificationConfig,
31
31
  childrenString = props.childrenString;
32
- console.log(props, 'propsprops');
33
- console.log(childrenString, 'childrenchildren');
34
32
  var _useState = useState(false),
35
33
  _useState2 = _slicedToArray(_useState, 2),
36
34
  loading = _useState2[0],
@@ -140,13 +138,18 @@ var SubmitButton = function SubmitButton(props) {
140
138
  if (allValues.id) {
141
139
  values.id = allValues.id;
142
140
  }
143
- _context2.next = 7;
141
+ if (toastConfig !== null && toastConfig !== void 0 && toastConfig.enable && !(toastConfig !== null && toastConfig !== void 0 && toastConfig.showAfterSubmit)) {
142
+ PisellToast({
143
+ content: toastConfig.title
144
+ });
145
+ }
146
+ _context2.next = 8;
144
147
  return onSubmit(values);
145
- case 7:
148
+ case 8:
146
149
  if (refreshData) {
147
150
  refreshTableData === null || refreshTableData === void 0 ? void 0 : refreshTableData();
148
151
  }
149
- if (toastConfig !== null && toastConfig !== void 0 && toastConfig.enable) {
152
+ if (toastConfig !== null && toastConfig !== void 0 && toastConfig.enable && toastConfig !== null && toastConfig !== void 0 && toastConfig.showAfterSubmit) {
150
153
  PisellToast({
151
154
  content: toastConfig.title
152
155
  });
@@ -157,16 +160,16 @@ var SubmitButton = function SubmitButton(props) {
157
160
  afterSubmitFunc();
158
161
  }
159
162
  }
160
- _context2.next = 14;
163
+ _context2.next = 15;
161
164
  break;
162
- case 12:
163
- _context2.prev = 12;
165
+ case 13:
166
+ _context2.prev = 13;
164
167
  _context2.t0 = _context2["catch"](0);
165
- case 14:
168
+ case 15:
166
169
  case "end":
167
170
  return _context2.stop();
168
171
  }
169
- }, _callee2, null, [[0, 12]]);
172
+ }, _callee2, null, [[0, 13]]);
170
173
  }));
171
174
  return function handleValideFieldsSubmit(_x3) {
172
175
  return _ref2.apply(this, arguments);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DataSourceType } from "../provider/dataSource/DataSourceContext";
3
- export declare type ModeType = 'edit' | 'add' | 'view' | 'disabled' | 'hidden';
3
+ export declare type ModeType = 'edit' | 'add' | 'view' | 'disabled' | 'hidden' | 'tableView';
4
4
  export interface DataSourceFormProps {
5
5
  title: string;
6
6
  description: string;
@@ -46,5 +46,5 @@ export declare const withOptions: <P extends unknown>(WrappedComponent: React.Co
46
46
  valueField: string;
47
47
  }) => React.JSX.Element;
48
48
  export declare const getNestedValue: (obj: Record<string, any>, path: string) => Record<string, any>;
49
- export declare const renderValueWithMap: (value: any, valueMap?: Record<string, string>) => React.JSX.Element | null;
49
+ export declare const renderValueWithMap: (value: any, valueMap?: Record<string, string>, renderMode?: ModeType) => React.JSX.Element | null;
50
50
  export declare function toArr(str: string | number | (string | number)[]): (string | number)[];
@@ -18,6 +18,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
18
18
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
19
19
  import React, { useEffect, useMemo } from 'react';
20
20
  import { isArr, isNumber, isString } from '@pisell/utils';
21
+ import classNames from 'classnames';
21
22
  import { parsePhoneNumberFromString, isValidPhoneNumber } from 'libphonenumber-js';
22
23
  import { getText } from "../../../locales";
23
24
  import Form from "../../form";
@@ -25,7 +26,11 @@ import useDataSource from "../hooks/useDataSource";
25
26
  import useFormSetting from "./provider/hooks/useFormSetting";
26
27
  import useJsonPrefixPath from "./provider/hooks/useJsonPrefixPath";
27
28
  import DataSourceProvider from "../provider/dataSource/DataSourceProvider";
29
+ import useEngineContext from "../../../hooks/useEngineContext";
28
30
  import "./style.less";
31
+ var translationOriginal = function translationOriginal(val) {
32
+ return val.original;
33
+ };
29
34
  /**
30
35
  * @title: 增加renderMode属性
31
36
  * @description: 基于renderMode属性控制渲染模式
@@ -49,7 +54,7 @@ export var withMode = function withMode(FieldComponent, ReadPrettyComponent, tra
49
54
  onChange: onChange,
50
55
  renderMode: renderMode
51
56
  });
52
- if (renderMode === 'view' && ReadPrettyComponent) {
57
+ if (['view', 'tableView'].includes(renderMode) && ReadPrettyComponent) {
53
58
  return /*#__PURE__*/React.createElement(ReadPrettyComponent, transformedProps);
54
59
  }
55
60
  if (renderMode === 'disabled') {
@@ -98,7 +103,7 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
98
103
  minobj = _ref2.minobj,
99
104
  normalize = _ref2.normalize,
100
105
  getValueProps = _ref2.getValueProps,
101
- validator = _ref2.validator,
106
+ _validator = _ref2.validator,
102
107
  style = _ref2.style,
103
108
  validateTrigger = _ref2.validateTrigger,
104
109
  __designMode = _ref2.__designMode,
@@ -219,6 +224,13 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
219
224
  message: minobj.message || getText('pisell-data-source-form-min-value-message')(minobj === null || minobj === void 0 ? void 0 : minobj.min)
220
225
  }));
221
226
  }
227
+ if (_validator) {
228
+ rules.push({
229
+ validator: function validator(_, value) {
230
+ return _validator(value);
231
+ }
232
+ });
233
+ }
222
234
  var labelCol = useMemo(function () {
223
235
  if (hideLabel) {
224
236
  return {
@@ -248,7 +260,9 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
248
260
  validateTrigger: validateTrigger,
249
261
  labelCol: labelCol,
250
262
  initialValue: otherProps === null || otherProps === void 0 ? void 0 : otherProps.defaultValue,
251
- className: "pisell-data-source-form-item"
263
+ className: classNames('pisell-data-source-form-item', {
264
+ 'pisell-data-source-form-item-view': effectiveMode === 'view'
265
+ })
252
266
  }, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.otherFormItemProps), renderComponent);
253
267
  };
254
268
  };
@@ -263,6 +277,8 @@ export var withDataSource = function withDataSource(WrappedComponent) {
263
277
  export var withOptions = function withOptions(WrappedComponent) {
264
278
  return function (props) {
265
279
  var _list$data2;
280
+ var context = useEngineContext();
281
+ translationOriginal = context.appHelper.utils.translationOriginal || translationOriginal;
266
282
  var propsOptions = props.options,
267
283
  optionSourceType = props.optionSourceType,
268
284
  labelField = props.labelField,
@@ -284,7 +300,7 @@ export var withOptions = function withOptions(WrappedComponent) {
284
300
  }
285
301
  return ((_list$data = list.data) === null || _list$data === void 0 ? void 0 : (_list$data$data = _list$data.data) === null || _list$data$data === void 0 ? void 0 : _list$data$data.map(function (item) {
286
302
  return {
287
- label: item[labelField],
303
+ label: translationOriginal(item[labelField]),
288
304
  value: item[valueField]
289
305
  };
290
306
  })) || [];
@@ -316,21 +332,27 @@ export var getNestedValue = function getNestedValue(obj, path) {
316
332
  };
317
333
 
318
334
  // 根据valueMap渲染value 用于ReadPretty组件 Select Radio Checkbox
319
- export var renderValueWithMap = function renderValueWithMap(value, valueMap) {
335
+ export var renderValueWithMap = function renderValueWithMap(value, valueMap, renderMode) {
336
+ var textStyle = renderMode === 'tableView' ? {
337
+ fontSize: 14,
338
+ fontWeight: 400
339
+ } : {};
320
340
  if (isArr(value)) {
321
341
  return /*#__PURE__*/React.createElement("span", {
322
342
  className: "pisell-form-read-pretty-text"
323
343
  }, value.map(function (item, index) {
324
344
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
325
345
  key: item,
326
- className: "pisell-form-read-pretty-value"
346
+ className: "pisell-form-read-pretty-value",
347
+ style: textStyle
327
348
  }, valueMap === null || valueMap === void 0 ? void 0 : valueMap[item]), index < value.length - 1 && ',');
328
349
  }));
329
350
  } else if (isString(value)) {
330
351
  return /*#__PURE__*/React.createElement("span", {
331
352
  className: "pisell-form-read-pretty-text"
332
353
  }, /*#__PURE__*/React.createElement("span", {
333
- className: "pisell-form-read-pretty-value"
354
+ className: "pisell-form-read-pretty-value",
355
+ style: textStyle
334
356
  }, (valueMap === null || valueMap === void 0 ? void 0 : valueMap[value]) || value));
335
357
  }
336
358
  return null;
@@ -2,7 +2,7 @@ var _excluded = ["columns", "dataSource", "operationContent"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- import React, { useEffect } from 'react';
5
+ import React, { useEffect, useRef } from 'react';
6
6
  import { useUpdateEffect } from 'ahooks';
7
7
  import Table from "../../table";
8
8
  import useVariables from "../hooks/useVariables";
@@ -20,6 +20,7 @@ var BaseTable = function BaseTable(props) {
20
20
  dataSource = props.dataSource,
21
21
  operationContent = props.operationContent,
22
22
  others = _objectWithoutProperties(props, _excluded);
23
+ var tableRef = useRef(null);
23
24
  var componentId = useComponentId(props);
24
25
  var _useVariables = useVariables(),
25
26
  registerValueVariable = _useVariables.registerValueVariable;
@@ -79,9 +80,12 @@ var BaseTable = function BaseTable(props) {
79
80
  openDrawer: openDrawer,
80
81
  closeDrawer: closeDrawer,
81
82
  refreshData: refreshData,
82
- handleFilterChange: handleFilterChange
83
+ handleFilterChange: handleFilterChange,
84
+ tableRef: tableRef
83
85
  });
84
- return /*#__PURE__*/React.createElement(TableSettingProvider, null, /*#__PURE__*/React.createElement(Table, _extends({}, others, transformProps, {
86
+ return /*#__PURE__*/React.createElement(TableSettingProvider, null, /*#__PURE__*/React.createElement(Table, _extends({
87
+ ref: tableRef
88
+ }, others, transformProps, {
85
89
  dataSource: (data === null || data === void 0 ? void 0 : data.data) || [],
86
90
  loading: list === null || list === void 0 ? void 0 : list.loading,
87
91
  onValuesChange: handleValuesChange
@@ -16,6 +16,7 @@ interface FilterProps {
16
16
  mode?: 'simple' | 'complex';
17
17
  items: BaseFilterItem[];
18
18
  handleValuesChange: (changedFields: any, allFields: any) => void;
19
+ show: boolean;
19
20
  search: {
20
21
  show: boolean;
21
22
  placeholder: string;
@@ -36,7 +36,8 @@ var Filter = function Filter(props) {
36
36
  sortButtonShow = _props$sortButtonShow === void 0 ? false : _props$sortButtonShow,
37
37
  handleValuesChange = props.handleValuesChange,
38
38
  search = props.search,
39
- filterBy = props.filterBy;
39
+ filterBy = props.filterBy,
40
+ show = props.show;
40
41
  var _Form$useForm = Form.useForm(),
41
42
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
42
43
  form = _Form$useForm2[0];
@@ -58,8 +59,11 @@ var Filter = function Filter(props) {
58
59
  });
59
60
  }, [items]);
60
61
  var filterDom = useMemo(function () {
62
+ if (!show) {
63
+ return null;
64
+ }
61
65
  return genFilterItems(list.quickFilter, dataSource);
62
- }, [list.quickFilter]);
66
+ }, [list.quickFilter, show]);
63
67
  useEffect(function () {
64
68
  var storedOrder = getStoredFilterOrder(componentId);
65
69
  if (!storedOrder) {
@@ -153,7 +157,7 @@ var Filter = function Filter(props) {
153
157
  layout: "inline",
154
158
  className: "filter-form-wrapper",
155
159
  onValuesChange: onValuesChange
156
- }, searchDom, filterDom, /*#__PURE__*/React.createElement(FilterButton, {
160
+ }, searchDom, filterDom, show && /*#__PURE__*/React.createElement(FilterButton, {
157
161
  value: list,
158
162
  quickFilterMaxLength: quickFilterMaxLength,
159
163
  formFiltersPrefix: '',
@@ -37,9 +37,9 @@ var fieldType2FilterMap = {
37
37
  'Checkbox.Group': 'FormItemSelect'
38
38
  };
39
39
  var getCptProps = function getCptProps(field, cptType, item) {
40
- var _field$uiSchema, _field$uiSchema2, _field$uiSchema3, _field$uiSchema3$enum, _field$uiSchema6, _field$uiSchema8;
40
+ var _field$uiSchema, _props, _field$uiSchema2, _field$uiSchema3, _field$uiSchema3$enum, _field$uiSchema6, _field$uiSchema8, _item$other;
41
41
  var props = (field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema['x-component-props']) || {};
42
- props.style = _objectSpread(_objectSpread({}, (props === null || props === void 0 ? void 0 : props.style) || {}), {}, {
42
+ props.style = _objectSpread(_objectSpread({}, ((_props = props) === null || _props === void 0 ? void 0 : _props.style) || {}), {}, {
43
43
  width: '200px',
44
44
  margin: 0
45
45
  });
@@ -60,7 +60,8 @@ var getCptProps = function getCptProps(field, cptType, item) {
60
60
  props.defaultValue = field === null || field === void 0 ? void 0 : (_field$uiSchema7 = field.uiSchema) === null || _field$uiSchema7 === void 0 ? void 0 : _field$uiSchema7.default;
61
61
  }
62
62
  if (cptType === 'DateRangePicker') {
63
- props.style = _objectSpread(_objectSpread({}, (props === null || props === void 0 ? void 0 : props.style) || {}), {}, {
63
+ var _props2;
64
+ props.style = _objectSpread(_objectSpread({}, ((_props2 = props) === null || _props2 === void 0 ? void 0 : _props2.style) || {}), {}, {
64
65
  width: '240px'
65
66
  });
66
67
  }
@@ -77,6 +78,7 @@ var getCptProps = function getCptProps(field, cptType, item) {
77
78
  value: false
78
79
  }];
79
80
  }
81
+ props = _objectSpread(_objectSpread({}, props), (item === null || item === void 0 ? void 0 : (_item$other = item.other) === null || _item$other === void 0 ? void 0 : _item$other.fieldProps) || {});
80
82
  return props;
81
83
  };
82
84
  export var field2Cpt = function field2Cpt(field, item, otherProps) {
@@ -7,9 +7,9 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
7
7
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
8
  import React, { useMemo } from 'react';
9
9
  import { getFieldComponent } from "../../fields";
10
- var genFieldProps = function genFieldProps(field) {
10
+ var genFieldProps = function genFieldProps(field, fieldProps) {
11
11
  var props = {
12
- renderMode: 'view',
12
+ renderMode: 'tableView',
13
13
  noStyle: true
14
14
  };
15
15
  if (!field) return props;
@@ -19,6 +19,7 @@ var genFieldProps = function genFieldProps(field) {
19
19
  }
20
20
  props.options = field.uiSchema.enum;
21
21
  }
22
+ props = _objectSpread(_objectSpread({}, props), fieldProps || {});
22
23
  return props;
23
24
  };
24
25
  var useColumns = function useColumns(_ref) {
@@ -36,12 +37,13 @@ var useColumns = function useColumns(_ref) {
36
37
  return useMemo(function () {
37
38
  if (Object.keys(fieldMap).length === 0) return [];
38
39
  return columns.map(function (column) {
40
+ var _other;
39
41
  var field = fieldMap[column === null || column === void 0 ? void 0 : column.dataIndex];
40
42
 
41
43
  // 优先 column.title -> field.title
42
44
  var title = (column === null || column === void 0 ? void 0 : column.title) || (field === null || field === void 0 ? void 0 : field.title);
43
45
  var FieldComponent = getFieldComponent(column === null || column === void 0 ? void 0 : column.fieldComponent) || 'div';
44
- var fieldProps = genFieldProps(field);
46
+ var fieldProps = genFieldProps(field, (_other = column.other) === null || _other === void 0 ? void 0 : _other.fieldProps);
45
47
  return _objectSpread(_objectSpread({}, column), {}, {
46
48
  title: title,
47
49
  render: function render(text) {
@@ -8,6 +8,7 @@ interface UseTablePropsProps {
8
8
  closeDrawer: () => void;
9
9
  refreshData: () => void;
10
10
  handleFilterChange: (changedFields: any, allFields: any) => void;
11
+ tableRef: any;
11
12
  }
12
13
  /**
13
14
  * 处理table的props
@@ -8,7 +8,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
8
8
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
10
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
- import React, { useMemo } from 'react';
11
+ import React, { useMemo, useEffect } from 'react';
12
12
  import { Button, Space, Modal } from 'antd';
13
13
  import { isString } from '@pisell/utils';
14
14
  import { useMemoizedFn } from 'ahooks';
@@ -32,7 +32,8 @@ var useTableProps = function useTableProps(props) {
32
32
  openDrawer = props.openDrawer,
33
33
  closeDrawer = props.closeDrawer,
34
34
  refreshData = props.refreshData,
35
- handleFilterChange = props.handleFilterChange;
35
+ handleFilterChange = props.handleFilterChange,
36
+ tableRef = props.tableRef;
36
37
  var propsTitle = originProps.title,
37
38
  propsSubTitle = originProps.subTitle,
38
39
  titleButtons = originProps.titleButtons,
@@ -58,6 +59,14 @@ var useTableProps = function useTableProps(props) {
58
59
  var pagination = usePagination({
59
60
  data: data
60
61
  });
62
+ useEffect(function () {
63
+ if (tableRef !== null && tableRef !== void 0 && tableRef.current) {
64
+ tableRef.current.formInstance.setFieldValue('pagination', {
65
+ page: (pagination === null || pagination === void 0 ? void 0 : pagination.current) || 1,
66
+ size: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || 10
67
+ });
68
+ }
69
+ }, [pagination]);
61
70
  var _useVariables = useVariables(),
62
71
  registerValueVariable = _useVariables.registerValueVariable;
63
72
 
@@ -149,10 +158,10 @@ var useTableProps = function useTableProps(props) {
149
158
  var handleClick = function handleClick() {
150
159
  if (actionType === 'delete') {
151
160
  Modal.confirm({
152
- title: '确认删除',
153
- content: '确定要删除该条记录吗?',
154
- okText: '确定',
155
- cancelText: '取消',
161
+ title: getText('pisell-delete-confirm-title'),
162
+ content: getText('pisell-delete-confirm-content'),
163
+ okText: getText('pisell-delete-confirm-ok'),
164
+ cancelText: getText('pisell-delete-confirm-cancel'),
156
165
  onOk: function onOk() {
157
166
  handleDelete(record);
158
167
  }
@@ -15,9 +15,10 @@ var CheckboxReadPretty = function CheckboxReadPretty(props) {
15
15
  };
16
16
  var CheckboxGroupReadPretty = function CheckboxGroupReadPretty(props) {
17
17
  var value = props.value,
18
- options = props.options;
18
+ options = props.options,
19
+ renderMode = props.renderMode;
19
20
  var valueMap = useValueMap(options || []);
20
- return renderValueWithMap(value, valueMap);
21
+ return renderValueWithMap(value, valueMap, renderMode);
21
22
  };
22
23
  CheckboxReadPretty.Group = CheckboxGroupReadPretty;
23
24
  export default CheckboxReadPretty;
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
+ import classNames from 'classnames';
2
3
  import dayjs from 'dayjs';
3
4
  import "./ReadPretty.less";
4
5
  var DatePickerReadPretty = function DatePickerReadPretty(props) {
5
- var value = props.value;
6
+ var value = props.value,
7
+ renderMode = props.renderMode;
6
8
  return /*#__PURE__*/React.createElement("span", {
7
- className: "pisell-date-picker-read-pretty"
9
+ className: classNames('pisell-date-picker-read-pretty', {
10
+ 'pisell-date-picker-read-pretty-table-view': renderMode === 'tableView'
11
+ })
8
12
  }, value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '');
9
13
  };
10
14
  export default DatePickerReadPretty;
@@ -4,3 +4,8 @@
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
6
6
  }
7
+
8
+ .pisell-date-picker-read-pretty-table-view {
9
+ font-size: 14px;
10
+ font-weight: 400;
11
+ }
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
+ import classNames from 'classnames';
2
3
  import dayjs from 'dayjs';
3
4
  import "./ReadPretty.less";
4
5
  var DateRangePickerReadPretty = function DateRangePickerReadPretty(props) {
5
- var value = props.value;
6
+ var value = props.value,
7
+ renderMode = props.renderMode;
6
8
  return /*#__PURE__*/React.createElement("span", {
7
- className: "pisell-date-range-picker-read-pretty"
9
+ className: classNames('pisell-date-range-picker-read-pretty', {
10
+ 'pisell-date-range-picker-read-pretty-table-view': renderMode === 'tableView'
11
+ })
8
12
  }, value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '');
9
13
  };
10
14
  export default DateRangePickerReadPretty;
@@ -4,3 +4,8 @@
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
6
6
  }
7
+
8
+ .pisell-date-range-picker-read-pretty-table-view {
9
+ font-size: 14px;
10
+ font-weight: 400;
11
+ }
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
+ import classNames from 'classnames';
2
3
  import "./ReadPretty.less";
3
4
  var InputReadPretty = function InputReadPretty(props) {
5
+ var value = props.value,
6
+ renderMode = props.renderMode;
4
7
  return /*#__PURE__*/React.createElement("span", {
5
- className: "pisell-input-read-pretty"
6
- }, props.value);
8
+ className: classNames('pisell-input-read-pretty', {
9
+ 'pisell-input-read-pretty-table-view': renderMode === 'tableView'
10
+ })
11
+ }, value);
7
12
  };
8
13
  export default InputReadPretty;
@@ -4,3 +4,8 @@
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
6
6
  }
7
+
8
+ .pisell-input-read-pretty-table-view {
9
+ font-size: 14px;
10
+ font-weight: 400;
11
+ }
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
+ import classNames from 'classnames';
2
3
  import "./ReadPretty.less";
3
4
  var InputReadPretty = function InputReadPretty(props) {
5
+ var value = props.value,
6
+ renderMode = props.renderMode;
4
7
  return /*#__PURE__*/React.createElement("span", {
5
- className: "pisell-input-email-read-pretty"
6
- }, props.value);
8
+ className: classNames('pisell-input-email-read-pretty', {
9
+ 'pisell-input-email-read-pretty-table-view': renderMode === 'tableView'
10
+ })
11
+ }, value);
7
12
  };
8
13
  export default InputReadPretty;
@@ -4,3 +4,8 @@
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
6
6
  }
7
+
8
+ .pisell-input-email-read-pretty-table-view {
9
+ font-size: 14px;
10
+ font-weight: 400;
11
+ }
@@ -1,17 +1,23 @@
1
1
  import React from 'react';
2
2
  import { isString } from '@pisell/utils';
3
+ import classNames from 'classnames';
3
4
  import "./ReadPretty.less";
4
5
  var PasswordReadPretty = function PasswordReadPretty(props) {
5
- if (props.value && isString(props.value)) {
6
- var _props$value, _props$value$split;
6
+ var value = props.value,
7
+ renderMode = props.renderMode;
8
+ var className = classNames('pisell-password-read-pretty', {
9
+ 'pisell-password-read-pretty-table-view': renderMode === 'tableView'
10
+ });
11
+ if (value && isString(value)) {
12
+ var _value$split;
7
13
  return /*#__PURE__*/React.createElement("span", {
8
- className: "pisell-password-read-pretty"
9
- }, (_props$value = props.value) === null || _props$value === void 0 ? void 0 : (_props$value$split = _props$value.split) === null || _props$value$split === void 0 ? void 0 : _props$value$split.call(_props$value, '').map(function () {
14
+ className: className
15
+ }, value === null || value === void 0 ? void 0 : (_value$split = value.split) === null || _value$split === void 0 ? void 0 : _value$split.call(value, '').map(function () {
10
16
  return '•';
11
17
  }));
12
18
  }
13
19
  return /*#__PURE__*/React.createElement("span", {
14
- className: "pisell-password-read-pretty"
20
+ className: className
15
21
  }, '••••••');
16
22
  };
17
23
  export default PasswordReadPretty;
@@ -4,3 +4,8 @@
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
6
6
  }
7
+
8
+ .pisell-password-read-pretty-table-view {
9
+ font-size: 14px;
10
+ font-weight: 400;
11
+ }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { PhoneInputProps } from './WithMode';
3
3
  import './ReadPretty.less';
4
- declare const ReadPretty: React.FC<Omit<PhoneInputProps, 'onChange'>>;
4
+ declare const ReadPretty: React.FC<PhoneInputProps>;
5
5
  export default ReadPretty;
@@ -1,20 +1,27 @@
1
1
  import React from 'react';
2
2
  import { parsePhoneNumberFromString as parsePhoneNumber } from 'libphonenumber-js';
3
+ import classNames from 'classnames';
3
4
  import "./ReadPretty.less";
4
5
  var ReadPretty = function ReadPretty(_ref) {
5
- var value = _ref.value;
6
+ var value = _ref.value,
7
+ renderMode = _ref.renderMode;
6
8
  if (!value) return null;
9
+ var className = classNames('pisell-phone-read-pretty', {
10
+ 'pisell-phone-read-pretty-table-view': renderMode === 'tableView'
11
+ });
7
12
  try {
8
13
  var phoneNumber = parsePhoneNumber(value);
9
- if (!phoneNumber) return /*#__PURE__*/React.createElement("span", null, value);
14
+ if (!phoneNumber) return /*#__PURE__*/React.createElement("span", {
15
+ className: className
16
+ }, value);
10
17
  var formattedValue = "(".concat(phoneNumber.formatInternational().split(' ')[0], ") ").concat(phoneNumber.formatNational());
11
18
  return /*#__PURE__*/React.createElement("span", {
12
- className: "pisell-phone-read-pretty"
19
+ className: className
13
20
  }, formattedValue);
14
21
  } catch (error) {
15
22
  // 如果解析失败,直接显示原始值
16
23
  return /*#__PURE__*/React.createElement("span", {
17
- className: "pisell-phone-read-pretty"
24
+ className: className
18
25
  }, value);
19
26
  }
20
27
  };