@rainte/ant 0.0.1
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/.editorconfig +9 -0
- package/.fatherrc.ts +15 -0
- package/.gitattributes +1 -0
- package/.prettierignore +7 -0
- package/.prettierrc +13 -0
- package/.umirc.ts +24 -0
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/docs/index.md +9 -0
- package/es/components/Editor/index.d.ts +8 -0
- package/es/components/Editor/index.js +35 -0
- package/es/components/Editor/props.d.ts +13 -0
- package/es/components/Editor/props.js +12 -0
- package/es/components/Form/index.d.ts +8 -0
- package/es/components/Form/index.js +53 -0
- package/es/components/Image/index.d.ts +5 -0
- package/es/components/Image/index.js +14 -0
- package/es/components/Table/index.d.ts +9 -0
- package/es/components/Table/index.js +35 -0
- package/es/components/Tabs/index.d.ts +9 -0
- package/es/components/Tabs/index.js +22 -0
- package/es/components/ValueType/components/Cascader.d.ts +3 -0
- package/es/components/ValueType/components/Cascader.js +89 -0
- package/es/components/ValueType/components/Editor.d.ts +3 -0
- package/es/components/ValueType/components/Editor.js +18 -0
- package/es/components/ValueType/components/TreeSelect.d.ts +3 -0
- package/es/components/ValueType/components/TreeSelect.js +87 -0
- package/es/components/ValueType/components/Upload.d.ts +4 -0
- package/es/components/ValueType/components/Upload.js +73 -0
- package/es/components/ValueType/index.d.ts +15 -0
- package/es/components/ValueType/index.js +10 -0
- package/es/index.d.ts +11 -0
- package/es/index.js +6 -0
- package/es/utils/Swr.d.ts +1 -0
- package/es/utils/Swr.js +58 -0
- package/es/utils/Tree.d.ts +2 -0
- package/es/utils/Tree.js +65 -0
- package/lib/components/Editor/index.d.ts +8 -0
- package/lib/components/Editor/index.js +43 -0
- package/lib/components/Editor/props.d.ts +13 -0
- package/lib/components/Editor/props.js +19 -0
- package/lib/components/Form/index.d.ts +8 -0
- package/lib/components/Form/index.js +64 -0
- package/lib/components/Image/index.d.ts +5 -0
- package/lib/components/Image/index.js +22 -0
- package/lib/components/Table/index.d.ts +9 -0
- package/lib/components/Table/index.js +46 -0
- package/lib/components/Tabs/index.d.ts +9 -0
- package/lib/components/Tabs/index.js +30 -0
- package/lib/components/ValueType/components/Cascader.d.ts +3 -0
- package/lib/components/ValueType/components/Cascader.js +97 -0
- package/lib/components/ValueType/components/Editor.d.ts +3 -0
- package/lib/components/ValueType/components/Editor.js +26 -0
- package/lib/components/ValueType/components/TreeSelect.d.ts +3 -0
- package/lib/components/ValueType/components/TreeSelect.js +95 -0
- package/lib/components/ValueType/components/Upload.d.ts +4 -0
- package/lib/components/ValueType/components/Upload.js +82 -0
- package/lib/components/ValueType/index.d.ts +15 -0
- package/lib/components/ValueType/index.js +18 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +41 -0
- package/lib/utils/Swr.d.ts +1 -0
- package/lib/utils/Swr.js +66 -0
- package/lib/utils/Tree.d.ts +2 -0
- package/lib/utils/Tree.js +73 -0
- package/package.json +52 -0
- package/src/components/Editor/index.md +8 -0
- package/src/components/Editor/index.tsx +20 -0
- package/src/components/Editor/props.ts +50 -0
- package/src/components/Form/index.md +132 -0
- package/src/components/Form/index.tsx +48 -0
- package/src/components/Image/index.md +8 -0
- package/src/components/Image/index.tsx +16 -0
- package/src/components/Table/index.md +80 -0
- package/src/components/Table/index.tsx +45 -0
- package/src/components/Tabs/index.md +24 -0
- package/src/components/Tabs/index.tsx +21 -0
- package/src/components/ValueType/components/Cascader.tsx +79 -0
- package/src/components/ValueType/components/Editor.tsx +18 -0
- package/src/components/ValueType/components/TreeSelect.tsx +74 -0
- package/src/components/ValueType/components/Upload.tsx +74 -0
- package/src/components/ValueType/index.ts +33 -0
- package/src/index.ts +12 -0
- package/src/utils/Swr.ts +29 -0
- package/src/utils/Tree.ts +51 -0
- package/tsconfig.json +31 -0
- package/typings.d.ts +4 -0
package/.editorconfig
ADDED
package/.fatherrc.ts
ADDED
package/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.* linguist-language=TypeScript
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/.umirc.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineConfig } from 'dumi'
|
|
2
|
+
|
|
3
|
+
const logo =
|
|
4
|
+
'https://user-images.githubusercontent.com/9554297/83762004-a0761b00-a6a9-11ea-83b4-9c8ff721d4b8.png'
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
title: 'dumi',
|
|
8
|
+
favicon: logo,
|
|
9
|
+
logo: logo,
|
|
10
|
+
outputPath: 'docs-dist',
|
|
11
|
+
mode: 'site',
|
|
12
|
+
extraBabelPlugins: [
|
|
13
|
+
[
|
|
14
|
+
'import',
|
|
15
|
+
{
|
|
16
|
+
libraryName: 'antd',
|
|
17
|
+
libraryDirectory: 'es',
|
|
18
|
+
style: true,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
],
|
|
22
|
+
// mfsu: {},
|
|
23
|
+
// more config: https://d.umijs.org/config
|
|
24
|
+
})
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2020] [Rainte]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# ant
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
Install dependencies,
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
$ npm i
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Start the dev server,
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
$ npm start
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Build documentation,
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
$ npm run docs:build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Build library via `father-build`,
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
$ npm run build
|
|
27
|
+
```
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'braft-editor/dist/index.css';
|
|
2
|
+
import 'braft-extensions/dist/table.css';
|
|
3
|
+
import BraftEditor, { BraftEditorProps } from 'braft-editor';
|
|
4
|
+
export type EditorProps = BraftEditorProps;
|
|
5
|
+
declare class Editor extends BraftEditor {
|
|
6
|
+
static defaultProps: any;
|
|
7
|
+
}
|
|
8
|
+
export default Editor;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
import 'braft-editor/dist/index.css';
|
|
16
|
+
import 'braft-extensions/dist/table.css';
|
|
17
|
+
import BraftEditor from 'braft-editor';
|
|
18
|
+
import Table from 'braft-extensions/dist/table';
|
|
19
|
+
import Props from './props';
|
|
20
|
+
var Editor = /*#__PURE__*/function (_BraftEditor) {
|
|
21
|
+
_inherits(Editor, _BraftEditor);
|
|
22
|
+
var _super = _createSuper(Editor);
|
|
23
|
+
function Editor() {
|
|
24
|
+
_classCallCheck(this, Editor);
|
|
25
|
+
return _super.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
return _createClass(Editor);
|
|
28
|
+
}(BraftEditor);
|
|
29
|
+
Editor.defaultProps = void 0;
|
|
30
|
+
Editor.use(Table({
|
|
31
|
+
withDropdown: true,
|
|
32
|
+
columnResizable: true
|
|
33
|
+
}));
|
|
34
|
+
export default Editor;
|
|
35
|
+
Editor.defaultProps = _objectSpread(_objectSpread({}, BraftEditor.defaultProps), Props);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
controls: ['undo', 'redo', 'separator', 'headings', 'separator', 'font-family', 'font-size', 'line-height', 'letter-spacing', 'separator', 'text-indent', 'text-align', 'separator', 'text-color', 'bold', 'italic', 'underline', 'strike-through', 'separator', 'superscript', 'subscript', 'remove-styles', 'emoji', 'hr', 'separator', 'list-ul', 'list-ol', 'blockquote', 'code', 'separator', 'link', 'separator', 'media', 'table', 'clear', 'fullscreen', 'separator'],
|
|
3
|
+
controlBarStyle: {
|
|
4
|
+
border: '1px solid #d9d9d9',
|
|
5
|
+
borderBottom: '0'
|
|
6
|
+
},
|
|
7
|
+
contentStyle: {
|
|
8
|
+
height: 300,
|
|
9
|
+
border: '1px solid #d9d9d9',
|
|
10
|
+
borderTop: '0'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { Context } from 'react';
|
|
2
|
+
import { FormSchema } from '@ant-design/pro-form/es/components/SchemaForm';
|
|
3
|
+
import { ValueTypeEnum } from '../ValueType';
|
|
4
|
+
export type FormProps<T = Record<string, any>, ValueType = ValueTypeEnum> = FormSchema<T, ValueType> & {
|
|
5
|
+
context: Context<any>;
|
|
6
|
+
};
|
|
7
|
+
declare const Form: React.FC<FormProps<any, any>>;
|
|
8
|
+
export default Form;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/form/style";
|
|
4
|
+
import _Form from "antd/es/form";
|
|
5
|
+
var _excluded = ["context"];
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React, { useContext } from 'react';
|
|
12
|
+
import ProForm, { BetaSchemaForm } from '@ant-design/pro-form';
|
|
13
|
+
import AntContext from '@ant-design/pro-provider';
|
|
14
|
+
import ValueTypeMap from '../ValueType';
|
|
15
|
+
var Form = function Form(props) {
|
|
16
|
+
var context = props.context,
|
|
17
|
+
attrs = _objectWithoutProperties(props, _excluded);
|
|
18
|
+
var values = useContext(context);
|
|
19
|
+
var valueTypeMap = ValueTypeMap;
|
|
20
|
+
return /*#__PURE__*/React.createElement(context.Provider, {
|
|
21
|
+
value: _objectSpread(_objectSpread({}, values), {}, {
|
|
22
|
+
valueTypeMap: valueTypeMap
|
|
23
|
+
})
|
|
24
|
+
}, /*#__PURE__*/React.createElement(BetaSchemaForm, _objectSpread({}, attrs)));
|
|
25
|
+
};
|
|
26
|
+
export default Form;
|
|
27
|
+
Form.defaultProps = {
|
|
28
|
+
context: AntContext,
|
|
29
|
+
layout: 'horizontal',
|
|
30
|
+
labelCol: {
|
|
31
|
+
span: 4
|
|
32
|
+
},
|
|
33
|
+
wrapperCol: {
|
|
34
|
+
span: 8
|
|
35
|
+
},
|
|
36
|
+
submitter: {
|
|
37
|
+
searchConfig: {
|
|
38
|
+
resetText: '返回',
|
|
39
|
+
submitText: '保存'
|
|
40
|
+
},
|
|
41
|
+
onReset: function onReset() {
|
|
42
|
+
return history.go(-1);
|
|
43
|
+
},
|
|
44
|
+
render: function render(_, dom) {
|
|
45
|
+
return /*#__PURE__*/React.createElement(_Form.Item, {
|
|
46
|
+
wrapperCol: {
|
|
47
|
+
offset: 4,
|
|
48
|
+
span: 8
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/React.createElement(ProForm.Group, null, /*#__PURE__*/React.createElement(_Space, null, dom)));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "antd/es/image/style";
|
|
2
|
+
import _Image from "antd/es/image";
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
import React from 'react';
|
|
7
|
+
var Image = function Image(props) {
|
|
8
|
+
return /*#__PURE__*/React.createElement(_Image, _objectSpread({}, props));
|
|
9
|
+
};
|
|
10
|
+
export default Image;
|
|
11
|
+
Image.defaultProps = {
|
|
12
|
+
src: '',
|
|
13
|
+
fallback: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=='
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { Context } from 'react';
|
|
2
|
+
import { ProTableProps } from '@ant-design/pro-table';
|
|
3
|
+
import { ValueTypeEnum } from '../ValueType';
|
|
4
|
+
export type TableProps<T = any, U = Record<string, any>, ValueType = ValueTypeEnum> = ProTableProps<T, U, ValueType> & {
|
|
5
|
+
context: Context<any>;
|
|
6
|
+
selection?: any[];
|
|
7
|
+
};
|
|
8
|
+
declare const Table: React.FC<TableProps<any, any>>;
|
|
9
|
+
export default Table;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var _excluded = ["context", "selection"];
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import React, { useContext } from 'react';
|
|
8
|
+
import ProTable from '@ant-design/pro-table';
|
|
9
|
+
import AntContext from '@ant-design/pro-provider';
|
|
10
|
+
import { FooterToolbar } from '@ant-design/pro-layout';
|
|
11
|
+
import ValueTypeMap from '../ValueType';
|
|
12
|
+
var Table = function Table(props) {
|
|
13
|
+
var context = props.context,
|
|
14
|
+
selection = props.selection,
|
|
15
|
+
attrs = _objectWithoutProperties(props, _excluded);
|
|
16
|
+
var values = useContext(context);
|
|
17
|
+
var valueTypeMap = ValueTypeMap;
|
|
18
|
+
return /*#__PURE__*/React.createElement(context.Provider, {
|
|
19
|
+
value: _objectSpread(_objectSpread({}, values), {}, {
|
|
20
|
+
valueTypeMap: valueTypeMap
|
|
21
|
+
})
|
|
22
|
+
}, /*#__PURE__*/React.createElement(ProTable, _objectSpread({}, attrs)), selection && selection.length > 0 && /*#__PURE__*/React.createElement(FooterToolbar, {
|
|
23
|
+
extra: /*#__PURE__*/React.createElement("div", null, "\u5DF2\u9009\u62E9 ", /*#__PURE__*/React.createElement("a", null, selection.length), " \u9879")
|
|
24
|
+
}, React.Children.map(props.children, function (item) {
|
|
25
|
+
return item;
|
|
26
|
+
})));
|
|
27
|
+
};
|
|
28
|
+
export default Table;
|
|
29
|
+
Table.defaultProps = {
|
|
30
|
+
context: AntContext,
|
|
31
|
+
rowKey: 'id',
|
|
32
|
+
search: {
|
|
33
|
+
labelWidth: 120
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "antd/es/tabs/style";
|
|
2
|
+
import _Tabs from "antd/es/tabs";
|
|
3
|
+
var _excluded = ["items"];
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
import React from 'react';
|
|
10
|
+
var Tabs = function Tabs(props) {
|
|
11
|
+
var items = props.items,
|
|
12
|
+
attrs = _objectWithoutProperties(props, _excluded);
|
|
13
|
+
var panes = items.map(function (item) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(_Tabs.TabPane, _objectSpread({}, item));
|
|
15
|
+
});
|
|
16
|
+
return /*#__PURE__*/React.createElement(_Tabs, _objectSpread({}, attrs), panes);
|
|
17
|
+
};
|
|
18
|
+
export default Tabs;
|
|
19
|
+
Tabs.defaultProps = {
|
|
20
|
+
type: 'card',
|
|
21
|
+
tabPosition: 'top'
|
|
22
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/cascader/style";
|
|
4
|
+
import _Cascader from "antd/es/cascader";
|
|
5
|
+
var _excluded = ["iParams", "iRequest"],
|
|
6
|
+
_excluded2 = ["iValue", "iDom", "iParams", "iRequest"];
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { fetch } from '../../../utils/Swr';
|
|
14
|
+
import { equal, intact } from '../../../utils/Tree';
|
|
15
|
+
var entire = function entire(value, options) {
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
if (value.length === 1) {
|
|
18
|
+
return intact(options, {
|
|
19
|
+
value: value[0]
|
|
20
|
+
}, 'value');
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
return [];
|
|
25
|
+
};
|
|
26
|
+
var combine = function combine(text, options, dom) {
|
|
27
|
+
return text.map(function (item) {
|
|
28
|
+
var node = equal(options, {
|
|
29
|
+
value: item
|
|
30
|
+
});
|
|
31
|
+
return node ? node.label : text ? text : dom;
|
|
32
|
+
}).join(' / ');
|
|
33
|
+
};
|
|
34
|
+
var Cascader = function Cascader(props) {
|
|
35
|
+
var _ref, _entire;
|
|
36
|
+
var iParams = props.iParams,
|
|
37
|
+
iRequest = props.iRequest,
|
|
38
|
+
attrs = _objectWithoutProperties(props, _excluded);
|
|
39
|
+
var data = fetch(iRequest, iParams, attrs);
|
|
40
|
+
var options = (_ref = iRequest ? data : attrs.options) !== null && _ref !== void 0 ? _ref : [];
|
|
41
|
+
var values = (_entire = entire(attrs.value, options)) !== null && _entire !== void 0 ? _entire : [];
|
|
42
|
+
return /*#__PURE__*/React.createElement(_Cascader, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
43
|
+
options: options,
|
|
44
|
+
value: values
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
var Text = function Text(props) {
|
|
48
|
+
var _ref2, _entire2;
|
|
49
|
+
var iValue = props.iValue,
|
|
50
|
+
iDom = props.iDom,
|
|
51
|
+
iParams = props.iParams,
|
|
52
|
+
iRequest = props.iRequest,
|
|
53
|
+
attrs = _objectWithoutProperties(props, _excluded2);
|
|
54
|
+
var data = fetch(iRequest, iParams, attrs);
|
|
55
|
+
var options = (_ref2 = iRequest ? data : attrs.options) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
56
|
+
var values = (_entire2 = entire(iValue, options)) !== null && _entire2 !== void 0 ? _entire2 : [];
|
|
57
|
+
var dom = values.length ? combine(values, options, iDom) : iDom;
|
|
58
|
+
return /*#__PURE__*/React.createElement(_Space, null, dom);
|
|
59
|
+
};
|
|
60
|
+
var Render = {
|
|
61
|
+
name: 'cascader',
|
|
62
|
+
render: function render(text, props, dom) {
|
|
63
|
+
var params = props.params,
|
|
64
|
+
request = props.request,
|
|
65
|
+
fieldProps = props.fieldProps;
|
|
66
|
+
var iParams = params;
|
|
67
|
+
var iRequest = request;
|
|
68
|
+
var attrs = {
|
|
69
|
+
iValue: text,
|
|
70
|
+
iDom: dom,
|
|
71
|
+
iParams: iParams,
|
|
72
|
+
iRequest: iRequest
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/React.createElement(Text, _objectSpread(_objectSpread({}, fieldProps), attrs));
|
|
75
|
+
},
|
|
76
|
+
renderFormItem: function renderFormItem(_, props) {
|
|
77
|
+
var params = props.params,
|
|
78
|
+
request = props.request,
|
|
79
|
+
fieldProps = props.fieldProps;
|
|
80
|
+
var iParams = params;
|
|
81
|
+
var iRequest = request;
|
|
82
|
+
var attrs = {
|
|
83
|
+
iParams: iParams,
|
|
84
|
+
iRequest: iRequest
|
|
85
|
+
};
|
|
86
|
+
return /*#__PURE__*/React.createElement(Cascader, _objectSpread(_objectSpread({}, fieldProps), attrs));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
export default Render;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Editor from '../../Editor';
|
|
6
|
+
var Render = {
|
|
7
|
+
name: 'editor',
|
|
8
|
+
render: function render(text, props, dom) {
|
|
9
|
+
if (text instanceof Object) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, text.toHTML());
|
|
11
|
+
}
|
|
12
|
+
return dom;
|
|
13
|
+
},
|
|
14
|
+
renderFormItem: function renderFormItem(_, props) {
|
|
15
|
+
return /*#__PURE__*/React.createElement(Editor, _objectSpread({}, props.fieldProps));
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default Render;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import "antd/es/space/style";
|
|
2
|
+
import _Space from "antd/es/space";
|
|
3
|
+
import "antd/es/tree-select/style";
|
|
4
|
+
import _TreeSelect from "antd/es/tree-select";
|
|
5
|
+
import "antd/es/tag/style";
|
|
6
|
+
import _Tag from "antd/es/tag";
|
|
7
|
+
var _excluded = ["iParams", "iRequest"],
|
|
8
|
+
_excluded2 = ["iValue", "iDom", "iParams", "iRequest"];
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { fetch } from '../../../utils/Swr';
|
|
16
|
+
import { equal } from '../../../utils/Tree';
|
|
17
|
+
var combine = function combine(text, options, dom) {
|
|
18
|
+
return text.map(function (item) {
|
|
19
|
+
var node = equal(options, {
|
|
20
|
+
value: item
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/React.createElement(_Tag, null, node ? node.title : text ? text : dom);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var TreeSelect = function TreeSelect(props) {
|
|
26
|
+
var _ref;
|
|
27
|
+
var iParams = props.iParams,
|
|
28
|
+
iRequest = props.iRequest,
|
|
29
|
+
attrs = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
var data = fetch(iRequest, iParams, attrs);
|
|
31
|
+
var options = (_ref = iRequest ? data : attrs.treeData) !== null && _ref !== void 0 ? _ref : [];
|
|
32
|
+
return /*#__PURE__*/React.createElement(_TreeSelect, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
33
|
+
treeData: options
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
var Text = function Text(props) {
|
|
37
|
+
var _ref2;
|
|
38
|
+
var iValue = props.iValue,
|
|
39
|
+
iDom = props.iDom,
|
|
40
|
+
iParams = props.iParams,
|
|
41
|
+
iRequest = props.iRequest,
|
|
42
|
+
attrs = _objectWithoutProperties(props, _excluded2);
|
|
43
|
+
var data = fetch(iRequest, iParams, attrs);
|
|
44
|
+
var options = (_ref2 = iRequest ? data : attrs.treeData) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
45
|
+
if (Array.isArray(iValue)) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(_Space, null, combine(iValue, options, iDom));
|
|
47
|
+
}
|
|
48
|
+
var node = equal(options, {
|
|
49
|
+
value: iValue
|
|
50
|
+
});
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, node ? node.title : iValue ? iValue : iDom);
|
|
52
|
+
};
|
|
53
|
+
var Render = {
|
|
54
|
+
name: 'treeSelect',
|
|
55
|
+
render: function render(text, props, dom) {
|
|
56
|
+
var params = props.params,
|
|
57
|
+
request = props.request,
|
|
58
|
+
fieldProps = props.fieldProps;
|
|
59
|
+
var iParams = params;
|
|
60
|
+
var iRequest = request;
|
|
61
|
+
var attrs = {
|
|
62
|
+
iValue: text,
|
|
63
|
+
iDom: dom,
|
|
64
|
+
iParams: iParams,
|
|
65
|
+
iRequest: iRequest
|
|
66
|
+
};
|
|
67
|
+
return /*#__PURE__*/React.createElement(Text, _objectSpread(_objectSpread({}, fieldProps), attrs));
|
|
68
|
+
},
|
|
69
|
+
renderFormItem: function renderFormItem(_, props) {
|
|
70
|
+
var params = props.params,
|
|
71
|
+
request = props.request,
|
|
72
|
+
fieldProps = props.fieldProps;
|
|
73
|
+
var iParams = params;
|
|
74
|
+
var iRequest = request;
|
|
75
|
+
var attrs = {
|
|
76
|
+
iParams: iParams,
|
|
77
|
+
iRequest: iRequest
|
|
78
|
+
};
|
|
79
|
+
return /*#__PURE__*/React.createElement(TreeSelect, _objectSpread(_objectSpread({}, fieldProps), attrs));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export default Render;
|
|
83
|
+
TreeSelect.defaultProps = {
|
|
84
|
+
allowClear: true,
|
|
85
|
+
showSearch: true,
|
|
86
|
+
treeNodeFilterProp: 'title'
|
|
87
|
+
};
|