@noah-libjs/components 0.0.3 → 0.0.5

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,208 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ 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"];
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
+ 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';
15
+ import 'rc-select';
16
+ 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,
33
+ 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
+ });
77
+ }
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);
99
+ }
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('');
126
+ }
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,
167
+ 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
+ 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
+ }));
207
+ }
208
+ export { MyAutoCompleteInner as default };
@@ -0,0 +1,109 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["value", "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 { M as MonthPicker_L, h as formatDatePickerProps, i as getIsUnknown, g as getInputStyle, T as TimePicker_L, D as DatePicker_L, j as get_unknown_conf, U as UNKNOWN_TIME_SYMBOL, k as handleChangeValue } from './index.js';
11
+ export { U as UNKNOWN_TIME_SYMBOL } from './index.js';
12
+ import '@ant-design/icons';
13
+ import 'rc-select';
14
+ import 'rc-tree';
15
+ function CusDatePicker(_props) {
16
+ var props = formatDatePickerProps(_props);
17
+ var _props$value = props.value,
18
+ value = _props$value === void 0 ? undefined : _props$value,
19
+ _onChange = props.onChange,
20
+ valueType = props.valueType,
21
+ minDate = props.minDate,
22
+ maxDate = props.maxDate,
23
+ validDate = props.validDate,
24
+ getPopupContainer = props.getPopupContainer,
25
+ time_only = props.time_only,
26
+ format = props.format,
27
+ style = props.style,
28
+ rest = _objectWithoutProperties(props, _excluded);
29
+ var isUnknown = getIsUnknown(props);
30
+ var _style = getInputStyle(props);
31
+ var transValue = useCallback(function (date) {
32
+ var result = undefined;
33
+ if (!!date) {
34
+ result = dayjs(date, format);
35
+ }
36
+ return result;
37
+ }, []);
38
+ var handleChange = function handleChange(date, dateString) {
39
+ var newValue = handleChangeValue(props, date);
40
+ _onChange === null || _onChange === void 0 || _onChange(newValue);
41
+ };
42
+ var disabledDate = useCallback(function (current) {
43
+ var dateStr = dayjs(current).format('YYYY-MM-DD');
44
+ if (validDate) {
45
+ return dateStr.includes(validDate);
46
+ }
47
+ if (minDate) {
48
+ if (minDate === 'now') {
49
+ return current < dayjs().endOf('day');
50
+ }
51
+ return current < dayjs(minDate).endOf('day');
52
+ }
53
+ if (maxDate) {
54
+ if (maxDate === 'now') {
55
+ return current > dayjs().endOf('day');
56
+ }
57
+ return current > dayjs(maxDate).endOf('day');
58
+ }
59
+ return false;
60
+ }, [validDate, maxDate, minDate]);
61
+ var node = props.time_only ? /*#__PURE__*/React__default.createElement(TimePicker_L, _objectSpread(_objectSpread({
62
+ getPopupContainer: getPopupContainer,
63
+ value: isUnknown ? null : transValue(value),
64
+ onChange: handleChange,
65
+ disabledDate: disabledDate,
66
+ format: format
67
+ }, rest), {}, {
68
+ style: _style,
69
+ placeholder: '请选择'
70
+ })) : /*#__PURE__*/React__default.createElement(DatePicker_L, _objectSpread(_objectSpread({
71
+ getPopupContainer: getPopupContainer,
72
+ value: isUnknown ? null : transValue(value),
73
+ onChange: handleChange,
74
+ disabledDate: disabledDate,
75
+ format: format,
76
+ presets: presets_date()
77
+ }, rest), {}, {
78
+ style: _style,
79
+ placeholder: '请选择'
80
+ }));
81
+ return get_unknown_conf(props) ? /*#__PURE__*/React__default.createElement("span", {
82
+ style: {
83
+ display: 'flex',
84
+ alignItems: 'center'
85
+ }
86
+ }, node, /*#__PURE__*/React__default.createElement("span", {
87
+ style: {
88
+ marginLeft: 6,
89
+ flex: 1
90
+ }
91
+ }, /*#__PURE__*/React__default.createElement(Checkbox, {
92
+ checked: isUnknown,
93
+ skipGroup: true,
94
+ onChange: function onChange(e) {
95
+ var _value = e.target.checked ? UNKNOWN_TIME_SYMBOL : null;
96
+ var value = handleChangeValue(props, _value);
97
+ _onChange === null || _onChange === void 0 || _onChange(value);
98
+ }
99
+ }), /*#__PURE__*/React__default.createElement("span", {
100
+ style: {
101
+ marginLeft: 6
102
+ }
103
+ }, "\u4E0D\u8BE6"))) : node;
104
+ }
105
+ var df = CusDatePicker;
106
+ // const df = memo<IMyDatePickerProps>(CusDatePicker, areEqual)
107
+ CusDatePicker.MonthPicker = MonthPicker_L;
108
+ var MyDatePickerInner = df;
109
+ export { MyDatePickerInner as default };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export * from './pack_components';
1
+ export * from './util-types';
2
+ export * from './packs';
2
3
  export * from './GlobalModal';
3
4
  export * from './Monaco';
4
5
  export * from './MyLazyComponent';