@teamias/rex-design 0.0.23 → 0.0.26
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/dist/components/base-form/components/ProFormDateRangePickerV2.d.ts +19 -0
- package/dist/components/base-form/components/ProFormDateRangePickerV2.js +176 -0
- package/dist/components/base-form/components/ProFormDigitRangeV2.d.ts +31 -0
- package/dist/components/base-form/components/ProFormDigitRangeV2.js +216 -0
- package/dist/components/base-form/components/RenderText.d.ts +7 -0
- package/dist/components/base-form/components/RenderText.js +9 -0
- package/dist/components/base-form/demo/BaseFormBasicTest.js +3 -2
- package/dist/components/base-form/demo/BaseFormCustomContent.js +6 -3
- package/dist/components/base-form/demo/BaseProFormDateRangePickerV2.d.ts +2 -0
- package/dist/components/base-form/demo/BaseProFormDateRangePickerV2.js +50 -0
- package/dist/components/base-form/demo/BaseProFormDigitRangeV2.d.ts +2 -0
- package/dist/components/base-form/demo/BaseProFormDigitRangeV2.js +58 -0
- package/dist/components/base-form/demo/index.js +7 -2
- package/dist/components/base-form/modules/renderComponentNode.js +34 -0
- package/dist/components/base-form/types.d.ts +6 -2
- package/dist/components/base-table/base-table.d.ts +6 -2
- package/dist/components/base-table/base-table.js +8 -1
- package/dist/components/base-table/demo/DynamicData.d.ts +2 -0
- package/dist/components/base-table/demo/DynamicData.js +67 -0
- package/dist/components/big-input/big-input.d.ts +0 -1
- package/dist/components/big-input/big-input.js +3 -4
- package/dist/components/big-input/demo/index.js +4 -4
- package/dist/components/data-cell/demo/DynamicData.d.ts +2 -0
- package/dist/components/data-cell/demo/DynamicData.js +80 -0
- package/dist/components/data-cell/index.d.ts +1 -0
- package/dist/components/data-cell/index.js +2 -1
- package/dist/components/data-cell/types.d.ts +6 -0
- package/dist/components/data-cell/utils/index.d.ts +3 -0
- package/dist/components/data-cell/utils/index.js +68 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/upload-plus/demo/index.js +5 -5
- package/dist/components/upload-plus/index.d.ts +1 -1
- package/dist/components/upload-plus/index.js +2 -2
- package/dist/components/upload-plus/types.d.ts +1 -2
- package/dist/components/upload-plus/upload-plus.d.ts +1 -2
- package/dist/components/upload-plus/upload-plus.js +2 -3
- package/package.json +3 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { RexProConfigProvider } from "../../../context";
|
|
2
|
+
import { ProForm, ProFormText } from '@ant-design/pro-components';
|
|
3
|
+
import { createIntl } from 'react-intl';
|
|
4
|
+
import { ProFormDigitRangeV2 } from "../components/ProFormDigitRangeV2";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export default (function () {
|
|
8
|
+
return /*#__PURE__*/_jsx(RexProConfigProvider, {
|
|
9
|
+
value: {
|
|
10
|
+
intl: createIntl({
|
|
11
|
+
locale: 'en-US',
|
|
12
|
+
messages: {}
|
|
13
|
+
})
|
|
14
|
+
// apiClient: (api, params) => {
|
|
15
|
+
// return fetch(api, {method: 'post', body: JSON.stringify(params)}).then((res) => ({data: []}));
|
|
16
|
+
// },
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/_jsxs(ProForm, {
|
|
19
|
+
initialValues: {
|
|
20
|
+
data: {
|
|
21
|
+
// min: 2,
|
|
22
|
+
// max: 1111,
|
|
23
|
+
},
|
|
24
|
+
testName: 'qweqwe'
|
|
25
|
+
}
|
|
26
|
+
// size="small"
|
|
27
|
+
// disabled
|
|
28
|
+
// readonly
|
|
29
|
+
,
|
|
30
|
+
layout: "horizontal",
|
|
31
|
+
onFinish: function onFinish(values) {
|
|
32
|
+
console.log(values);
|
|
33
|
+
},
|
|
34
|
+
children: [/*#__PURE__*/_jsx(ProFormDigitRangeV2, {
|
|
35
|
+
required: true,
|
|
36
|
+
label: "\u6570\u5B57\u8303\u56F4",
|
|
37
|
+
name: [['data', 'min'], ['data', 'max']],
|
|
38
|
+
initialValue: [undefined, 3],
|
|
39
|
+
formItemProps: {
|
|
40
|
+
style: {
|
|
41
|
+
margin: 0
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
fieldProps: {
|
|
45
|
+
min: 0,
|
|
46
|
+
max: 1000
|
|
47
|
+
}
|
|
48
|
+
}), /*#__PURE__*/_jsx(ProFormText, {
|
|
49
|
+
required: true,
|
|
50
|
+
rules: [{
|
|
51
|
+
required: true
|
|
52
|
+
}],
|
|
53
|
+
label: "\u6D4B\u8BD5\u6587\u672C",
|
|
54
|
+
name: "testName"
|
|
55
|
+
})]
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -137,10 +137,15 @@ export default (function () {
|
|
|
137
137
|
b: 2
|
|
138
138
|
}
|
|
139
139
|
}, {
|
|
140
|
-
valueType: '
|
|
140
|
+
valueType: 'dateRangeV2',
|
|
141
141
|
field: ['dateRange-start', 'dateRange-end'],
|
|
142
142
|
label: 'dateRange',
|
|
143
|
-
defaultValue: -29
|
|
143
|
+
defaultValue: -29,
|
|
144
|
+
required: true,
|
|
145
|
+
fieldProps: {
|
|
146
|
+
showTime: true,
|
|
147
|
+
format: 'YYYY/MM/DD HH:mm:ss'
|
|
148
|
+
}
|
|
144
149
|
}, {
|
|
145
150
|
valueType: 'cascader',
|
|
146
151
|
field: 'cascader',
|
|
@@ -21,6 +21,8 @@ import { ProFormCascader, ProFormCheckbox, ProFormDatePicker, ProFormDateRangePi
|
|
|
21
21
|
import classNames from 'classnames';
|
|
22
22
|
import dayjs from 'dayjs';
|
|
23
23
|
import { BaseForm } from "../base-form";
|
|
24
|
+
import { ProFormDateRangePickerV2 } from "../components/ProFormDateRangePickerV2";
|
|
25
|
+
import { ProFormDigitRangeV2 } from "../components/ProFormDigitRangeV2";
|
|
24
26
|
import { getFieldsDefaultValues } from "./handlerData";
|
|
25
27
|
import { createElement as _createElement } from "react";
|
|
26
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -460,6 +462,20 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
460
462
|
}
|
|
461
463
|
});
|
|
462
464
|
}
|
|
465
|
+
if (valueType === 'dateRangeV2') {
|
|
466
|
+
// const initialValues = getFieldsDefaultValues([item]);
|
|
467
|
+
return dynamicCom(ProFormDateRangePickerV2, {
|
|
468
|
+
name: [splitKeyStr(fields[0]), splitKeyStr(fields[1])],
|
|
469
|
+
placeholder: [formatMessage({
|
|
470
|
+
id: 'rex.components.base-form.placeholder.date-range.start',
|
|
471
|
+
defaultMessage: '开始时间'
|
|
472
|
+
}), formatMessage({
|
|
473
|
+
id: 'rex.components.base-form.placeholder.date-range.end',
|
|
474
|
+
defaultMessage: '结束时间'
|
|
475
|
+
})],
|
|
476
|
+
initialValue: defaultValue
|
|
477
|
+
});
|
|
478
|
+
}
|
|
463
479
|
if (valueType === 'cascader') {
|
|
464
480
|
return dynamicCom(ProFormCascader, {
|
|
465
481
|
fieldProps: {
|
|
@@ -602,6 +618,24 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
602
618
|
})]
|
|
603
619
|
});
|
|
604
620
|
}
|
|
621
|
+
if (valueType === 'inputNumberRangeV2') {
|
|
622
|
+
return dynamicCom(ProFormDigitRangeV2, {
|
|
623
|
+
initialValue: defaultValue,
|
|
624
|
+
// name: keyStr as [string, string],
|
|
625
|
+
name: [splitKeyStr(fields[0]), splitKeyStr(fields[1])],
|
|
626
|
+
// transform: (inrValues: Array<number | undefined>) => ({
|
|
627
|
+
// [fields[0]]: inrValues[0],
|
|
628
|
+
// [fields[1]]: inrValues[1],
|
|
629
|
+
// }),
|
|
630
|
+
placeholder: [formatMessage({
|
|
631
|
+
id: 'rex.components.base-form.placeholder.input-number-range.min',
|
|
632
|
+
defaultMessage: '最小值'
|
|
633
|
+
}), formatMessage({
|
|
634
|
+
id: 'rex.components.base-form.placeholder.input-number-range.max',
|
|
635
|
+
defaultMessage: '最大值'
|
|
636
|
+
})]
|
|
637
|
+
});
|
|
638
|
+
}
|
|
605
639
|
if (valueType === 'textArea') {
|
|
606
640
|
return dynamicCom(ProFormTextArea, {
|
|
607
641
|
initialValue: defaultValue,
|
|
@@ -2,10 +2,12 @@ import { ProForm, ProFormCascader, ProFormCheckbox, ProFormDatePicker, ProFormDa
|
|
|
2
2
|
import { TButtonFilterItem } from "../..";
|
|
3
3
|
import { Form, GetProps } from 'antd';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
+
import { ProFormDateRangePickerV2 } from './components/ProFormDateRangePickerV2';
|
|
6
|
+
import { ProFormDigitRangeV2 } from './components/ProFormDigitRangeV2';
|
|
5
7
|
/** 组件props */
|
|
6
8
|
export interface IBaseFormProps {
|
|
7
9
|
/** 字段配置 */
|
|
8
|
-
fields?: Array<TInputProps | TDateRangeProps | TSelectProps | TSelectInputProps | TSelectDimProps | TCustomProps | TSelectDateRangeProps | TCascaderProps | TTreeSelectProps | TCheckboxProps | TCheckboxGroupProps | TRadioGroupProps | TInputNumberProps | TInputNumberRangeProps | TTextAreaProps | TSelectRadioProps | TMultipleComponentsProps | TSwitchProps | TDatePickerProps | THiddenProps>;
|
|
10
|
+
fields?: Array<TInputProps | TDateRangeProps | TSelectProps | TSelectInputProps | TSelectDimProps | TCustomProps | TSelectDateRangeProps | TCascaderProps | TTreeSelectProps | TCheckboxProps | TCheckboxGroupProps | TRadioGroupProps | TInputNumberProps | TInputNumberRangeProps | TTextAreaProps | TSelectRadioProps | TMultipleComponentsProps | TSwitchProps | TDatePickerProps | THiddenProps | TInputNumberRangeV2Props | TDateRangeV2Props>;
|
|
9
11
|
/** 字段对应的本地代码配置 */
|
|
10
12
|
fieldProps?: Record<string, Exclude<IBaseFormProps['fields'], undefined>[number]>;
|
|
11
13
|
/**
|
|
@@ -29,6 +31,7 @@ export type TInputProps = IBaseFormFieldItem<'input'> & Omit<GetProps<typeof Pro
|
|
|
29
31
|
export type TSelectProps = IBaseFormFieldItem<'select'> & Omit<GetProps<typeof ProFormSelect>, TOmitComponentItemType>;
|
|
30
32
|
export type TSelectDimProps = IBaseFormFieldItem<'selectDim'> & Omit<GetProps<typeof ProFormSelect>, TOmitComponentItemType>;
|
|
31
33
|
export type TDateRangeProps = IBaseFormFieldItem<'dateRange'> & Omit<GetProps<typeof ProFormDateRangePicker>, TOmitComponentItemType>;
|
|
34
|
+
export type TDateRangeV2Props = IBaseFormFieldItem<'dateRangeV2'> & Omit<GetProps<typeof ProFormDateRangePickerV2>, TOmitComponentItemType>;
|
|
32
35
|
export type TCascaderProps = IBaseFormFieldItem<'cascader'> & Omit<GetProps<typeof ProFormCascader>, TOmitComponentItemType>;
|
|
33
36
|
export type TTreeSelectProps = IBaseFormFieldItem<'treeSelect'> & Omit<GetProps<typeof ProFormTreeSelect>, TOmitComponentItemType>;
|
|
34
37
|
export type TCheckboxProps = IBaseFormFieldItem<'checkbox'> & Omit<GetProps<typeof ProFormCheckbox>, TOmitComponentItemType>;
|
|
@@ -36,6 +39,7 @@ export type TCheckboxGroupProps = IBaseFormFieldItem<'checkboxGroup'> & Omit<Get
|
|
|
36
39
|
export type TRadioGroupProps = IBaseFormFieldItem<'radioGroup'> & Omit<GetProps<typeof ProFormRadio>, TOmitComponentItemType>;
|
|
37
40
|
export type TInputNumberProps = IBaseFormFieldItem<'inputNumber'> & Omit<GetProps<typeof ProFormDigit>, TOmitComponentItemType>;
|
|
38
41
|
export type TInputNumberRangeProps = IBaseFormFieldItem<'inputNumberRange'> & Omit<GetProps<typeof ProFormDigitRange>, TOmitComponentItemType>;
|
|
42
|
+
export type TInputNumberRangeV2Props = IBaseFormFieldItem<'inputNumberRangeV2'> & Omit<GetProps<typeof ProFormDigitRangeV2>, TOmitComponentItemType>;
|
|
39
43
|
export type TTextAreaProps = IBaseFormFieldItem<'textArea'> & Omit<GetProps<typeof ProFormTextArea>, TOmitComponentItemType>;
|
|
40
44
|
export type TSelectRadioProps = IBaseFormFieldItem<'selectRadio'> & Omit<GetProps<typeof ProFormSelect>, TOmitComponentItemType>;
|
|
41
45
|
export type TSwitchProps = IBaseFormFieldItem<'switch'> & Omit<GetProps<typeof ProFormSwitch>, TOmitComponentItemType>;
|
|
@@ -178,5 +182,5 @@ export type TValueType = 'input'
|
|
|
178
182
|
* @desc 下拉框+输入框
|
|
179
183
|
* @deprecated 建议使用 multipleComponents 进行组合
|
|
180
184
|
*/
|
|
181
|
-
| 'selectInput' | 'selectDim' | 'dateRange' | 'selectDateRange' | 'cascader' | 'treeSelect' | 'checkbox' | 'checkboxGroup' | 'radioGroup' | 'inputNumber' | 'inputNumberRange' | 'textArea' | 'selectRadio' | 'multipleComponents' | 'switch' | 'datePicker' | 'hidden' | 'upload' | 'table' | 'custom';
|
|
185
|
+
| 'selectInput' | 'selectDim' | 'dateRange' | 'dateRangeV2' | 'selectDateRange' | 'cascader' | 'treeSelect' | 'checkbox' | 'checkboxGroup' | 'radioGroup' | 'inputNumber' | 'inputNumberRange' | 'inputNumberRangeV2' | 'textArea' | 'selectRadio' | 'multipleComponents' | 'switch' | 'datePicker' | 'hidden' | 'upload' | 'table' | 'custom';
|
|
182
186
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GetProps, Table } from 'antd';
|
|
3
|
-
import { IDataCellItem, TGroupV2 } from '../data-cell
|
|
4
|
-
export declare const BaseTable: <T extends object = object>({ useDataCellRender, fields: outFields, fieldsConfig, fieldProps: outFieldProps, requestFields, requestFieldsUrl, requestFieldsParams, fieldPropsFn, indexColumn, extraColumns, onDataCellClick, onDataCellClickV2, scroll, rootClassName, customEmptyText, headerStyle: topHeaderStyle, ...otherProps }: IBaseTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
import { IDataCellItem, TDataCellConfig, TGroupV2 } from '../data-cell';
|
|
4
|
+
export declare const BaseTable: <T extends object = object>({ useDataCellRender, fields: outFields, fieldsConfig, fieldProps: outFieldProps, requestFields, requestFieldsUrl, requestFieldsParams, fieldPropsFn, indexColumn, extraColumns, onDataCellClick, onDataCellClickV2, scroll, rootClassName, customEmptyText, headerStyle: topHeaderStyle, useDataCellConfig, dataCellConfig, dataSource, ...otherProps }: IBaseTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
/** 组件props */
|
|
6
6
|
export interface IBaseTableProps<T extends object = object> extends Omit<TRawTableProps<T>, 'size' | 'bordered' | 'tableLayout' | 'scroll'> {
|
|
7
7
|
/** @deprecated 使用 fieldsConfig */
|
|
@@ -29,6 +29,10 @@ export interface IBaseTableProps<T extends object = object> extends Omit<TRawTab
|
|
|
29
29
|
* @default true
|
|
30
30
|
*/
|
|
31
31
|
useDataCellRender?: boolean;
|
|
32
|
+
/** 是否使用 dataCell 配置,进行渲染 */
|
|
33
|
+
useDataCellConfig?: boolean;
|
|
34
|
+
/** dataCell 组件配置项, 通过这种方式来配置单元格内容,简化bff层的逻辑 */
|
|
35
|
+
dataCellConfig?: TDataCellConfig;
|
|
32
36
|
/** dataCell组件中的点击回调 */
|
|
33
37
|
onDataCellClick?: (item: IDataCellItem, dataIndex: string, record: T, index: number) => void;
|
|
34
38
|
onDataCellClickV2?: (data: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["useDataCellRender", "fields", "fieldsConfig", "fieldProps", "requestFields", "requestFieldsUrl", "requestFieldsParams", "fieldPropsFn", "indexColumn", "extraColumns", "onDataCellClick", "onDataCellClickV2", "scroll", "rootClassName", "customEmptyText", "headerStyle"];
|
|
1
|
+
var _excluded = ["useDataCellRender", "fields", "fieldsConfig", "fieldProps", "requestFields", "requestFieldsUrl", "requestFieldsParams", "fieldPropsFn", "indexColumn", "extraColumns", "onDataCellClick", "onDataCellClickV2", "scroll", "rootClassName", "customEmptyText", "headerStyle", "useDataCellConfig", "dataCellConfig", "dataSource"];
|
|
2
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -12,6 +12,7 @@ import { useDebounceEffect } from 'ahooks';
|
|
|
12
12
|
import { ConfigProvider, Empty, Skeleton, Table } from 'antd';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useMemo } from 'react';
|
|
15
|
+
import { dataToDataCellData } from "../data-cell";
|
|
15
16
|
import { DataCell } from "../data-cell/data-cell";
|
|
16
17
|
import { BaseTableRow } from "./components/BaseTableRow";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -35,6 +36,10 @@ export var BaseTable = function BaseTable(_ref) {
|
|
|
35
36
|
rootClassName = _ref.rootClassName,
|
|
36
37
|
customEmptyText = _ref.customEmptyText,
|
|
37
38
|
topHeaderStyle = _ref.headerStyle,
|
|
39
|
+
useDataCellConfig = _ref.useDataCellConfig,
|
|
40
|
+
_ref$dataCellConfig = _ref.dataCellConfig,
|
|
41
|
+
dataCellConfig = _ref$dataCellConfig === void 0 ? [] : _ref$dataCellConfig,
|
|
42
|
+
dataSource = _ref.dataSource,
|
|
38
43
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
39
44
|
var responseConfig = useRequestFieldsConfig();
|
|
40
45
|
var _useRexProConfigProvi = useRexProConfigProvider(),
|
|
@@ -60,6 +65,7 @@ export var BaseTable = function BaseTable(_ref) {
|
|
|
60
65
|
}),
|
|
61
66
|
loading = _useRequestFields.loading,
|
|
62
67
|
fields = _useRequestFields.fields;
|
|
68
|
+
// const newDataSrouce = useMemo(() => useDataCellConfig ? dataToDataCellData(dataSource as [], dataCellConfig) as [] : dataSource, [])
|
|
63
69
|
|
|
64
70
|
/** 表格点击事件 */
|
|
65
71
|
var cellClick = function cellClick(data) {
|
|
@@ -272,6 +278,7 @@ export var BaseTable = function BaseTable(_ref) {
|
|
|
272
278
|
})),
|
|
273
279
|
rowKey: "key"
|
|
274
280
|
}, otherProps), {}, {
|
|
281
|
+
dataSource: useDataCellConfig ? dataToDataCellData(dataSource, dataCellConfig) : dataSource,
|
|
275
282
|
rootClassName: classNames(state.tableKey, rootClassName),
|
|
276
283
|
onRow: function onRow() {
|
|
277
284
|
return {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BaseTable } from "../base-table";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export default (function () {
|
|
4
|
+
var config = [{
|
|
5
|
+
field: 'goods_image',
|
|
6
|
+
items: [{
|
|
7
|
+
type: 'group-v2',
|
|
8
|
+
props: {
|
|
9
|
+
items: [{
|
|
10
|
+
type: 'text',
|
|
11
|
+
action: 'default',
|
|
12
|
+
value: '{{ dqewe }}'
|
|
13
|
+
}]
|
|
14
|
+
},
|
|
15
|
+
extra: {}
|
|
16
|
+
}],
|
|
17
|
+
key: '1763099807878ve0lbd1'
|
|
18
|
+
}, {
|
|
19
|
+
field: 'sku_size',
|
|
20
|
+
items: [{
|
|
21
|
+
type: 'group-v2',
|
|
22
|
+
props: {
|
|
23
|
+
items: [{
|
|
24
|
+
type: 'text',
|
|
25
|
+
action: 'default',
|
|
26
|
+
value: '{{ qweqwe }}'
|
|
27
|
+
}, {
|
|
28
|
+
type: 'text',
|
|
29
|
+
action: 'default',
|
|
30
|
+
value: '{{ eeeeeeqw }}'
|
|
31
|
+
}, {
|
|
32
|
+
type: 'text',
|
|
33
|
+
action: 'default',
|
|
34
|
+
value: 'eeeeeeqw'
|
|
35
|
+
}],
|
|
36
|
+
itemsDirection: 'row',
|
|
37
|
+
itemsGap: 4,
|
|
38
|
+
itemsSeparator: '/',
|
|
39
|
+
label: 'weqw'
|
|
40
|
+
},
|
|
41
|
+
extra: {}
|
|
42
|
+
}],
|
|
43
|
+
key: '1763099807878dft337k'
|
|
44
|
+
}];
|
|
45
|
+
var data = [{
|
|
46
|
+
qweqwe: 1,
|
|
47
|
+
dqewe: '图片1',
|
|
48
|
+
eeeeeeqw: 'false'
|
|
49
|
+
}, {
|
|
50
|
+
qweqwe: 2,
|
|
51
|
+
dqewe: '图片2',
|
|
52
|
+
eeeeeeqw: 'true'
|
|
53
|
+
}];
|
|
54
|
+
return /*#__PURE__*/_jsx(BaseTable, {
|
|
55
|
+
fieldsConfig: [{
|
|
56
|
+
title: 'sku_size',
|
|
57
|
+
dataIndex: 'sku_size'
|
|
58
|
+
}, {
|
|
59
|
+
title: 'goods_image',
|
|
60
|
+
dataIndex: 'goods_image'
|
|
61
|
+
}],
|
|
62
|
+
useDataCellRender: true,
|
|
63
|
+
useDataCellConfig: true,
|
|
64
|
+
dataCellConfig: config,
|
|
65
|
+
dataSource: data
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -7,15 +7,15 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
|
-
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
11
10
|
import Input from 'antd/es/input';
|
|
11
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
var TextArea = Input.TextArea;
|
|
16
16
|
export var BigInput = function BigInput(props) {
|
|
17
17
|
var _props$placeholder = props.placeholder,
|
|
18
|
-
placeholder = _props$placeholder === void 0 ?
|
|
18
|
+
placeholder = _props$placeholder === void 0 ? '请输入' : _props$placeholder,
|
|
19
19
|
handleChange = props.onChange,
|
|
20
20
|
handleBlur = props.onBlur,
|
|
21
21
|
handleFocus = props.onFocus,
|
|
@@ -169,5 +169,4 @@ export var BigInput = function BigInput(props) {
|
|
|
169
169
|
className: className
|
|
170
170
|
}, "input")
|
|
171
171
|
});
|
|
172
|
-
};
|
|
173
|
-
export default BigInput;
|
|
172
|
+
};
|
|
@@ -11,11 +11,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import { RexProConfigProvider } from "../../../context";
|
|
14
|
-
import enUS from "antd/es/calendar/locale/en_US";
|
|
15
|
-
import { crush } from "radash";
|
|
16
|
-
import { createIntl } from "react-intl";
|
|
17
14
|
import { BigInput } from "../../..";
|
|
18
|
-
import
|
|
15
|
+
import enUS from 'antd/es/calendar/locale/en_US';
|
|
16
|
+
import { crush } from 'radash';
|
|
17
|
+
import { useState } from 'react';
|
|
18
|
+
import { createIntl } from 'react-intl';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
21
|
export default (function () {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DataCell } from "../data-cell";
|
|
2
|
+
import { dataToDataCellData } from "../utils";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export default (function () {
|
|
7
|
+
var _dataSource$, _dataSource$2, _dataSource$3, _dataSource$4;
|
|
8
|
+
var config = [{
|
|
9
|
+
field: 'goods_image',
|
|
10
|
+
items: [{
|
|
11
|
+
type: 'group-v2',
|
|
12
|
+
props: {
|
|
13
|
+
items: [{
|
|
14
|
+
type: 'text',
|
|
15
|
+
action: 'default',
|
|
16
|
+
value: '{{ dqewe }}'
|
|
17
|
+
}]
|
|
18
|
+
},
|
|
19
|
+
extra: {}
|
|
20
|
+
}],
|
|
21
|
+
key: '1763099807878ve0lbd1'
|
|
22
|
+
}, {
|
|
23
|
+
field: 'sku_size',
|
|
24
|
+
items: [{
|
|
25
|
+
type: 'group-v2',
|
|
26
|
+
props: {
|
|
27
|
+
items: [{
|
|
28
|
+
type: 'text',
|
|
29
|
+
action: 'default',
|
|
30
|
+
value: '{{ qweqwe }}'
|
|
31
|
+
}, {
|
|
32
|
+
type: 'text',
|
|
33
|
+
action: 'default',
|
|
34
|
+
value: '{{ eeeeeeqw }}'
|
|
35
|
+
}, {
|
|
36
|
+
type: 'text',
|
|
37
|
+
action: 'default',
|
|
38
|
+
value: 'eeeeeeqw'
|
|
39
|
+
}],
|
|
40
|
+
itemsDirection: 'row',
|
|
41
|
+
itemsGap: 4,
|
|
42
|
+
itemsSeparator: '/',
|
|
43
|
+
label: 'weqw'
|
|
44
|
+
},
|
|
45
|
+
extra: {}
|
|
46
|
+
}],
|
|
47
|
+
key: '1763099807878dft337k'
|
|
48
|
+
}];
|
|
49
|
+
var data = [{
|
|
50
|
+
qweqwe: 1,
|
|
51
|
+
dqewe: '图片1',
|
|
52
|
+
eeeeeeqw: 'false'
|
|
53
|
+
}, {
|
|
54
|
+
qweqwe: 2,
|
|
55
|
+
dqewe: '图片2',
|
|
56
|
+
eeeeeeqw: 'true'
|
|
57
|
+
}];
|
|
58
|
+
var dataSource = dataToDataCellData(data, config) || [];
|
|
59
|
+
// console.log(dataSource);
|
|
60
|
+
|
|
61
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
62
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
63
|
+
children: /*#__PURE__*/_jsx(DataCell, {
|
|
64
|
+
items: (_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 ? void 0 : _dataSource$.goods_image
|
|
65
|
+
})
|
|
66
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
67
|
+
children: /*#__PURE__*/_jsx(DataCell, {
|
|
68
|
+
items: (_dataSource$2 = dataSource[0]) === null || _dataSource$2 === void 0 ? void 0 : _dataSource$2.sku_size
|
|
69
|
+
})
|
|
70
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
71
|
+
children: /*#__PURE__*/_jsx(DataCell, {
|
|
72
|
+
items: (_dataSource$3 = dataSource[1]) === null || _dataSource$3 === void 0 ? void 0 : _dataSource$3.goods_image
|
|
73
|
+
})
|
|
74
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
75
|
+
children: /*#__PURE__*/_jsx(DataCell, {
|
|
76
|
+
items: (_dataSource$4 = dataSource[1]) === null || _dataSource$4 === void 0 ? void 0 : _dataSource$4.sku_size
|
|
77
|
+
})
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -190,3 +190,9 @@ export type TCellActionExtend = {
|
|
|
190
190
|
};
|
|
191
191
|
/** 支持配置的展示类型 */
|
|
192
192
|
export type TDataCellType = 'text' | 'link' | 'tag' | 'link-group' | 'img' | 'icon' | 'group' | 'group-v2';
|
|
193
|
+
/** 数据单元格配置 */
|
|
194
|
+
export type TDataCellConfig = Array<{
|
|
195
|
+
field: string;
|
|
196
|
+
key: string;
|
|
197
|
+
items: Array<TGroupV2>;
|
|
198
|
+
}>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import { get } from 'radash';
|
|
3
|
+
// 缓存编译后的正则表达式
|
|
4
|
+
var TEMPLATE_REGEX = /"{{\s*(.+?)\s*}}"/g;
|
|
5
|
+
|
|
6
|
+
// 缓存字符串转义函数
|
|
7
|
+
var escapeString = function escapeString(str) {
|
|
8
|
+
// 使用更高效的替换方式
|
|
9
|
+
var result = '';
|
|
10
|
+
for (var i = 0; i < str.length; i++) {
|
|
11
|
+
var char = str[i];
|
|
12
|
+
if (char === '\\') result += '\\\\';else if (char === '"') result += '\\"';else result += char;
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// 提取替换逻辑为独立函数,避免重复创建
|
|
18
|
+
var replaceTemplate = function replaceTemplate(item) {
|
|
19
|
+
return function (rawStr, matchKey) {
|
|
20
|
+
var trimmedKey = matchKey.trim();
|
|
21
|
+
var newVal = get(item, trimmedKey);
|
|
22
|
+
if (typeof newVal === 'string') {
|
|
23
|
+
return "\"".concat(escapeString(newVal), "\"");
|
|
24
|
+
} else if (typeof newVal === 'number' || typeof newVal === 'boolean') {
|
|
25
|
+
return String(newVal);
|
|
26
|
+
} else if (newVal === null || typeof newVal === 'undefined') {
|
|
27
|
+
return 'null';
|
|
28
|
+
} else if (_typeof(newVal) === 'object') {
|
|
29
|
+
return JSON.stringify(newVal);
|
|
30
|
+
}
|
|
31
|
+
return rawStr;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** 将 普通数据 转 dataCell 数据 */
|
|
36
|
+
export var dataToDataCellData = function dataToDataCellData(oldDataSource, config) {
|
|
37
|
+
if (!Array.isArray(config) || !config.length) return oldDataSource;
|
|
38
|
+
if (!oldDataSource || !oldDataSource.length) return oldDataSource;
|
|
39
|
+
var newDataSource = [];
|
|
40
|
+
|
|
41
|
+
// 预编译配置的 JSON 字符串,避免重复 stringify
|
|
42
|
+
var preCompiledConfigs = config.map(function (cfg) {
|
|
43
|
+
return {
|
|
44
|
+
field: cfg.field,
|
|
45
|
+
items: cfg.items,
|
|
46
|
+
jsonStr: JSON.stringify(cfg.items)
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
oldDataSource.forEach(function (item) {
|
|
50
|
+
// 保留原始数据的所有字段
|
|
51
|
+
var newItem = {
|
|
52
|
+
_raw: item
|
|
53
|
+
};
|
|
54
|
+
var replacer = replaceTemplate(item);
|
|
55
|
+
preCompiledConfigs.forEach(function (config) {
|
|
56
|
+
// 重置正则表达式的 lastIndex(虽然使用了 g 标志,但 replace 会自动处理)
|
|
57
|
+
var newJson = config.jsonStr.replace(TEMPLATE_REGEX, replacer);
|
|
58
|
+
try {
|
|
59
|
+
newItem[config.field] = JSON.parse(newJson);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error("DataCell config parse error for key \"".concat(config.field, "\":"), error, '\nJSON:', newJson);
|
|
62
|
+
newItem[config.field] = config.items;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
newDataSource.push(newItem);
|
|
66
|
+
});
|
|
67
|
+
return newDataSource;
|
|
68
|
+
};
|
|
@@ -3,9 +3,9 @@ export * from './base-descriptions';
|
|
|
3
3
|
export * from './base-form';
|
|
4
4
|
export * from './base-list-table';
|
|
5
5
|
export * from './base-table';
|
|
6
|
+
export * from './big-input';
|
|
6
7
|
export * from './data-cell';
|
|
7
8
|
export * from './icons';
|
|
8
9
|
export * from './media-viewer';
|
|
9
10
|
export * from './tiptap-editor';
|
|
10
|
-
export * from './big-input';
|
|
11
11
|
export * from './upload-plus';
|
package/dist/components/index.js
CHANGED
|
@@ -3,9 +3,9 @@ export * from "./base-descriptions";
|
|
|
3
3
|
export * from "./base-form";
|
|
4
4
|
export * from "./base-list-table";
|
|
5
5
|
export * from "./base-table";
|
|
6
|
+
export * from "./big-input";
|
|
6
7
|
export * from "./data-cell";
|
|
7
8
|
export * from "./icons";
|
|
8
9
|
export * from "./media-viewer";
|
|
9
10
|
export * from "./tiptap-editor";
|
|
10
|
-
export * from "./big-input";
|
|
11
11
|
export * from "./upload-plus";
|
|
@@ -5,11 +5,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { RexProConfigProvider } from "../../../context";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
8
|
+
import { UploadPlus } from "../../..";
|
|
9
|
+
import { Card, message } from 'antd';
|
|
10
|
+
import enUS from 'antd/es/calendar/locale/en_US';
|
|
11
|
+
import { crush } from 'radash';
|
|
12
|
+
import { createIntl } from 'react-intl';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
export default (function () {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./upload-plus";
|
|
@@ -10,7 +10,7 @@ import React from 'react';
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
var Dragger = Upload.Dragger;
|
|
13
|
-
var
|
|
13
|
+
export var UploadPlus = function UploadPlus(props) {
|
|
14
14
|
var draggerRef = React.useRef(null);
|
|
15
15
|
|
|
16
16
|
// 处理粘贴事件
|
|
@@ -79,5 +79,4 @@ var App = function App(props) {
|
|
|
79
79
|
})]
|
|
80
80
|
}))
|
|
81
81
|
});
|
|
82
|
-
};
|
|
83
|
-
export default App;
|
|
82
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@ant-design/icons": "^6.0.0",
|
|
52
52
|
"@ant-design/pro-components": "^2.8.10",
|
|
53
|
+
"@ant-design/pro-form": "^2.32.0",
|
|
53
54
|
"@iconify/react": "^6.0.0",
|
|
54
55
|
"@tiptap/core": "^2.12.0",
|
|
55
56
|
"@tiptap/extension-bullet-list": "2.12.0",
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
"peerDependencies": {
|
|
103
104
|
"@ant-design/icons": ">=5.0.0",
|
|
104
105
|
"@ant-design/pro-components": ">=2.0.0",
|
|
106
|
+
"@ant-design/pro-form": ">=2.0.0",
|
|
105
107
|
"antd": ">=5.0.0",
|
|
106
108
|
"react": ">=16.9.0",
|
|
107
109
|
"react-dom": ">=16.9.0",
|