@pisell/materials 1.0.498 → 1.0.500
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 +16 -11
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +7 -3
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +2 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +11 -2
- 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 +3 -7
- 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/Translation/BaseTranslation.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.js +103 -0
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.js +13 -0
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.less +11 -0
- package/es/components/dataSourceComponents/fields/Translation/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Translation/WithMode.js +5 -0
- package/es/components/dataSourceComponents/fields/Translation/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Translation/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Translation/index.less +61 -0
- package/es/components/dataSourceComponents/fields/Translation/type.d.ts +15 -0
- package/es/components/dataSourceComponents/fields/Translation/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +377 -235
- package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/ReadPretty.js +35 -11
- 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 +56 -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 +240 -215
- package/es/components/dataSourceComponents/fields/index.d.ts +4 -2
- package/es/components/dataSourceComponents/fields/index.js +4 -1
- package/es/hooks/useTranslationOriginal.d.ts +2 -0
- package/es/hooks/useTranslationOriginal.js +9 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locales/en-US.d.ts +6 -0
- package/es/locales/en-US.js +12 -2
- package/es/locales/zh-CN.d.ts +6 -0
- package/es/locales/zh-CN.js +7 -1
- package/es/locales/zh-TW.d.ts +6 -0
- package/es/locales/zh-TW.js +7 -1
- 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 +11 -9
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +2 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +10 -1
- 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 +6 -8
- 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/Translation/BaseTranslation.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.js +107 -0
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.js +50 -0
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.less +11 -0
- package/lib/components/dataSourceComponents/fields/Translation/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Translation/WithMode.js +39 -0
- package/lib/components/dataSourceComponents/fields/Translation/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Translation/index.js +38 -0
- package/lib/components/dataSourceComponents/fields/Translation/index.less +61 -0
- package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +15 -0
- package/lib/components/dataSourceComponents/fields/Translation/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +384 -247
- package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.js +24 -4
- 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 +56 -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 +207 -254
- package/lib/components/dataSourceComponents/fields/index.d.ts +4 -2
- package/lib/components/dataSourceComponents/fields/index.js +4 -1
- package/lib/hooks/useTranslationOriginal.d.ts +2 -0
- package/lib/hooks/useTranslationOriginal.js +41 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/locales/en-US.d.ts +6 -0
- package/lib/locales/en-US.js +8 -1
- package/lib/locales/zh-CN.d.ts +6 -0
- package/lib/locales/zh-CN.js +7 -1
- package/lib/locales/zh-TW.d.ts +6 -0
- package/lib/locales/zh-TW.js +7 -1
- package/lowcode/data-source-form/constants.ts +1 -0
- package/lowcode/data-source-form/utils.ts +16 -4
- package/lowcode/data-source-table/utils.tsx +2 -2
- package/lowcode/form-item-translation/meta.ts +249 -0
- package/lowcode/form-item-translation/snippets.ts +13 -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,11 +26,8 @@ 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";
|
|
28
|
-
import
|
|
29
|
+
import useTranslationOriginal from "../../../hooks/useTranslationOriginal";
|
|
29
30
|
import "./style.less";
|
|
30
|
-
var translationOriginal = function translationOriginal(val) {
|
|
31
|
-
return val.original;
|
|
32
|
-
};
|
|
33
31
|
/**
|
|
34
32
|
* @title: 增加renderMode属性
|
|
35
33
|
* @description: 基于renderMode属性控制渲染模式
|
|
@@ -53,7 +51,7 @@ export var withMode = function withMode(FieldComponent, ReadPrettyComponent, tra
|
|
|
53
51
|
onChange: onChange,
|
|
54
52
|
renderMode: renderMode
|
|
55
53
|
});
|
|
56
|
-
if (
|
|
54
|
+
if (['view', 'tableView'].includes(renderMode) && ReadPrettyComponent) {
|
|
57
55
|
return /*#__PURE__*/React.createElement(ReadPrettyComponent, transformedProps);
|
|
58
56
|
}
|
|
59
57
|
if (renderMode === 'disabled') {
|
|
@@ -259,7 +257,9 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
|
|
|
259
257
|
validateTrigger: validateTrigger,
|
|
260
258
|
labelCol: labelCol,
|
|
261
259
|
initialValue: otherProps === null || otherProps === void 0 ? void 0 : otherProps.defaultValue,
|
|
262
|
-
className:
|
|
260
|
+
className: classNames('pisell-data-source-form-item', {
|
|
261
|
+
'pisell-data-source-form-item-view': effectiveMode === 'view'
|
|
262
|
+
})
|
|
263
263
|
}, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.otherFormItemProps), renderComponent);
|
|
264
264
|
};
|
|
265
265
|
};
|
|
@@ -274,8 +274,7 @@ export var withDataSource = function withDataSource(WrappedComponent) {
|
|
|
274
274
|
export var withOptions = function withOptions(WrappedComponent) {
|
|
275
275
|
return function (props) {
|
|
276
276
|
var _list$data2;
|
|
277
|
-
var
|
|
278
|
-
translationOriginal = context.appHelper.utils.translationOriginal || translationOriginal;
|
|
277
|
+
var translationOriginal = useTranslationOriginal();
|
|
279
278
|
var propsOptions = props.options,
|
|
280
279
|
optionSourceType = props.optionSourceType,
|
|
281
280
|
labelField = props.labelField,
|
|
@@ -329,21 +328,27 @@ export var getNestedValue = function getNestedValue(obj, path) {
|
|
|
329
328
|
};
|
|
330
329
|
|
|
331
330
|
// 根据valueMap渲染value 用于ReadPretty组件 Select Radio Checkbox
|
|
332
|
-
export var renderValueWithMap = function renderValueWithMap(value, valueMap) {
|
|
331
|
+
export var renderValueWithMap = function renderValueWithMap(value, valueMap, renderMode) {
|
|
332
|
+
var textStyle = renderMode === 'tableView' ? {
|
|
333
|
+
fontSize: 14,
|
|
334
|
+
fontWeight: 400
|
|
335
|
+
} : {};
|
|
333
336
|
if (isArr(value)) {
|
|
334
337
|
return /*#__PURE__*/React.createElement("span", {
|
|
335
338
|
className: "pisell-form-read-pretty-text"
|
|
336
339
|
}, value.map(function (item, index) {
|
|
337
340
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
338
341
|
key: item,
|
|
339
|
-
className: "pisell-form-read-pretty-value"
|
|
342
|
+
className: "pisell-form-read-pretty-value",
|
|
343
|
+
style: textStyle
|
|
340
344
|
}, valueMap === null || valueMap === void 0 ? void 0 : valueMap[item]), index < value.length - 1 && ',');
|
|
341
345
|
}));
|
|
342
346
|
} else if (isString(value)) {
|
|
343
347
|
return /*#__PURE__*/React.createElement("span", {
|
|
344
348
|
className: "pisell-form-read-pretty-text"
|
|
345
349
|
}, /*#__PURE__*/React.createElement("span", {
|
|
346
|
-
className: "pisell-form-read-pretty-value"
|
|
350
|
+
className: "pisell-form-read-pretty-value",
|
|
351
|
+
style: textStyle
|
|
347
352
|
}, (valueMap === null || valueMap === void 0 ? void 0 : valueMap[value]) || value));
|
|
348
353
|
}
|
|
349
354
|
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
|
|
@@ -34,7 +34,8 @@ var fieldType2FilterMap = {
|
|
|
34
34
|
'Input.URL': 'FormItemInput',
|
|
35
35
|
'Input.Password': 'FormItemInput',
|
|
36
36
|
'Radio.Group': 'FormItemSelect',
|
|
37
|
-
'Checkbox.Group': 'FormItemSelect'
|
|
37
|
+
'Checkbox.Group': 'FormItemSelect',
|
|
38
|
+
'Translation': 'FormItemTranslation'
|
|
38
39
|
};
|
|
39
40
|
var getCptProps = function getCptProps(field, cptType, item) {
|
|
40
41
|
var _field$uiSchema, _props, _field$uiSchema2, _field$uiSchema3, _field$uiSchema3$enum, _field$uiSchema6, _field$uiSchema8, _item$other;
|
|
@@ -9,7 +9,7 @@ import React, { useMemo } from 'react';
|
|
|
9
9
|
import { getFieldComponent } from "../../fields";
|
|
10
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;
|
|
@@ -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
|
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputProps } from 'antd';
|
|
3
|
+
import { ModeType } from "../../dataSourceForm/type";
|
|
3
4
|
export interface PhoneInputProps extends Omit<InputProps, 'value' | 'onChange'> {
|
|
5
|
+
renderMode: ModeType;
|
|
4
6
|
value?: string;
|
|
5
7
|
onChange?: (value: string) => void;
|
|
6
8
|
isVerification?: boolean;
|
|
@@ -11,15 +11,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
11
11
|
import React, { useState, useEffect, useMemo } from 'react';
|
|
12
12
|
import { Input, Select, Space } from 'antd';
|
|
13
13
|
import { isValidPhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
14
|
-
import
|
|
14
|
+
import { isNumber } from '@pisell/utils';
|
|
15
15
|
import { useCountries } from "./serve";
|
|
16
16
|
import ReadPretty from "./ReadPretty";
|
|
17
17
|
import { withMode } from "../../dataSourceForm/utils";
|
|
18
|
-
import
|
|
18
|
+
import useTranslationOriginal from "../../../../hooks/useTranslationOriginal";
|
|
19
19
|
var Option = Select.Option;
|
|
20
|
-
var translationOriginal = function translationOriginal(val) {
|
|
21
|
-
return val.original;
|
|
22
|
-
};
|
|
23
20
|
var PhoneInput = function PhoneInput(_ref) {
|
|
24
21
|
var propsValue = _ref.value,
|
|
25
22
|
onChange = _ref.onChange,
|
|
@@ -28,8 +25,7 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
28
25
|
var _useCountries = useCountries(),
|
|
29
26
|
_useCountries$data = _useCountries.data,
|
|
30
27
|
countries = _useCountries$data === void 0 ? [] : _useCountries$data;
|
|
31
|
-
var
|
|
32
|
-
translationOriginal = context.appHelper.utils.translationOriginal || translationOriginal;
|
|
28
|
+
var translationOriginal = useTranslationOriginal();
|
|
33
29
|
var value = useMemo(function () {
|
|
34
30
|
if (isNumber(propsValue)) {
|
|
35
31
|
return "".concat(propsValue);
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import "./ReadPretty.less";
|
|
3
4
|
var TextAreaReadPretty = function TextAreaReadPretty(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-textarea-read-pretty', {
|
|
9
|
+
'pisell-input-textarea-read-pretty-table-view': renderMode === 'tableView'
|
|
10
|
+
})
|
|
11
|
+
}, value);
|
|
7
12
|
};
|
|
8
13
|
export default TextAreaReadPretty;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Typography } from 'antd';
|
|
3
|
+
import classNames from 'classnames';
|
|
3
4
|
import "./ReadPretty.less";
|
|
4
5
|
var Link = Typography.Link;
|
|
5
6
|
var UrlReadPretty = function UrlReadPretty(props) {
|
|
7
|
+
var value = props.value,
|
|
8
|
+
renderMode = props.renderMode;
|
|
6
9
|
return /*#__PURE__*/React.createElement(Link, {
|
|
7
|
-
className:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
className: classNames('pisell-url-read-pretty', {
|
|
11
|
+
'pisell-url-read-pretty-table-view': renderMode === 'tableView'
|
|
12
|
+
}),
|
|
13
|
+
href: value
|
|
14
|
+
}, value);
|
|
10
15
|
};
|
|
11
16
|
export default UrlReadPretty;
|