@noah-libjs/components 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/dist/ArrayInput/components.d.ts +165 -5
- package/dist/ArrayInput/types.d.ts +2 -1
- package/dist/ArraySingle/DispalyInner.d.ts +4 -0
- package/dist/ArraySingle/Inner.d.ts +4 -0
- package/dist/ArraySingle/index.d.ts +4 -0
- package/dist/ArraySingle/types.d.ts +16 -0
- package/dist/LazyAntd/ColorPicker/index.d.ts +1 -1
- package/dist/LazyAntd/DatePicker/Base/DatePicker.d.ts +3 -1
- package/dist/LazyAntd/DatePicker/Base/index.d.ts +6 -2
- package/dist/LazyAntd/DatePicker/RangePicker.d.ts +3 -1
- package/dist/LazyAntd/Tree/Inner.d.ts +2 -1
- package/dist/LazyAntd/Tree/index.d.ts +3 -2
- package/dist/MyAutoComplete/types.d.ts +4 -1
- package/dist/MyButton/index.d.ts +10 -0
- package/dist/MyCheckbox/components.d.ts +184 -24
- package/dist/MyCheckbox/types.d.ts +6 -3
- package/dist/MyDatePicker/Display.d.ts +1 -1
- package/dist/MyIconSelect/MyIcon.d.ts +2 -0
- package/dist/MyIconSelect/MyIconSelect.d.ts +5 -0
- package/dist/MyIconSelect/index.d.ts +6 -0
- package/dist/MyIconSelect/types.d.ts +16 -0
- package/dist/MyIconSelect/utils.d.ts +7 -0
- package/dist/MyInput/index.d.ts +3 -3
- package/dist/MyRangeDate/Inner.d.ts +4 -5
- package/dist/MyRangeDate/index.d.ts +6 -7
- package/dist/MyRangeDate/utils.d.ts +18 -381
- package/dist/MySelect/components.d.ts +165 -5
- package/dist/MySelect/types.d.ts +3 -1
- package/dist/MySwitch/types.d.ts +5 -2
- package/dist/a_chunks/index.js +509 -116
- package/dist/a_chunks/index.module.js +1 -24
- package/dist/a_chunks/root.17.js +12 -6
- package/dist/a_chunks/root.18.js +5 -6
- package/dist/a_chunks/root.19.js +2 -2
- package/dist/a_chunks/root.20.js +2 -2
- package/dist/a_chunks/root.21.js +2 -2
- package/dist/a_chunks/root.22.js +141 -183
- package/dist/a_chunks/root.23.js +15 -109
- package/dist/a_chunks/root.24.js +66 -5
- package/dist/a_chunks/root.25.js +8 -4
- package/dist/a_chunks/root.26.js +68 -0
- package/dist/a_chunks/root.27.js +212 -0
- package/dist/a_chunks/root.28.js +117 -0
- package/dist/a_chunks/root.29.js +5 -0
- package/dist/a_chunks/root.30.js +4 -0
- package/dist/a_chunks/root.8.js +7 -5
- package/dist/a_chunks/utils.js +59 -0
- package/dist/index.js +2 -2
- package/dist/packs.d.ts +168 -1
- package/dist/util-types/fd/InputType.d.ts +1 -1
- package/dist/util-types/fd/index.d.ts +41 -11
- package/dist/utils/getInputStyle.d.ts +3 -2
- package/dist/utils/msmc.d.ts +13 -4
- package/dist/utils/new.d.ts +12 -0
- package/dist/utils/use_array_marshal.d.ts +5 -0
- package/package.json +4 -4
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if (ref === void 0) ref = {};
|
|
3
|
-
var insertAt = ref.insertAt;
|
|
4
|
-
if (!css || typeof document === 'undefined') {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
8
|
-
var style = document.createElement('style');
|
|
9
|
-
style.type = 'text/css';
|
|
10
|
-
if (insertAt === 'top') {
|
|
11
|
-
if (head.firstChild) {
|
|
12
|
-
head.insertBefore(style, head.firstChild);
|
|
13
|
-
} else {
|
|
14
|
-
head.appendChild(style);
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
head.appendChild(style);
|
|
18
|
-
}
|
|
19
|
-
if (style.styleSheet) {
|
|
20
|
-
style.styleSheet.cssText = css;
|
|
21
|
-
} else {
|
|
22
|
-
style.appendChild(document.createTextNode(css));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import { s as styleInject } from './index.js';
|
|
25
2
|
var css_248z = ".index-module_wrapper__8xmrk input {\n padding: 0 !important;\n border-top: none !important;\n border-left: none !important;\n border-right: none !important;\n}\n.index-module_wrapper__8xmrk .ant-select-selector {\n padding: 0 !important;\n border-top: none !important;\n border-left: none !important;\n border-right: none !important;\n}\n.index-module_wrapper__8xmrk .ant-select-selection-search-input {\n padding: 0 !important;\n border-top: none !important;\n border-left: none !important;\n border-right: none !important;\n}\n.index-module_block-box__zbZ8F {\n display: block !important;\n}\n.index-module_block-box__zbZ8F > div {\n margin-bottom: 6px;\n}\n.index-module_flex-box__aGmld {\n display: flex;\n}\n.index-module_warning__Z3oMd .ant-checkbox-checked .ant-checkbox-inner {\n background: red !important;\n border-color: red !important;\n}\n.index-module_warning__Z3oMd .ant-input {\n color: red !important;\n border-color: red !important;\n border-radius: 0 !important;\n}\n.index-module_warning__Z3oMd .ant-select-selector {\n color: red !important;\n border-color: red !important;\n border-radius: 0 !important;\n}\n.index-module_warning__Z3oMd .ant-select-selection-search-input {\n border-color: red !important;\n border-radius: 0 !important;\n}\n";
|
|
26
3
|
var styles = {
|
|
27
4
|
"wrapper": "index-module_wrapper__8xmrk",
|
package/dist/a_chunks/root.17.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
var _excluded = ["onChange", "value", "marshal", "fetch_options", "uniqueKey", "popupMatchSelectWidth"];
|
|
3
|
+
var _excluded = ["onChange", "value", "marshal", "fetch_options", "uniqueKey", "popupMatchSelectWidth", "fetch_options_on_open"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { isNil, numberLikeCompare } from '@noah-libjs/utils';
|
|
@@ -8,10 +8,10 @@ import { Row, Col } from 'antd';
|
|
|
8
8
|
import React__default, { useMemo } from 'react';
|
|
9
9
|
import { p as packs, u as use_options, g as getInputStyle, a as getMarshal, b as get_mode, c as check_multiple, S as Select_L, d as parse_MC_value } from './index.js';
|
|
10
10
|
import { s as styles } from './index.module.js';
|
|
11
|
-
import '@ant-design/icons';
|
|
12
11
|
import 'dayjs';
|
|
13
12
|
import 'rc-select';
|
|
14
13
|
import 'rc-tree';
|
|
14
|
+
import '@noah-libjs/request';
|
|
15
15
|
var componentMap = packs;
|
|
16
16
|
function RenderComponent(p) {
|
|
17
17
|
var _target$props;
|
|
@@ -54,13 +54,15 @@ var MySelect = function MySelect(props) {
|
|
|
54
54
|
fetch_options = props.fetch_options,
|
|
55
55
|
uniqueKey = props.uniqueKey,
|
|
56
56
|
_props$popupMatchSele = props.popupMatchSelectWidth,
|
|
57
|
-
popupMatchSelectWidth = _props$popupMatchSele === void 0 ?
|
|
57
|
+
popupMatchSelectWidth = _props$popupMatchSele === void 0 ? 140 : _props$popupMatchSele,
|
|
58
|
+
fetch_options_on_open = props.fetch_options_on_open,
|
|
58
59
|
others = _objectWithoutProperties(props, _excluded);
|
|
59
60
|
var _use_options = use_options(props),
|
|
60
61
|
options = _use_options.options,
|
|
61
62
|
loading = _use_options.loading,
|
|
62
63
|
data = _use_options.data,
|
|
63
|
-
setData = _use_options.setData
|
|
64
|
+
setData = _use_options.setData,
|
|
65
|
+
process_options = _use_options.process_options;
|
|
64
66
|
var _style = getInputStyle(props);
|
|
65
67
|
var marshal = getMarshal(props);
|
|
66
68
|
var needToRenderComponent = options.some(function (_) {
|
|
@@ -138,8 +140,12 @@ var MySelect = function MySelect(props) {
|
|
|
138
140
|
});
|
|
139
141
|
// 多选不支持 非 marshal 不支持
|
|
140
142
|
var isR = !is_multiple && marshal && target;
|
|
141
|
-
var select_node = loading ? /*#__PURE__*/React__default.createElement("span", null, "'\u6570\u636E\u52A0\u8F7D\u4E2D...'") : /*#__PURE__*/React__default.createElement(Select_L, _objectSpread(_objectSpread({
|
|
142
|
-
|
|
143
|
+
var select_node = loading && !fetch_options_on_open ? /*#__PURE__*/React__default.createElement("span", null, "'\u6570\u636E\u52A0\u8F7D\u4E2D...'") : /*#__PURE__*/React__default.createElement(Select_L, _objectSpread(_objectSpread({
|
|
144
|
+
onOpenChange: function onOpenChange(v) {
|
|
145
|
+
if (v && fetch_options_on_open) {
|
|
146
|
+
process_options();
|
|
147
|
+
}
|
|
148
|
+
},
|
|
143
149
|
loading: loading,
|
|
144
150
|
className: _warning ? styles['warning'] : undefined,
|
|
145
151
|
style: _style,
|
package/dist/a_chunks/root.18.js
CHANGED
|
@@ -7,11 +7,11 @@ import React__default, { useRef, useEffect } from 'react';
|
|
|
7
7
|
import { p as packs, a as getMarshal, u as use_options, C as Checkbox_L, d as parse_MC_value } from './index.js';
|
|
8
8
|
import MyCheckbox_DisplayFC from './root.19.js';
|
|
9
9
|
import { s as styles } from './index.module.js';
|
|
10
|
-
import '@ant-design/icons';
|
|
11
10
|
import 'antd';
|
|
12
11
|
import 'dayjs';
|
|
13
12
|
import 'rc-select';
|
|
14
13
|
import 'rc-tree';
|
|
14
|
+
import '@noah-libjs/request';
|
|
15
15
|
var components = packs;
|
|
16
16
|
var MyCheckbox = function MyCheckbox(props) {
|
|
17
17
|
var _props$type = props.type,
|
|
@@ -22,7 +22,7 @@ var MyCheckbox = function MyCheckbox(props) {
|
|
|
22
22
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
23
23
|
_onBlur = props.onBlur,
|
|
24
24
|
_props$inputWidth = props.inputWidth,
|
|
25
|
-
inputWidth = _props$inputWidth === void 0 ?
|
|
25
|
+
inputWidth = _props$inputWidth === void 0 ? 50 : _props$inputWidth,
|
|
26
26
|
_props$vertical = props.vertical,
|
|
27
27
|
vertical = _props$vertical === void 0 ? false : _props$vertical,
|
|
28
28
|
_props$style = props.style,
|
|
@@ -108,18 +108,18 @@ var MyCheckbox = function MyCheckbox(props) {
|
|
|
108
108
|
return d.value === option.value;
|
|
109
109
|
});
|
|
110
110
|
if (!targetData || !inputType) return null;
|
|
111
|
-
var C = components[inputType];
|
|
111
|
+
var C = components === null || components === void 0 ? void 0 : components[inputType];
|
|
112
112
|
var inputValue = targetData.text;
|
|
113
113
|
var props = (_option$props = option.props) !== null && _option$props !== void 0 ? _option$props : {};
|
|
114
114
|
var style = (_props$style2 = props.style) !== null && _props$style2 !== void 0 ? _props$style2 : {};
|
|
115
115
|
if (['MyInput', 'Input', 'input', 'MA', 'MyAutoComplete'].includes(inputType)) {
|
|
116
116
|
style = _objectSpread({
|
|
117
|
-
width: inputWidth * (longOptions ? 1 :
|
|
117
|
+
width: inputWidth * (longOptions ? 1 : 1.5)
|
|
118
118
|
}, style);
|
|
119
119
|
}
|
|
120
120
|
if (['Select', 'MS', 'MySelect'].includes(inputType)) {
|
|
121
121
|
style = _objectSpread({
|
|
122
|
-
minWidth: inputWidth * (longOptions ? 1 :
|
|
122
|
+
minWidth: inputWidth * (longOptions ? 1 : 1.5)
|
|
123
123
|
}, style);
|
|
124
124
|
}
|
|
125
125
|
return C ? /*#__PURE__*/React__default.createElement(C, _objectSpread(_objectSpread({
|
|
@@ -202,7 +202,6 @@ var MyCheckbox = function MyCheckbox(props) {
|
|
|
202
202
|
}
|
|
203
203
|
}, ")") : null);
|
|
204
204
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
205
|
-
title: JSON.stringify(options),
|
|
206
205
|
key: index,
|
|
207
206
|
style: {
|
|
208
207
|
display: 'flex',
|
package/dist/a_chunks/root.19.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import '@noah-libjs/utils';
|
|
2
1
|
import { u as use_options } from './index.js';
|
|
2
|
+
import '@noah-libjs/utils';
|
|
3
3
|
import 'react';
|
|
4
|
-
import '@ant-design/icons';
|
|
5
4
|
import 'antd';
|
|
6
5
|
import 'dayjs';
|
|
7
6
|
import 'rc-select';
|
|
8
7
|
import 'rc-tree';
|
|
8
|
+
import '@noah-libjs/request';
|
|
9
9
|
var MyCheckbox_DisplayFC = function MyCheckbox_DisplayFC(props) {
|
|
10
10
|
var _use_options = use_options(props),
|
|
11
11
|
options = _use_options.options,
|
package/dist/a_chunks/root.20.js
CHANGED
|
@@ -3,13 +3,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React__default, { useRef, useEffect } from 'react';
|
|
5
5
|
import { c as componentMap } from './components.js';
|
|
6
|
-
import '@noah-libjs/utils';
|
|
7
6
|
import { u as use_options } from './index.js';
|
|
8
|
-
import '@
|
|
7
|
+
import '@noah-libjs/utils';
|
|
9
8
|
import 'antd';
|
|
10
9
|
import 'dayjs';
|
|
11
10
|
import 'rc-select';
|
|
12
11
|
import 'rc-tree';
|
|
12
|
+
import '@noah-libjs/request';
|
|
13
13
|
function ArrayInputInner(props) {
|
|
14
14
|
var value = props.value,
|
|
15
15
|
onChange = props.onChange,
|
package/dist/a_chunks/root.21.js
CHANGED
|
@@ -3,13 +3,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React__default, { useEffect } from 'react';
|
|
5
5
|
import { c as componentMap } from './components.js';
|
|
6
|
-
import '@noah-libjs/utils';
|
|
7
6
|
import { u as use_options } from './index.js';
|
|
8
|
-
import '@
|
|
7
|
+
import '@noah-libjs/utils';
|
|
9
8
|
import 'antd';
|
|
10
9
|
import 'dayjs';
|
|
11
10
|
import 'rc-select';
|
|
12
11
|
import 'rc-tree';
|
|
12
|
+
import '@noah-libjs/request';
|
|
13
13
|
var DisplayFC = function DisplayFC(props) {
|
|
14
14
|
var value = props.value,
|
|
15
15
|
_props$separator = props.separator,
|
package/dist/a_chunks/root.22.js
CHANGED
|
@@ -1,208 +1,166 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
-
var _excluded = ["
|
|
5
|
+
var _excluded = ["inputType", "linker", "component_map", "tip", "disabled", "value", "form", "onChange", "marshal", "addBtnStyle", "on_row_value_change", "genRowData"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { request } from '@noah-libjs/request';
|
|
8
|
+
import { Divider, Button } from 'antd';
|
|
9
|
+
import React__default, { useState, useEffect, useRef } from 'react';
|
|
10
|
+
import { isNil, isArray, safe_json_parse_arr, safe_json_parse, safe_json_stringify, isObjectLike, get } from '@noah-libjs/utils';
|
|
11
|
+
import { M as MyIcon, p as packs } from './index.js';
|
|
12
|
+
import { isString } from 'antd/es/button';
|
|
14
13
|
import 'dayjs';
|
|
15
14
|
import 'rc-select';
|
|
16
15
|
import 'rc-tree';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
function useConfig_MyAutoComplete(props) {
|
|
21
|
-
var optionKey = props.optionKey,
|
|
22
|
-
_props$options = props.options,
|
|
23
|
-
options = _props$options === void 0 ? defaultOptions : _props$options,
|
|
24
|
-
searchKey = props.searchKey,
|
|
25
|
-
value = props.value,
|
|
26
|
-
memorable = props.memorable,
|
|
27
|
-
memorieskey = props.memorieskey,
|
|
28
|
-
memoriesname = props.memoriesname,
|
|
29
|
-
_props$formName = props.formName,
|
|
30
|
-
formName = _props$formName === void 0 ? 'unsetFormName' : _props$formName,
|
|
31
|
-
name = props.name,
|
|
32
|
-
uniqueKey = props.uniqueKey,
|
|
33
|
-
onChange = props.onChange,
|
|
34
|
-
onBlur = props.onBlur;
|
|
16
|
+
import '@noah-libjs/request';
|
|
17
|
+
function use_array_marshal(marshal, _value, _onChange) {
|
|
18
|
+
var linker = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
|
|
35
19
|
var _useState = useState([]),
|
|
36
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var _useState3 = useState(),
|
|
40
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
init_value = _useState4[0],
|
|
42
|
-
setInit_value = _useState4[1];
|
|
43
|
-
var _memorieskey = memorieskey !== null && memorieskey !== void 0 ? memorieskey : "".concat(formName, ".").concat(name);
|
|
44
|
-
// const _memoriesname = memoriesname ?? SLocal_State.getUserData()?.login
|
|
45
|
-
var _memoriesname = memoriesname !== null && memoriesname !== void 0 ? memoriesname : 'unset';
|
|
46
|
-
var _memorable = memorable || !!memorieskey;
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
init();
|
|
49
|
-
return function () {};
|
|
50
|
-
}, [optionKey, options, searchKey]);
|
|
21
|
+
safe_value = _useState2[0],
|
|
22
|
+
set_safe_value = _useState2[1];
|
|
51
23
|
useEffect(function () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}));
|
|
69
|
-
var _options = parse_MC_option(_objectSpread(_objectSpread({}, props), {}, {
|
|
70
|
-
useString: true
|
|
71
|
-
}));
|
|
72
|
-
if (searchValue) {
|
|
73
|
-
_options.push({
|
|
74
|
-
value: searchValue,
|
|
75
|
-
label: searchValue
|
|
76
|
-
});
|
|
24
|
+
if (isNil(_value)) return set_safe_value === null || set_safe_value === void 0 ? void 0 : set_safe_value([]);
|
|
25
|
+
if (isArray(_value)) return set_safe_value === null || set_safe_value === void 0 ? void 0 : set_safe_value(_value);
|
|
26
|
+
switch (marshal) {
|
|
27
|
+
case 0:
|
|
28
|
+
if (!isString(_value)) return set_safe_value === null || set_safe_value === void 0 ? void 0 : set_safe_value([]);
|
|
29
|
+
var arr = _value.split(linker);
|
|
30
|
+
set_safe_value === null || set_safe_value === void 0 || set_safe_value(arr.map(function (_) {
|
|
31
|
+
return safe_json_parse(_, _);
|
|
32
|
+
}));
|
|
33
|
+
break;
|
|
34
|
+
case 1:
|
|
35
|
+
set_safe_value === null || set_safe_value === void 0 || set_safe_value(safe_json_parse_arr(_value));
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
set_safe_value === null || set_safe_value === void 0 || set_safe_value(isArray(_value) ? _value : []);
|
|
39
|
+
break;
|
|
77
40
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
set__options(_options);
|
|
96
|
-
});
|
|
97
|
-
} else {
|
|
98
|
-
set__options(_options);
|
|
41
|
+
}, [_value, marshal]);
|
|
42
|
+
function onChangeSafeValue(_v) {
|
|
43
|
+
if (!isArray(_v) || !_v.length) return _onChange === null || _onChange === void 0 ? void 0 : _onChange([]);
|
|
44
|
+
switch (marshal) {
|
|
45
|
+
case 0:
|
|
46
|
+
var is_obj = isObjectLike(_v[0]);
|
|
47
|
+
var arr = is_obj ? _v.map(function (_) {
|
|
48
|
+
return safe_json_stringify(_);
|
|
49
|
+
}) : _v;
|
|
50
|
+
_onChange === null || _onChange === void 0 || _onChange(arr.join(linker));
|
|
51
|
+
break;
|
|
52
|
+
case 1:
|
|
53
|
+
_onChange === null || _onChange === void 0 || _onChange(safe_json_stringify(_v));
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
_onChange === null || _onChange === void 0 || _onChange(_v);
|
|
57
|
+
break;
|
|
99
58
|
}
|
|
100
59
|
}
|
|
101
|
-
function _OnBlur(e) {
|
|
102
|
-
onBlur === null || onBlur === void 0 || onBlur(e);
|
|
103
|
-
setTimeout(function () {
|
|
104
|
-
var thisValue = value;
|
|
105
|
-
if (!_memorable || !thisValue || __options.some(function (_) {
|
|
106
|
-
return _.value === thisValue;
|
|
107
|
-
})) return;
|
|
108
|
-
var data = {
|
|
109
|
-
key: _memorieskey,
|
|
110
|
-
name: _memoriesname,
|
|
111
|
-
value: thisValue
|
|
112
|
-
};
|
|
113
|
-
request.post("/api/text-memories", data, {
|
|
114
|
-
ignore_usr: true
|
|
115
|
-
}).then(init);
|
|
116
|
-
}, 10);
|
|
117
|
-
}
|
|
118
|
-
function remove(item) {
|
|
119
|
-
request["delete"]("/api/text-memories/".concat(item.id), {
|
|
120
|
-
params: {},
|
|
121
|
-
ignore_usr: true
|
|
122
|
-
}).then(function (r) {
|
|
123
|
-
init();
|
|
124
|
-
if (value === item.label) {
|
|
125
|
-
safeOnChange('');
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
60
|
return {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
options: __options,
|
|
134
|
-
remove: remove,
|
|
135
|
-
init_value: init_value
|
|
61
|
+
safe_value: safe_value,
|
|
62
|
+
set_safe_value: set_safe_value,
|
|
63
|
+
onChangeSafeValue: onChangeSafeValue
|
|
136
64
|
};
|
|
137
65
|
}
|
|
138
|
-
function
|
|
139
|
-
var _props$
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
_props$style = props.style,
|
|
147
|
-
style = _props$style === void 0 ? {} : _props$style,
|
|
148
|
-
defaultValue = props.defaultValue,
|
|
66
|
+
var ArraySingleInner = function ArraySingleInner(props) {
|
|
67
|
+
var _props$inputType = props.inputType,
|
|
68
|
+
inputType = _props$inputType === void 0 ? 'input' : _props$inputType,
|
|
69
|
+
linker = props.linker,
|
|
70
|
+
_props$component_map = props.component_map,
|
|
71
|
+
component_map = _props$component_map === void 0 ? packs : _props$component_map,
|
|
72
|
+
tip = props.tip,
|
|
73
|
+
disabled = props.disabled,
|
|
149
74
|
value = props.value,
|
|
150
|
-
|
|
151
|
-
width = props.width,
|
|
75
|
+
form = props.form,
|
|
152
76
|
onChange = props.onChange,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
77
|
+
_props$marshal = props.marshal,
|
|
78
|
+
marshal = _props$marshal === void 0 ? 1 : _props$marshal,
|
|
79
|
+
_props$addBtnStyle = props.addBtnStyle,
|
|
80
|
+
addBtnStyle = _props$addBtnStyle === void 0 ? {} : _props$addBtnStyle,
|
|
81
|
+
on_row_value_change = props.on_row_value_change,
|
|
82
|
+
genRowData = props.genRowData,
|
|
83
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
84
|
+
var defaultValue = useRef([]);
|
|
85
|
+
var _use_array_marshal = use_array_marshal(marshal, value !== null && value !== void 0 ? value : defaultValue.current, onChange, linker),
|
|
86
|
+
_use_array_marshal$sa = _use_array_marshal.safe_value,
|
|
87
|
+
safe_value = _use_array_marshal$sa === void 0 ? [] : _use_array_marshal$sa,
|
|
88
|
+
onChangeSafeValue = _use_array_marshal.onChangeSafeValue;
|
|
89
|
+
useEffect(function () {}, []);
|
|
90
|
+
function genDefaultData() {
|
|
91
|
+
var _genRowData;
|
|
92
|
+
var userData = (_genRowData = genRowData === null || genRowData === void 0 ? void 0 : genRowData(safe_value)) !== null && _genRowData !== void 0 ? _genRowData : '';
|
|
93
|
+
return userData;
|
|
94
|
+
}
|
|
95
|
+
function onDel(idx) {
|
|
96
|
+
safe_value.splice(idx, 1);
|
|
97
|
+
onChangeSafeValue === null || onChangeSafeValue === void 0 || onChangeSafeValue(_toConsumableArray(safe_value));
|
|
98
|
+
}
|
|
99
|
+
function onChangeValue(idx, _value) {
|
|
100
|
+
safe_value.splice(idx, 1, _value);
|
|
101
|
+
var new_data = _toConsumableArray(safe_value);
|
|
102
|
+
onChangeSafeValue === null || onChangeSafeValue === void 0 || onChangeSafeValue(new_data);
|
|
103
|
+
on_row_value_change === null || on_row_value_change === void 0 || on_row_value_change(new_data, idx, _value, form);
|
|
104
|
+
}
|
|
105
|
+
var C = get(component_map, inputType) || function () {
|
|
106
|
+
return null;
|
|
107
|
+
};
|
|
108
|
+
return /*#__PURE__*/React__default.createElement("div", null, safe_value.map(function (item, idx) {
|
|
109
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
110
|
+
key: idx
|
|
111
|
+
}, tip ? /*#__PURE__*/React__default.createElement(Divider, {
|
|
112
|
+
style: {
|
|
113
|
+
margin: '4px 0',
|
|
114
|
+
fontSize: 12,
|
|
115
|
+
color: '#ccc'
|
|
116
|
+
}
|
|
117
|
+
}, " ", tip, idx + 1) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
182
118
|
style: {
|
|
183
119
|
display: 'flex',
|
|
184
|
-
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
marginTop: tip ? 0 : 2
|
|
185
122
|
}
|
|
186
123
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
187
|
-
title: item.label,
|
|
188
124
|
style: {
|
|
189
|
-
flex: 1
|
|
190
|
-
textOverflow: 'ellipsis',
|
|
191
|
-
overflow: 'hidden',
|
|
192
|
-
whiteSpace: 'nowrap',
|
|
193
|
-
color: item.warning ? 'red' : ''
|
|
125
|
+
flex: 1
|
|
194
126
|
}
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
e.stopPropagation();
|
|
202
|
-
var ok = confirm('确定删除吗?');
|
|
203
|
-
ok && remove(item);
|
|
127
|
+
}, /*#__PURE__*/React__default.createElement(C, _objectSpread(_objectSpread({
|
|
128
|
+
disabled: disabled
|
|
129
|
+
}, others), {}, {
|
|
130
|
+
value: item,
|
|
131
|
+
onChange: function onChange(v) {
|
|
132
|
+
onChangeValue(idx, v);
|
|
204
133
|
}
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
134
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
135
|
+
style: {
|
|
136
|
+
width: 32,
|
|
137
|
+
display: 'flex',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
justifyContent: 'flex-end'
|
|
140
|
+
}
|
|
141
|
+
}, /*#__PURE__*/React__default.createElement(MyIcon, {
|
|
142
|
+
value: 'MinusCircleOutlined',
|
|
143
|
+
style: {
|
|
144
|
+
color: 'red'
|
|
145
|
+
},
|
|
146
|
+
onClick: function onClick() {
|
|
147
|
+
return onDel(idx);
|
|
148
|
+
}
|
|
149
|
+
}))));
|
|
150
|
+
}), /*#__PURE__*/React__default.createElement(Button, _objectSpread(_objectSpread({
|
|
151
|
+
disabled: disabled,
|
|
152
|
+
style: {
|
|
153
|
+
marginTop: 6
|
|
154
|
+
},
|
|
155
|
+
type: "dashed",
|
|
156
|
+
block: true,
|
|
157
|
+
icon: /*#__PURE__*/React__default.createElement(MyIcon, {
|
|
158
|
+
value: 'PlusOutlined'
|
|
159
|
+
})
|
|
160
|
+
}, addBtnStyle), {}, {
|
|
161
|
+
onClick: function onClick() {
|
|
162
|
+
return onChangeSafeValue([].concat(_toConsumableArray(safe_value), [genDefaultData()]));
|
|
163
|
+
}
|
|
164
|
+
}), "\u65B0\u589E", tip));
|
|
165
|
+
};
|
|
166
|
+
export { ArraySingleInner as default };
|