@noah-libjs/components 0.0.6 → 0.0.8

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 (42) hide show
  1. package/dist/ArrayInput/components.d.ts +787 -4
  2. package/dist/LazyAntd/ColorPicker/index.d.ts +1 -1
  3. package/dist/LazyAntd/DatePicker/Base/DatePicker.d.ts +3 -1
  4. package/dist/LazyAntd/DatePicker/Base/index.d.ts +6 -2
  5. package/dist/LazyAntd/DatePicker/RangePicker.d.ts +3 -1
  6. package/dist/LazyAntd/Tree/Inner.d.ts +2 -1
  7. package/dist/LazyAntd/Tree/index.d.ts +3 -2
  8. package/dist/MyAutoComplete/types.d.ts +4 -1
  9. package/dist/MyButton/index.d.ts +10 -0
  10. package/dist/MyCheckbox/components.d.ts +807 -24
  11. package/dist/MyCheckbox/types.d.ts +3 -1
  12. package/dist/MyDatePicker/Display.d.ts +1 -1
  13. package/dist/MyIconSelect/index.d.ts +7 -0
  14. package/dist/MyIconSelect/types.d.ts +16 -0
  15. package/dist/MyInput/index.d.ts +1 -1
  16. package/dist/MyRangeDate/Inner.d.ts +3 -5
  17. package/dist/MyRangeDate/index.d.ts +6 -7
  18. package/dist/MyRangeDate/utils.d.ts +32 -30
  19. package/dist/MySelect/components.d.ts +787 -4
  20. package/dist/MySelect/types.d.ts +1 -1
  21. package/dist/MySwitch/types.d.ts +5 -2
  22. package/dist/a_chunks/index.js +561 -91
  23. package/dist/a_chunks/index.module.js +1 -24
  24. package/dist/a_chunks/root.17.js +2 -2
  25. package/dist/a_chunks/root.18.js +5 -5
  26. package/dist/a_chunks/root.19.js +2 -1
  27. package/dist/a_chunks/root.20.js +2 -1
  28. package/dist/a_chunks/root.21.js +2 -1
  29. package/dist/a_chunks/root.22.js +54 -196
  30. package/dist/a_chunks/root.23.js +198 -95
  31. package/dist/a_chunks/root.24.js +118 -5
  32. package/dist/a_chunks/root.25.js +4 -3
  33. package/dist/a_chunks/root.26.js +4 -0
  34. package/dist/a_chunks/root.8.js +7 -5
  35. package/dist/index.js +2 -1
  36. package/dist/packs.d.ts +788 -0
  37. package/dist/util-types/fd/InputType.d.ts +1 -1
  38. package/dist/util-types/fd/index.d.ts +33 -10
  39. package/dist/utils/getInputStyle.d.ts +3 -2
  40. package/dist/utils/msmc.d.ts +8 -2
  41. package/dist/utils/new.d.ts +12 -0
  42. package/package.json +4 -4
@@ -1,27 +1,4 @@
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
- }
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",
@@ -12,6 +12,7 @@ import '@ant-design/icons';
12
12
  import 'dayjs';
13
13
  import 'rc-select';
14
14
  import 'rc-tree';
15
+ import '@noah-libjs/request';
15
16
  var componentMap = packs;
