vap1 0.0.7 → 0.0.9
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/components/SearchBar/ActionButtons.d.ts +2 -1
- package/components/SearchBar/ActionButtons.js +2 -2
- package/components/SearchBar/ByKeyword.js +1 -1
- package/components/SearchBar/SearchTags.js +2 -2
- package/components/Tables/ApiTableModal.d.ts +2 -2
- package/components/Tables/Components/Actions.js +3 -3
- package/components/Tables/TopTable.js +3 -3
- package/components/Tables/TopTableModal.d.ts +2 -2
- package/components/Tables/VTable.js +4 -1
- package/components/Tables/index.d.ts +1 -1
- package/components/TreeSelect/BaseTreeSelect.js +3 -3
- package/components/TreeSelect/DTreeSelect.js +2 -2
- package/components/TreeSelect/FTreeSelect.js +2 -2
- package/components/TreeSelect/STreeSelect.js +2 -2
- package/components/Trees/ActionTree.d.ts +3 -1
- package/components/Trees/ActionTree.js +77 -20
- package/components/Trees/BaseTree.d.ts +8 -3
- package/components/Trees/BaseTree.js +12 -3
- package/components/Trees/FTree.js +0 -1
- package/components/Trees/STree.js +6 -7
- package/components/Trees/index.d.ts +6 -1
- package/components/UForm/UForm.d.ts +2 -2
- package/components/UForm/UForm.js +44 -12
- package/components/UForm/UFormModal.js +6 -3
- package/components/UForm/UInfoModal.js +3 -0
- package/components/UForm/UModal.js +10 -5
- package/components/UForm/index.d.ts +8 -3
- package/components/Upload/UploadModal.d.ts +2 -2
- package/components/Upload/UploadModal.js +5 -1
- package/components/Upload/useUpload.d.ts +2 -2
- package/components/_adapt/Alert.d.ts +3 -3
- package/components/_adapt/Breadcrumb.d.ts +15 -0
- package/components/_adapt/Breadcrumb.js +18 -0
- package/components/_adapt/Button.d.ts +5 -5
- package/components/_adapt/Button.js +2 -0
- package/components/_adapt/Collapse.d.ts +7 -7
- package/components/_adapt/ConfigProvider.d.ts +6 -0
- package/components/_adapt/ConfigProvider.js +10 -0
- package/components/_adapt/Drawer.d.ts +8 -3
- package/components/_adapt/Drawer.js +5 -1
- package/components/_adapt/Dropdown.d.ts +6 -6
- package/components/_adapt/FloatButton.d.ts +3 -3
- package/components/_adapt/FloatButton.js +1 -0
- package/components/_adapt/Form.d.ts +14 -0
- package/components/_adapt/Form.js +48 -0
- package/components/_adapt/Input.d.ts +17 -0
- package/components/_adapt/Input.js +43 -0
- package/components/_adapt/InputNumber.d.ts +8 -0
- package/components/_adapt/InputNumber.js +60 -0
- package/components/_adapt/Menu.d.ts +8 -7
- package/components/_adapt/Menu.js +12 -20
- package/components/_adapt/Modal.d.ts +9 -7
- package/components/_adapt/Modal.js +12 -20
- package/components/_adapt/Pagination.d.ts +9 -0
- package/components/_adapt/Pagination.js +10 -0
- package/components/_adapt/Popconfirm.d.ts +3 -3
- package/components/_adapt/Popover.d.ts +3 -3
- package/components/_adapt/Progress.d.ts +3 -3
- package/components/_adapt/Radio.d.ts +16 -0
- package/components/_adapt/Radio.js +24 -0
- package/components/_adapt/Select.d.ts +15 -8
- package/components/_adapt/Select.js +134 -13
- package/components/_adapt/Slider.d.ts +31 -0
- package/components/_adapt/Slider.js +5 -0
- package/components/_adapt/Table.d.ts +26 -0
- package/components/_adapt/Table.js +43 -0
- package/components/_adapt/Tabs.d.ts +4 -4
- package/components/_adapt/Tag.d.ts +9 -7
- package/components/_adapt/Tag.js +4 -3
- package/components/_adapt/Tooltip.d.ts +3 -3
- package/components/_adapt/TreeSelect.d.ts +13 -0
- package/components/_adapt/TreeSelect.js +46 -0
- package/components/_adapt/_Antd5.d.ts +11 -0
- package/components/_adapt/_Antd5.js +5 -0
- package/components/_adapt/notification.d.ts +22 -0
- package/components/_adapt/notification.js +5 -0
- package/components/_adapt/todo/Image.d.ts +1 -1
- package/components/_adapt/todo/NotEffectOnV15.d.ts +1 -0
- package/components/_adapt/todo/NotEffectOnV15.js +5 -0
- package/components/_adapt/todo/Segmented.d.ts +1 -1
- package/components/_adapt/utils.d.ts +1 -1
- package/components/_adapt/utils.js +1 -0
- package/components/_common/AutoComplete.js +1 -1
- package/components/_common/Upagination.d.ts +1 -1
- package/components/_common/Upagination.js +2 -2
- package/components/_setup/UForm/UFormJSON.js +5 -3
- package/components/_setup/UForm/UFormSelect.js +10 -7
- package/components/_setup/UForm/UFormTree.js +1 -1
- package/deps/SpringCloud.d.ts +1 -1
- package/deps/_editor/tools/_TxtButton.js +5 -4
- package/hooks/useAjaxQuery.d.ts +5 -8
- package/hooks/useAjaxQuery.js +21 -25
- package/index.d.ts +45 -31
- package/index.js +23 -13
- package/package.json +1 -1
- package/utils/Const.d.ts +1 -1
- package/utils/CustomApp.d.ts +3 -3
- package/utils/Global.js +39 -0
- package/utils/PageUtil.d.ts +5 -1
- package/utils/PageUtil.js +15 -1
- package/utils/Renders/StatusRender.d.ts +1 -1
- package/utils/TreeUtil.d.ts +9 -0
|
@@ -39,7 +39,7 @@ exports.UForm = exports.initValue = void 0;
|
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const lodash_1 = __importDefault(require("lodash"));
|
|
41
41
|
const utils_1 = require("../../utils");
|
|
42
|
-
const
|
|
42
|
+
const Form_1 = require("../_adapt/Form");
|
|
43
43
|
const Row_1 = require("../_adapt/Row");
|
|
44
44
|
const Col_1 = require("../_adapt/Col");
|
|
45
45
|
const Popconfirm_1 = require("../_adapt/Popconfirm");
|
|
@@ -145,8 +145,9 @@ const renderFormField = (state, field, form, update, data) => {
|
|
|
145
145
|
const input = (0, _register_1.getUFormInput)(field.type || 'text');
|
|
146
146
|
const { labelSpan, inputSpan, colSpan, cols, disableFields, hiddenFields, requireFields, optionFields, } = state;
|
|
147
147
|
if (hiddenFields.current.has(field.field)) {
|
|
148
|
-
return react_1.default.createElement(
|
|
148
|
+
return react_1.default.createElement(Form_1.Form.Item, { style: { display: 'none' } }, form.getFieldDecorator(field.field)(react_1.default.createElement(input.component, {
|
|
149
149
|
form,
|
|
150
|
+
// initValue:
|
|
150
151
|
field,
|
|
151
152
|
disabled: disableFields.current.has(field.field),
|
|
152
153
|
options: (0, _FormUtils_1.getOptions)(optionFields.current.has(field.field) ? optionFields.current.get(field.field) : (field.options || []), field, data)
|
|
@@ -154,7 +155,7 @@ const renderFormField = (state, field, form, update, data) => {
|
|
|
154
155
|
}
|
|
155
156
|
const [required, rules] = (0, _FormUtils_1.requireStatus)(field, requireFields.current, disableFields.current, hiddenFields.current);
|
|
156
157
|
const options = {
|
|
157
|
-
|
|
158
|
+
initialValue: form.getFieldValue(field.field),
|
|
158
159
|
validateFirst: true,
|
|
159
160
|
rules,
|
|
160
161
|
getValueFromEvent: (value, extra) => onChangeEvent(state, field, form, update, value, extra),
|
|
@@ -224,7 +225,7 @@ const renderFormField = (state, field, form, update, data) => {
|
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
return react_1.default.createElement(Col_1.Col, Object.assign({}, colProps),
|
|
227
|
-
react_1.default.createElement(
|
|
228
|
+
react_1.default.createElement(Form_1.Form.Item, Object.assign({}, itemProps), form.getFieldDecorator(field.field, options)(react_1.default.createElement(input.component, {
|
|
228
229
|
form,
|
|
229
230
|
field,
|
|
230
231
|
disabled: disableFields.current.has(field.field),
|
|
@@ -346,9 +347,11 @@ const _FormField = (props) => {
|
|
|
346
347
|
const { form } = props;
|
|
347
348
|
const update = (0, useUpdate_1.useUpdate)();
|
|
348
349
|
(0, react_1.useEffect)(() => {
|
|
350
|
+
// console.log('dfdsaupdate')
|
|
349
351
|
const values = (0, exports.initValue)(props);
|
|
350
352
|
props.initRef.current = values;
|
|
351
|
-
|
|
353
|
+
console.log(values);
|
|
354
|
+
form.setFieldsValue(props.initRef.current);
|
|
352
355
|
props.fields.map(field => {
|
|
353
356
|
if (field == null || field == false)
|
|
354
357
|
return;
|
|
@@ -358,10 +361,12 @@ const _FormField = (props) => {
|
|
|
358
361
|
if (lodash_1.default.isArray(field.link) && field.link.length > 0)
|
|
359
362
|
setTimeout(() => onChangeEvent(props.state, field, form, update, values[field.field]), 2);
|
|
360
363
|
});
|
|
364
|
+
// console.log('google')
|
|
361
365
|
update();
|
|
362
366
|
}, []);
|
|
363
|
-
|
|
364
|
-
|
|
367
|
+
// console.log(props.initRef.current)
|
|
368
|
+
// return Const.NONE
|
|
369
|
+
// if (props.initRef.current === null) return Const.NONE;
|
|
365
370
|
const data = form.getFieldsValue();
|
|
366
371
|
return props.fields.map(field => {
|
|
367
372
|
if (field == null || field === false)
|
|
@@ -392,8 +397,7 @@ const _FormGroup = (props) => {
|
|
|
392
397
|
});
|
|
393
398
|
update();
|
|
394
399
|
}, []);
|
|
395
|
-
if (props.initRef.current === null)
|
|
396
|
-
return utils_1.Const.NONE;
|
|
400
|
+
// if (props.initRef.current === null) return Const.NONE;
|
|
397
401
|
const data = form.getFieldsValue();
|
|
398
402
|
return props.fields.map(group => {
|
|
399
403
|
if (group == null || group === false)
|
|
@@ -449,12 +453,39 @@ const _UForm = (0, react_1.forwardRef)((props, ref) => {
|
|
|
449
453
|
checkMultiple(item);
|
|
450
454
|
}
|
|
451
455
|
});
|
|
456
|
+
// initRef.current = initValue({ ...props, state })
|
|
457
|
+
// if (state.isGroup) {
|
|
458
|
+
// props.fields.map(group => {
|
|
459
|
+
// if (group == null || group == false) return;
|
|
460
|
+
// (group as UFormFieldGroup).fields.map(field => {
|
|
461
|
+
// // @ts-ignore
|
|
462
|
+
// if (field == null || field == false) return;
|
|
463
|
+
// if (!_.has(initRef.current, field.field) || initRef.current[field.field] === null || initRef.current[field.field] === undefined) return;
|
|
464
|
+
// // setFieldsValue 要 render 后才能get ,延时执行 link事件
|
|
465
|
+
// // if (_.isArray(field.link) && field.link.length > 0) setTimeout(() => onChangeEvent(state, field, form, update, values[field.field]), 2);
|
|
466
|
+
// })
|
|
467
|
+
// })
|
|
468
|
+
// } else {
|
|
469
|
+
// props.fields.map(field => {
|
|
470
|
+
// if (field == null || field == false) return;
|
|
471
|
+
// if (!_.has(initRef.current, field.field) || initRef.current[field.field] === null || initRef.current[field.field] === undefined) return;
|
|
472
|
+
// // setFieldsValue 要 render 后才能get ,延时执行 link事件
|
|
473
|
+
// // if (_.isArray(field.link) && field.link.length > 0) setTimeout(() => onChangeEvent(props.state, field, form, update, values[field.field]), 2);
|
|
474
|
+
// })
|
|
475
|
+
// }
|
|
476
|
+
// form.setFieldsValue(initRef.current, () => setChecked(true))
|
|
452
477
|
setChecked(true);
|
|
453
478
|
}, []);
|
|
454
|
-
|
|
479
|
+
if (!checked)
|
|
480
|
+
return utils_1.Const.NONE;
|
|
481
|
+
// console.log(initRef)
|
|
482
|
+
// console.log('fdsafd')
|
|
483
|
+
return react_1.default.createElement(Form_1.Form
|
|
484
|
+
// defaultValue={initRef.current}
|
|
455
485
|
// initialValues={props.default}
|
|
456
486
|
// size={props.size || GLOBAL.CONFIG.FORM.SIZE}
|
|
457
487
|
, {
|
|
488
|
+
// defaultValue={initRef.current}
|
|
458
489
|
// initialValues={props.default}
|
|
459
490
|
// size={props.size || GLOBAL.CONFIG.FORM.SIZE}
|
|
460
491
|
className: state.isGroup ? 'c-form c-form-group' : 'c-form', style: { width: state.width }, form: form },
|
|
@@ -469,7 +500,8 @@ class _UFormAdaptor extends react_1.default.Component {
|
|
|
469
500
|
}
|
|
470
501
|
// 3.0 适配层
|
|
471
502
|
const UFormAdaptor = (0, react_1.memo)((0, react_1.forwardRef)((props, ref) => {
|
|
472
|
-
const FROM =
|
|
503
|
+
const FROM = Form_1.Form.create()(_UFormAdaptor);
|
|
504
|
+
// <ConfigProvider ></ConfigProvider>
|
|
473
505
|
return react_1.default.createElement(FROM, Object.assign({}, props, { aref: ref }));
|
|
474
506
|
}));
|
|
475
507
|
/**
|
|
@@ -480,5 +512,5 @@ const UFormAdaptor = (0, react_1.memo)((0, react_1.forwardRef)((props, ref) => {
|
|
|
480
512
|
* 3. 支持 ref 控制方法
|
|
481
513
|
* 4. filed 支持更多提示,验证方法
|
|
482
514
|
*/
|
|
483
|
-
exports.UForm = react_1.
|
|
515
|
+
exports.UForm = (0, react_1.forwardRef)((props, ref) => react_1.default.createElement(FormWrapper_1.FormWrapper, Object.assign({ isInfo: false }, props),
|
|
484
516
|
react_1.default.createElement(UFormAdaptor, Object.assign({}, props, { ref: ref }))));
|
|
@@ -38,7 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
38
|
exports.UFormModal = void 0;
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const lodash_1 = __importDefault(require("lodash"));
|
|
41
|
-
const
|
|
41
|
+
const Popconfirm_1 = require("../_adapt/Popconfirm");
|
|
42
42
|
const Modal_1 = require("../_adapt/Modal");
|
|
43
43
|
const Button_1 = require("../_adapt/Button");
|
|
44
44
|
const UForm_1 = require("./UForm");
|
|
@@ -48,6 +48,9 @@ const FormWrapper_1 = require("./FormWrapper");
|
|
|
48
48
|
const FORM_FIELDS = ['layout', 'fields', 'groupType', 'isEdit', 'tip', 'default', 'data', 'mode', 'size'];
|
|
49
49
|
const UFormModal = (props) => {
|
|
50
50
|
const ref = (0, react_1.useRef)(null);
|
|
51
|
+
const [open, afterClose] = (0, Modal_1.useDestoryModal)(props);
|
|
52
|
+
if (!open)
|
|
53
|
+
return utils_1.Const.NONE;
|
|
51
54
|
let modalProps = {
|
|
52
55
|
onOk: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
56
|
const result = yield ref.current.validate();
|
|
@@ -136,14 +139,14 @@ const UFormModal = (props) => {
|
|
|
136
139
|
btn.icon = react_1.default.createElement(Icon, { type: btn.icon });
|
|
137
140
|
}
|
|
138
141
|
if (btn.confirm) {
|
|
139
|
-
return react_1.default.createElement(
|
|
142
|
+
return react_1.default.createElement(Popconfirm_1.Popconfirm, { title: btn.confirm, onConfirm: (evt) => onClick(evt) },
|
|
140
143
|
react_1.default.createElement(Button_1.Button, Object.assign({}, btn, { onClick: undefined }), utils_1.i18n.getText(btn.ik, btn.label)));
|
|
141
144
|
}
|
|
142
145
|
return react_1.default.createElement(Button_1.Button, Object.assign({}, btn, { onClick: evt => onClick(evt) }), utils_1.i18n.getText(btn.ik, btn.label));
|
|
143
146
|
});
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
|
-
return react_1.default.createElement(Modal_1.Modal, Object.assign({ maskClosable: utils_1.GLOBAL.CONFIG.FORM.maskClosable, destroyOnClose: true }, lodash_1.default.omit(props, FORM_FIELDS), { className: utils_1.StringUtil.className(['u-form-modal'], props.className), onCancel: () => props.onCancel() }, modalProps),
|
|
149
|
+
return react_1.default.createElement(Modal_1.Modal, Object.assign({ maskClosable: utils_1.GLOBAL.CONFIG.FORM.maskClosable, destroyOnClose: true, afterClose: afterClose }, lodash_1.default.omit(props, FORM_FIELDS), { className: utils_1.StringUtil.className(['u-form-modal'], props.className), onCancel: () => props.onCancel() }, modalProps),
|
|
147
150
|
react_1.default.createElement(UForm_1.UForm, Object.assign({}, lodash_1.default.pick(props, FORM_FIELDS), { ref: ref })));
|
|
148
151
|
};
|
|
149
152
|
exports.UFormModal = UFormModal;
|
|
@@ -13,6 +13,9 @@ const Const_1 = require("../_setup/Const");
|
|
|
13
13
|
const FormWrapper_1 = require("./FormWrapper");
|
|
14
14
|
const FORM_FIELDS = ['layout', 'fields', 'groupType', 'isEdit', 'tip', 'default', 'data', 'mode', 'hideBorder', 'theme'];
|
|
15
15
|
const UInfoModal = (props) => {
|
|
16
|
+
const [open, afterClose] = (0, Modal_1.useDestoryModal)(props);
|
|
17
|
+
if (!open)
|
|
18
|
+
return utils_1.Const.NONE;
|
|
16
19
|
const param = lodash_1.default.omit(props, FORM_FIELDS);
|
|
17
20
|
if (!lodash_1.default.has(props, 'title') && lodash_1.default.has(props, 'autoTitle')) {
|
|
18
21
|
let name = null;
|
|
@@ -8,17 +8,22 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
9
9
|
const UFormModal_1 = require("./UFormModal");
|
|
10
10
|
const UInfoModal_1 = require("./UInfoModal");
|
|
11
|
+
const Modal_1 = require("../_adapt/Modal");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
11
13
|
const UModal = (props) => {
|
|
14
|
+
const [open, afterClose] = (0, Modal_1.useDestoryModal)(props);
|
|
15
|
+
if (!open)
|
|
16
|
+
return utils_1.Const.NONE;
|
|
12
17
|
// 指定模式时,以指定的模式为准
|
|
13
18
|
if (lodash_1.default.has(props, 'mode')) {
|
|
14
19
|
if (props.mode == 'INFO')
|
|
15
|
-
return react_1.default.createElement(UInfoModal_1.UInfoModal, Object.assign({}, props));
|
|
16
|
-
return react_1.default.createElement(UFormModal_1.UFormModal, Object.assign({}, props));
|
|
20
|
+
return react_1.default.createElement(UInfoModal_1.UInfoModal, Object.assign({ afterClose: afterClose }, props));
|
|
21
|
+
return react_1.default.createElement(UFormModal_1.UFormModal, Object.assign({ afterClose: afterClose }, props));
|
|
17
22
|
}
|
|
18
23
|
if (props.isEdit)
|
|
19
|
-
return react_1.default.createElement(UFormModal_1.UFormModal, Object.assign({}, props));
|
|
24
|
+
return react_1.default.createElement(UFormModal_1.UFormModal, Object.assign({ afterClose: afterClose }, props));
|
|
20
25
|
if (props.data && lodash_1.default.keys(props.data).length)
|
|
21
|
-
return react_1.default.createElement(UInfoModal_1.UInfoModal, Object.assign({}, props));
|
|
22
|
-
return react_1.default.createElement(UFormModal_1.UFormModal, Object.assign({}, props));
|
|
26
|
+
return react_1.default.createElement(UInfoModal_1.UInfoModal, Object.assign({ afterClose: afterClose }, props));
|
|
27
|
+
return react_1.default.createElement(UFormModal_1.UFormModal, Object.assign({ afterClose: afterClose }, props));
|
|
23
28
|
};
|
|
24
29
|
exports.UModal = UModal;
|
|
@@ -6,8 +6,8 @@ export { UInfoModal } from './UInfoModal';
|
|
|
6
6
|
export { UModal } from './UModal';
|
|
7
7
|
export { UDescriptions } from './UDescriptions';
|
|
8
8
|
import type { BaseOption, PlainObject, BaseItem } from '../../basetype';
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
9
|
+
import type { ModalProps } from '../_adapt/Modal';
|
|
10
|
+
import type { ButtonProps } from '../_adapt/Button';
|
|
11
11
|
import type { ValidationRule } from 'antd/es/form/Form';
|
|
12
12
|
/**
|
|
13
13
|
* 表单布局方式 simple = 1 列 (比较宽松) | common = 2 列 (常规) | compress = 3列 (紧凑)
|
|
@@ -22,6 +22,7 @@ export type UFormLayout = 'common' | 'simple' | 'compress';
|
|
|
22
22
|
export type GroupType = 'default' | 'tabs' | 'collapse';
|
|
23
23
|
export type LinkValue = string | number | boolean;
|
|
24
24
|
import type { _FieldType } from './_FieldType';
|
|
25
|
+
import type { SizeType } from '../_adapt/_Antd5';
|
|
25
26
|
/**
|
|
26
27
|
* 联动结果 : 改变目标字段的交互属性
|
|
27
28
|
* 所有属性为可选,需要改变几项属性,则只返回包含几个属性的对象,
|
|
@@ -223,6 +224,10 @@ export type UFromProps = {
|
|
|
223
224
|
* 表单宽度,仅支持数字,一般不传,需要时使用,
|
|
224
225
|
*/
|
|
225
226
|
width?: number;
|
|
227
|
+
/**
|
|
228
|
+
* 表单大小
|
|
229
|
+
*/
|
|
230
|
+
size?: SizeType;
|
|
226
231
|
/**
|
|
227
232
|
* 说明:
|
|
228
233
|
*
|
|
@@ -286,7 +291,7 @@ export type UFromAction = ButtonProps & {
|
|
|
286
291
|
* 新版本 ModalProps 只支持 open 且必传,
|
|
287
292
|
* 不使用 deprecated 属性
|
|
288
293
|
*/
|
|
289
|
-
export type UModalProps = UFromProps & Omit<
|
|
294
|
+
export type UModalProps = UFromProps & Omit<ModalProps, 'children'> & {
|
|
290
295
|
/**
|
|
291
296
|
* open 为必填项,不使用废弃的 visable 属性
|
|
292
297
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { BaseUploadProps } from './index';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ModalProps } from '../../components/_adapt/Modal';
|
|
4
4
|
import type { PlainObject } from '../../basetype';
|
|
5
5
|
/**
|
|
6
6
|
* 导入结果
|
|
@@ -26,7 +26,7 @@ type ImportResult = boolean | {
|
|
|
26
26
|
9. 导入成功后显示结果,成功 OR 失败,失败时重新上传
|
|
27
27
|
0. 成功后可关闭窗体,关闭后可自行刷新数据。
|
|
28
28
|
*/
|
|
29
|
-
export type UploadModalProps =
|
|
29
|
+
export type UploadModalProps = ModalProps & Omit<BaseUploadProps, 'onChange' | 'disabled'> & {
|
|
30
30
|
/**
|
|
31
31
|
* 上传提示,通常包括上传数据说明,数据模板文件下载等内容。
|
|
32
32
|
* 默认 : 请注意:导入的Excel数据字段须与Excel模版保持一致,否则无法导入数据。点击确认时将仅导入正常数据。
|
|
@@ -39,6 +39,7 @@ exports.UploadModal = void 0;
|
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const lodash_1 = __importDefault(require("lodash"));
|
|
41
41
|
const Modal_1 = require("../../components/_adapt/Modal");
|
|
42
|
+
// import { Icon } from '../../components/_adapt/Icon';
|
|
42
43
|
const utils_1 = require("../../utils");
|
|
43
44
|
const antd_1 = require("antd");
|
|
44
45
|
const Alert_1 = require("../_adapt/Alert");
|
|
@@ -48,6 +49,9 @@ const Const_1 = require("../../components/_setup/Const");
|
|
|
48
49
|
const DEFAULT = { uploading: false, uploaded: false, percent: 0, error: false, };
|
|
49
50
|
const UploadModal = props => {
|
|
50
51
|
const [state, setState] = (0, react_1.useState)(DEFAULT);
|
|
52
|
+
const [open, afterClose] = (0, Modal_1.useDestoryModal)(props);
|
|
53
|
+
if (!open)
|
|
54
|
+
return utils_1.Const.NONE;
|
|
51
55
|
const onChange = (info) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
56
|
if (lodash_1.default.isEmpty(info.file))
|
|
53
57
|
return;
|
|
@@ -132,7 +136,7 @@ const UploadModal = props => {
|
|
|
132
136
|
react_1.default.createElement(Button_1.Button, { loading: state.uploading, disabled: state.uploading, icon: "upload" }, utils_1.i18n.txt(Const_1.V.UPLOAD_FILE))),
|
|
133
137
|
react_1.default.createElement(Button_1.Button, { onClick: () => props.onCancel() }, utils_1.i18n.ant('Modal.cancelText')));
|
|
134
138
|
};
|
|
135
|
-
return react_1.default.createElement(Modal_1.Modal, Object.assign({ width: 640 }, props, { title: utils_1.i18n.getText(props.ik, props.title, Const_1.V.UPLOAD_MODAL_TITLE), className: "c-upload-modal",
|
|
139
|
+
return react_1.default.createElement(Modal_1.Modal, Object.assign({ width: 640 }, props, { afterClose: () => { setState(DEFAULT); afterClose(); }, title: utils_1.i18n.getText(props.ik, props.title, Const_1.V.UPLOAD_MODAL_TITLE), className: "c-upload-modal", footer: uploaded ? react_1.default.createElement(Button_1.Button, { type: 'primary', onClick: () => props.onOk ? props.onOk(null) : props.onCancel() }, utils_1.i18n.ant('Modal.okText')) : footer() }),
|
|
136
140
|
props.tip ? props.tip : react_1.default.createElement(Alert_1.Alert, { message: react_1.default.createElement("p", null, utils_1.i18n.txt(Const_1.V.UPLOAD_MODAL_TIP)), type: "info" }),
|
|
137
141
|
error && react_1.default.createElement(Alert_1.Alert, { type: "error", message: state.errMsg }),
|
|
138
142
|
uploaded && react_1.default.createElement(Alert_1.Alert, { type: "success", message: state.sucMsg }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { UploadProps } from 'antd/es/upload';
|
|
2
|
+
import type { UploadProps as AntdUploadProps } from 'antd/es/upload';
|
|
3
3
|
import type { BaseUploadProps } from './index';
|
|
4
4
|
import type { UploadChangeParam, UploadFile } from 'antd/es/upload/interface';
|
|
5
5
|
export type UploadState = {
|
|
@@ -11,5 +11,5 @@ export type UploadState = {
|
|
|
11
11
|
name?: string;
|
|
12
12
|
info?: any;
|
|
13
13
|
};
|
|
14
|
-
export declare const getBaseOptions: (props: BaseUploadProps) =>
|
|
14
|
+
export declare const getBaseOptions: (props: BaseUploadProps) => AntdUploadProps;
|
|
15
15
|
export declare const useUpload: (props: BaseUploadProps) => [UploadState, (info: UploadChangeParam<UploadFile<any>>) => void];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
|
-
import type { AlertProps } from 'antd/es/alert';
|
|
3
|
+
import type { AlertProps as AntdAlertProps } from 'antd/es/alert';
|
|
4
4
|
/**
|
|
5
5
|
* 说明: 排除 Alert 组件已被 antd 标记为 deprecated 的属性:
|
|
6
6
|
* closeText : 使用 closeIcon替代
|
|
7
7
|
*/
|
|
8
|
-
export type
|
|
8
|
+
export type AlertProps = Omit<AntdAlertProps, 'closeText'> & {
|
|
9
9
|
closeIcon?: boolean | React.ReactNode;
|
|
10
10
|
};
|
|
11
|
-
export declare const Alert: FC<
|
|
11
|
+
export declare const Alert: FC<AlertProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Breadcrumb as AntdBreadcrumb } from 'antd';
|
|
2
|
+
import type { BreadcrumbProps as AntdBreadcrumbProps, BreadcrumbItemProps as AntdBreadcrumbItemProps } from 'antd/es/breadcrumb';
|
|
3
|
+
import type { BaseOption } from '../../basetype';
|
|
4
|
+
import type { ExoticComponent, PropsWithChildren } from 'react';
|
|
5
|
+
type ItemType = Partial<AntdBreadcrumbItemProps> & BaseOption;
|
|
6
|
+
export type BreadcrumbProps = AntdBreadcrumbProps & {
|
|
7
|
+
items?: ItemType[];
|
|
8
|
+
};
|
|
9
|
+
export type BreadcrumbItemProps = AntdBreadcrumbItemProps;
|
|
10
|
+
type BreadcrumbComponent = ExoticComponent<PropsWithChildren<BreadcrumbProps>> & {
|
|
11
|
+
Item: typeof AntdBreadcrumb.Item;
|
|
12
|
+
Separator: typeof AntdBreadcrumb.Separator;
|
|
13
|
+
};
|
|
14
|
+
export declare const Breadcrumb: BreadcrumbComponent;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Breadcrumb = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
const antd_1 = require("antd");
|
|
10
|
+
const _BreadcrumbWithItems = (props) => react_1.default.createElement(antd_1.Breadcrumb, Object.assign({}, props), props.items.map(item => react_1.default.createElement(antd_1.Breadcrumb.Item, Object.assign({}, lodash_1.default.omit(props, ['label', 'title', 'children'])), item.label || item.title || item.children)));
|
|
11
|
+
const _Breadcrumb = props => {
|
|
12
|
+
if (lodash_1.default.isArray(props.items) && props.items.length)
|
|
13
|
+
return react_1.default.createElement(_BreadcrumbWithItems, Object.assign({}, props));
|
|
14
|
+
return react_1.default.createElement(antd_1.Breadcrumb, Object.assign({}, props));
|
|
15
|
+
};
|
|
16
|
+
exports.Breadcrumb = _Breadcrumb;
|
|
17
|
+
exports.Breadcrumb.Item = antd_1.Breadcrumb.Item;
|
|
18
|
+
exports.Breadcrumb.Separator = antd_1.Breadcrumb.Separator;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Button as AntdButton } from "antd";
|
|
3
|
-
import type { ButtonProps } from 'antd/es/button';
|
|
3
|
+
import type { ButtonProps as AntdButtonProps } from 'antd/es/button';
|
|
4
4
|
import type { ExoticComponent } from 'react';
|
|
5
5
|
import type { BaseItem } from '../../basetype';
|
|
6
|
-
|
|
7
|
-
export type
|
|
8
|
-
export type OButtonProps = Omit<ButtonProps, 'type' | 'icon'> & BaseItem & {
|
|
6
|
+
import type { SizeType, ButtonType } from './_Antd5';
|
|
7
|
+
export type ButtonProps = Omit<AntdButtonProps, 'type' | 'icon' | 'size'> & BaseItem & {
|
|
9
8
|
danger?: boolean;
|
|
10
9
|
type?: ButtonType;
|
|
10
|
+
size?: SizeType;
|
|
11
11
|
icon?: string | React.ReactNode;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* 扩展 Button 支持 roleCode 和 ik
|
|
15
15
|
*/
|
|
16
|
-
type Button = ExoticComponent<
|
|
16
|
+
type Button = ExoticComponent<ButtonProps> & {
|
|
17
17
|
Group: typeof AntdButton.Group;
|
|
18
18
|
};
|
|
19
19
|
export declare const Button: Button;
|
|
@@ -15,6 +15,8 @@ const _Button = props => {
|
|
|
15
15
|
let btnProps = Object.assign({}, props);
|
|
16
16
|
if (props.danger)
|
|
17
17
|
btnProps.type = 'danger';
|
|
18
|
+
if (props.size)
|
|
19
|
+
btnProps.size = props.size == 'middle' ? 'default' : props.size;
|
|
18
20
|
let icon = null;
|
|
19
21
|
if (props.icon) {
|
|
20
22
|
icon = lodash_1.default.isString(props.icon) ? react_1.default.createElement(Icon_1.Icon, { type: props.icon }) : props.icon;
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* 手风琴组件兼容模块 : Collapse
|
|
4
4
|
* -------------------------------
|
|
5
5
|
*/
|
|
6
|
-
import type { CollapseProps } from 'antd/es/collapse';
|
|
7
|
-
import type { CollapsePanelProps } from 'antd/es/collapse/CollapsePanel';
|
|
6
|
+
import type { CollapseProps as AntdCollapseProps } from 'antd/es/collapse';
|
|
7
|
+
import type { CollapsePanelProps as AntdCollapsePanelProps } from 'antd/es/collapse/CollapsePanel';
|
|
8
8
|
import type { FC, PropsWithChildren, ExoticComponent } from 'react';
|
|
9
9
|
/**
|
|
10
10
|
* 说明: 排除 Collapse 组件已被 antd 标记为 deprecated 的属性:
|
|
11
11
|
* expandIconPosition : 不支持 'left'/'right' 使用 'start'/'end' 替代
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
14
|
-
export type
|
|
13
|
+
export type ExpandIconPosition = 'start' | 'end' | undefined;
|
|
14
|
+
export type CollapseProps = Omit<AntdCollapseProps, 'expandIconPosition'> & {
|
|
15
15
|
expandIconPosition?: ExpandIconPosition;
|
|
16
16
|
};
|
|
17
17
|
type CollapsibleType = 'disabled';
|
|
@@ -20,11 +20,11 @@ type CollapsibleType = 'disabled';
|
|
|
20
20
|
* disabled:1. 不再被支持 , 使用 `collapsible="disabled"` 替代
|
|
21
21
|
* 2. 本版本不支持 header,icon ,只能使用 collapsible="disabled"
|
|
22
22
|
*/
|
|
23
|
-
export type
|
|
23
|
+
export type CollapsePanelProps = Omit<AntdCollapsePanelProps, 'disabled'> & {
|
|
24
24
|
collapsible?: CollapsibleType;
|
|
25
25
|
};
|
|
26
|
-
type CollapseComponent = ExoticComponent<PropsWithChildren<
|
|
27
|
-
Panel: FC<PropsWithChildren<
|
|
26
|
+
type CollapseComponent = ExoticComponent<PropsWithChildren<CollapseProps>> & {
|
|
27
|
+
Panel: FC<PropsWithChildren<CollapsePanelProps>>;
|
|
28
28
|
};
|
|
29
29
|
export declare const Collapse: CollapseComponent;
|
|
30
30
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfigProviderProps as AntdConfigProviderProps } from 'antd/es/config-provider';
|
|
3
|
+
export type ConfigProviderProps = AntdConfigProviderProps & {
|
|
4
|
+
[properties: string]: any;
|
|
5
|
+
};
|
|
6
|
+
export declare const ConfigProvider: React.FC<ConfigProviderProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConfigProvider = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const antd_1 = require("antd");
|
|
9
|
+
const ConfigProvider = props => react_1.default.createElement(antd_1.ConfigProvider, Object.assign({}, props));
|
|
10
|
+
exports.ConfigProvider = ConfigProvider;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DrawerProps as AntdDrawerProps } from 'antd/es/drawer';
|
|
2
3
|
import type { FC } from 'react';
|
|
3
4
|
/**
|
|
4
5
|
* 说明: 排除 Drawer 组件已被 antd 标记为 deprecated 的属性:
|
|
5
6
|
* 1. visible : Please use `open` instead
|
|
6
7
|
* 2. afterVisibleChange Please use `afterOpenChange` instead
|
|
7
8
|
*/
|
|
8
|
-
export type
|
|
9
|
+
export type DrawerProps = Omit<AntdDrawerProps, 'visible' | 'afterVisibleChange'> & {
|
|
10
|
+
/**
|
|
11
|
+
* 1.5版本无法生效的属性
|
|
12
|
+
* */
|
|
9
13
|
size?: 'default' | 'large';
|
|
10
14
|
open?: boolean;
|
|
15
|
+
footer?: React.ReactNode;
|
|
11
16
|
afterOpenChange?: (open: boolean) => void;
|
|
12
17
|
};
|
|
13
|
-
export declare const Drawer: FC<
|
|
18
|
+
export declare const Drawer: FC<DrawerProps>;
|
|
@@ -7,5 +7,9 @@ exports.Drawer = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const antd_1 = require("antd");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
|
-
const Drawer = (props) =>
|
|
10
|
+
const Drawer = (props) => {
|
|
11
|
+
return react_1.default.createElement(antd_1.Drawer, Object.assign({}, (0, utils_1.convertProps)(props, ['visible', 'open'], ['afterVisibleChange', 'afterOpenChange'])),
|
|
12
|
+
props.children,
|
|
13
|
+
props.footer);
|
|
14
|
+
};
|
|
11
15
|
exports.Drawer = Drawer;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type { DropDownProps } from 'antd/es/dropdown';
|
|
2
|
+
import type { MenuProps } from './Menu';
|
|
3
|
+
import type { DropDownProps as AntdDropDownProps } from 'antd/es/dropdown';
|
|
4
4
|
/**
|
|
5
5
|
* 说明: 排除 Dropdown 组件已被 antd 标记为 deprecated 的属性:
|
|
6
6
|
* 1. visible : Please use `open` instead
|
|
7
7
|
* 2. onVisibleChange Please use `onOpenChange` instead
|
|
8
8
|
* 3. overlay Please use `menu` instead
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type DropdownProps = Omit<AntdDropDownProps, 'visible' | 'onVisibleChange' | 'overlay'> & {
|
|
11
11
|
arrow?: boolean;
|
|
12
|
-
menu?:
|
|
13
|
-
overlay?:
|
|
12
|
+
menu?: MenuProps;
|
|
13
|
+
overlay?: AntdDropDownProps['overlay'];
|
|
14
14
|
};
|
|
15
|
-
export declare const Dropdown: FC<
|
|
15
|
+
export declare const Dropdown: FC<DropdownProps>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { BadgeProps } from 'antd/es/badge';
|
|
2
|
+
import type { BadgeProps as AntdBadgeProps } from 'antd/es/badge';
|
|
3
3
|
export type FloatButtonType = 'default' | 'primary';
|
|
4
4
|
export type FloatButtonShape = 'circle' | 'square';
|
|
5
5
|
export type FloatButtonGroupTrigger = 'click' | 'hover';
|
|
6
|
-
export type FloatButtonBadgeProps = Omit<
|
|
6
|
+
export type FloatButtonBadgeProps = Omit<AntdBadgeProps, 'status' | 'text' | 'title' | 'children'>;
|
|
7
7
|
export interface FloatButtonProps {
|
|
8
8
|
className?: string;
|
|
9
9
|
style?: React.CSSProperties;
|
|
@@ -15,4 +15,4 @@ export interface FloatButtonProps {
|
|
|
15
15
|
badge?: FloatButtonBadgeProps;
|
|
16
16
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
17
17
|
}
|
|
18
|
-
export declare const FloatButton: (props: FloatButtonProps) => React.
|
|
18
|
+
export declare const FloatButton: (props: FloatButtonProps) => React.ReactElement<any, any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FormProps as AntdFormProps, FormItemProps as AntdFormItemProps, FormComponentProps, FormCreateOption } from 'antd/es/form';
|
|
3
|
+
import type { FormWrappedProps } from 'antd/es/form/interface';
|
|
4
|
+
import type { FC, ExoticComponent, PropsWithChildren } from 'react';
|
|
5
|
+
export type FormProps = AntdFormProps;
|
|
6
|
+
export type FormItemProps = AntdFormItemProps & {
|
|
7
|
+
tooltip?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type FormComponent = ExoticComponent<PropsWithChildren<AntdFormProps>> & {
|
|
10
|
+
Item: FC<FormItemProps>;
|
|
11
|
+
create: <TOwnProps extends FormComponentProps<any>>(options?: FormCreateOption<TOwnProps>) => FormWrappedProps<TOwnProps>;
|
|
12
|
+
};
|
|
13
|
+
export declare const Form: FormComponent;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Form = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const antd_1 = require("antd");
|
|
29
|
+
const Icon_1 = require("./Icon");
|
|
30
|
+
const Popover_1 = require("./Popover");
|
|
31
|
+
const FormItem = props => {
|
|
32
|
+
const label = (0, react_1.useMemo)(() => {
|
|
33
|
+
if (props.label == null || props.label == undefined) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
if (props.tooltip) {
|
|
37
|
+
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
38
|
+
react_1.default.createElement(Popover_1.Popover, null,
|
|
39
|
+
react_1.default.createElement(Icon_1.Icon, { type: 'help' }),
|
|
40
|
+
props.label));
|
|
41
|
+
}
|
|
42
|
+
return props.label;
|
|
43
|
+
}, [props.label, props.tooltip]);
|
|
44
|
+
return react_1.default.createElement(antd_1.Form.Item, Object.assign({}, props, { label: label }));
|
|
45
|
+
};
|
|
46
|
+
const _Form = antd_1.Form;
|
|
47
|
+
exports.Form = _Form;
|
|
48
|
+
exports.Form.Item = FormItem;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Input as AntdInput } from 'antd';
|
|
2
|
+
import type { InputProps } from 'antd/es/input';
|
|
3
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
4
|
+
export interface InputRef {
|
|
5
|
+
input: HTMLInputElement | null;
|
|
6
|
+
focus: () => void;
|
|
7
|
+
blur: () => void;
|
|
8
|
+
select: () => void;
|
|
9
|
+
}
|
|
10
|
+
type InputComponent = ForwardRefExoticComponent<InputProps & RefAttributes<InputRef>> & {
|
|
11
|
+
Group: typeof AntdInput.Group;
|
|
12
|
+
Search: typeof AntdInput.Search;
|
|
13
|
+
TextArea: typeof AntdInput.TextArea;
|
|
14
|
+
Password: typeof AntdInput.Password;
|
|
15
|
+
};
|
|
16
|
+
export declare const Input: InputComponent;
|
|
17
|
+
export {};
|