@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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +5 -5
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +22 -22
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +21 -21
- package/es/components/dataSourceComponents/dataSourceForm/style.less +9 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +13 -10
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +29 -7
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +7 -3
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -3
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +5 -3
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +5 -3
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +15 -6
- package/es/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +3 -2
- package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +6 -2
- package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +6 -2
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input/ReadPretty.js +7 -2
- package/es/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +7 -2
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +11 -5
- package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +1 -1
- package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +7 -2
- package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +8 -3
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
- package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Radio/ReadPretty.js +3 -2
- package/es/components/dataSourceComponents/fields/Select/ReadPretty.js +3 -2
- package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +6 -2
- package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +291 -252
- package/es/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
- package/es/components/dataSourceComponents/fields/Upload/constants.js +9 -0
- package/es/components/dataSourceComponents/fields/Upload/index.less +49 -0
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
- package/es/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
- package/es/components/dataSourceComponents/fields/Upload/types.js +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
- package/es/components/dataSourceComponents/fields/Upload/utils.js +237 -215
- package/es/components/dataSourceComponents/fields/index.d.ts +2 -1
- package/es/components/dataSourceComponents/fields/index.js +1 -0
- package/es/components/page/index.js +2 -6
- package/es/locales/en-US.d.ts +9 -0
- package/es/locales/en-US.js +10 -1
- package/es/locales/zh-CN.d.ts +9 -0
- package/es/locales/zh-CN.js +9 -0
- package/es/locales/zh-TW.d.ts +9 -0
- package/es/locales/zh-TW.js +9 -0
- package/lib/components/dataSourceComponents/dataSourceForm/style.less +9 -0
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +6 -3
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +21 -6
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -3
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +5 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +9 -4
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +14 -5
- package/lib/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +11 -2
- package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +11 -2
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input/ReadPretty.js +11 -1
- package/lib/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +11 -1
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +9 -4
- package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +4 -4
- package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +11 -1
- package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +12 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
- package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Radio/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/Select/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +11 -2
- package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +319 -247
- package/lib/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
- package/lib/components/dataSourceComponents/fields/Upload/constants.js +47 -0
- package/lib/components/dataSourceComponents/fields/Upload/index.less +49 -0
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
- package/lib/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
- package/lib/components/dataSourceComponents/fields/Upload/types.js +17 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
- package/lib/components/dataSourceComponents/fields/Upload/utils.js +205 -254
- package/lib/components/dataSourceComponents/fields/index.d.ts +2 -1
- package/lib/components/dataSourceComponents/fields/index.js +1 -0
- package/lib/components/page/index.js +2 -2
- package/lib/locales/en-US.d.ts +9 -0
- package/lib/locales/en-US.js +10 -1
- package/lib/locales/zh-CN.d.ts +9 -0
- package/lib/locales/zh-CN.js +9 -0
- package/lib/locales/zh-TW.d.ts +9 -0
- package/lib/locales/zh-TW.js +9 -0
- package/lowcode/data-source-form/utils.ts +5 -4
- package/lowcode/data-source-table/meta.ts +18 -1
- package/lowcode/data-source-table/utils.tsx +14 -13
- package/lowcode/form-item-input.json/snippets.ts +16 -0
- package/lowcode/form-item-upload/meta.ts +11 -0
- package/lowcode/submit-button/meta.ts +10 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
|
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 =
|
|
163
|
+
_context2.next = 15;
|
|
161
164
|
break;
|
|
162
|
-
case
|
|
163
|
-
_context2.prev =
|
|
165
|
+
case 13:
|
|
166
|
+
_context2.prev = 13;
|
|
164
167
|
_context2.t0 = _context2["catch"](0);
|
|
165
|
-
case
|
|
168
|
+
case 15:
|
|
166
169
|
case "end":
|
|
167
170
|
return _context2.stop();
|
|
168
171
|
}
|
|
169
|
-
}, _callee2, null, [[0,
|
|
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
|
|
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 (
|
|
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
|
-
|
|
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:
|
|
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({
|
|
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
|
|
@@ -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 ||
|
|
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
|
-
|
|
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: '
|
|
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,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:
|
|
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;
|
|
@@ -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:
|
|
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;
|
|
@@ -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:
|
|
6
|
-
|
|
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;
|
|
@@ -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:
|
|
6
|
-
|
|
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;
|
|
@@ -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
|
-
|
|
6
|
-
|
|
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:
|
|
9
|
-
},
|
|
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:
|
|
20
|
+
className: className
|
|
15
21
|
}, '••••••');
|
|
16
22
|
};
|
|
17
23
|
export default PasswordReadPretty;
|
|
@@ -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",
|
|
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:
|
|
19
|
+
className: className
|
|
13
20
|
}, formattedValue);
|
|
14
21
|
} catch (error) {
|
|
15
22
|
// 如果解析失败,直接显示原始值
|
|
16
23
|
return /*#__PURE__*/React.createElement("span", {
|
|
17
|
-
className:
|
|
24
|
+
className: className
|
|
18
25
|
}, value);
|
|
19
26
|
}
|
|
20
27
|
};
|