@noah-libjs/components 0.0.23 → 0.0.42

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 (149) hide show
  1. package/README.md +1 -1
  2. package/dist/ArrayInput/DispalyInner.d.ts +4 -0
  3. package/dist/ArrayInput/Inner.d.ts +4 -0
  4. package/dist/ArrayInput/components.d.ts +201 -0
  5. package/dist/ArrayInput/index.d.ts +4 -0
  6. package/dist/ArrayInput/types.d.ts +77 -0
  7. package/dist/ArrayInput/utils.d.ts +3 -0
  8. package/dist/ArraySingle/DispalyInner.d.ts +4 -0
  9. package/dist/ArraySingle/Inner.d.ts +4 -0
  10. package/dist/ArraySingle/index.d.ts +4 -0
  11. package/dist/ArraySingle/types.d.ts +16 -0
  12. package/dist/ContainerDimensions/index.d.ts +9 -0
  13. package/dist/GlobalModal/index.d.ts +8 -0
  14. package/dist/GlobalModal/utils.d.ts +65 -0
  15. package/dist/LazyAntd/AutoComplete/Inner.d.ts +3 -0
  16. package/dist/LazyAntd/AutoComplete/index.d.ts +9 -0
  17. package/dist/LazyAntd/Checkbox/GroupInner.d.ts +3 -0
  18. package/dist/LazyAntd/Checkbox/Inner.d.ts +2 -0
  19. package/dist/LazyAntd/Checkbox/index.d.ts +9 -0
  20. package/dist/LazyAntd/ColorPicker/Inner.d.ts +3 -0
  21. package/dist/LazyAntd/ColorPicker/index.d.ts +42 -0
  22. package/dist/LazyAntd/DatePicker/Base/Calendar.d.ts +3 -0
  23. package/dist/LazyAntd/DatePicker/Base/DatePicker.d.ts +37 -0
  24. package/dist/LazyAntd/DatePicker/Base/index.d.ts +62 -0
  25. package/dist/LazyAntd/DatePicker/Calendar.d.ts +5 -0
  26. package/dist/LazyAntd/DatePicker/DatePicker.d.ts +12 -0
  27. package/dist/LazyAntd/DatePicker/MonthPicker.d.ts +11 -0
  28. package/dist/LazyAntd/DatePicker/RangePicker.d.ts +19 -0
  29. package/dist/LazyAntd/DatePicker/TimePicker.d.ts +12 -0
  30. package/dist/LazyAntd/DatePicker/index.d.ts +5 -0
  31. package/dist/LazyAntd/Dropdown/Button.d.ts +2 -0
  32. package/dist/LazyAntd/Dropdown/Inner.d.ts +2 -0
  33. package/dist/LazyAntd/Dropdown/index.d.ts +10 -0
  34. package/dist/LazyAntd/Form/FormItemInner.d.ts +2 -0
  35. package/dist/LazyAntd/Form/Inner.d.ts +2 -0
  36. package/dist/LazyAntd/Form/index.d.ts +9 -0
  37. package/dist/LazyAntd/Modal/Inner.d.ts +3 -0
  38. package/dist/LazyAntd/Modal/index.d.ts +3 -0
  39. package/dist/LazyAntd/Pagination/Inner.d.ts +2 -0
  40. package/dist/LazyAntd/Pagination/index.d.ts +3 -0
  41. package/dist/LazyAntd/QRCode/Inner.d.ts +3 -0
  42. package/dist/LazyAntd/QRCode/index.d.ts +2 -0
  43. package/dist/LazyAntd/Select/Inner.d.ts +2 -0
  44. package/dist/LazyAntd/Select/OptionInner.d.ts +1 -0
  45. package/dist/LazyAntd/Select/index.d.ts +9 -0
  46. package/dist/LazyAntd/Switch/index.d.ts +1 -0
  47. package/dist/LazyAntd/Table/Inner.d.ts +2 -0
  48. package/dist/LazyAntd/Table/index.d.ts +3 -0
  49. package/dist/LazyAntd/Tree/DirectoryTreeInner.d.ts +2 -0
  50. package/dist/LazyAntd/Tree/Inner.d.ts +3 -0
  51. package/dist/LazyAntd/Tree/TreeNodeInner.d.ts +3 -0
  52. package/dist/LazyAntd/Tree/index.d.ts +14 -0
  53. package/dist/LazyAntd/TreeSelect/Inner.d.ts +2 -0
  54. package/dist/LazyAntd/TreeSelect/index.d.ts +3 -0
  55. package/dist/LazyAntd/index.d.ts +14 -0
  56. package/dist/Monaco/Inner.d.ts +4 -0
  57. package/dist/Monaco/index.d.ts +6 -0
  58. package/dist/Monaco/types.d.ts +9 -0
  59. package/dist/MyAutoComplete/Inner.d.ts +3 -0
  60. package/dist/MyAutoComplete/index.d.ts +5 -0
  61. package/dist/MyAutoComplete/types.d.ts +25 -0
  62. package/dist/MyAutoComplete/useConfig.d.ts +11 -0
  63. package/dist/MyButton/index.d.ts +10 -0
  64. package/dist/MyCheckbox/Display.d.ts +6 -0
  65. package/dist/MyCheckbox/Inner.d.ts +5 -0
  66. package/dist/MyCheckbox/components.d.ts +201 -0
  67. package/dist/MyCheckbox/index.d.ts +6 -0
  68. package/dist/MyCheckbox/types.d.ts +65 -0
  69. package/dist/MyCheckbox/utils.d.ts +3 -0
  70. package/dist/MyColor/index.d.ts +4 -0
  71. package/dist/MyColor/types.d.ts +6 -0
  72. package/dist/MyDatePicker/Display.d.ts +3 -0
  73. package/dist/MyDatePicker/Inner.d.ts +5 -0
  74. package/dist/MyDatePicker/index.d.ts +8 -0
  75. package/dist/MyDatePicker/utils.d.ts +26 -0
  76. package/dist/MyIconSelect/MyIcon.d.ts +2 -0
  77. package/dist/MyIconSelect/MyIconSelect.d.ts +5 -0
  78. package/dist/MyIconSelect/index.d.ts +6 -0
  79. package/dist/MyIconSelect/types.d.ts +16 -0
  80. package/dist/MyIconSelect/utils.d.ts +7 -0
  81. package/dist/MyInput/index.d.ts +5 -0
  82. package/dist/MyInput/types.d.ts +7 -0
  83. package/dist/MyInputNumber/index.d.ts +5 -0
  84. package/dist/MyInputNumber/types.d.ts +9 -0
  85. package/dist/MyLazyComponent/index.d.ts +6 -0
  86. package/dist/MyRangeDate/Display.d.ts +2 -0
  87. package/dist/MyRangeDate/Inner.d.ts +6 -0
  88. package/dist/MyRangeDate/index.d.ts +7 -0
  89. package/dist/MyRangeDate/utils.d.ts +40 -0
  90. package/dist/MySelect/Display.d.ts +3 -0
  91. package/dist/MySelect/Inner.d.ts +4 -0
  92. package/dist/MySelect/components.d.ts +201 -0
  93. package/dist/MySelect/index.d.ts +8 -0
  94. package/dist/MySelect/types.d.ts +29 -0
  95. package/dist/MySelect/utils.d.ts +1 -0
  96. package/dist/MySwitch/index.d.ts +4 -0
  97. package/dist/MySwitch/types.d.ts +10 -0
  98. package/dist/a_chunks/ArrayInput.DispalyInner.js +78 -0
  99. package/dist/a_chunks/ArrayInput.Inner.js +129 -0
  100. package/dist/a_chunks/ArraySingle.DispalyInner.js +15 -0
  101. package/dist/a_chunks/ArraySingle.Inner.js +166 -0
  102. package/dist/a_chunks/Base.Calendar.js +4 -0
  103. package/dist/a_chunks/Base.DatePicker.js +5 -0
  104. package/dist/a_chunks/Checkbox.GroupInner.js +9 -0
  105. package/dist/a_chunks/Checkbox.Inner.js +9 -0
  106. package/dist/a_chunks/ColorPicker.Inner.js +9 -0
  107. package/dist/a_chunks/Dropdown.Button.js +9 -0
  108. package/dist/a_chunks/Dropdown.Inner.js +9 -0
  109. package/dist/a_chunks/Form.FormItemInner.js +9 -0
  110. package/dist/a_chunks/Form.Inner.js +9 -0
  111. package/dist/a_chunks/Modal.Inner.js +9 -0
  112. package/dist/a_chunks/Monaco.Inner.js +37 -0
  113. package/dist/a_chunks/MyAutoComplete.Inner.js +212 -0
  114. package/dist/a_chunks/MyCheckbox.Display.js +18 -0
  115. package/dist/a_chunks/MyCheckbox.Inner.js +245 -0
  116. package/dist/a_chunks/MyDatePicker.Inner.js +117 -0
  117. package/dist/a_chunks/MyIconSelect.MyIcon.js +8 -0
  118. package/dist/a_chunks/MyIconSelect.MyIconSelect.js +68 -0
  119. package/dist/a_chunks/MyRangeDate.Inner.js +66 -0
  120. package/dist/a_chunks/MySelect.Inner.js +172 -0
  121. package/dist/a_chunks/Pagination.Inner.js +19 -0
  122. package/dist/a_chunks/QRCode.Inner.js +9 -0
  123. package/dist/a_chunks/Select.Inner.js +9 -0
  124. package/dist/a_chunks/Table.Inner.js +9 -0
  125. package/dist/a_chunks/Tree.DirectoryTreeInner.js +9 -0
  126. package/dist/a_chunks/Tree.Inner.js +11 -0
  127. package/dist/a_chunks/TreeSelect.Inner.js +9 -0
  128. package/dist/a_chunks/components.js +7 -0
  129. package/dist/a_chunks/index.js +1414 -0
  130. package/dist/a_chunks/index.module.js +10 -0
  131. package/dist/a_chunks/utils.js +59 -0
  132. package/dist/index.d.ts +8 -0
  133. package/dist/index.js +8 -0
  134. package/dist/packs.d.ts +215 -0
  135. package/dist/util-types/comp.d.ts +12 -0
  136. package/dist/util-types/fd/FormItemLayout.d.ts +5 -0
  137. package/dist/util-types/fd/InputType.d.ts +1 -0
  138. package/dist/util-types/fd/Rules.d.ts +4 -0
  139. package/dist/util-types/fd/SpecialConfig.d.ts +33 -0
  140. package/dist/util-types/fd/TranferRules.d.ts +9 -0
  141. package/dist/util-types/fd/index.d.ts +230 -0
  142. package/dist/util-types/index.d.ts +2 -0
  143. package/dist/utils/getInputStyle.d.ts +14 -0
  144. package/dist/utils/index.d.ts +4 -0
  145. package/dist/utils/msmc.d.ts +50 -0
  146. package/dist/utils/new.d.ts +18 -0
  147. package/dist/utils/other.d.ts +4 -0
  148. package/dist/utils/use_array_marshal.d.ts +5 -0
  149. package/package.json +4 -4