16
17
  function RenderComponent(p) {
17
18
  var _target$props;
@@ -54,7 +55,7 @@ var MySelect = function MySelect(props) {
54
55
  fetch_options = props.fetch_options,
55
56
  uniqueKey = props.uniqueKey,
56
57
  _props$popupMatchSele = props.popupMatchSelectWidth,
57
- popupMatchSelectWidth = _props$popupMatchSele === void 0 ? 120 : _props$popupMatchSele,
58
+ popupMatchSelectWidth = _props$popupMatchSele === void 0 ? 140 : _props$popupMatchSele,
58
59
  others = _objectWithoutProperties(props, _excluded);
59
60
  var _use_options = use_options(props),
60
61
  options = _use_options.options,
@@ -139,7 +140,6 @@ var MySelect = function MySelect(props) {
139
140
  // 多选不支持 非 marshal 不支持
140
141
  var isR = !is_multiple && marshal && target;
141
142
  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
143
  loading: loading,
144
144
  className: _warning ? styles['warning'] : undefined,
145
145
  style: _style,
@@ -12,6 +12,7 @@ import 'antd';
12
12
  import 'dayjs';
13
13
  import 'rc-select';
14
14
  import 'rc-tree';
15
+ import '@noah-libjs/request';
15
16
  var components = packs;
16
17
  var MyCheckbox = function MyCheckbox(props) {
17
18
  var _props$type = props.type,
@@ -22,7 +23,7 @@ var MyCheckbox = function MyCheckbox(props) {
22
23
  disabled = _props$disabled === void 0 ? false : _props$disabled,
23
24
  _onBlur = props.onBlur,
24
25
  _props$inputWidth = props.inputWidth,
25
- inputWidth = _props$inputWidth === void 0 ? 64 : _props$inputWidth,
26
+ inputWidth = _props$inputWidth === void 0 ? 50 : _props$inputWidth,
26
27
  _props$vertical = props.vertical,
27
28
  vertical = _props$vertical === void 0 ? false : _props$vertical,
28
29
  _props$style = props.style,
@@ -108,18 +109,18 @@ var MyCheckbox = function MyCheckbox(props) {
108
109
  return d.value === option.value;
109
110
  });
110
111
  if (!targetData || !inputType) return null;
111
- var C = components[inputType];
112
+ var C = components === null || components === void 0 ? void 0 : components[inputType];
112
113
  var inputValue = targetData.text;
113
114
  var props = (_option$props = option.props) !== null && _option$props !== void 0 ? _option$props : {};
114
115
  var style = (_props$style2 = props.style) !== null && _props$style2 !== void 0 ? _props$style2 : {};
115
116
  if (['MyInput', 'Input', 'input', 'MA', 'MyAutoComplete'].includes(inputType)) {
116
117
  style = _objectSpread({
117
- width: inputWidth * (longOptions ? 1 : 2)
118
+ width: inputWidth * (longOptions ? 1 : 1.5)
118
119
  }, style);
119
120
  }
120
121
  if (['Select', 'MS', 'MySelect'].includes(inputType)) {
121
122
  style = _objectSpread({
122
- minWidth: inputWidth * (longOptions ? 1 : 2)
123
+ minWidth: inputWidth * (longOptions ? 1 : 1.5)
123
124
  }, style);
124
125
  }
125
126
  return C ? /*#__PURE__*/React__default.createElement(C, _objectSpread(_objectSpread({
@@ -202,7 +203,6 @@ var MyCheckbox = function MyCheckbox(props) {
202
203
  }
203
204
  }, ")") : null);
204
205
  return /*#__PURE__*/React__default.createElement("div", {
205
- title: JSON.stringify(options),
206
206
  key: index,
207
207
  style: {
208
208
  display: 'flex',
@@ -1,11 +1,12 @@
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
4
  import '@ant-design/icons';
5
5
  import 'antd';
6
6
  import 'dayjs';
7
7
  import 'rc-select';
8
8
  import 'rc-tree';
9
+ import '@noah-libjs/request';
9
10
  var MyCheckbox_DisplayFC = function MyCheckbox_DisplayFC(props) {
10
11
  var _use_options = use_options(props),
11
12
  options = _use_options.options,
@@ -3,13 +3,14 @@ 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';
7
+ import '@noah-libjs/utils';
8
8
  import '@ant-design/icons';
9
9
  import 'antd';
10
10
  import 'dayjs';
11
11
  import 'rc-select';
12
12
  import 'rc-tree';
13
+ import '@noah-libjs/request';
13
14
  function ArrayInputInner(props) {
14
15
  var value = props.value,
15
16
  onChange = props.onChange,
@@ -3,13 +3,14 @@ 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';
7
+ import '@noah-libjs/utils';
8
8
  import '@ant-design/icons';
9
9
  import 'antd';
10
10
  import 'dayjs';
11
11
  import 'rc-select';
12
12
  import 'rc-tree';
13
+ import '@noah-libjs/request';
13
14
  var DisplayFC = function DisplayFC(props) {
14
15
  var value = props.value,
15
16
  _props$separator = props.separator,
@@ -1,208 +1,66 @@
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";
4
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
- var _excluded = ["popupMatchSelectWidth", "getPopupContainer", "options", "style", "defaultValue", "value", "placeholder", "width", "onChange"];
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["value", "onChange", "marshal", "minDate", "maxDate", "validDate", "getPopupContainer", "showUnknown", "format", "style"];
6
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; }
7
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; }
8
- import { CloseOutlined } from '@ant-design/icons';
9
- import { AutoComplete, Button } from 'antd';
10
- import React__default, { useState, useEffect } from 'react';
11
- import { e as parse_MC_dict_options, f as parse_MC_option, g as getInputStyle } from './index.js';
12
- import { isFunction, getPresetOptions, getSearchParamsValue } from '@noah-libjs/utils';
13
- import { request } from '@noah-libjs/request';
14
- import 'dayjs';
6
+ import dayjs from 'dayjs';
7
+ import React__default, { memo, useCallback } from 'react';
8
+ import { e as areEqual, 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 '@ant-design/icons';
12
+ import 'antd';
15
13
  import 'rc-select';
16
14
  import 'rc-tree';
17
-
18
- // import { ICommonOption, getPresetOptions, getSameOptions } from '@lm_fe/env';
19
- var defaultOptions = [];
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,
15
+ function MyRangePickerInner(_props) {
16
+ var props = format_range_props(_props);
17
+ var _props$value = props.value,
18
+ value = _props$value === void 0 ? undefined : _props$value,
33
19
  onChange = props.onChange,
34
- onBlur = props.onBlur;
35
- var _useState = useState([]),
36
- _useState2 = _slicedToArray(_useState, 2),
37
- __options = _useState2[0],
38
- set__options = _useState2[1];
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]);
51
- useEffect(function () {
52
- // if (!init_value && value) {
53
- // setInit_value(value)
54
- // }
55
- setInit_value(value);
56
- return function () {};
57
- }, [value]);
58
- function safeOnChange(str) {
59
- setInit_value(str);
60
- onChange === null || onChange === void 0 || onChange(str);
61
- }
62
- function init() {
63
- isFunction(options) ? options() : options;
64
- optionKey ? getPresetOptions(optionKey) : null;
65
- var searchValue = searchKey ? getSearchParamsValue(searchKey) : null;
66
- parse_MC_dict_options(_objectSpread(_objectSpread({}, props), {}, {
67
- useString: true
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
- });
20
+ marshal = props.marshal,
21
+ minDate = props.minDate,
22
+ maxDate = props.maxDate,
23
+ validDate = props.validDate,
24
+ getPopupContainer = props.getPopupContainer,
25
+ showUnknown = props.showUnknown,
26
+ format = props.format,
27
+ style = props.style,
28
+ rest = _objectWithoutProperties(props, _excluded);
29
+ var _style = getInputStyle(props);
30
+ var handleChange = function handleChange(date, dateString) {
31
+ date = date !== null && date !== void 0 ? date : [];
32
+ var _value = handleChangeValue(props, date);
33
+ onChange === null || onChange === void 0 || onChange(_value);
34
+ };
35
+ var disabledDate = useCallback(function (current) {
36
+ var dateStr = dayjs(current).format(format);
37
+ if (validDate) {
38
+ return dateStr.includes(validDate);
77
39
  }
78
- if (_memorable) {
79
- request.get("/api/text-memories", {
80
- ignore_usr: true,
81
- params: {
82
- 'key.equals': _memorieskey,
83
- size: 9999
84
- }
85
- }).then(function (r) {
86
- var _r$data;
87
- var arr = (_r$data = r.data) !== null && _r$data !== void 0 ? _r$data : [];
88
- _options.push.apply(_options, _toConsumableArray(arr.map(function (_) {
89
- return {
90
- label: _.value,
91
- value: _.value,
92
- id: _.id
93
- };
94
- })));
95
- set__options(_options);
96
- });
97
- } else {
98
- set__options(_options);
40
+ if (minDate) {
41
+ if (minDate === 'now') {
42
+ return current < dayjs().endOf('day');
43
+ }
44
+ return current < dayjs(minDate).endOf('day');
99
45
  }
100
- }
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('');
46
+ if (maxDate) {
47
+ if (maxDate === 'now') {
48
+ return current > dayjs().endOf('day');
126
49
  }
127
- });
128
- }
129
- return {
130
- safeOnChange: safeOnChange,
131
- onBlur: _OnBlur,
132
- init: init,
133
- options: __options,
134
- remove: remove,
135
- init_value: init_value
136
- };
137
- }
138
- function MyAutoCompleteInner(props) {
139
- var _props$popupMatchSele = props.popupMatchSelectWidth,
140
- popupMatchSelectWidth = _props$popupMatchSele === void 0 ? 120 : _props$popupMatchSele,
141
- _props$getPopupContai = props.getPopupContainer,
142
- getPopupContainer = _props$getPopupContai === void 0 ? function () {
143
- return document.body;
144
- } : _props$getPopupContai,
145
- _options = props.options,
146
- _props$style = props.style,
147
- style = _props$style === void 0 ? {} : _props$style,
148
- defaultValue = props.defaultValue,
149
- value = props.value,
150
- placeholder = props.placeholder,
151
- width = props.width,
152
- onChange = props.onChange,
153
- rest = _objectWithoutProperties(props, _excluded);
154
- var _style = getInputStyle(_objectSpread({}, props));
155
- var _useConfig_MyAutoComp = useConfig_MyAutoComplete(props),
156
- safeOnChange = _useConfig_MyAutoComp.safeOnChange,
157
- onBlur = _useConfig_MyAutoComp.onBlur,
158
- options = _useConfig_MyAutoComp.options,
159
- remove = _useConfig_MyAutoComp.remove,
160
- init_value = _useConfig_MyAutoComp.init_value;
161
- return /*#__PURE__*/React__default.createElement(AutoComplete
162
- // dropdownStyle={{ minWidth: 180 }}
163
- , _objectSpread(_objectSpread({
164
- // dropdownStyle={{ minWidth: 180 }}
165
- title: JSON.stringify(options),
166
- popupMatchSelectWidth: popupMatchSelectWidth,
50
+ return current > dayjs(maxDate).endOf('day');
51
+ }
52
+ return false;
53
+ }, [validDate, maxDate, minDate, format]);
54
+ return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(RangePicker_L, _objectSpread(_objectSpread({
167
55
  style: _style,
168
- // bordered={false}
169
- allowClear: true
170
- }, rest), {}, {
171
- value: init_value !== null && init_value !== void 0 ? init_value : defaultValue,
172
- onBlur: onBlur,
173
- onChange: safeOnChange,
174
- // options={options}
175
56
  getPopupContainer: getPopupContainer,
176
- placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "请选择或输入"
177
- }), options.map(function (item) {
178
- return /*#__PURE__*/React__default.createElement(AutoComplete.Option, {
179
- key: item.value,
180
- value: item.value
181
- }, /*#__PURE__*/React__default.createElement("div", {
182
- style: {
183
- display: 'flex',
184
- justifyContent: 'space-between'
185
- }
186
- }, /*#__PURE__*/React__default.createElement("div", {
187
- title: item.label,
188
- style: {
189
- flex: 1,
190
- textOverflow: 'ellipsis',
191
- overflow: 'hidden',
192
- whiteSpace: 'nowrap',
193
- color: item.warning ? 'red' : ''
194
- }
195
- }, item.label), item.id ? /*#__PURE__*/React__default.createElement(Button, {
196
- title: "\u5220\u9664",
197
- size: 'small',
198
- type: 'dashed',
199
- icon: /*#__PURE__*/React__default.createElement(CloseOutlined, null),
200
- onClick: function onClick(e) {
201
- e.stopPropagation();
202
- var ok = confirm('确定删除吗?');
203
- ok && remove(item);
204
- }
205
- }) : null));
206
- }));
57
+ value: value,
58
+ onChange: handleChange,
59
+ disabledDate: disabledDate,
60
+ format: format
61
+ }, rest), {}, {
62
+ placeholder: ['开始', '结束']
63
+ })));
207
64
  }
208
- export { MyAutoCompleteInner as default };
65
+ var RangePicker_ = /*#__PURE__*/memo(MyRangePickerInner, areEqual);
66
+ export { RangePicker_ as default };