@noah-libjs/components 0.0.3 → 0.0.4

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.
Files changed (93) hide show
  1. package/dist/ArrayInput/DispalyInner.d.ts +4 -0
  2. package/dist/ArrayInput/Inner.d.ts +4 -0
  3. package/dist/ArrayInput/components.d.ts +41 -0
  4. package/dist/ArrayInput/index.d.ts +4 -0
  5. package/dist/ArrayInput/types.d.ts +76 -0
  6. package/dist/ArrayInput/utils.d.ts +3 -0
  7. package/dist/LazyAntd/AutoComplete/index.d.ts +6 -1
  8. package/dist/LazyAntd/Checkbox/index.d.ts +1 -1
  9. package/dist/LazyAntd/ColorPicker/index.d.ts +1 -1
  10. package/dist/LazyAntd/DatePicker/DatePicker.d.ts +1 -1
  11. package/dist/LazyAntd/DatePicker/MonthPicker.d.ts +1 -1
  12. package/dist/LazyAntd/DatePicker/TimePicker.d.ts +1 -1
  13. package/dist/LazyAntd/Select/OptionInner.d.ts +1 -2
  14. package/dist/LazyAntd/Select/index.d.ts +4 -5
  15. package/dist/LazyAntd/Tree/index.d.ts +6 -5
  16. package/dist/MyAutoComplete/Inner.d.ts +3 -0
  17. package/dist/MyAutoComplete/index.d.ts +5 -0
  18. package/dist/MyAutoComplete/types.d.ts +22 -0
  19. package/dist/MyAutoComplete/useConfig.d.ts +11 -0
  20. package/dist/MyCheckbox/Display.d.ts +6 -0
  21. package/dist/MyCheckbox/Inner.d.ts +5 -0
  22. package/dist/MyCheckbox/components.d.ts +41 -0
  23. package/dist/MyCheckbox/index.d.ts +6 -0
  24. package/dist/MyCheckbox/types.d.ts +62 -0
  25. package/dist/MyCheckbox/utils.d.ts +3 -0
  26. package/dist/MyColor/index.d.ts +4 -6
  27. package/dist/MyColor/types.d.ts +6 -0
  28. package/dist/MyDatePicker/Display.d.ts +3 -0
  29. package/dist/MyDatePicker/Inner.d.ts +5 -0
  30. package/dist/MyDatePicker/index.d.ts +8 -0
  31. package/dist/MyDatePicker/utils.d.ts +26 -0
  32. package/dist/MyInput/index.d.ts +3 -3
  33. package/dist/MyInputNumber/index.d.ts +5 -0
  34. package/dist/MyInputNumber/types.d.ts +9 -0
  35. package/dist/MyRangeDate/Display.d.ts +2 -0
  36. package/dist/MyRangeDate/Inner.d.ts +7 -0
  37. package/dist/MyRangeDate/index.d.ts +8 -0
  38. package/dist/MyRangeDate/utils.d.ts +403 -0
  39. package/dist/MySelect/Display.d.ts +3 -0
  40. package/dist/MySelect/Inner.d.ts +4 -0
  41. package/dist/MySelect/components.d.ts +41 -0
  42. package/dist/MySelect/index.d.ts +8 -0
  43. package/dist/MySelect/types.d.ts +27 -0
  44. package/dist/MySelect/utils.d.ts +1 -0
  45. package/dist/MySwitch/index.d.ts +4 -0
  46. package/dist/MySwitch/types.d.ts +7 -0
  47. package/dist/a_chunks/components.js +7 -0
  48. package/dist/a_chunks/index.js +1010 -0
  49. package/dist/a_chunks/index.module.js +33 -0
  50. package/dist/a_chunks/{Monaco.Inner.js → root..js} +0 -1
  51. package/dist/a_chunks/root.17.js +166 -0
  52. package/dist/a_chunks/root.18.js +238 -0
  53. package/dist/a_chunks/root.19.js +18 -0
  54. package/dist/a_chunks/root.20.js +129 -0
  55. package/dist/a_chunks/root.21.js +78 -0
  56. package/dist/a_chunks/root.22.js +208 -0
  57. package/dist/a_chunks/root.23.js +109 -0
  58. package/dist/index.d.ts +2 -1
  59. package/dist/index.js +7 -572
  60. package/dist/packs.d.ts +48 -0
  61. package/dist/util-types/comp.d.ts +12 -0
  62. package/dist/util-types/fd/FormItemLayout.d.ts +5 -0
  63. package/dist/util-types/fd/InputType.d.ts +1 -0
  64. package/dist/util-types/fd/Rules.d.ts +4 -0
  65. package/dist/util-types/fd/SpecialConfig.d.ts +33 -0
  66. package/dist/util-types/fd/TranferRules.d.ts +9 -0
  67. package/dist/util-types/fd/index.d.ts +200 -0
  68. package/dist/util-types/index.d.ts +2 -0
  69. package/dist/utils/getInputStyle.d.ts +2 -0
  70. package/dist/utils/index.d.ts +2 -0
  71. package/dist/utils/msmc.d.ts +41 -0
  72. package/dist/utils/new.d.ts +6 -0
  73. package/package.json +5 -3
  74. package/dist/a_chunks/AutoComplete.Inner.js +0 -9
  75. package/dist/a_chunks/Select.OptionInner.js +0 -9
  76. package/dist/pack_components.d.ts +0 -10
  77. /package/dist/a_chunks/{Modal.Inner.js → root.10.js} +0 -0
  78. /package/dist/a_chunks/{Pagination.Inner.js → root.11.js} +0 -0
  79. /package/dist/a_chunks/{Select.Inner.js → root.12.js} +0 -0
  80. /package/dist/a_chunks/{TreeSelect.Inner.js → root.13.js} +0 -0
  81. /package/dist/a_chunks/{Checkbox.Inner.js → root.14.js} +0 -0
  82. /package/dist/a_chunks/{Checkbox.GroupInner.js → root.15.js} +0 -0
  83. /package/dist/a_chunks/{QRCode.Inner.js → root.16.js} +0 -0
  84. /package/dist/a_chunks/{ColorPicker.Inner.js → root.2.js} +0 -0
  85. /package/dist/a_chunks/{Base.DatePicker.js → root.24.js} +0 -0
  86. /package/dist/a_chunks/{Base.Calendar.js → root.25.js} +0 -0
  87. /package/dist/a_chunks/{Form.Inner.js → root.3.js} +0 -0
  88. /package/dist/a_chunks/{Form.FormItemInner.js → root.4.js} +0 -0
  89. /package/dist/a_chunks/{Dropdown.Inner.js → root.5.js} +0 -0
  90. /package/dist/a_chunks/{Dropdown.Button.js → root.6.js} +0 -0
  91. /package/dist/a_chunks/{Table.Inner.js → root.7.js} +0 -0
  92. /package/dist/a_chunks/{Tree.Inner.js → root.8.js} +0 -0
  93. /package/dist/a_chunks/{Tree.DirectoryTreeInner.js → root.9.js} +0 -0
