@hanwenbo/x-web-pro-components 0.0.4 → 0.0.6
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/es/components/descriptions/index.d.ts +3 -3
- package/es/components/descriptions/index.js +5 -5
- package/es/components/form/index.d.ts +5 -2
- package/es/components/form/stepsForm.d.ts +1 -1
- package/es/components/form/stepsForm.js +80 -28
- package/es/components/list/index.d.ts +4 -4
- package/es/components/list/index.js +6 -7
- package/es/components/provider/intl.d.ts +4 -1
- package/es/components/provider/types.d.ts +1 -0
- package/es/components/table/index.d.ts +1 -1
- package/es/components/table/index.js +2 -1
- package/es/types.d.ts +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/components/descriptions/index.d.ts +3 -3
- package/lib/components/descriptions/index.js +5 -5
- package/lib/components/form/index.d.ts +5 -2
- package/lib/components/form/stepsForm.d.ts +1 -1
- package/lib/components/form/stepsForm.js +79 -27
- package/lib/components/list/index.d.ts +4 -4
- package/lib/components/list/index.js +6 -7
- package/lib/components/provider/intl.d.ts +4 -1
- package/lib/components/provider/types.d.ts +1 -0
- package/lib/components/table/index.d.ts +1 -1
- package/lib/components/table/index.js +2 -1
- package/lib/types.d.ts +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { type TooltipProps } from '@hanwenbo/x-web-ui/tooltip';
|
|
3
3
|
import type { ActionType, ProColumnType, RequestData } from '../../types';
|
|
4
4
|
export declare type FieldRender<RecordType = Record<string, any>> = (text: any, record: RecordType, index: number) => React.ReactNode;
|
|
5
|
-
export declare type DescriptionsItemProps<RecordType = Record<string, any>> = ProColumnType<RecordType>;
|
|
6
|
-
export declare type ProDescriptionsItemProps<RecordType = Record<string, any>> = ProColumnType<RecordType>;
|
|
5
|
+
export declare type DescriptionsItemProps<RecordType extends object = Record<string, any>> = ProColumnType<RecordType>;
|
|
6
|
+
export declare type ProDescriptionsItemProps<RecordType extends object = Record<string, any>> = ProColumnType<RecordType>;
|
|
7
7
|
export declare type ProDescriptionsActionType = ActionType;
|
|
8
|
-
export interface ProDescriptionsProps<RecordType = Record<string, any>> {
|
|
8
|
+
export interface ProDescriptionsProps<RecordType extends object = Record<string, any>> {
|
|
9
9
|
title?: React.ReactNode;
|
|
10
10
|
tooltip?: React.ReactNode | (TooltipProps & {
|
|
11
11
|
title?: React.ReactNode;
|
|
@@ -294,7 +294,7 @@ export var ProDescriptions = function ProDescriptions(_ref3) {
|
|
|
294
294
|
children: title
|
|
295
295
|
}), resolveTooltipProps(tooltip) ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, resolveTooltipProps(tooltip)), {}, {
|
|
296
296
|
children: /*#__PURE__*/_jsx("span", {
|
|
297
|
-
className: "cursor-help text-xs font-normal
|
|
297
|
+
className: "text-muted-foreground cursor-help text-xs font-normal",
|
|
298
298
|
children: "?"
|
|
299
299
|
})
|
|
300
300
|
})) : null]
|
|
@@ -323,19 +323,19 @@ export var ProDescriptions = function ProDescriptions(_ref3) {
|
|
|
323
323
|
var isEditable = editable && columnItem.valueType !== 'option' && (typeof columnItem.editable === 'function' ? columnItem.editable(getValueByDataIndex(entity || {}, columnItem.dataIndex), entity, 0) : columnItem.editable !== false);
|
|
324
324
|
var editing = Boolean(isEditable && mergedEditableKeys.includes(columnKey));
|
|
325
325
|
return /*#__PURE__*/_jsxs("div", {
|
|
326
|
-
className: "
|
|
326
|
+
className: "border-border bg-background rounded-xl border p-4",
|
|
327
327
|
style: columnItem.colSpan && columnItem.colSpan > 1 ? {
|
|
328
328
|
gridColumn: "span ".concat(columnItem.colSpan, " / span ").concat(columnItem.colSpan)
|
|
329
329
|
} : undefined,
|
|
330
330
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
331
331
|
className: "mb-2 flex items-center justify-between gap-3",
|
|
332
332
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
333
|
-
className: "flex items-center gap-2 text-sm font-medium
|
|
333
|
+
className: "text-muted-foreground flex items-center gap-2 text-sm font-medium",
|
|
334
334
|
children: [/*#__PURE__*/_jsx("span", {
|
|
335
335
|
children: columnItem.title
|
|
336
336
|
}), columnItem.tooltip ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, resolveTooltipProps(columnItem.tooltip)), {}, {
|
|
337
337
|
children: /*#__PURE__*/_jsx("span", {
|
|
338
|
-
className: "cursor-help text-xs
|
|
338
|
+
className: "text-muted-foreground cursor-help text-xs",
|
|
339
339
|
children: "?"
|
|
340
340
|
})
|
|
341
341
|
})) : null]
|
|
@@ -403,7 +403,7 @@ export var ProDescriptions = function ProDescriptions(_ref3) {
|
|
|
403
403
|
}) : null]
|
|
404
404
|
})]
|
|
405
405
|
}), /*#__PURE__*/_jsx("div", {
|
|
406
|
-
className: "text-
|
|
406
|
+
className: "text-foreground text-sm",
|
|
407
407
|
children: editing ? /*#__PURE__*/_jsx(ProField, {
|
|
408
408
|
mode: "edit",
|
|
409
409
|
text: text,
|
|
@@ -145,6 +145,9 @@ interface ProFormOptionFieldProps<T = Record<string, any>> extends ProFormFieldI
|
|
|
145
145
|
searchOnFocus?: boolean;
|
|
146
146
|
resetAfterSelect?: boolean;
|
|
147
147
|
}
|
|
148
|
+
declare type ProFormSinglePlaceholderFieldProps = Omit<ProFormOptionFieldProps, 'placeholder'> & {
|
|
149
|
+
placeholder?: string;
|
|
150
|
+
};
|
|
148
151
|
declare const BaseProForm: <Values extends Record<string, any> = Record<string, any>>({ submitter, layoutType, layout, form: controlledForm, onReset, classNames, colon, className, children, defaultCollapsed, collapsed, onCollapse, defaultColsNumber, defaultFormItemsNumber, split, searchText, resetText, labelWidth, searchGutter, span, ignoreRules, preserve, showHiddenNum, collapseRender, optionRender, submitterColSpanProps, containerStyle, ...restProps }: QueryLikeFormProps<Values>) => React.JSX.Element;
|
|
149
152
|
export declare const ProFormField: React.FC<ProFormOptionFieldProps>;
|
|
150
153
|
export declare const ProFormText: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
@@ -159,9 +162,9 @@ export declare const ProFormSelect: React.FC<ProFormOptionFieldProps> & {
|
|
|
159
162
|
};
|
|
160
163
|
export declare const ProFormCheckbox: React.FC<ProFormOptionFieldProps>;
|
|
161
164
|
export declare const ProFormRadio: React.FC<ProFormOptionFieldProps>;
|
|
162
|
-
export declare const ProFormTreeSelect: React.FC<
|
|
165
|
+
export declare const ProFormTreeSelect: React.FC<ProFormSinglePlaceholderFieldProps>;
|
|
163
166
|
export declare const ProFormSegmented: React.FC<ProFormOptionFieldProps>;
|
|
164
|
-
export declare const ProFormCascader: React.FC<
|
|
167
|
+
export declare const ProFormCascader: React.FC<ProFormSinglePlaceholderFieldProps>;
|
|
165
168
|
export declare const ProFormDatePicker: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
166
169
|
export declare const ProFormDateWeekPicker: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
167
170
|
export declare const ProFormDateMonthPicker: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type FormInstance, type FormProps } from '@hanwenbo/x-web-ui/form';
|
|
3
3
|
import type { SubmitterProps } from '../../types';
|
|
4
|
-
export interface StepFormProps<Values extends Record<string, any> = Record<string, any>> extends Omit<FormProps<Values>, 'form' | 'children' | 'layout'> {
|
|
4
|
+
export interface StepFormProps<Values extends Record<string, any> = Record<string, any>> extends Omit<FormProps<Values>, 'form' | 'children' | 'layout' | 'title' | 'onFinish'> {
|
|
5
5
|
title?: React.ReactNode;
|
|
6
6
|
description?: React.ReactNode;
|
|
7
7
|
children?: React.ReactNode;
|
|
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
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; }
|
|
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
|
-
import React, { useMemo, useState } from 'react';
|
|
19
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
20
20
|
import { Button } from '@hanwenbo/x-web-ui/button';
|
|
21
21
|
import { Card } from '@hanwenbo/x-web-ui/card';
|
|
22
22
|
import { Form, useForm } from '@hanwenbo/x-web-ui/form';
|
|
@@ -37,7 +37,7 @@ var isStepFormElement = function isStepFormElement(child) {
|
|
|
37
37
|
return /*#__PURE__*/React.isValidElement(child) && Boolean(child.type.__PRO_STEP_FORM__);
|
|
38
38
|
};
|
|
39
39
|
export var StepsForm = function StepsForm(_ref2) {
|
|
40
|
-
var
|
|
40
|
+
var _submitterConfig$sear, _submitterConfig$sear2, _submitterConfig$subm;
|
|
41
41
|
var current = _ref2.current,
|
|
42
42
|
onCurrentChange = _ref2.onCurrentChange,
|
|
43
43
|
submitter = _ref2.submitter,
|
|
@@ -61,7 +61,26 @@ export var StepsForm = function StepsForm(_ref2) {
|
|
|
61
61
|
return React.Children.toArray(children).filter(isStepFormElement);
|
|
62
62
|
}, [children]);
|
|
63
63
|
var activeStep = steps[mergedCurrent];
|
|
64
|
+
var pendingSubmission = useRef(null);
|
|
65
|
+
var _useState3 = useState(false),
|
|
66
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
+
submitting = _useState4[0],
|
|
68
|
+
setSubmitting = _useState4[1];
|
|
69
|
+
|
|
70
|
+
// A completed request only owns the step where it started. A host reset,
|
|
71
|
+
// replacement step, or unmount must not let it advance a newer form session.
|
|
72
|
+
useEffect(function () {
|
|
73
|
+
pendingSubmission.current = null;
|
|
74
|
+
setSubmitting(false);
|
|
75
|
+
return function () {
|
|
76
|
+
pendingSubmission.current = null;
|
|
77
|
+
};
|
|
78
|
+
}, [mergedCurrent, activeStep === null || activeStep === void 0 ? void 0 : activeStep.key]);
|
|
64
79
|
var setStep = function setStep(nextStep) {
|
|
80
|
+
if (nextStep !== mergedCurrent) {
|
|
81
|
+
pendingSubmission.current = null;
|
|
82
|
+
setSubmitting(false);
|
|
83
|
+
}
|
|
65
84
|
if (current === undefined) {
|
|
66
85
|
setInnerCurrent(nextStep);
|
|
67
86
|
}
|
|
@@ -69,47 +88,78 @@ export var StepsForm = function StepsForm(_ref2) {
|
|
|
69
88
|
};
|
|
70
89
|
var handleNext = /*#__PURE__*/function () {
|
|
71
90
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
72
|
-
var _activeStep$props$onF, _activeStep$props;
|
|
73
|
-
var allValues, result, finalResult;
|
|
91
|
+
var submission, isCurrentSubmission, stage, _activeStep$props$onF, _activeStep$props, allValues, result;
|
|
74
92
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
75
93
|
while (1) switch (_context.prev = _context.next) {
|
|
76
94
|
case 0:
|
|
77
|
-
|
|
78
|
-
|
|
95
|
+
if (!pendingSubmission.current) {
|
|
96
|
+
_context.next = 2;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
return _context.abrupt("return");
|
|
79
100
|
case 2:
|
|
101
|
+
submission = Symbol('step submission');
|
|
102
|
+
pendingSubmission.current = submission;
|
|
103
|
+
setSubmitting(true);
|
|
104
|
+
isCurrentSubmission = function isCurrentSubmission() {
|
|
105
|
+
return pendingSubmission.current === submission;
|
|
106
|
+
};
|
|
107
|
+
stage = 'validation';
|
|
108
|
+
_context.prev = 7;
|
|
109
|
+
_context.next = 10;
|
|
110
|
+
return form.validateFields();
|
|
111
|
+
case 10:
|
|
112
|
+
if (isCurrentSubmission()) {
|
|
113
|
+
_context.next = 12;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
return _context.abrupt("return");
|
|
117
|
+
case 12:
|
|
80
118
|
allValues = form.getFieldsValue(true);
|
|
81
|
-
|
|
119
|
+
stage = 'step';
|
|
120
|
+
_context.next = 16;
|
|
82
121
|
return activeStep === null || activeStep === void 0 || (_activeStep$props$onF = (_activeStep$props = activeStep.props).onFinish) === null || _activeStep$props$onF === void 0 ? void 0 : _activeStep$props$onF.call(_activeStep$props, allValues, form);
|
|
83
|
-
case
|
|
122
|
+
case 16:
|
|
84
123
|
result = _context.sent;
|
|
85
|
-
if (!(result === false)) {
|
|
86
|
-
_context.next =
|
|
124
|
+
if (!(result === false || !isCurrentSubmission())) {
|
|
125
|
+
_context.next = 19;
|
|
87
126
|
break;
|
|
88
127
|
}
|
|
89
128
|
return _context.abrupt("return");
|
|
90
|
-
case
|
|
129
|
+
case 19:
|
|
91
130
|
if (!(mergedCurrent >= steps.length - 1)) {
|
|
92
|
-
_context.next =
|
|
131
|
+
_context.next = 24;
|
|
93
132
|
break;
|
|
94
133
|
}
|
|
95
|
-
|
|
134
|
+
stage = 'final';
|
|
135
|
+
_context.next = 23;
|
|
96
136
|
return onFinish === null || onFinish === void 0 ? void 0 : onFinish(allValues);
|
|
97
|
-
case
|
|
98
|
-
finalResult = _context.sent;
|
|
99
|
-
if (!(finalResult === false)) {
|
|
100
|
-
_context.next = 14;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
137
|
+
case 23:
|
|
103
138
|
return _context.abrupt("return");
|
|
104
|
-
case
|
|
105
|
-
return _context.abrupt("return");
|
|
106
|
-
case 15:
|
|
139
|
+
case 24:
|
|
107
140
|
setStep(mergedCurrent + 1);
|
|
108
|
-
|
|
141
|
+
_context.next = 30;
|
|
142
|
+
break;
|
|
143
|
+
case 27:
|
|
144
|
+
_context.prev = 27;
|
|
145
|
+
_context.t0 = _context["catch"](7);
|
|
146
|
+
// Field validation already renders its own errors. Callback exceptions
|
|
147
|
+
// retain the draft for retry, but must remain visible to diagnostics.
|
|
148
|
+
if (stage !== 'validation') {
|
|
149
|
+
console.error("StepsForm ".concat(stage, " submission error:"), _context.t0);
|
|
150
|
+
}
|
|
151
|
+
case 30:
|
|
152
|
+
_context.prev = 30;
|
|
153
|
+
if (isCurrentSubmission()) {
|
|
154
|
+
pendingSubmission.current = null;
|
|
155
|
+
setSubmitting(false);
|
|
156
|
+
}
|
|
157
|
+
return _context.finish(30);
|
|
158
|
+
case 33:
|
|
109
159
|
case "end":
|
|
110
160
|
return _context.stop();
|
|
111
161
|
}
|
|
112
|
-
}, _callee);
|
|
162
|
+
}, _callee, null, [[7, 27, 30, 33]]);
|
|
113
163
|
}));
|
|
114
164
|
return function handleNext() {
|
|
115
165
|
return _ref3.apply(this, arguments);
|
|
@@ -118,8 +168,9 @@ export var StepsForm = function StepsForm(_ref2) {
|
|
|
118
168
|
var handlePrev = function handlePrev() {
|
|
119
169
|
setStep(Math.max(0, mergedCurrent - 1));
|
|
120
170
|
};
|
|
121
|
-
var
|
|
122
|
-
var
|
|
171
|
+
var submitterConfig = submitter === false ? undefined : submitter;
|
|
172
|
+
var submitButtonText = (submitterConfig === null || submitterConfig === void 0 || (_submitterConfig$sear = submitterConfig.searchConfig) === null || _submitterConfig$sear === void 0 ? void 0 : _submitterConfig$sear.submitText) || (mergedCurrent >= steps.length - 1 ? intl.getMessage('modalForm.submit', '提交') : intl.getMessage('stepsForm.next', '下一步'));
|
|
173
|
+
var resetButtonText = (submitterConfig === null || submitterConfig === void 0 || (_submitterConfig$sear2 = submitterConfig.searchConfig) === null || _submitterConfig$sear2 === void 0 ? void 0 : _submitterConfig$sear2.resetText) || intl.getMessage('stepsForm.previous', '上一步');
|
|
123
174
|
var submitterDom = submitter === false ? null : /*#__PURE__*/_jsxs("div", {
|
|
124
175
|
className: "mt-6 flex flex-wrap items-center justify-between gap-3",
|
|
125
176
|
children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
@@ -127,12 +178,13 @@ export var StepsForm = function StepsForm(_ref2) {
|
|
|
127
178
|
htmlType: "button",
|
|
128
179
|
onClick: handlePrev,
|
|
129
180
|
disabled: mergedCurrent <= 0
|
|
130
|
-
},
|
|
181
|
+
}, submitterConfig === null || submitterConfig === void 0 ? void 0 : submitterConfig.resetButtonProps), {}, {
|
|
131
182
|
children: resetButtonText
|
|
132
183
|
})), /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
133
184
|
htmlType: "button",
|
|
134
185
|
onClick: handleNext
|
|
135
|
-
},
|
|
186
|
+
}, submitterConfig === null || submitterConfig === void 0 ? void 0 : submitterConfig.submitButtonProps), {}, {
|
|
187
|
+
loading: submitting || (submitterConfig === null || submitterConfig === void 0 || (_submitterConfig$subm = submitterConfig.submitButtonProps) === null || _submitterConfig$subm === void 0 ? void 0 : _submitterConfig$subm.loading),
|
|
136
188
|
children: submitButtonText
|
|
137
189
|
}))]
|
|
138
190
|
});
|
|
@@ -5,10 +5,10 @@ export declare type Key = React.Key;
|
|
|
5
5
|
export declare type TriggerEventHandler = (...args: any[]) => void;
|
|
6
6
|
export declare type GetComponentProps<RecordType = any> = (item: RecordType) => React.HTMLAttributes<HTMLDivElement>;
|
|
7
7
|
export declare type AntdListProps = React.HTMLAttributes<HTMLDivElement>;
|
|
8
|
-
export declare type ProListMeta<T = any> = Pick<ProColumnType<T>, 'dataIndex' | 'valueType' | 'render' | 'title' | 'valueEnum' | 'fieldProps' | 'formItemProps' | 'formItemRender' | 'search' | 'editable' | 'listSlot'> & {
|
|
8
|
+
export declare type ProListMeta<T extends object = any> = Pick<ProColumnType<T>, 'dataIndex' | 'valueType' | 'render' | 'title' | 'valueEnum' | 'fieldProps' | 'formItemProps' | 'formItemRender' | 'search' | 'editable' | 'listSlot'> & {
|
|
9
9
|
key?: React.Key;
|
|
10
10
|
};
|
|
11
|
-
export declare type ProListMetas<T = any> = {
|
|
11
|
+
export declare type ProListMetas<T extends object = any> = {
|
|
12
12
|
title?: ProListMeta<T>;
|
|
13
13
|
subTitle?: ProListMeta<T>;
|
|
14
14
|
description?: ProListMeta<T>;
|
|
@@ -17,8 +17,8 @@ export declare type ProListMetas<T = any> = {
|
|
|
17
17
|
actions?: ProListMeta<T>;
|
|
18
18
|
[key: string]: ProListMeta<T> | undefined;
|
|
19
19
|
};
|
|
20
|
-
export declare type BaseProListMetas<T = any> = ProListMetas<T>;
|
|
21
|
-
export interface ProListProps<RecordType = any> {
|
|
20
|
+
export declare type BaseProListMetas<T extends object = any> = ProListMetas<T>;
|
|
21
|
+
export interface ProListProps<RecordType extends object = any> {
|
|
22
22
|
title?: React.ReactNode;
|
|
23
23
|
headerTitle?: React.ReactNode;
|
|
24
24
|
tooltip?: React.ReactNode;
|
|
@@ -30,7 +30,7 @@ var DEFAULT_VALUE_TYPE_MAP = {
|
|
|
30
30
|
description: 'textarea'
|
|
31
31
|
};
|
|
32
32
|
var getValueByDataIndex = function getValueByDataIndex(record, dataIndex) {
|
|
33
|
-
if (
|
|
33
|
+
if (dataIndex === undefined || dataIndex === null) {
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
36
36
|
var path = Array.isArray(dataIndex) ? dataIndex : [dataIndex];
|
|
@@ -324,7 +324,7 @@ export var ProList = function ProList(_ref) {
|
|
|
324
324
|
className: "mb-4",
|
|
325
325
|
children: header
|
|
326
326
|
}) : null, pagedDataSource.length === 0 ? /*#__PURE__*/_jsx("div", {
|
|
327
|
-
className: "bg-muted/10 rounded-2xl border border-dashed
|
|
327
|
+
className: "bg-muted/10 border-border text-muted-foreground rounded-2xl border border-dashed px-4 py-8 text-center text-sm",
|
|
328
328
|
children: emptyText
|
|
329
329
|
}) : /*#__PURE__*/_jsx(List, {
|
|
330
330
|
mode: "card",
|
|
@@ -369,7 +369,7 @@ export var ProList = function ProList(_ref) {
|
|
|
369
369
|
children: [/*#__PURE__*/_jsx("div", {
|
|
370
370
|
children: defaultTitleDom
|
|
371
371
|
}), slotMap.description || slotMap.subTitle ? /*#__PURE__*/_jsx("div", {
|
|
372
|
-
className: "mt-1 text-sm
|
|
372
|
+
className: "text-muted-foreground mt-1 text-sm",
|
|
373
373
|
children: slotMap.description || slotMap.subTitle
|
|
374
374
|
}) : null]
|
|
375
375
|
}), actionsNode.length ? /*#__PURE__*/_jsx("div", {
|
|
@@ -385,16 +385,15 @@ export var ProList = function ProList(_ref) {
|
|
|
385
385
|
}) : slotMap.content;
|
|
386
386
|
var itemProps = _objectSpread(_objectSpread({}, (onRow === null || onRow === void 0 ? void 0 : onRow(record, index)) || {}), (onItem === null || onItem === void 0 ? void 0 : onItem(record, index)) || {});
|
|
387
387
|
var itemClassName = cn(typeof rowClassName === 'function' ? rowClassName(record, index) : rowClassName, selected && 'ring-primary/20 ring-1');
|
|
388
|
-
var dom = /*#__PURE__*/_jsx(ListItem,
|
|
388
|
+
var dom = /*#__PURE__*/_jsx(ListItem, {
|
|
389
389
|
prefix: mergedPrefix,
|
|
390
390
|
title: itemLayout === 'vertical' ? undefined : defaultHeaderDom,
|
|
391
391
|
description: itemLayout === 'vertical' ? undefined : slotMap.description || slotMap.subTitle,
|
|
392
392
|
extra: itemLayout === 'vertical' ? undefined : actionsNode,
|
|
393
393
|
bordered: split,
|
|
394
|
-
className: itemClassName
|
|
395
|
-
}, itemProps), {}, {
|
|
394
|
+
className: itemClassName,
|
|
396
395
|
children: contentNode
|
|
397
|
-
}
|
|
396
|
+
}, recordKey);
|
|
398
397
|
var maybeWrappedDom = itemCardProps ? /*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({}, itemCardProps), {}, {
|
|
399
398
|
className: cn('h-full', itemCardProps.className),
|
|
400
399
|
bodyClassName: cn(itemCardProps.bodyClassName),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export declare type IntlType = {
|
|
2
|
+
locale: string;
|
|
3
|
+
getMessage: (id: string, defaultMessage?: string) => string;
|
|
4
|
+
};
|
|
2
5
|
export declare const createIntl: (locale: string, messages?: Record<string, string>) => IntlType;
|
|
3
6
|
export declare const mnMNIntl: IntlType;
|
|
4
7
|
export declare const arEGIntl: IntlType;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ProFieldFCMode, ProRenderFieldPropsType, ProSchemaValueEnumType } from '../../types';
|
|
3
3
|
import type { IntlType } from './intl';
|
|
4
|
+
export type { IntlType } from './intl';
|
|
4
5
|
export type { ProFieldFCMode, ProRenderFieldPropsType, ProSchemaValueEnumType };
|
|
5
6
|
export declare type ParamsType = Record<string, any>;
|
|
6
7
|
export declare type DeepPartial<T> = {
|
|
@@ -20,7 +20,7 @@ export declare type ColumnsState = Record<string, {
|
|
|
20
20
|
export declare type DragTableProps<RecordType extends Record<string, any> = Record<string, any>> = import('./dragSortTable').DragSortTableProps<RecordType>;
|
|
21
21
|
export declare type EditableFormInstance = FormInstance<any>;
|
|
22
22
|
export declare type EditableProTableProps<RecordType extends Record<string, any> = Record<string, any>> = import('./editableTable').EditableTableProps<RecordType>;
|
|
23
|
-
export
|
|
23
|
+
export type { IntlType } from '../provider';
|
|
24
24
|
export declare type ListToolBarProps = import('./listToolBar').ListToolBarProps;
|
|
25
25
|
export declare type ListToolBarSetting = import('./listToolBar').ListToolBarSetting;
|
|
26
26
|
export declare type ProColumnsValueType = ProFieldValueType;
|
|
@@ -1293,6 +1293,7 @@ var BaseProTable = function BaseProTable(_ref3) {
|
|
|
1293
1293
|
return null;
|
|
1294
1294
|
}
|
|
1295
1295
|
return /*#__PURE__*/_jsx("div", {
|
|
1296
|
+
className: "x-pro-table-toolbar",
|
|
1296
1297
|
children: toolbarNode
|
|
1297
1298
|
});
|
|
1298
1299
|
}, [toolbarNode]);
|
|
@@ -1313,7 +1314,7 @@ var BaseProTable = function BaseProTable(_ref3) {
|
|
|
1313
1314
|
return null;
|
|
1314
1315
|
}
|
|
1315
1316
|
return /*#__PURE__*/_jsx("div", {
|
|
1316
|
-
className: PRO_TABLE_STACK_CLASS,
|
|
1317
|
+
className: cn(PRO_TABLE_STACK_CLASS, !searchNode && 'x-pro-table-toolbar-only'),
|
|
1317
1318
|
children: React.Children.toArray(sections)
|
|
1318
1319
|
});
|
|
1319
1320
|
}, [toolbarSectionNode, searchSectionNode]);
|
package/es/types.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare type ActionType = {
|
|
|
37
37
|
}>) => void;
|
|
38
38
|
clearSelected?: () => void;
|
|
39
39
|
};
|
|
40
|
-
export interface ProColumnType<RecordType = any, ValueType = 'text'> extends Omit<TableColumnType<RecordType>, 'render'> {
|
|
40
|
+
export interface ProColumnType<RecordType extends object = any, ValueType = 'text'> extends Omit<TableColumnType<RecordType>, 'render'> {
|
|
41
41
|
valueType?: ValueType | ProFieldValueType;
|
|
42
42
|
valueEnum?: ProSchemaValueEnum;
|
|
43
43
|
tooltip?: React.ReactNode | {
|
|
@@ -91,7 +91,7 @@ export interface ProColumnType<RecordType = any, ValueType = 'text'> extends Omi
|
|
|
91
91
|
renderText?: (value: any, record: RecordType, index: number) => React.ReactNode;
|
|
92
92
|
render?: (value: any, record: RecordType, index: number) => React.ReactNode;
|
|
93
93
|
}
|
|
94
|
-
export declare type ProColumns<RecordType = any, ValueType = 'text'> = ProColumnType<RecordType, ValueType>[];
|
|
94
|
+
export declare type ProColumns<RecordType extends object = any, ValueType = 'text'> = ProColumnType<RecordType, ValueType>[];
|
|
95
95
|
export declare type SubmitterProps = {
|
|
96
96
|
submitButtonProps?: Record<string, any>;
|
|
97
97
|
resetButtonProps?: Record<string, any>;
|
|
@@ -126,7 +126,7 @@ export interface ProFormDependencyProps {
|
|
|
126
126
|
name: NamePath[];
|
|
127
127
|
children: (values: Record<string, any>, form: FormInstance<any>) => React.ReactNode;
|
|
128
128
|
}
|
|
129
|
-
export interface ProTableProps<RecordType = any, Params extends Record<string, any> = Record<string, any>> extends Omit<TableProps<RecordType>, 'columns' | 'dataSource' | 'title'> {
|
|
129
|
+
export interface ProTableProps<RecordType extends object = any, Params extends Record<string, any> = Record<string, any>> extends Omit<TableProps<RecordType>, 'columns' | 'dataSource' | 'title' | 'onLoad'> {
|
|
130
130
|
columns: ProColumns<RecordType>;
|
|
131
131
|
params?: Params;
|
|
132
132
|
request?: (params: Params & {
|
package/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.6";
|
|
2
2
|
export default version;
|
package/es/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = '0.0.
|
|
1
|
+
export var version = '0.0.6';
|
|
2
2
|
export default version;
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { type TooltipProps } from '@hanwenbo/x-web-ui/tooltip';
|
|
3
3
|
import type { ActionType, ProColumnType, RequestData } from '../../types';
|
|
4
4
|
export declare type FieldRender<RecordType = Record<string, any>> = (text: any, record: RecordType, index: number) => React.ReactNode;
|
|
5
|
-
export declare type DescriptionsItemProps<RecordType = Record<string, any>> = ProColumnType<RecordType>;
|
|
6
|
-
export declare type ProDescriptionsItemProps<RecordType = Record<string, any>> = ProColumnType<RecordType>;
|
|
5
|
+
export declare type DescriptionsItemProps<RecordType extends object = Record<string, any>> = ProColumnType<RecordType>;
|
|
6
|
+
export declare type ProDescriptionsItemProps<RecordType extends object = Record<string, any>> = ProColumnType<RecordType>;
|
|
7
7
|
export declare type ProDescriptionsActionType = ActionType;
|
|
8
|
-
export interface ProDescriptionsProps<RecordType = Record<string, any>> {
|
|
8
|
+
export interface ProDescriptionsProps<RecordType extends object = Record<string, any>> {
|
|
9
9
|
title?: React.ReactNode;
|
|
10
10
|
tooltip?: React.ReactNode | (TooltipProps & {
|
|
11
11
|
title?: React.ReactNode;
|
|
@@ -300,7 +300,7 @@ var ProDescriptions = exports.ProDescriptions = function ProDescriptions(_ref3)
|
|
|
300
300
|
children: title
|
|
301
301
|
}), resolveTooltipProps(tooltip) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.Tooltip, _objectSpread(_objectSpread({}, resolveTooltipProps(tooltip)), {}, {
|
|
302
302
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
303
|
-
className: "cursor-help text-xs font-normal
|
|
303
|
+
className: "text-muted-foreground cursor-help text-xs font-normal",
|
|
304
304
|
children: "?"
|
|
305
305
|
})
|
|
306
306
|
})) : null]
|
|
@@ -329,19 +329,19 @@ var ProDescriptions = exports.ProDescriptions = function ProDescriptions(_ref3)
|
|
|
329
329
|
var isEditable = editable && columnItem.valueType !== 'option' && (typeof columnItem.editable === 'function' ? columnItem.editable(getValueByDataIndex(entity || {}, columnItem.dataIndex), entity, 0) : columnItem.editable !== false);
|
|
330
330
|
var editing = Boolean(isEditable && mergedEditableKeys.includes(columnKey));
|
|
331
331
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
332
|
-
className: "
|
|
332
|
+
className: "border-border bg-background rounded-xl border p-4",
|
|
333
333
|
style: columnItem.colSpan && columnItem.colSpan > 1 ? {
|
|
334
334
|
gridColumn: "span ".concat(columnItem.colSpan, " / span ").concat(columnItem.colSpan)
|
|
335
335
|
} : undefined,
|
|
336
336
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
337
337
|
className: "mb-2 flex items-center justify-between gap-3",
|
|
338
338
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
339
|
-
className: "flex items-center gap-2 text-sm font-medium
|
|
339
|
+
className: "text-muted-foreground flex items-center gap-2 text-sm font-medium",
|
|
340
340
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
341
341
|
children: columnItem.title
|
|
342
342
|
}), columnItem.tooltip ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.Tooltip, _objectSpread(_objectSpread({}, resolveTooltipProps(columnItem.tooltip)), {}, {
|
|
343
343
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
344
|
-
className: "cursor-help text-xs
|
|
344
|
+
className: "text-muted-foreground cursor-help text-xs",
|
|
345
345
|
children: "?"
|
|
346
346
|
})
|
|
347
347
|
})) : null]
|
|
@@ -409,7 +409,7 @@ var ProDescriptions = exports.ProDescriptions = function ProDescriptions(_ref3)
|
|
|
409
409
|
}) : null]
|
|
410
410
|
})]
|
|
411
411
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
412
|
-
className: "text-
|
|
412
|
+
className: "text-foreground text-sm",
|
|
413
413
|
children: editing ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_field.ProField, {
|
|
414
414
|
mode: "edit",
|
|
415
415
|
text: text,
|
|
@@ -145,6 +145,9 @@ interface ProFormOptionFieldProps<T = Record<string, any>> extends ProFormFieldI
|
|
|
145
145
|
searchOnFocus?: boolean;
|
|
146
146
|
resetAfterSelect?: boolean;
|
|
147
147
|
}
|
|
148
|
+
declare type ProFormSinglePlaceholderFieldProps = Omit<ProFormOptionFieldProps, 'placeholder'> & {
|
|
149
|
+
placeholder?: string;
|
|
150
|
+
};
|
|
148
151
|
declare const BaseProForm: <Values extends Record<string, any> = Record<string, any>>({ submitter, layoutType, layout, form: controlledForm, onReset, classNames, colon, className, children, defaultCollapsed, collapsed, onCollapse, defaultColsNumber, defaultFormItemsNumber, split, searchText, resetText, labelWidth, searchGutter, span, ignoreRules, preserve, showHiddenNum, collapseRender, optionRender, submitterColSpanProps, containerStyle, ...restProps }: QueryLikeFormProps<Values>) => React.JSX.Element;
|
|
149
152
|
export declare const ProFormField: React.FC<ProFormOptionFieldProps>;
|
|
150
153
|
export declare const ProFormText: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
@@ -159,9 +162,9 @@ export declare const ProFormSelect: React.FC<ProFormOptionFieldProps> & {
|
|
|
159
162
|
};
|
|
160
163
|
export declare const ProFormCheckbox: React.FC<ProFormOptionFieldProps>;
|
|
161
164
|
export declare const ProFormRadio: React.FC<ProFormOptionFieldProps>;
|
|
162
|
-
export declare const ProFormTreeSelect: React.FC<
|
|
165
|
+
export declare const ProFormTreeSelect: React.FC<ProFormSinglePlaceholderFieldProps>;
|
|
163
166
|
export declare const ProFormSegmented: React.FC<ProFormOptionFieldProps>;
|
|
164
|
-
export declare const ProFormCascader: React.FC<
|
|
167
|
+
export declare const ProFormCascader: React.FC<ProFormSinglePlaceholderFieldProps>;
|
|
165
168
|
export declare const ProFormDatePicker: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
166
169
|
export declare const ProFormDateWeekPicker: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
167
170
|
export declare const ProFormDateMonthPicker: React.FC<ProFormFieldItemProps<Record<string, any>>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type FormInstance, type FormProps } from '@hanwenbo/x-web-ui/form';
|
|
3
3
|
import type { SubmitterProps } from '../../types';
|
|
4
|
-
export interface StepFormProps<Values extends Record<string, any> = Record<string, any>> extends Omit<FormProps<Values>, 'form' | 'children' | 'layout'> {
|
|
4
|
+
export interface StepFormProps<Values extends Record<string, any> = Record<string, any>> extends Omit<FormProps<Values>, 'form' | 'children' | 'layout' | 'title' | 'onFinish'> {
|
|
5
5
|
title?: React.ReactNode;
|
|
6
6
|
description?: React.ReactNode;
|
|
7
7
|
children?: React.ReactNode;
|
|
@@ -43,7 +43,7 @@ var isStepFormElement = function isStepFormElement(child) {
|
|
|
43
43
|
return /*#__PURE__*/_react.default.isValidElement(child) && Boolean(child.type.__PRO_STEP_FORM__);
|
|
44
44
|
};
|
|
45
45
|
var StepsForm = exports.StepsForm = function StepsForm(_ref2) {
|
|
46
|
-
var
|
|
46
|
+
var _submitterConfig$sear, _submitterConfig$sear2, _submitterConfig$subm;
|
|
47
47
|
var current = _ref2.current,
|
|
48
48
|
onCurrentChange = _ref2.onCurrentChange,
|
|
49
49
|
submitter = _ref2.submitter,
|
|
@@ -67,7 +67,26 @@ var StepsForm = exports.StepsForm = function StepsForm(_ref2) {
|
|
|
67
67
|
return _react.default.Children.toArray(children).filter(isStepFormElement);
|
|
68
68
|
}, [children]);
|
|
69
69
|
var activeStep = steps[mergedCurrent];
|
|
70
|
+
var pendingSubmission = (0, _react.useRef)(null);
|
|
71
|
+
var _useState3 = (0, _react.useState)(false),
|
|
72
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
73
|
+
submitting = _useState4[0],
|
|
74
|
+
setSubmitting = _useState4[1];
|
|
75
|
+
|
|
76
|
+
// A completed request only owns the step where it started. A host reset,
|
|
77
|
+
// replacement step, or unmount must not let it advance a newer form session.
|
|
78
|
+
(0, _react.useEffect)(function () {
|
|
79
|
+
pendingSubmission.current = null;
|
|
80
|
+
setSubmitting(false);
|
|
81
|
+
return function () {
|
|
82
|
+
pendingSubmission.current = null;
|
|
83
|
+
};
|
|
84
|
+
}, [mergedCurrent, activeStep === null || activeStep === void 0 ? void 0 : activeStep.key]);
|
|
70
85
|
var setStep = function setStep(nextStep) {
|
|
86
|
+
if (nextStep !== mergedCurrent) {
|
|
87
|
+
pendingSubmission.current = null;
|
|
88
|
+
setSubmitting(false);
|
|
89
|
+
}
|
|
71
90
|
if (current === undefined) {
|
|
72
91
|
setInnerCurrent(nextStep);
|
|
73
92
|
}
|
|
@@ -75,47 +94,78 @@ var StepsForm = exports.StepsForm = function StepsForm(_ref2) {
|
|
|
75
94
|
};
|
|
76
95
|
var handleNext = /*#__PURE__*/function () {
|
|
77
96
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
78
|
-
var _activeStep$props$onF, _activeStep$props;
|
|
79
|
-
var allValues, result, finalResult;
|
|
97
|
+
var submission, isCurrentSubmission, stage, _activeStep$props$onF, _activeStep$props, allValues, result;
|
|
80
98
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
81
99
|
while (1) switch (_context.prev = _context.next) {
|
|
82
100
|
case 0:
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
if (!pendingSubmission.current) {
|
|
102
|
+
_context.next = 2;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
return _context.abrupt("return");
|
|
85
106
|
case 2:
|
|
107
|
+
submission = Symbol('step submission');
|
|
108
|
+
pendingSubmission.current = submission;
|
|
109
|
+
setSubmitting(true);
|
|
110
|
+
isCurrentSubmission = function isCurrentSubmission() {
|
|
111
|
+
return pendingSubmission.current === submission;
|
|
112
|
+
};
|
|
113
|
+
stage = 'validation';
|
|
114
|
+
_context.prev = 7;
|
|
115
|
+
_context.next = 10;
|
|
116
|
+
return form.validateFields();
|
|
117
|
+
case 10:
|
|
118
|
+
if (isCurrentSubmission()) {
|
|
119
|
+
_context.next = 12;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return _context.abrupt("return");
|
|
123
|
+
case 12:
|
|
86
124
|
allValues = form.getFieldsValue(true);
|
|
87
|
-
|
|
125
|
+
stage = 'step';
|
|
126
|
+
_context.next = 16;
|
|
88
127
|
return activeStep === null || activeStep === void 0 || (_activeStep$props$onF = (_activeStep$props = activeStep.props).onFinish) === null || _activeStep$props$onF === void 0 ? void 0 : _activeStep$props$onF.call(_activeStep$props, allValues, form);
|
|
89
|
-
case
|
|
128
|
+
case 16:
|
|
90
129
|
result = _context.sent;
|
|
91
|
-
if (!(result === false)) {
|
|
92
|
-
_context.next =
|
|
130
|
+
if (!(result === false || !isCurrentSubmission())) {
|
|
131
|
+
_context.next = 19;
|
|
93
132
|
break;
|
|
94
133
|
}
|
|
95
134
|
return _context.abrupt("return");
|
|
96
|
-
case
|
|
135
|
+
case 19:
|
|
97
136
|
if (!(mergedCurrent >= steps.length - 1)) {
|
|
98
|
-
_context.next =
|
|
137
|
+
_context.next = 24;
|
|
99
138
|
break;
|
|
100
139
|
}
|
|
101
|
-
|
|
140
|
+
stage = 'final';
|
|
141
|
+
_context.next = 23;
|
|
102
142
|
return onFinish === null || onFinish === void 0 ? void 0 : onFinish(allValues);
|
|
103
|
-
case
|
|
104
|
-
finalResult = _context.sent;
|
|
105
|
-
if (!(finalResult === false)) {
|
|
106
|
-
_context.next = 14;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
143
|
+
case 23:
|
|
109
144
|
return _context.abrupt("return");
|
|
110
|
-
case
|
|
111
|
-
return _context.abrupt("return");
|
|
112
|
-
case 15:
|
|
145
|
+
case 24:
|
|
113
146
|
setStep(mergedCurrent + 1);
|
|
114
|
-
|
|
147
|
+
_context.next = 30;
|
|
148
|
+
break;
|
|
149
|
+
case 27:
|
|
150
|
+
_context.prev = 27;
|
|
151
|
+
_context.t0 = _context["catch"](7);
|
|
152
|
+
// Field validation already renders its own errors. Callback exceptions
|
|
153
|
+
// retain the draft for retry, but must remain visible to diagnostics.
|
|
154
|
+
if (stage !== 'validation') {
|
|
155
|
+
console.error("StepsForm ".concat(stage, " submission error:"), _context.t0);
|
|
156
|
+
}
|
|
157
|
+
case 30:
|
|
158
|
+
_context.prev = 30;
|
|
159
|
+
if (isCurrentSubmission()) {
|
|
160
|
+
pendingSubmission.current = null;
|
|
161
|
+
setSubmitting(false);
|
|
162
|
+
}
|
|
163
|
+
return _context.finish(30);
|
|
164
|
+
case 33:
|
|
115
165
|
case "end":
|
|
116
166
|
return _context.stop();
|
|
117
167
|
}
|
|
118
|
-
}, _callee);
|
|
168
|
+
}, _callee, null, [[7, 27, 30, 33]]);
|
|
119
169
|
}));
|
|
120
170
|
return function handleNext() {
|
|
121
171
|
return _ref3.apply(this, arguments);
|
|
@@ -124,8 +174,9 @@ var StepsForm = exports.StepsForm = function StepsForm(_ref2) {
|
|
|
124
174
|
var handlePrev = function handlePrev() {
|
|
125
175
|
setStep(Math.max(0, mergedCurrent - 1));
|
|
126
176
|
};
|
|
127
|
-
var
|
|
128
|
-
var
|
|
177
|
+
var submitterConfig = submitter === false ? undefined : submitter;
|
|
178
|
+
var submitButtonText = (submitterConfig === null || submitterConfig === void 0 || (_submitterConfig$sear = submitterConfig.searchConfig) === null || _submitterConfig$sear === void 0 ? void 0 : _submitterConfig$sear.submitText) || (mergedCurrent >= steps.length - 1 ? intl.getMessage('modalForm.submit', '提交') : intl.getMessage('stepsForm.next', '下一步'));
|
|
179
|
+
var resetButtonText = (submitterConfig === null || submitterConfig === void 0 || (_submitterConfig$sear2 = submitterConfig.searchConfig) === null || _submitterConfig$sear2 === void 0 ? void 0 : _submitterConfig$sear2.resetText) || intl.getMessage('stepsForm.previous', '上一步');
|
|
129
180
|
var submitterDom = submitter === false ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
130
181
|
className: "mt-6 flex flex-wrap items-center justify-between gap-3",
|
|
131
182
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, _objectSpread(_objectSpread({
|
|
@@ -133,12 +184,13 @@ var StepsForm = exports.StepsForm = function StepsForm(_ref2) {
|
|
|
133
184
|
htmlType: "button",
|
|
134
185
|
onClick: handlePrev,
|
|
135
186
|
disabled: mergedCurrent <= 0
|
|
136
|
-
},
|
|
187
|
+
}, submitterConfig === null || submitterConfig === void 0 ? void 0 : submitterConfig.resetButtonProps), {}, {
|
|
137
188
|
children: resetButtonText
|
|
138
189
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, _objectSpread(_objectSpread({
|
|
139
190
|
htmlType: "button",
|
|
140
191
|
onClick: handleNext
|
|
141
|
-
},
|
|
192
|
+
}, submitterConfig === null || submitterConfig === void 0 ? void 0 : submitterConfig.submitButtonProps), {}, {
|
|
193
|
+
loading: submitting || (submitterConfig === null || submitterConfig === void 0 || (_submitterConfig$subm = submitterConfig.submitButtonProps) === null || _submitterConfig$subm === void 0 ? void 0 : _submitterConfig$subm.loading),
|
|
142
194
|
children: submitButtonText
|
|
143
195
|
}))]
|
|
144
196
|
});
|
|
@@ -5,10 +5,10 @@ export declare type Key = React.Key;
|
|
|
5
5
|
export declare type TriggerEventHandler = (...args: any[]) => void;
|
|
6
6
|
export declare type GetComponentProps<RecordType = any> = (item: RecordType) => React.HTMLAttributes<HTMLDivElement>;
|
|
7
7
|
export declare type AntdListProps = React.HTMLAttributes<HTMLDivElement>;
|
|
8
|
-
export declare type ProListMeta<T = any> = Pick<ProColumnType<T>, 'dataIndex' | 'valueType' | 'render' | 'title' | 'valueEnum' | 'fieldProps' | 'formItemProps' | 'formItemRender' | 'search' | 'editable' | 'listSlot'> & {
|
|
8
|
+
export declare type ProListMeta<T extends object = any> = Pick<ProColumnType<T>, 'dataIndex' | 'valueType' | 'render' | 'title' | 'valueEnum' | 'fieldProps' | 'formItemProps' | 'formItemRender' | 'search' | 'editable' | 'listSlot'> & {
|
|
9
9
|
key?: React.Key;
|
|
10
10
|
};
|
|
11
|
-
export declare type ProListMetas<T = any> = {
|
|
11
|
+
export declare type ProListMetas<T extends object = any> = {
|
|
12
12
|
title?: ProListMeta<T>;
|
|
13
13
|
subTitle?: ProListMeta<T>;
|
|
14
14
|
description?: ProListMeta<T>;
|
|
@@ -17,8 +17,8 @@ export declare type ProListMetas<T = any> = {
|
|
|
17
17
|
actions?: ProListMeta<T>;
|
|
18
18
|
[key: string]: ProListMeta<T> | undefined;
|
|
19
19
|
};
|
|
20
|
-
export declare type BaseProListMetas<T = any> = ProListMetas<T>;
|
|
21
|
-
export interface ProListProps<RecordType = any> {
|
|
20
|
+
export declare type BaseProListMetas<T extends object = any> = ProListMetas<T>;
|
|
21
|
+
export interface ProListProps<RecordType extends object = any> {
|
|
22
22
|
title?: React.ReactNode;
|
|
23
23
|
headerTitle?: React.ReactNode;
|
|
24
24
|
tooltip?: React.ReactNode;
|
|
@@ -37,7 +37,7 @@ var DEFAULT_VALUE_TYPE_MAP = {
|
|
|
37
37
|
description: 'textarea'
|
|
38
38
|
};
|
|
39
39
|
var getValueByDataIndex = function getValueByDataIndex(record, dataIndex) {
|
|
40
|
-
if (
|
|
40
|
+
if (dataIndex === undefined || dataIndex === null) {
|
|
41
41
|
return undefined;
|
|
42
42
|
}
|
|
43
43
|
var path = Array.isArray(dataIndex) ? dataIndex : [dataIndex];
|
|
@@ -331,7 +331,7 @@ var ProList = exports.ProList = function ProList(_ref) {
|
|
|
331
331
|
className: "mb-4",
|
|
332
332
|
children: header
|
|
333
333
|
}) : null, pagedDataSource.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
334
|
-
className: "bg-muted/10 rounded-2xl border border-dashed
|
|
334
|
+
className: "bg-muted/10 border-border text-muted-foreground rounded-2xl border border-dashed px-4 py-8 text-center text-sm",
|
|
335
335
|
children: emptyText
|
|
336
336
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_list.List, {
|
|
337
337
|
mode: "card",
|
|
@@ -376,7 +376,7 @@ var ProList = exports.ProList = function ProList(_ref) {
|
|
|
376
376
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
377
377
|
children: defaultTitleDom
|
|
378
378
|
}), slotMap.description || slotMap.subTitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
379
|
-
className: "mt-1 text-sm
|
|
379
|
+
className: "text-muted-foreground mt-1 text-sm",
|
|
380
380
|
children: slotMap.description || slotMap.subTitle
|
|
381
381
|
}) : null]
|
|
382
382
|
}), actionsNode.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -392,16 +392,15 @@ var ProList = exports.ProList = function ProList(_ref) {
|
|
|
392
392
|
}) : slotMap.content;
|
|
393
393
|
var itemProps = _objectSpread(_objectSpread({}, (onRow === null || onRow === void 0 ? void 0 : onRow(record, index)) || {}), (onItem === null || onItem === void 0 ? void 0 : onItem(record, index)) || {});
|
|
394
394
|
var itemClassName = (0, _cn.cn)(typeof rowClassName === 'function' ? rowClassName(record, index) : rowClassName, selected && 'ring-primary/20 ring-1');
|
|
395
|
-
var dom = /*#__PURE__*/(0, _jsxRuntime.jsx)(_list.ListItem,
|
|
395
|
+
var dom = /*#__PURE__*/(0, _jsxRuntime.jsx)(_list.ListItem, {
|
|
396
396
|
prefix: mergedPrefix,
|
|
397
397
|
title: itemLayout === 'vertical' ? undefined : defaultHeaderDom,
|
|
398
398
|
description: itemLayout === 'vertical' ? undefined : slotMap.description || slotMap.subTitle,
|
|
399
399
|
extra: itemLayout === 'vertical' ? undefined : actionsNode,
|
|
400
400
|
bordered: split,
|
|
401
|
-
className: itemClassName
|
|
402
|
-
}, itemProps), {}, {
|
|
401
|
+
className: itemClassName,
|
|
403
402
|
children: contentNode
|
|
404
|
-
}
|
|
403
|
+
}, recordKey);
|
|
405
404
|
var maybeWrappedDom = itemCardProps ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_card.Card, _objectSpread(_objectSpread({}, itemCardProps), {}, {
|
|
406
405
|
className: (0, _cn.cn)('h-full', itemCardProps.className),
|
|
407
406
|
bodyClassName: (0, _cn.cn)(itemCardProps.bodyClassName),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export declare type IntlType = {
|
|
2
|
+
locale: string;
|
|
3
|
+
getMessage: (id: string, defaultMessage?: string) => string;
|
|
4
|
+
};
|
|
2
5
|
export declare const createIntl: (locale: string, messages?: Record<string, string>) => IntlType;
|
|
3
6
|
export declare const mnMNIntl: IntlType;
|
|
4
7
|
export declare const arEGIntl: IntlType;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ProFieldFCMode, ProRenderFieldPropsType, ProSchemaValueEnumType } from '../../types';
|
|
3
3
|
import type { IntlType } from './intl';
|
|
4
|
+
export type { IntlType } from './intl';
|
|
4
5
|
export type { ProFieldFCMode, ProRenderFieldPropsType, ProSchemaValueEnumType };
|
|
5
6
|
export declare type ParamsType = Record<string, any>;
|
|
6
7
|
export declare type DeepPartial<T> = {
|
|
@@ -20,7 +20,7 @@ export declare type ColumnsState = Record<string, {
|
|
|
20
20
|
export declare type DragTableProps<RecordType extends Record<string, any> = Record<string, any>> = import('./dragSortTable').DragSortTableProps<RecordType>;
|
|
21
21
|
export declare type EditableFormInstance = FormInstance<any>;
|
|
22
22
|
export declare type EditableProTableProps<RecordType extends Record<string, any> = Record<string, any>> = import('./editableTable').EditableTableProps<RecordType>;
|
|
23
|
-
export
|
|
23
|
+
export type { IntlType } from '../provider';
|
|
24
24
|
export declare type ListToolBarProps = import('./listToolBar').ListToolBarProps;
|
|
25
25
|
export declare type ListToolBarSetting = import('./listToolBar').ListToolBarSetting;
|
|
26
26
|
export declare type ProColumnsValueType = ProFieldValueType;
|
|
@@ -1438,6 +1438,7 @@ var BaseProTable = function BaseProTable(_ref3) {
|
|
|
1438
1438
|
return null;
|
|
1439
1439
|
}
|
|
1440
1440
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1441
|
+
className: "x-pro-table-toolbar",
|
|
1441
1442
|
children: toolbarNode
|
|
1442
1443
|
});
|
|
1443
1444
|
}, [toolbarNode]);
|
|
@@ -1458,7 +1459,7 @@ var BaseProTable = function BaseProTable(_ref3) {
|
|
|
1458
1459
|
return null;
|
|
1459
1460
|
}
|
|
1460
1461
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1461
|
-
className: PRO_TABLE_STACK_CLASS,
|
|
1462
|
+
className: (0, _cn.cn)(PRO_TABLE_STACK_CLASS, !searchNode && 'x-pro-table-toolbar-only'),
|
|
1462
1463
|
children: _react.default.Children.toArray(sections)
|
|
1463
1464
|
});
|
|
1464
1465
|
}, [toolbarSectionNode, searchSectionNode]);
|
package/lib/types.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare type ActionType = {
|
|
|
37
37
|
}>) => void;
|
|
38
38
|
clearSelected?: () => void;
|
|
39
39
|
};
|
|
40
|
-
export interface ProColumnType<RecordType = any, ValueType = 'text'> extends Omit<TableColumnType<RecordType>, 'render'> {
|
|
40
|
+
export interface ProColumnType<RecordType extends object = any, ValueType = 'text'> extends Omit<TableColumnType<RecordType>, 'render'> {
|
|
41
41
|
valueType?: ValueType | ProFieldValueType;
|
|
42
42
|
valueEnum?: ProSchemaValueEnum;
|
|
43
43
|
tooltip?: React.ReactNode | {
|
|
@@ -91,7 +91,7 @@ export interface ProColumnType<RecordType = any, ValueType = 'text'> extends Omi
|
|
|
91
91
|
renderText?: (value: any, record: RecordType, index: number) => React.ReactNode;
|
|
92
92
|
render?: (value: any, record: RecordType, index: number) => React.ReactNode;
|
|
93
93
|
}
|
|
94
|
-
export declare type ProColumns<RecordType = any, ValueType = 'text'> = ProColumnType<RecordType, ValueType>[];
|
|
94
|
+
export declare type ProColumns<RecordType extends object = any, ValueType = 'text'> = ProColumnType<RecordType, ValueType>[];
|
|
95
95
|
export declare type SubmitterProps = {
|
|
96
96
|
submitButtonProps?: Record<string, any>;
|
|
97
97
|
resetButtonProps?: Record<string, any>;
|
|
@@ -126,7 +126,7 @@ export interface ProFormDependencyProps {
|
|
|
126
126
|
name: NamePath[];
|
|
127
127
|
children: (values: Record<string, any>, form: FormInstance<any>) => React.ReactNode;
|
|
128
128
|
}
|
|
129
|
-
export interface ProTableProps<RecordType = any, Params extends Record<string, any> = Record<string, any>> extends Omit<TableProps<RecordType>, 'columns' | 'dataSource' | 'title'> {
|
|
129
|
+
export interface ProTableProps<RecordType extends object = any, Params extends Record<string, any> = Record<string, any>> extends Omit<TableProps<RecordType>, 'columns' | 'dataSource' | 'title' | 'onLoad'> {
|
|
130
130
|
columns: ProColumns<RecordType>;
|
|
131
131
|
params?: Params;
|
|
132
132
|
request?: (params: Params & {
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.6";
|
|
2
2
|
export default version;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanwenbo/x-web-pro-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Enterprise-ready pro components built on x-web-ui",
|
|
5
5
|
"author": "9476400@qq.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"dayjs": "^1.11.3",
|
|
46
46
|
"lucide-react": "^0.460.0",
|
|
47
|
-
"@hanwenbo/x-web-ui": "0.0.
|
|
47
|
+
"@hanwenbo/x-web-ui": "0.0.8"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": ">=18.0.0",
|