@@ -0,0 +1,18 @@
1
+ import { u as use_options } from './index.js';
2
+ import '@noah-libjs/utils';
3
+ import 'react';
4
+ import 'antd';
5
+ import 'dayjs';
6
+ import 'rc-select';
7
+ import 'rc-tree';
8
+ import '@noah-libjs/request';
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,245 @@
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, M as MyIcon, d as parse_MC_value } from './index.js';
8
+ import MyCheckbox_DisplayFC from './MyCheckbox.Display.js';
9
+ import { s as styles } from './index.module.js';
10
+ import { Tooltip } from 'antd';
11
+ import 'dayjs';
12
+ import 'rc-select';
13
+ import 'rc-tree';
14
+ import '@noah-libjs/request';
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 ? 50 : _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 === null || components === void 0 ? void 0 : 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 : 1.5)
118
+ }, style);
119
+ }
120
+ if (['Select', 'MS', 'MySelect'].includes(inputType)) {
121
+ style = _objectSpread({
122
+ minWidth: inputWidth * (longOptions ? 1 : 1.5)
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
+ key: index,
206
+ style: {
207
+ display: 'flex',
208
+ alignItems: 'center',
209
+ marginRight: 2
210
+ },
211
+ className: option.warning && checked ? styles['warning'] : undefined
212
+ }, /*#__PURE__*/React__default.createElement("span", {
213
+ onFocus: function onFocus(e) {
214
+ setTimeout(function () {
215
+ forcusInfo.current = {
216
+ index: index,
217
+ type: 'parent'
218
+ };
219
+ }, 10);
220
+ },
221
+ onBlur: function onBlur(e) {
222
+ setTimeout(function () {
223
+ if (forcusInfo.current.index === index && forcusInfo.current.type === 'child') return;
224
+ forcusInfo.current = {
225
+ index: undefined,
226
+ type: undefined
227
+ };
228
+ _onBlur === null || _onBlur === void 0 || _onBlur(e);
229
+ }, 10);
230
+ }
231
+ }, /*#__PURE__*/React__default.createElement(Checkbox_L, {
232
+ value: option.value
233
+ }, option.label, option.tip ? /*#__PURE__*/React__default.createElement(Tooltip, {
234
+ title: option.tip
235
+ }, /*#__PURE__*/React__default.createElement(MyIcon, {
236
+ value: 'QuestionCircleOutlined',
237
+ style: {
238
+ cursor: 'help',
239
+ marginLeft: 2
240
+ }
241
+ })) : null)), surround_node);
242
+ }));
243
+ };
244
+ MyCheckbox.DisplayFC = MyCheckbox_DisplayFC;
245
+ export { MyCheckbox as default };
@@ -0,0 +1,117 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["value", "onBlur", "onChange", "valueType", "minDate", "maxDate", "validDate", "getPopupContainer", "time_only", "format", "style"];
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 { presets_date } from '@noah-libjs/utils';
7
+ import { Checkbox } from 'antd';
8
+ import dayjs from 'dayjs';
9
+ import React__default, { useCallback } from 'react';
10
+ import { k as MonthPicker_L, l as formatDatePickerProps, m as getIsUnknown, g as getInputStyle, T as TimePicker_L, n as DatePicker_L, o as get_unknown_conf, U as UNKNOWN_TIME_SYMBOL, q as handleChangeValue } from './index.js';
11
+ export { U as UNKNOWN_TIME_SYMBOL } from './index.js';
12
+ import 'rc-select';
13
+ import 'rc-tree';
14
+ import '@noah-libjs/request';
15
+ function MyDatePicker_Inner(_props) {
16
+ var props = formatDatePickerProps(_props);
17
+ var _props$value = props.value,
18
+ value = _props$value === void 0 ? undefined : _props$value,
19
+ onBlur = props.onBlur,
20
+ _onChange = props.onChange,
21
+ valueType = props.valueType,
22
+ minDate = props.minDate,
23
+ maxDate = props.maxDate,
24
+ validDate = props.validDate,
25
+ getPopupContainer = props.getPopupContainer,
26
+ time_only = props.time_only,
27
+ format = props.format,
28
+ style = props.style,
29
+ rest = _objectWithoutProperties(props, _excluded);
30
+ var isUnknown = getIsUnknown(props);
31
+ var _style = getInputStyle(props);
32
+ var transValue = useCallback(function (date) {
33
+ var result = undefined;
34
+ if (!!date) {
35
+ result = dayjs(date, format);
36
+ }
37
+ return result;
38
+ }, []);
39
+ var handleChange = function handleChange(date, dateString) {
40
+ var newValue = handleChangeValue(props, date);
41
+ _onChange === null || _onChange === void 0 || _onChange(newValue);
42
+ setTimeout(function () {
43
+ onBlur === null || onBlur === void 0 || onBlur({}, {
44
+ range: 'end'
45
+ });
46
+ }, 10);
47
+ };
48
+ var disabledDate = useCallback(function (current) {
49
+ var dateStr = dayjs(current).format('YYYY-MM-DD');
50
+ if (validDate) {
51
+ return dateStr.includes(validDate);
52
+ }
53
+ if (minDate) {
54
+ if (minDate === 'now') {
55
+ return current < dayjs().endOf('day');
56
+ }
57
+ return current < dayjs(minDate).endOf('day');
58
+ }
59
+ if (maxDate) {
60
+ if (maxDate === 'now') {
61
+ return current > dayjs().endOf('day');
62
+ }
63
+ return current > dayjs(maxDate).endOf('day');
64
+ }
65
+ return false;
66
+ }, [validDate, maxDate, minDate]);
67
+ var node = props.time_only ? /*#__PURE__*/React__default.createElement(TimePicker_L, _objectSpread(_objectSpread({
68
+ getPopupContainer: getPopupContainer,
69
+ value: isUnknown ? null : transValue(value),
70
+ onChange: handleChange,
71
+ disabledDate: disabledDate,
72
+ format: format
73
+ }, rest), {}, {
74
+ // onBlur={undefined}
75
+ // onBlurCapture={undefined}
76
+ style: _style,
77
+ placeholder: '请选择'
78
+ })) : /*#__PURE__*/React__default.createElement(DatePicker_L, _objectSpread(_objectSpread({
79
+ getPopupContainer: getPopupContainer,
80
+ value: isUnknown ? null : transValue(value),
81
+ onChange: handleChange,
82
+ disabledDate: disabledDate,
83
+ format: format,
84
+ presets: presets_date()
85
+ }, rest), {}, {
86
+ style: _style,
87
+ placeholder: '请选择'
88
+ }));
89
+ return get_unknown_conf(props) ? /*#__PURE__*/React__default.createElement("span", {
90
+ style: {
91
+ display: 'flex',
92
+ alignItems: 'center'
93
+ }
94
+ }, node, /*#__PURE__*/React__default.createElement("span", {
95
+ style: {
96
+ marginLeft: 6,
97
+ flex: 1
98
+ }
99
+ }, /*#__PURE__*/React__default.createElement(Checkbox, {
100
+ checked: isUnknown,
101
+ skipGroup: true,
102
+ onChange: function onChange(e) {
103
+ var _value = e.target.checked ? UNKNOWN_TIME_SYMBOL : null;
104
+ var value = handleChangeValue(props, _value);
105
+ _onChange === null || _onChange === void 0 || _onChange(value);
106
+ }
107
+ }), /*#__PURE__*/React__default.createElement("span", {
108
+ style: {
109
+ marginLeft: 6
110
+ }
111
+ }, "\u4E0D\u8BE6"))) : node;
112
+ }
113
+ var df = MyDatePicker_Inner;
114
+ // const df = memo<IMyDatePickerProps>(MyDatePicker_Inner, areEqual)
115
+ MyDatePicker_Inner.MonthPicker = MonthPicker_L;
116
+ var MyDatePickerInner = df;
117
+ export { MyDatePickerInner as default };
@@ -0,0 +1,8 @@
1
+ import { u as use_icon } from './utils.js';
2
+ import 'react';
3
+ function MyIcon(props) {
4
+ var _use_icon = use_icon(props),
5
+ render_Icon = _use_icon.render_Icon;
6
+ return render_Icon(props.value);
7
+ }
8
+ export { MyIcon as default };
@@ -0,0 +1,68 @@
1
+ import { Card, List } from 'antd';
2
+ import React__default, { forwardRef } from 'react';
3
+ import { D as Dropdown_L, e as MyInput } from './index.js';
4
+ import { u as use_icon } from './utils.js';
5
+ import '@noah-libjs/utils';
6
+ import 'dayjs';
7
+ import 'rc-select';
8
+ import 'rc-tree';
9
+ import '@noah-libjs/request';
10
+ var MyIconSelect = /*#__PURE__*/forwardRef(function (props, myRef) {
11
+ var value = props.value,
12
+ onChange = props.onChange;
13
+ var _use_icon = use_icon(props),
14
+ all_keys = _use_icon.all_keys,
15
+ render_Icon = _use_icon.render_Icon;
16
+ return /*#__PURE__*/React__default.createElement(Dropdown_L, {
17
+ arrow: true,
18
+ trigger: ['click'],
19
+ popupRender: function popupRender(node) {
20
+ return /*#__PURE__*/React__default.createElement(Card, {
21
+ size: 'small',
22
+ styles: {
23
+ body: {
24
+ width: 580,
25
+ height: 360,
26
+ overflowY: 'auto'
27
+ }
28
+ }
29
+ }, /*#__PURE__*/React__default.createElement(List, {
30
+ style: {},
31
+ grid: {
32
+ column: 12
33
+ },
34
+ dataSource: all_keys,
35
+ renderItem: function renderItem(key) {
36
+ return /*#__PURE__*/React__default.createElement(List.Item, {
37
+ style: {
38
+ cursor: 'pointer',
39
+ background: key === value ? '#aaa' : '',
40
+ padding: 12,
41
+ display: 'flex',
42
+ alignItems: 'center',
43
+ justifyContent: 'center'
44
+ },
45
+ key: key,
46
+ onClick: function onClick() {
47
+ return onChange === null || onChange === void 0 ? void 0 : onChange(key);
48
+ }
49
+ }, render_Icon(key, {
50
+ style: {
51
+ fontSize: 20
52
+ }
53
+ }), node);
54
+ }
55
+ }));
56
+ }
57
+ }, /*#__PURE__*/React__default.createElement(MyInput, {
58
+ addonBefore: render_Icon(value),
59
+ placeholder: '请选择',
60
+ value: value,
61
+ allowClear: true,
62
+ onChange: onChange,
63
+ onClear: function onClear() {
64
+ return onChange === null || onChange === void 0 ? void 0 : onChange('');
65
+ }
66
+ }));
67
+ });
68
+ export { MyIconSelect as default };
@@ -0,0 +1,66 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["value", "onChange", "marshal", "minDate", "maxDate", "validDate", "getPopupContainer", "showUnknown", "format", "style"];
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 dayjs from 'dayjs';
7
+ import React__default, { useCallback } from 'react';
8
+ import { f as format_range_props, g as getInputStyle, R as RangePicker_L, h as handleChangeValue } from './index.js';
9
+ import '@noah-libjs/utils';
10
+ import '@noah-libjs/request';
11
+ import 'antd';
12
+ import 'rc-select';
13
+ import 'rc-tree';
14
+ function MyRangePickerInner(_props) {
15
+ var props = format_range_props(_props);
16
+ var _props$value = props.value,
17
+ value = _props$value === void 0 ? undefined : _props$value,
18
+ onChange = props.onChange,
19
+ marshal = props.marshal,
20
+ minDate = props.minDate,
21
+ maxDate = props.maxDate,
22
+ validDate = props.validDate,
23
+ getPopupContainer = props.getPopupContainer,
24
+ showUnknown = props.showUnknown,
25
+ format = props.format,
26
+ style = props.style,
27
+ rest = _objectWithoutProperties(props, _excluded);
28
+ var _style = getInputStyle(props);
29
+ var handleChange = function handleChange(date, dateString) {
30
+ date = date !== null && date !== void 0 ? date : [];
31
+ var _value = handleChangeValue(props, date);
32
+ onChange === null || onChange === void 0 || onChange(_value);
33
+ };
34
+ var disabledDate = useCallback(function (current) {
35
+ var dateStr = dayjs(current).format(format);
36
+ if (validDate) {
37
+ return dateStr.includes(validDate);
38
+ }
39
+ if (minDate) {
40
+ if (minDate === 'now') {
41
+ return current < dayjs().endOf('day');
42
+ }
43
+ return current < dayjs(minDate).endOf('day');
44
+ }
45
+ if (maxDate) {
46
+ if (maxDate === 'now') {
47
+ return current > dayjs().endOf('day');
48
+ }
49
+ return current > dayjs(maxDate).endOf('day');
50
+ }
51
+ return false;
52
+ }, [validDate, maxDate, minDate, format]);
53
+ return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(RangePicker_L, _objectSpread(_objectSpread({
54
+ style: _style,
55
+ getPopupContainer: getPopupContainer,
56
+ value: value,
57
+ onChange: handleChange,
58
+ disabledDate: disabledDate,
59
+ format: format
60
+ }, rest), {}, {
61
+ placeholder: ['开始', '结束']
62
+ })));
63
+ }
64
+ // const RangePicker_ = memo<IMyRangePickerProps>(MyRangePickerInner, areEqual)
65
+ var RangePicker_ = MyRangePickerInner;
66
+ export { RangePicker_ as default };