@@ -0,0 +1,33 @@
1
+ function styleInject(css, ref) {
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
+ }
25
+ 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
+ var styles = {
27
+ "wrapper": "index-module_wrapper__8xmrk",
28
+ "block-box": "index-module_block-box__zbZ8F",
29
+ "flex-box": "index-module_flex-box__aGmld",
30
+ "warning": "index-module_warning__Z3oMd"
31
+ };
32
+ styleInject(css_248z);
33
+ export { styles as s };
@@ -12,7 +12,6 @@ function MonacoInner(props) {
12
12
  height = _props$height === void 0 ? '400px' : _props$height,
13
13
  _props$theme = props.theme,
14
14
  theme = _props$theme === void 0 ? "vs-dark" : _props$theme;
15
- console.log('MyMonaco', props);
16
15
  var _useState = useState(value),
17
16
  _useState2 = _slicedToArray(_useState, 2),
18
17
  inner_value = _useState2[0],
@@ -0,0 +1,166 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ var _excluded = ["onChange", "value", "marshal", "fetch_options", "uniqueKey", "popupMatchSelectWidth"];
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
+ 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
+ import { isNil, numberLikeCompare } from '@noah-libjs/utils';
7
+ import { Row, Col } from 'antd';
8
+ import React__default, { useMemo } from 'react';
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
+ import { s as styles } from './index.module.js';
11
+ import '@ant-design/icons';
12
+ import 'dayjs';
13
+ import 'rc-select';
14
+ import 'rc-tree';
15
+ var componentMap = packs;
16
+ function RenderComponent(p) {
17
+ var _target$props;
18
+ var target = p.target,
19
+ handleInputChange = p.handleInputChange;
20
+ if (!target) return null;
21
+ var inputType = target.inputType;
22
+ var props = (_target$props = target.props) !== null && _target$props !== void 0 ? _target$props : {};
23
+ var C = useMemo(function () {
24
+ return componentMap[inputType];
25
+ }, [inputType]);
26
+ return /*#__PURE__*/React__default.createElement("span", {
27
+ key: "aa",
28
+ style: {
29
+ display: 'flex',
30
+ alignItems: 'center'
31
+ }
32
+ }, target.prefix ? /*#__PURE__*/React__default.createElement("span", {
33
+ style: {
34
+ margin: '0 2px',
35
+ whiteSpace: 'nowrap'
36
+ }
37
+ }, target.prefix) : null, C ? /*#__PURE__*/React__default.createElement(C, _objectSpread(_objectSpread({}, props), {}, {
38
+ value: target.text,
39
+ onChange: function onChange(e) {
40
+ handleInputChange(e, target);
41
+ }
42
+ })) : '未知组件', target.suffix ? /*#__PURE__*/React__default.createElement("span", {
43
+ style: {
44
+ margin: '0 2px',
45
+ whiteSpace: 'nowrap'
46
+ }
47
+ }, target.suffix) : null);
48
+ }
49
+ var MySelect = function MySelect(props) {
50
+ var _data$;
51
+ var onChange = props.onChange,
52
+ value = props.value,
53
+ _marshal = props.marshal,
54
+ fetch_options = props.fetch_options,
55
+ uniqueKey = props.uniqueKey,
56
+ _props$popupMatchSele = props.popupMatchSelectWidth,
57
+ popupMatchSelectWidth = _props$popupMatchSele === void 0 ? 120 : _props$popupMatchSele,
58
+ others = _objectWithoutProperties(props, _excluded);
59
+ var _use_options = use_options(props),
60
+ options = _use_options.options,
61
+ loading = _use_options.loading,
62
+ data = _use_options.data,
63
+ setData = _use_options.setData;
64
+ var _style = getInputStyle(props);
65
+ var marshal = getMarshal(props);
66
+ var needToRenderComponent = options.some(function (_) {
67
+ return _.inputType;
68
+ });
69
+ var type = get_mode(props);
70
+ var is_multiple = check_multiple(props);
71
+ function isChecked(value) {
72
+ // return __data.some(d => d.value === value)
73
+ return data.some(function (d) {
74
+ return numberLikeCompare(d.value, value);
75
+ });
76
+ }
77
+ function safe_onChange(changedValue) {
78
+ // if (!changedValue.length) {
79
+ // return onChange?.(undefined)
80
+ // }
81
+ // const v = marshal ? (Number(marshal) == 2 ? changedValue : JSON.stringify(changedValue,)) : (type === 'single' ? (changedValue[0]?.value ?? null) : changedValue.map(_ => _.value).join(','))
82
+ // console.log('abc', changedValue, marshal, v)
83
+ var v = parse_MC_value(props, changedValue);
84
+ // mchcLogger.log('safe_onChange', {v,changedValue})
85
+ onChange === null || onChange === void 0 || onChange(v);
86
+ }
87
+ function handleChange(rawValue) {
88
+ // mchcLogger.log('safe_onChange 00', {rawValue})
89
+ var checkedValues = Array.isArray(rawValue) ? rawValue : [rawValue];
90
+ var hasExclusiveItem = checkedValues.filter(function (v) {
91
+ return !isChecked(v);
92
+ }).find(function (v) {
93
+ var option = options.find(function (o) {
94
+ return o.value === v;
95
+ });
96
+ return option === null || option === void 0 ? void 0 : option.exclusive;
97
+ });
98
+ var values = !isNil(hasExclusiveItem) ? [hasExclusiveItem] : checkedValues.filter(function (v) {
99
+ var _options$find;
100
+ return !((_options$find = options.find(function (_) {
101
+ return _.value === v;
102
+ })) !== null && _options$find !== void 0 && _options$find.exclusive);
103
+ });
104
+ var changedData = values.filter(function (v) {
105
+ return is_multiple ? true : !isChecked(v);
106
+ }).map(function (v) {
107
+ var _options$find2, _old$text;
108
+ var option = (_options$find2 = options.find(function (o) {
109
+ return o.value === v;
110
+ })) !== null && _options$find2 !== void 0 ? _options$find2 : {
111
+ label: v,
112
+ value: v
113
+ };
114
+ var old = data.find(function (d) {
115
+ return d.value === v;
116
+ });
117
+ return {
118
+ value: option === null || option === void 0 ? void 0 : option.value,
119
+ label: option === null || option === void 0 ? void 0 : option.label,
120
+ text: (_old$text = old === null || old === void 0 ? void 0 : old.text) !== null && _old$text !== void 0 ? _old$text : undefined
121
+ };
122
+ });
123
+ setData(changedData);
124
+ safe_onChange(changedData);
125
+ }
126
+ function handleInputChange(e, target) {
127
+ target.text = e;
128
+ onChange === null || onChange === void 0 || onChange(JSON.stringify(data));
129
+ }
130
+ var _value = is_multiple ? data.map(function (_) {
131
+ return _.value;
132
+ }) : (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.value;
133
+ var _warning = data.some(function (_) {
134
+ return _.warning;
135
+ });
136
+ var target = (Array.isArray(data) ? data : []).find(function (_) {
137
+ return _.inputType;
138
+ });
139
+ // 多选不支持 非 marshal 不支持
140
+ 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
+ title: JSON.stringify(options),
143
+ loading: loading,
144
+ className: _warning ? styles['warning'] : undefined,
145
+ style: _style,
146
+ allowClear: true,
147
+ value: _value,
148
+ onChange: handleChange,
149
+ mode: type,
150
+ // dropdownStyle={{ minWidth: 120 }}
151
+ popupMatchSelectWidth: popupMatchSelectWidth
152
+ }, others), {}, {
153
+ options: options
154
+ }));
155
+ return isR ? /*#__PURE__*/React__default.createElement(Row, {
156
+ gutter: needToRenderComponent ? 6 : 0
157
+ }, /*#__PURE__*/React__default.createElement(Col, {
158
+ span: needToRenderComponent ? 12 : 24
159
+ }, select_node), /*#__PURE__*/React__default.createElement(Col, {
160
+ span: needToRenderComponent ? 12 : 0
161
+ }, isR && /*#__PURE__*/React__default.createElement(RenderComponent, {
162
+ target: target,
163
+ handleInputChange: handleInputChange
164
+ }))) : select_node;
165
+ };
166
+ export { MySelect as default };
@@ -0,0 +1,238 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
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
+ import { isNil, numberLikeCompare, cloneDeep } from '@noah-libjs/utils';
5
+ import classnames from 'classnames';
6
+ import React__default, { useRef, useEffect } from 'react';
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
+ import MyCheckbox_DisplayFC from './root.19.js';
9
+ import { s as styles } from './index.module.js';
10
+ import '@ant-design/icons';
11
+ import 'antd';
12
+ import 'dayjs';
13
+ import 'rc-select';
14
+ import 'rc-tree';
15
+ var components = packs;
16
+ var MyCheckbox = function MyCheckbox(props) {
17
+ var _props$type = props.type,
18
+ type = _props$type === void 0 ? 'single' : _props$type,
19
+ value = props.value,
20
+ onChange = props.onChange,
21
+ _props$disabled = props.disabled,
22
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
23
+ _onBlur = props.onBlur,
24
+ _props$inputWidth = props.inputWidth,
25
+ inputWidth = _props$inputWidth === void 0 ? 64 : _props$inputWidth,
26
+ _props$vertical = props.vertical,
27
+ vertical = _props$vertical === void 0 ? false : _props$vertical,
28
+ _props$style = props.style,
29
+ style = _props$style === void 0 ? {} : _props$style;
30
+ var marshal = getMarshal(props);
31
+ var _use_options = use_options(props),
32
+ options = _use_options.options,
33
+ loading = _use_options.loading,
34
+ __data = _use_options.data,
35
+ setData = _use_options.setData;
36
+ var longOptions = options.length > 2;
37
+ var forcusInfo = useRef({});
38
+ // mchcEnv.logger.log('MyCheckbox', { MyCheckboxProps, options, __data })
39
+ useEffect(function () {
40
+ // const _value = parseValue(value, marshal, type)
41
+ // setData(_value);
42
+ // if (isNil(value)) {
43
+ // setData([]);
44
+ // } else {
45
+ // const d = marshal ? safe_json_parse(value, []) : (type === 'single' ? [{ value }] : (value?.split?.(',')?.filter?.(_ => !isNil(_))?.map?.(value => ({ value })) ?? []))
46
+ // setData(Array.isArray(d) ? d : []);
47
+ // }
48
+ }, [value]);
49
+ function safe_onChange(changedValue) {
50
+ // if (!changedValue.length) {
51
+ // return onChange?.(undefined)
52
+ // }
53
+ // const v = marshal ? (Number(marshal) == 2 ? changedValue : JSON.stringify(changedValue,)) : (type === 'single' ? (changedValue[0]?.value ?? null) : changedValue.map(_ => _.value).join(','))
54
+ var v = parse_MC_value(props, changedValue);
55
+ onChange === null || onChange === void 0 || onChange(v);
56
+ }
57
+ var handleBoxGroupChange = function handleBoxGroupChange() {
58
+ var checkedValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
59
+ var hasExclusiveItem = checkedValues.filter(function (v) {
60
+ return !isChecked(v);
61
+ }).find(function (v) {
62
+ var option = options.find(function (o) {
63
+ return o.value === v;
64
+ });
65
+ return option === null || option === void 0 ? void 0 : option.exclusive;
66
+ });
67
+ var values = !isNil(hasExclusiveItem) ? [hasExclusiveItem] : checkedValues.filter(function (v) {
68
+ var _options$find;
69
+ return !((_options$find = options.find(function (_) {
70
+ return _.value === v;
71
+ })) !== null && _options$find !== void 0 && _options$find.exclusive);
72
+ });
73
+ var changedData = values.filter(function (v) {
74
+ return type === 'multiple' ? true : !isChecked(v);
75
+ }).map(function (v) {
76
+ var _old$text;
77
+ var option = options.find(function (o) {
78
+ return o.value === v;
79
+ });
80
+ var old = __data.find(function (d) {
81
+ return d.value === v;
82
+ });
83
+ return {
84
+ value: option === null || option === void 0 ? void 0 : option.value,
85
+ label: option === null || option === void 0 ? void 0 : option.label,
86
+ text: (_old$text = old === null || old === void 0 ? void 0 : old.text) !== null && _old$text !== void 0 ? _old$text : undefined
87
+ };
88
+ });
89
+ setData(changedData);
90
+ safe_onChange(changedData);
91
+ };
92
+ var handleInputChange = function handleInputChange(option) {
93
+ return function (inputValue) {
94
+ var tempData = cloneDeep(__data) || [];
95
+ var target = tempData.find(function (d) {
96
+ return d.value === option.value;
97
+ });
98
+ if (!target) return;
99
+ target.text = inputValue;
100
+ // setData(tempData);
101
+ safe_onChange(tempData);
102
+ };
103
+ };
104
+ var renderInput = function renderInput(option) {
105
+ var _option$props, _props$style2;
106
+ var inputType = option.inputType;
107
+ var targetData = __data.find(function (d) {
108
+ return d.value === option.value;
109
+ });
110
+ if (!targetData || !inputType) return null;
111
+ var C = components[inputType];
112
+ var inputValue = targetData.text;
113
+ var props = (_option$props = option.props) !== null && _option$props !== void 0 ? _option$props : {};
114
+ var style = (_props$style2 = props.style) !== null && _props$style2 !== void 0 ? _props$style2 : {};
115
+ if (['MyInput', 'Input', 'input', 'MA', 'MyAutoComplete'].includes(inputType)) {
116
+ style = _objectSpread({
117
+ width: inputWidth * (longOptions ? 1 : 2)
118
+ }, style);
119
+ }
120
+ if (['Select', 'MS', 'MySelect'].includes(inputType)) {
121
+ style = _objectSpread({
122
+ minWidth: inputWidth * (longOptions ? 1 : 2)
123
+ }, style);
124
+ }
125
+ return C ? /*#__PURE__*/React__default.createElement(C, _objectSpread(_objectSpread({
126
+ size: "small",
127
+ disabled: disabled,
128
+ marshal: marshal,
129
+ inputWidth: inputWidth,
130
+ // onBlur={onBlur}
131
+ className: classnames({
132
+ // 'global-issue-input': option.warning,
133
+ }),
134
+ style: style
135
+ }, props), {}, {
136
+ onChange: handleInputChange(option),
137
+ value: inputValue
138
+ })) : null;
139
+ };
140
+ function isChecked(value) {
141
+ // return __data.some(d => d.value === value)
142
+ return __data.some(function (d) {
143
+ return numberLikeCompare(d.value, value);
144
+ });
145
+ }
146
+ if (options.length === 0) return null;
147
+ return /*#__PURE__*/React__default.createElement(Checkbox_L.Group, {
148
+ className: classnames([styles['wrapper'], vertical ? styles['block-box'] : styles['flex-box']]),
149
+ disabled: disabled,
150
+ value: __data.map(function (_) {
151
+ return _.value;
152
+ }),
153
+ onChange: handleBoxGroupChange,
154
+ style: _objectSpread(_objectSpread({}, style), {}, {
155
+ // width: '100%',
156
+ flexWrap: 'wrap'
157
+ })
158
+ }, options.map(function (option, index) {
159
+ var _option$props2;
160
+ var prefix = option.prefix,
161
+ sufix = option.sufix,
162
+ suffix = option.suffix,
163
+ parentheses = option.parentheses;
164
+ var _parentheses = parentheses !== null && parentheses !== void 0 ? parentheses : ['MC', 'MArr'].includes(option.inputType) && !!(option !== null && option !== void 0 && (_option$props2 = option.props) !== null && _option$props2 !== void 0 && _option$props2.options);
165
+ var _suffix = sufix !== null && sufix !== void 0 ? sufix : suffix;
166
+ var checked = isChecked(option.value);
167
+ var node = checked ? renderInput(option) : null;
168
+ var surround_node = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, _parentheses && checked ? /*#__PURE__*/React__default.createElement("span", {
169
+ style: {
170
+ margin: "0 2px"
171
+ }
172
+ }, "(") : null, prefix && checked ? /*#__PURE__*/React__default.createElement("span", {
173
+ style: {
174
+ margin: "0 2px",
175
+ whiteSpace: 'nowrap'
176
+ }
177
+ }, prefix) : null, node ? /*#__PURE__*/React__default.createElement("span", {
178
+ onFocus: function onFocus(e) {
179
+ forcusInfo.current = {
180
+ index: index,
181
+ type: 'child'
182
+ };
183
+ },
184
+ onBlur: function onBlur(e) {
185
+ forcusInfo.current = {
186
+ index: undefined,
187
+ type: undefined
188
+ };
189
+ _onBlur === null || _onBlur === void 0 || _onBlur(e);
190
+ },
191
+ style: {
192
+ // margin: "0 2px",
193
+ }
194
+ }, node) : null, _suffix && checked ? /*#__PURE__*/React__default.createElement("span", {
195
+ style: {
196
+ margin: "0 2px"
197
+ }
198
+ }, _suffix) : null, _parentheses && checked ? /*#__PURE__*/React__default.createElement("span", {
199
+ style: {
200
+ margin: "0 2px",
201
+ whiteSpace: 'nowrap'
202
+ }
203
+ }, ")") : null);
204
+ return /*#__PURE__*/React__default.createElement("div", {
205
+ title: JSON.stringify(options),
206
+ key: index,
207
+ style: {
208
+ display: 'flex',
209
+ alignItems: 'center',
210
+ marginRight: 2
211
+ },
212
+ className: option.warning && checked ? styles['warning'] : undefined
213
+ }, /*#__PURE__*/React__default.createElement("span", {
214
+ onFocus: function onFocus(e) {
215
+ setTimeout(function () {
216
+ forcusInfo.current = {
217
+ index: index,
218
+ type: 'parent'
219
+ };
220
+ }, 10);
221
+ },
222
+ onBlur: function onBlur(e) {
223
+ setTimeout(function () {
224
+ if (forcusInfo.current.index === index && forcusInfo.current.type === 'child') return;
225
+ forcusInfo.current = {
226
+ index: undefined,
227
+ type: undefined
228
+ };
229
+ _onBlur === null || _onBlur === void 0 || _onBlur(e);
230
+ }, 10);
231
+ }
232
+ }, /*#__PURE__*/React__default.createElement(Checkbox_L, {
233
+ value: option.value
234
+ }, option.label)), surround_node);
235
+ }));
236
+ };
237
+ MyCheckbox.DisplayFC = MyCheckbox_DisplayFC;
238
+ export { MyCheckbox as default };
@@ -0,0 +1,18 @@
1
+ import '@noah-libjs/utils';
2
+ import { u as use_options } from './index.js';
3
+ import 'react';
4
+ import '@ant-design/icons';
5
+ import 'antd';
6
+ import 'dayjs';
7
+ import 'rc-select';
8
+ import 'rc-tree';
9
+ var MyCheckbox_DisplayFC = function MyCheckbox_DisplayFC(props) {
10
+ var _use_options = use_options(props),
11
+ options = _use_options.options,
12
+ loading = _use_options.loading,
13
+ data = _use_options.data,
14
+ setData = _use_options.setData,
15
+ display_node = _use_options.display_node;
16
+ return display_node;
17
+ };
18
+ export { MyCheckbox_DisplayFC as default };
@@ -0,0 +1,129 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
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
+ import React__default, { useRef, useEffect } from 'react';
5
+ import { c as componentMap } from './components.js';
6
+ import '@noah-libjs/utils';
7
+ import { u as use_options } from './index.js';
8
+ import '@ant-design/icons';
9
+ import 'antd';
10
+ import 'dayjs';
11
+ import 'rc-select';
12
+ import 'rc-tree';
13
+ function ArrayInputInner(props) {
14
+ var value = props.value,
15
+ onChange = props.onChange,
16
+ _props$separator = props.separator,
17
+ separator = _props$separator === void 0 ? ',' : _props$separator,
18
+ _props$inputWidth = props.inputWidth,
19
+ inputWidth = _props$inputWidth === void 0 ? 64 : _props$inputWidth,
20
+ _props$marshal = props.marshal,
21
+ marshal = _props$marshal === void 0 ? 1 : _props$marshal,
22
+ autoFocus = props.autoFocus,
23
+ _onBlur = props.onBlur,
24
+ disabled = props.disabled;
25
+ var nMarshal = Number(marshal);
26
+ // const _options = getOption(props)
27
+ // const [_value, set_value] = useState<any[]>([])
28
+ var _value_ref = useRef([]);
29
+ var forcusInfo = useRef(autoFocus ? {
30
+ index: 0,
31
+ type: 'self'
32
+ } : {});
33
+ var _use_options = use_options(props),
34
+ _options = _use_options.options,
35
+ loading = _use_options.loading,
36
+ _value = _use_options.data,
37
+ setData = _use_options.setData;
38
+ _value_ref.current = _value;
39
+ useEffect(function () {
40
+ // const arr = nMarshal === 0 ? value?.split(',') : (nMarshal === 1 ? safe_json_parse_arr(value) : value)
41
+ // const v = Array.isArray(arr) ? arr : []
42
+ // set_value(v)
43
+ // _value_ref.current = _value
44
+ return function () {};
45
+ }, [value]);
46
+ function handleChange(v, idx) {
47
+ _value_ref.current[idx] = v;
48
+ onChange === null || onChange === void 0 || onChange(nMarshal === 0 ? _value_ref.current.join(',') : nMarshal === 1 ? JSON.stringify(_value_ref.current) : _value_ref.current);
49
+ }
50
+ return /*#__PURE__*/React__default.createElement("div", {
51
+ style: {
52
+ display: 'inline-block'
53
+ }
54
+ }, " ", /*#__PURE__*/React__default.createElement("span", {
55
+ style: {
56
+ display: 'flex',
57
+ alignItems: 'center'
58
+ }
59
+ }, _options.map(function (opt, index) {
60
+ var _opt$props, _props$style;
61
+ var C = componentMap[opt.inputType];
62
+ var props = (_opt$props = opt.props) !== null && _opt$props !== void 0 ? _opt$props : {};
63
+ var style = (_props$style = props.style) !== null && _props$style !== void 0 ? _props$style : {};
64
+ if (['MyInput', 'Input', 'MA', 'MyAutoComplete', 'input'].includes(opt.inputType)) {
65
+ style = _objectSpread({
66
+ width: inputWidth
67
+ }, style);
68
+ }
69
+ if (['Select', 'MS', 'MySelect'].includes(opt.inputType)) {
70
+ style = _objectSpread({
71
+ minWidth: inputWidth
72
+ }, style);
73
+ }
74
+ return /*#__PURE__*/React__default.createElement("span", {
75
+ key: opt.value,
76
+ style: {
77
+ display: 'flex',
78
+ alignItems: 'center'
79
+ }
80
+ }, opt.prefix ? /*#__PURE__*/React__default.createElement("span", {
81
+ style: {
82
+ margin: '0 2px',
83
+ whiteSpace: 'nowrap'
84
+ }
85
+ }, opt.prefix) : null, opt.label ? /*#__PURE__*/React__default.createElement("span", {
86
+ style: {
87
+ margin: '0 2px',
88
+ whiteSpace: 'nowrap'
89
+ }
90
+ }, opt.label, ":") : null, C ? /*#__PURE__*/React__default.createElement(C, _objectSpread(_objectSpread({
91
+ size: 'small',
92
+ disabled: disabled,
93
+ autoFocus: index === 0 ? autoFocus : undefined
94
+ }, props), {}, {
95
+ onFocus: function onFocus(e) {
96
+ forcusInfo.current = {
97
+ index: index
98
+ };
99
+ },
100
+ onBlur: function onBlur(e) {
101
+ setTimeout(function () {
102
+ if (forcusInfo.current.index !== index) {
103
+ return;
104
+ }
105
+ forcusInfo.current = {
106
+ index: undefined,
107
+ type: undefined
108
+ };
109
+ _onBlur === null || _onBlur === void 0 || _onBlur(e);
110
+ }, 100);
111
+ },
112
+ style: style,
113
+ value: _value[index],
114
+ onChange: function onChange(e) {
115
+ return handleChange(e, index);
116
+ }
117
+ })) : '未知组件', opt.suffix ? /*#__PURE__*/React__default.createElement("span", {
118
+ style: {
119
+ margin: '0 2px',
120
+ whiteSpace: 'nowrap'
121
+ }
122
+ }, opt.suffix) : null, index === _options.length - 1 ? null : /*#__PURE__*/React__default.createElement("span", {
123
+ style: {
124
+ margin: '0 2px'
125
+ }
126
+ }, separator));
127
+ })));
128
+ }
129
+ export { ArrayInputInner as default };
@@ -0,0 +1,78 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
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
+ import React__default, { useEffect } from 'react';
5
+ import { c as componentMap } from './components.js';
6
+ import '@noah-libjs/utils';
7
+ import { u as use_options } from './index.js';
8
+ import '@ant-design/icons';
9
+ import 'antd';
10
+ import 'dayjs';
11
+ import 'rc-select';
12
+ import 'rc-tree';
13
+ var DisplayFC = function DisplayFC(props) {
14
+ var value = props.value,
15
+ _props$separator = props.separator,
16
+ separator = _props$separator === void 0 ? ',' : _props$separator,
17
+ _props$marshal = props.marshal,
18
+ marshal = _props$marshal === void 0 ? 1 : _props$marshal;
19
+ // const _options = parse_MC_option(props)
20
+ // const [_value, set_value] = useState<any[]>([])
21
+ var _use_options = use_options(props),
22
+ _options = _use_options.options,
23
+ loading = _use_options.loading,
24
+ _value = _use_options.data,
25
+ setData = _use_options.setData;
26
+ useEffect(function () {
27
+ // const arr = nMarshal == 0 ? value?.split(',') : (nMarshal === 1 ? safe_json_parse_arr(value) : value)
28
+ // const v = Array.isArray(arr) ? arr : []
29
+ // set_value(v)
30
+ return function () {};
31
+ }, [value]);
32
+ var isEmpty = _value.every(function (_) {
33
+ return !_;
34
+ });
35
+ return /*#__PURE__*/React__default.createElement("div", {
36
+ style: {
37
+ display: 'inline-block'
38
+ }
39
+ }, /*#__PURE__*/React__default.createElement("span", {
40
+ style: {
41
+ display: 'flex',
42
+ alignItems: 'center'
43
+ }
44
+ }, isEmpty ? '--' : _options.map(function (o, idx) {
45
+ var _componentMap$o$input, _o$props, _ref;
46
+ var C = componentMap[o.inputType];
47
+ var _DisplayFC = (_componentMap$o$input = componentMap[o.inputType]) === null || _componentMap$o$input === void 0 ? void 0 : _componentMap$o$input.DisplayFC;
48
+ var props = (_o$props = o.props) !== null && _o$props !== void 0 ? _o$props : {};
49
+ var DisplayFC = (_ref = _DisplayFC !== null && _DisplayFC !== void 0 ? _DisplayFC : C === null || C === void 0 ? void 0 : C.DisplayFC) !== null && _ref !== void 0 ? _ref : function (_ref2) {
50
+ var value = _ref2.value;
51
+ return /*#__PURE__*/React__default.createElement("span", null, value !== null && value !== void 0 ? value : '--');
52
+ };
53
+ return /*#__PURE__*/React__default.createElement("span", {
54
+ key: o.value,
55
+ style: {
56
+ display: 'flex',
57
+ alignItems: 'center'
58
+ }
59
+ }, o.prefix ? /*#__PURE__*/React__default.createElement("span", {
60
+ style: {
61
+ margin: '0 2px',
62
+ whiteSpace: 'nowrap'
63
+ }
64
+ }, o.prefix) : null, /*#__PURE__*/React__default.createElement(DisplayFC, _objectSpread({
65
+ value: _value[idx]
66
+ }, props)), o.suffix ? /*#__PURE__*/React__default.createElement("span", {
67
+ style: {
68
+ margin: '0 2px',
69
+ whiteSpace: 'nowrap'
70
+ }
71
+ }, o.suffix) : null, idx === _options.length - 1 ? null : /*#__PURE__*/React__default.createElement("span", {
72
+ style: {
73
+ margin: '0 2px'
74
+ }
75
+ }, separator));
76
+ })));
77
+ };
78
+ export { DisplayFC as default };