@noah-libjs/components 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/ArrayInput/components.d.ts +26 -649
  2. package/dist/ArrayInput/types.d.ts +2 -1
  3. package/dist/ArraySingle/DispalyInner.d.ts +4 -0
  4. package/dist/ArraySingle/Inner.d.ts +4 -0
  5. package/dist/ArraySingle/index.d.ts +4 -0
  6. package/dist/ArraySingle/types.d.ts +16 -0
  7. package/dist/MyCheckbox/components.d.ts +26 -649
  8. package/dist/MyCheckbox/types.d.ts +3 -2
  9. package/dist/MyIconSelect/MyIcon.d.ts +2 -0
  10. package/dist/MyIconSelect/MyIconSelect.d.ts +5 -0
  11. package/dist/MyIconSelect/index.d.ts +2 -3
  12. package/dist/MyIconSelect/utils.d.ts +7 -0
  13. package/dist/MyInput/index.d.ts +3 -3
  14. package/dist/MyRangeDate/Inner.d.ts +2 -1
  15. package/dist/MyRangeDate/utils.d.ts +11 -376
  16. package/dist/MySelect/components.d.ts +26 -649
  17. package/dist/MySelect/types.d.ts +2 -0
  18. package/dist/a_chunks/index.js +111 -188
  19. package/dist/a_chunks/root.17.js +10 -4
  20. package/dist/a_chunks/root.18.js +0 -1
  21. package/dist/a_chunks/root.19.js +0 -1
  22. package/dist/a_chunks/root.20.js +0 -1
  23. package/dist/a_chunks/root.21.js +0 -1
  24. package/dist/a_chunks/root.22.js +155 -55
  25. package/dist/a_chunks/root.23.js +14 -211
  26. package/dist/a_chunks/root.24.js +23 -75
  27. package/dist/a_chunks/root.25.js +8 -5
  28. package/dist/a_chunks/root.26.js +68 -4
  29. package/dist/a_chunks/root.27.js +212 -0
  30. package/dist/a_chunks/root.28.js +117 -0
  31. package/dist/a_chunks/root.29.js +5 -0
  32. package/dist/a_chunks/root.30.js +4 -0
  33. package/dist/a_chunks/utils.js +59 -0
  34. package/dist/index.js +1 -2
  35. package/dist/packs.d.ts +28 -649
  36. package/dist/util-types/fd/InputType.d.ts +1 -1
  37. package/dist/util-types/fd/index.d.ts +9 -2
  38. package/dist/utils/msmc.d.ts +6 -3
  39. package/dist/utils/use_array_marshal.d.ts +5 -0
  40. package/package.json +4 -4
@@ -22,6 +22,8 @@ export interface IMySelectProps extends Omit<SelectProps<any>, 'options'> {
22
22
  marshal?: TMarshal;
23
23
  startIndex?: number;
24
24
  useString?: boolean;
25
+ useDefault?: boolean;
25
26
  fetch_options?: T_FETCH_OPTIONS;
27
+ fetch_options_on_open?: boolean;
26
28
  }
27
29
  export {};
@@ -12,10 +12,9 @@ var _excluded = ["placeholder"],
12
12
  _excluded2 = ["placeholder"],
13
13
  _excluded3 = ["value", "onChange", "placeholder", "warning", "disabled"],
14
14
  _excluded4 = ["width", "style", "placeholder", "name", "warning", "form", "value", "onChange", "type"],
15
- _excluded5 = ["icon_type", "value", "onChange", "form"],
16
- _excluded6 = ["btn_text", "defaultIcon", "onClick", "form", "children", "icon", "loading", "primary", "hidden", "on_btn_click"],
17
- _excluded7 = ["storeKey", "cb"],
18
- _excluded8 = ["storeKey", "cb"];
15
+ _excluded5 = ["btn_text", "defaultIcon", "onClick", "form", "children", "icon", "loading", "primary", "hidden", "on_btn_click", "title"],
16
+ _excluded6 = ["storeKey", "cb"],
17
+ _excluded7 = ["storeKey", "cb"];
19
18
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
20
19
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
20
  import _regeneratorRuntime from "@babel/runtime/regenerator";
@@ -23,9 +22,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
23
22
  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; }
24
23
  import * as React from 'react';
25
24
  import React__default, { lazy, forwardRef, useRef, useState, useEffect, Suspense, Component } from 'react';
26
- import { CloseOutlined, CheckOutlined, LoadingOutlined } from '@ant-design/icons';
27
- import { getMomentRange, isString, get, isEmpty, numberLikeCompare, isNumber, isBoolean, isNull, getPresetOptions, getDictionariesEnumerations, isFunction, isArray, getDualModeOptions, safe_json_parse_arr, safe_json_parse, isNil, formatDateTimeNoSecond, formatDate, getMomentObj, EMPTY_PLACEHOLDER, safe_json_stringify, safe_async_call, sleep } from '@noah-libjs/utils';
28
- import { Space, Button as Button$1, InputNumber, Checkbox, Input, Card, List, Skeleton, Modal } from 'antd';
25
+ import { getMomentRange, isString, get, isEmpty, isNumber, isBoolean, isNull, numberLikeCompare, getPresetOptions, getDictionariesEnumerations, isFunction, isArray, identity, getDualModeOptions, safe_json_parse_arr, safe_json_parse, isNil, isPrimitive, formatDateTimeNoSecond, formatDate, getMomentObj, EMPTY_PLACEHOLDER, safe_json_stringify, safe_async_call, sleep } from '@noah-libjs/utils';
26
+ import { Space, Button as Button$1, InputNumber, Checkbox, Input, Divider, Skeleton, Modal } from 'antd';
29
27
  import dayjs from 'dayjs';
30
28
  import { Option } from 'rc-select';
31
29
  import RCTree, { TreeNode } from 'rc-tree';
@@ -36,9 +34,15 @@ var ArrayInput = /*#__PURE__*/lazy(function () {
36
34
  ArrayInput.DisplayFC = /*#__PURE__*/lazy(function () {
37
35
  return import('./root.21.js');
38
36
  });
39
- var MyAutoComplete = /*#__PURE__*/lazy(function () {
37
+ var ArraySingle = /*#__PURE__*/lazy(function () {
38
+ return import('./root.22.js');
39
+ });
40
+ ArraySingle.DisplayFC = /*#__PURE__*/lazy(function () {
40
41
  return import('./root.23.js');
41
42
  });
43
+ var MyAutoComplete = /*#__PURE__*/lazy(function () {
44
+ return import('./root.27.js');
45
+ });
42
46
  MyAutoComplete.DisplayFC = function (props) {
43
47
  return /*#__PURE__*/React__default.createElement("span", null, props.value);
44
48
  };
@@ -50,35 +54,35 @@ var MyCheckbox_Display = /*#__PURE__*/lazy(function () {
50
54
  });
51
55
  MyCheckbox.DisplayFC = MyCheckbox_Display;
52
56
  var DatePickerInner = /*#__PURE__*/lazy(function () {
53
- return import('./root.25.js').then(function (r) {
57
+ return import('./root.29.js').then(function (r) {
54
58
  return {
55
59
  "default": r.DatePicker
56
60
  };
57
61
  });
58
62
  });
59
63
  var RangePickerInner = /*#__PURE__*/lazy(function () {
60
- return import('./root.25.js').then(function (r) {
64
+ return import('./root.29.js').then(function (r) {
61
65
  return {
62
66
  "default": r.DatePicker.RangePicker
63
67
  };
64
68
  });
65
69
  });
66
70
  var MonthPickerInner = /*#__PURE__*/lazy(function () {
67
- return import('./root.25.js').then(function (r) {
71
+ return import('./root.29.js').then(function (r) {
68
72
  return {
69
73
  "default": r.DatePicker.MonthPicker
70
74
  };
71
75
  });
72
76
  });
73
77
  var TimePickerInner = /*#__PURE__*/lazy(function () {
74
- return import('./root.25.js').then(function (r) {
78
+ return import('./root.29.js').then(function (r) {
75
79
  return {
76
80
  "default": r.DatePicker.TimePicker
77
81
  };
78
82
  });
79
83
  });
80
84
  var CalendarInner = /*#__PURE__*/lazy(function () {
81
- return import('./root.26.js');
85
+ return import('./root.30.js');
82
86
  });
83
87
  var DatePicker_L = /*#__PURE__*/React.forwardRef(function (props, ref) {
84
88
  return /*#__PURE__*/React.createElement(DatePickerInner, _objectSpread(_objectSpread({}, props), {}, {
@@ -228,6 +232,13 @@ var QRCode_L = /*#__PURE__*/lazy(function () {
228
232
  var Switch_L = /*#__PURE__*/lazy(function () {
229
233
  return import('antd/es/switch');
230
234
  });
235
+ var MyIcon = /*#__PURE__*/lazy(function () {
236
+ return import('./root.25.js');
237
+ });
238
+ var MyIconSelect = /*#__PURE__*/lazy(function () {
239
+ return import('./root.26.js');
240
+ });
241
+ MyIconSelect.DisplayFC = MyIcon;
231
242
  var MyColor = function MyColor(props) {
232
243
  var value = props.value,
233
244
  _onChange = props.onChange,
@@ -242,7 +253,9 @@ var MyColor = function MyColor(props) {
242
253
  }
243
254
  }), allowClear ? /*#__PURE__*/React__default.createElement(Button$1, {
244
255
  size: size,
245
- icon: /*#__PURE__*/React__default.createElement(CloseOutlined, null),
256
+ icon: /*#__PURE__*/React__default.createElement(MyIcon, {
257
+ value: 'CloseOutlined'
258
+ }),
246
259
  onClick: function onClick() {
247
260
  return _onChange === null || _onChange === void 0 ? void 0 : _onChange(null);
248
261
  }
@@ -465,18 +478,18 @@ function get_check_invert_values(configs) {
465
478
  });
466
479
  var name = (_ref = (_item$name = item === null || item === void 0 ? void 0 : item.name) !== null && _item$name !== void 0 ? _item$name : item === null || item === void 0 ? void 0 : item.key) !== null && _ref !== void 0 ? _ref : item === null || item === void 0 ? void 0 : item.dataIndex;
467
480
  var inputType = item === null || item === void 0 ? void 0 : item.inputType;
468
- var options = parse_MC_option(props);
481
+ var opts = parse_MC_option(props);
469
482
  if (inputType === 'MSW') {
470
483
  var _props$checked_value, _props$unchecked_valu;
471
484
  return _objectSpread(_objectSpread({}, a), {}, _defineProperty({}, "".concat(name), [(_props$checked_value = props.checked_value) !== null && _props$checked_value !== void 0 ? _props$checked_value : true, (_props$unchecked_valu = props.unchecked_value) !== null && _props$unchecked_valu !== void 0 ? _props$unchecked_valu : false]));
472
485
  }
473
- if (inputType === 'MA' && isEmpty(options)) {
486
+ if (inputType === 'MA' && isEmpty(opts)) {
474
487
  return a;
475
488
  }
476
- var firstOption = options[0];
489
+ var firstOption = opts[0];
477
490
  return _objectSpread(_objectSpread({}, a), {}, _defineProperty({}, "".concat(name), [parse_MC_value(props, [firstOption]), null, {
478
491
  props: props,
479
- options: options
492
+ options: opts
480
493
  }]));
481
494
  }
482
495
  }, {});
@@ -504,6 +517,11 @@ function parse_MC_value(props, changedValue) {
504
517
  var type = get_mode(props);
505
518
  if (!changedValue.length) return null;
506
519
  if (marshal) {
520
+ if (marshal === 3) {
521
+ return changedValue.map(function (_) {
522
+ return _.value;
523
+ });
524
+ }
507
525
  var frugal_value = process_frugal_local(props, changedValue);
508
526
  return marshal === 2 ? frugal_value : JSON.stringify(frugal_value);
509
527
  }
@@ -530,7 +548,8 @@ function use_options(props) {
530
548
  _props$linker2 = props.linker,
531
549
  linker = _props$linker2 === void 0 ? ',' : _props$linker2,
532
550
  frugal = props.frugal,
533
- display_linker = props.display_linker;
551
+ display_linker = props.display_linker,
552
+ fetch_options_on_open = props.fetch_options_on_open;
534
553
  var _useState = useState([]),
535
554
  _useState2 = _slicedToArray(_useState, 2),
536
555
  options = _useState2[0],
@@ -550,19 +569,22 @@ function use_options(props) {
550
569
  var safeData = getData(value, options, marshal, type, linker, frugal);
551
570
  setData(safeData);
552
571
  }, [value, options]);
572
+ // useEffect(() => {
573
+ // process_options()
574
+ // }, []);
553
575
  useEffect(function () {
576
+ process_options();
577
+ }, [optionKey, _options, uniqueKey]);
578
+ function process_options() {
554
579
  if (fetch_options) {
555
580
  setLoading(true);
556
581
  safe_fetch_options(fetch_options, form).then(set_options)["finally"](function () {
557
582
  return setLoading(false);
558
583
  });
559
- }
560
- }, []);
561
- useEffect(function () {
562
- if (!fetch_options) {
584
+ } else {
563
585
  set_options(parse_MC_option(props));
564
586
  }
565
- }, [optionKey, _options, uniqueKey]);
587
+ }
566
588
  var is_multiple = check_multiple(props);
567
589
  // mchcLogger.log('MySelect', { data, options, props })
568
590
  var label = is_multiple ? data.map(function (_) {
@@ -577,7 +599,8 @@ function use_options(props) {
577
599
  options: options,
578
600
  data: data,
579
601
  setData: setData,
580
- display_node: display_node
602
+ display_node: display_node,
603
+ process_options: process_options
581
604
  };
582
605
  }
583
606
  function process_frugal_local(props, changedValue) {
@@ -593,28 +616,37 @@ function process_frugal_remote(value, frugal) {
593
616
  if (isNil(frugal_value === null || frugal_value === void 0 ? void 0 : frugal_value.value)) return [];
594
617
  return [frugal_value];
595
618
  }
619
+ function process_primary_array_value(value, options) {
620
+ if (isArray(value) && value.every(isPrimitive)) {
621
+ return value.map(function (v) {
622
+ var _options$find;
623
+ return (_options$find = options.find(function (opt) {
624
+ return numberLikeCompare(v, opt.value);
625
+ })) !== null && _options$find !== void 0 ? _options$find : {
626
+ value: v,
627
+ label: v
628
+ };
629
+ });
630
+ }
631
+ return [];
632
+ }
596
633
  function getData(value, options, marshal, type) {
597
634
  var l = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ',';
598
635
  var frugal = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
636
+ if (marshal === 3) {
637
+ return process_primary_array_value(value, options);
638
+ }
599
639
  var unMarshalData = process_frugal_remote(value, frugal);
600
640
  var splitValue = function splitValue() {
601
641
  return isString(value) ? value.split(l).filter(function (_) {
602
642
  return _;
603
643
  }) : [];
604
644
  };
605
- var v = [1, 2].includes(marshal) ? unMarshalData : (type === 'multiple' || type === 'tags') && isString(value) ? splitValue().map(function (value) {
606
- var _options$find;
607
- return (_options$find = options.find(function (_) {
608
- return numberLikeCompare(value, _.value);
609
- })) !== null && _options$find !== void 0 ? _options$find : {
610
- value: value,
611
- label: value
612
- };
613
- }) : value;
645
+ var v = [1, 2].includes(marshal) ? unMarshalData : (type === 'multiple' || type === 'tags') && isString(value) ? process_primary_array_value(splitValue(), options) : value;
614
646
  var safeData = Array.isArray(v) ? v : isNumber(v) || isString(v) || isBoolean(v) || isNull(v)
615
647
  // ? options.filter(_ => _.value === v)
616
- ? options.filter(function (_) {
617
- return numberLikeCompare(_.value, v);
648
+ ? options.filter(function (opt) {
649
+ return numberLikeCompare(opt.value, v);
618
650
  }) : [];
619
651
  // mchcLogger.log('MySelect', { numberLikeCompare, v, options })
620
652
  return safeData;
@@ -627,9 +659,8 @@ function parse_MC_option(props) {
627
659
  var optionKey = props.optionKey;
628
660
  var preOptions = optionKey ? getPresetOptions(optionKey, marshal === 0) : null;
629
661
  var dicOptions = parse_MC_dict_options(props);
630
- var options = (_ref2 = (_ref3 = dicOptions !== null && dicOptions !== void 0 ? dicOptions : preOptions) !== null && _ref3 !== void 0 ? _ref3 : parse_MC_string_options(props)) !== null && _ref2 !== void 0 ? _ref2 : defaultOptions;
631
- // const multiple_compatible_options = options.map(_ => ({ value:}))
632
- return options;
662
+ var opts = (_ref2 = (_ref3 = dicOptions !== null && dicOptions !== void 0 ? dicOptions : preOptions) !== null && _ref3 !== void 0 ? _ref3 : parse_MC_string_options(props)) !== null && _ref2 !== void 0 ? _ref2 : defaultOptions;
663
+ return opts;
633
664
  }
634
665
  function parse_MC_dict_options(props) {
635
666
  if (!(props !== null && props !== void 0 && props.uniqueKey)) return;
@@ -655,30 +686,33 @@ function parse_MC_string_options(props) {
655
686
  var _config$inputType;
656
687
  if (!props) return [];
657
688
  var useString = props.useString,
689
+ _props$useDefault = props.useDefault,
690
+ useDefault = _props$useDefault === void 0 ? true : _props$useDefault,
658
691
  type = props.type,
659
692
  config = props.config,
660
693
  startIndex = props.startIndex,
661
694
  sp = props.sp;
662
- var _options = isFunction(props.options) ? props.options() : props.options;
663
- if (!isString(_options)) return isArray(_options) ? _options.map(function (_) {
695
+ var _opt = isFunction(props.options) ? props.options() : props.options;
696
+ if (!isString(_opt)) return isArray(_opt) ? _opt.map(function (_) {
664
697
  return isString(_) ? {
665
698
  value: _,
666
699
  label: _
667
700
  } : _;
668
- }) : [];
701
+ }).filter(identity) : [];
669
702
  var input_type = (_config$inputType = config === null || config === void 0 ? void 0 : config.inputType) !== null && _config$inputType !== void 0 ? _config$inputType : 'MC';
670
703
  var multiple = type === 'multiple';
671
704
  var marshal = getMarshal(props);
672
- var options = getDualModeOptions(_options, {
705
+ var opts = getDualModeOptions(_opt, {
673
706
  sp: sp,
674
707
  useString: multiple && !marshal || useString,
675
- start: startIndex
708
+ start: startIndex,
709
+ useDefault: useDefault
676
710
  });
677
- return input_type === 'MA' ? options[1] : options[0];
711
+ return input_type === 'MA' ? opts[1] : opts[0];
678
712
  }
679
- function displayValue(_options, value) {
713
+ function displayValue(_opt, value) {
680
714
  var l = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ',';
681
- var _value = _options.filter(function (o) {
715
+ var _value = _opt.filter(function (o) {
682
716
  return value.find(function (v) {
683
717
  return v.value == o.value;
684
718
  });
@@ -739,18 +773,13 @@ var DisplayFC$3 = function DisplayFC$3(_props) {
739
773
  return /*#__PURE__*/React__default.createElement("span", null, isUnknown ? '不详' : m.isValid() ? m.format(format) : EMPTY_PLACEHOLDER);
740
774
  };
741
775
  var MyDatePicker = /*#__PURE__*/lazy(function () {
742
- return import('./root.24.js');
776
+ return import('./root.28.js');
743
777
  });
744
778
  MyDatePicker.DisplayFC = DisplayFC$3;
745
779
  var defaultGetPopupContainer = function defaultGetPopupContainer() {
746
780
  return document.body;
747
781
  };
748
- function areEqual(prevProps, nextProps) {
749
- if (prevProps.value !== nextProps.value) {
750
- return false;
751
- }
752
- return true;
753
- }
782
+ // & Omit<RangePickerProps, 'value' | 'disabled'>
754
783
  function process_value_remote(value, marshal, linker) {
755
784
  var _value = value;
756
785
  var safeValue = [];
@@ -812,7 +841,7 @@ var DisplayFC$2 = function DisplayFC$2(_props) {
812
841
  return disPlay_value.join(linker);
813
842
  };
814
843
  var MyRangePicker = /*#__PURE__*/lazy(function () {
815
- return import('./root.22.js');
844
+ return import('./root.24.js');
816
845
  });
817
846
  var MyRangeDate = function MyRangeDate(props) {
818
847
  var placeholder = props.placeholder,
@@ -924,7 +953,7 @@ var MyInput = /*#__PURE__*/forwardRef(function (props, myRef) {
924
953
  _onChange3 = props.onChange,
925
954
  type = props.type,
926
955
  others = _objectWithoutProperties(props, _excluded4);
927
- if (type === 'number') return /*#__PURE__*/React__default.createElement(MyInputNumber, _objectSpread({}, props));
956
+ if (type === "number") return /*#__PURE__*/React__default.createElement(MyInputNumber, _objectSpread({}, props));
928
957
  var _useState7 = useState(value),
929
958
  _useState8 = _slicedToArray(_useState7, 2),
930
959
  _value = _useState8[0],
@@ -936,6 +965,7 @@ var MyInput = /*#__PURE__*/forwardRef(function (props, myRef) {
936
965
  return /*#__PURE__*/React__default.createElement(Input, _objectSpread(_objectSpread({
937
966
  ref: myRef,
938
967
  value: _value,
968
+ title: value,
939
969
  onChange: function onChange(e) {
940
970
  var v = e.target.value;
941
971
  set_value(v);
@@ -946,7 +976,7 @@ var MyInput = /*#__PURE__*/forwardRef(function (props, myRef) {
946
976
  },
947
977
  style: _style
948
978
  }, others), {}, {
949
- placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : '请输入'
979
+ placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "请输入"
950
980
  }));
951
981
  });
952
982
  MyInput.DisplayFC = function (props) {
@@ -998,123 +1028,12 @@ MySwitch.DisplayFC = function (_ref6) {
998
1028
  unCheckedChildren = _ref6.unCheckedChildren,
999
1029
  unchecked_text = _ref6.unchecked_text;
1000
1030
  if (isNil(value)) return '';
1001
- return value ? (_ref7 = checkedChildren !== null && checkedChildren !== void 0 ? checkedChildren : checked_text) !== null && _ref7 !== void 0 ? _ref7 : /*#__PURE__*/React__default.createElement(CheckOutlined, null) : (_ref8 = unCheckedChildren !== null && unCheckedChildren !== void 0 ? unCheckedChildren : unchecked_text) !== null && _ref8 !== void 0 ? _ref8 : /*#__PURE__*/React__default.createElement(CloseOutlined, null);
1031
+ return value ? (_ref7 = checkedChildren !== null && checkedChildren !== void 0 ? checkedChildren : checked_text) !== null && _ref7 !== void 0 ? _ref7 : /*#__PURE__*/React__default.createElement(MyIcon, {
1032
+ value: 'CheckOutlined'
1033
+ }) : (_ref8 = unCheckedChildren !== null && unCheckedChildren !== void 0 ? unCheckedChildren : unchecked_text) !== null && _ref8 !== void 0 ? _ref8 : /*#__PURE__*/React__default.createElement(MyIcon, {
1034
+ value: 'CloseOutlined'
1035
+ });
1002
1036
  };
1003
- function use_icon(props) {
1004
- var _props$icon_type = props.icon_type,
1005
- icon_type = _props$icon_type === void 0 ? '' : _props$icon_type,
1006
- value = props.value,
1007
- onChange = props.onChange,
1008
- form = props.form,
1009
- others = _objectWithoutProperties(props, _excluded5);
1010
- var _useState9 = useState({}),
1011
- _useState10 = _slicedToArray(_useState9, 2),
1012
- all_icons = _useState10[0],
1013
- set_all_icons = _useState10[1];
1014
- var _useState11 = useState([]),
1015
- _useState12 = _slicedToArray(_useState11, 2),
1016
- all_keys = _useState12[0],
1017
- set_all_keys = _useState12[1];
1018
- var QuestionOutlined = all_icons['QuestionOutlined'] || function () {
1019
- return /*#__PURE__*/React__default.createElement("span", null, "?");
1020
- };
1021
- function render_Icon(t) {
1022
- var _all_icons$default, _all_icons$default2;
1023
- var p = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1024
- if (!((_all_icons$default = all_icons["default"]) !== null && _all_icons$default !== void 0 && _all_icons$default.render)) return null;
1025
- var R = (_all_icons$default2 = all_icons["default"]) === null || _all_icons$default2 === void 0 ? void 0 : _all_icons$default2.render;
1026
- if (!t) return null;
1027
- if (!all_keys.includes(t)) return /*#__PURE__*/React__default.createElement(R, _objectSpread(_objectSpread({
1028
- title: t,
1029
- component: QuestionOutlined
1030
- }, p), others));
1031
- var C = all_icons[t];
1032
- return /*#__PURE__*/React__default.createElement(R, _objectSpread(_objectSpread({
1033
- title: t,
1034
- component: C
1035
- }, p), others));
1036
- }
1037
- useEffect(function () {
1038
- import('@ant-design/icons').then(function (mod) {
1039
- /*#__PURE__*/React__default.createElement(mod["default"], null);
1040
- set_all_icons(mod);
1041
- var keys = Object.keys(mod).filter(function (_) {
1042
- return ['Outlined'].some(function (limit) {
1043
- return _.includes(limit);
1044
- });
1045
- });
1046
- set_all_keys(keys);
1047
- });
1048
- }, []);
1049
- return {
1050
- all_keys: all_keys,
1051
- render_Icon: render_Icon
1052
- };
1053
- }
1054
- var MyIconSelect = /*#__PURE__*/forwardRef(function (props, myRef) {
1055
- var value = props.value,
1056
- onChange = props.onChange;
1057
- var _use_icon = use_icon(props),
1058
- all_keys = _use_icon.all_keys,
1059
- render_Icon = _use_icon.render_Icon;
1060
- return /*#__PURE__*/React__default.createElement(Dropdown_L, {
1061
- arrow: true,
1062
- trigger: ['click'],
1063
- popupRender: function popupRender(node) {
1064
- return /*#__PURE__*/React__default.createElement(Card, {
1065
- size: 'small',
1066
- styles: {
1067
- body: {
1068
- width: 580,
1069
- height: 360,
1070
- overflowY: 'auto'
1071
- }
1072
- }
1073
- }, /*#__PURE__*/React__default.createElement(List, {
1074
- style: {},
1075
- grid: {
1076
- column: 12
1077
- },
1078
- dataSource: all_keys,
1079
- renderItem: function renderItem(key) {
1080
- return /*#__PURE__*/React__default.createElement(List.Item, {
1081
- style: {
1082
- cursor: 'pointer',
1083
- background: key === value ? '#aaa' : '',
1084
- padding: 12,
1085
- display: 'flex',
1086
- alignItems: 'center',
1087
- justifyContent: 'center'
1088
- },
1089
- key: key,
1090
- onClick: function onClick() {
1091
- return onChange === null || onChange === void 0 ? void 0 : onChange(key);
1092
- }
1093
- }, render_Icon(key, {
1094
- style: {
1095
- fontSize: 20
1096
- }
1097
- }), node);
1098
- }
1099
- }));
1100
- }
1101
- }, /*#__PURE__*/React__default.createElement(MyInput, {
1102
- addonBefore: render_Icon(value),
1103
- placeholder: '请选择',
1104
- value: value,
1105
- allowClear: true,
1106
- onChange: onChange,
1107
- onClear: function onClear() {
1108
- return onChange === null || onChange === void 0 ? void 0 : onChange('');
1109
- }
1110
- }));
1111
- });
1112
- function MyIcon(props) {
1113
- var _use_icon2 = use_icon(props),
1114
- render_Icon = _use_icon2.render_Icon;
1115
- return render_Icon(props.value);
1116
- }
1117
- MyIconSelect.DisplayFC = MyIcon;
1118
1037
  function MyButton(props) {
1119
1038
  var btn_text = props.btn_text,
1120
1039
  defaultIcon = props.defaultIcon,
@@ -1126,14 +1045,17 @@ function MyButton(props) {
1126
1045
  primary = props.primary,
1127
1046
  hidden = props.hidden,
1128
1047
  on_btn_click = props.on_btn_click,
1129
- others = _objectWithoutProperties(props, _excluded6);
1048
+ title = props.title,
1049
+ others = _objectWithoutProperties(props, _excluded5);
1130
1050
  if (hidden) return null;
1131
1051
  var type = props.type;
1132
- var _useState13 = useState(false),
1133
- _useState14 = _slicedToArray(_useState13, 2),
1134
- visible = _useState14[0],
1135
- setVisible = _useState14[1];
1136
- var _icon = visible ? defaultIcon !== null && defaultIcon !== void 0 ? defaultIcon : /*#__PURE__*/React__default.createElement(LoadingOutlined, null) : icon;
1052
+ var _useState9 = useState(false),
1053
+ _useState10 = _slicedToArray(_useState9, 2),
1054
+ visible = _useState10[0],
1055
+ setVisible = _useState10[1];
1056
+ var _icon = visible ? defaultIcon !== null && defaultIcon !== void 0 ? defaultIcon : /*#__PURE__*/React__default.createElement(MyIcon, {
1057
+ value: 'LoadingOutlined'
1058
+ }) : icon;
1137
1059
  if (primary) {
1138
1060
  type = 'primary';
1139
1061
  }
@@ -1181,13 +1103,14 @@ function MyButton(props) {
1181
1103
  }
1182
1104
  // const node = (visible) ? tip : (text ?? children)
1183
1105
  return /*#__PURE__*/React__default.createElement(Button$1, _objectSpread(_objectSpread({}, others), {}, {
1184
- title: btn_text,
1106
+ title: title || btn_text,
1185
1107
  icon: _icon,
1186
1108
  type: type,
1187
1109
  onClick: on_click
1188
1110
  }), btn_text !== null && btn_text !== void 0 ? btn_text : children);
1189
1111
  }
1190
1112
  var packs = {
1113
+ Divider: Divider,
1191
1114
  MyIconSelect: MyIconSelect,
1192
1115
  MI: MyInput,
1193
1116
  input: MyInput,
@@ -1220,7 +1143,7 @@ var packs = {
1220
1143
  Switch: MySwitch,
1221
1144
  MSW: MySwitch,
1222
1145
  ArrayInput: ArrayInput,
1223
- MArr: ArrayInput,
1146
+ ArraySingle: ArraySingle,
1224
1147
  MySelect: MySelect,
1225
1148
  MS: MySelect,
1226
1149
  Select: MySelect,
@@ -1273,7 +1196,7 @@ var GlobalModal_ = /*#__PURE__*/function () {
1273
1196
  value: function confirmOnce(_ref10) {
1274
1197
  var storeKey = _ref10.storeKey,
1275
1198
  cb = _ref10.cb,
1276
- others = _objectWithoutProperties(_ref10, _excluded7);
1199
+ others = _objectWithoutProperties(_ref10, _excluded6);
1277
1200
  var isAllow = localStorage.get(storeKey);
1278
1201
  if (isNil(isAllow)) {
1279
1202
  Modal.confirm(_objectSpread(_objectSpread({}, others), {}, {
@@ -1374,7 +1297,7 @@ var GlobalModal = /*#__PURE__*/function () {
1374
1297
  value: function confirmOnce(_ref11) {
1375
1298
  var storeKey = _ref11.storeKey,
1376
1299
  cb = _ref11.cb,
1377
- others = _objectWithoutProperties(_ref11, _excluded8);
1300
+ others = _objectWithoutProperties(_ref11, _excluded7);
1378
1301
  var isAllow = localStorage.get(storeKey);
1379
1302
  if (isNil(isAllow)) {
1380
1303
  Modal.confirm(_objectSpread(_objectSpread({}, others), {}, {
@@ -1396,10 +1319,10 @@ function MountGlobalModal(props) {
1396
1319
  var meta = props.meta,
1397
1320
  globalModal = props.globalModal;
1398
1321
  // useNotification()
1399
- var _useState15 = useState([]),
1400
- _useState16 = _slicedToArray(_useState15, 2),
1401
- modalQueue = _useState16[0],
1402
- setModalQueue = _useState16[1];
1322
+ var _useState11 = useState([]),
1323
+ _useState12 = _slicedToArray(_useState11, 2),
1324
+ modalQueue = _useState12[0],
1325
+ setModalQueue = _useState12[1];
1403
1326
  useEffect(function () {
1404
1327
  globalModal.init(modalQueue, setModalQueue);
1405
1328
  }, [modalQueue]);
@@ -1477,4 +1400,4 @@ var ContainerDimensions = /*#__PURE__*/function (_Component) {
1477
1400
  }
1478
1401
  }]);
1479
1402
  }(Component);
1480
- export { AutoComplete_L as $, ArrayInput as A, MyIconSelect as B, Checkbox_L as C, DatePicker_L as D, MyAutoComplete as E, MyButton as F, MountGlobalModal as G, GlobalModal_ as H, GlobalModal as I, MyMonaco as J, MyLazyComponent as K, isUrl as L, MonthPicker_L as M, getArray as N, getFormat as O, getParamByName as P, handle_form_error as Q, RangePicker_L as R, Select_L as S, TimePicker_L as T, UNKNOWN_TIME_SYMBOL as U, form_validate as V, fuck_focus as W, get_check_invert_values as X, parse_MC_dict_options as Y, displayValue as Z, Calendar_L as _, getMarshal as a, ColorPicker_L as a0, Form_L as a1, Dropdown_L as a2, Table_L as a3, Tree_L as a4, Modal_L as a5, Pagination_L as a6, SelectOption_L as a7, TreeSelect_L as a8, QRCode_L as a9, Switch_L as aa, ContainerDimensions as ab, get_mode as b, check_multiple as c, parse_MC_value as d, areEqual as e, format_range_props as f, getInputStyle as g, handleChangeValue as h, parse_MC_option as i, get_status_cls as j, formatDatePickerProps as k, getIsUnknown as l, get_unknown_conf as m, handleChangeValue$1 as n, MyInput as o, packs as p, MySelect as q, MyCheckbox_Display as r, styleInject as s, MyCheckbox as t, use_options as u, MyRangePicker as v, MyRangeDate as w, MyRangeDateTime as x, MyColor as y, MyIcon as z };
1403
+ export { displayValue as $, ArrayInput as A, MyColor as B, Checkbox_L as C, Dropdown_L as D, MyIconSelect as E, MyAutoComplete as F, MyButton as G, MySwitch as H, MountGlobalModal as I, GlobalModal_ as J, GlobalModal as K, MyMonaco as L, MyIcon as M, MyLazyComponent as N, isUrl as O, getArray as P, getFormat as Q, RangePicker_L as R, Select_L as S, TimePicker_L as T, UNKNOWN_TIME_SYMBOL as U, getParamByName as V, handle_form_error as W, form_validate as X, fuck_focus as Y, get_check_invert_values as Z, parse_MC_dict_options as _, getMarshal as a, Calendar_L as a0, AutoComplete_L as a1, ColorPicker_L as a2, Form_L as a3, Table_L as a4, Tree_L as a5, Modal_L as a6, Pagination_L as a7, SelectOption_L as a8, TreeSelect_L as a9, QRCode_L as aa, Switch_L as ab, ContainerDimensions as ac, get_mode as b, check_multiple as c, parse_MC_value as d, MyInput as e, format_range_props as f, getInputStyle as g, handleChangeValue as h, parse_MC_option as i, get_status_cls as j, MonthPicker_L as k, formatDatePickerProps as l, getIsUnknown as m, DatePicker_L as n, get_unknown_conf as o, packs as p, handleChangeValue$1 as q, MySelect as r, styleInject as s, MyCheckbox_Display as t, use_options as u, MyCheckbox as v, ArraySingle as w, MyRangePicker as x, MyRangeDate as y, MyRangeDateTime as z };
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- var _excluded = ["onChange", "value", "marshal", "fetch_options", "uniqueKey", "popupMatchSelectWidth"];
3
+ var _excluded = ["onChange", "value", "marshal", "fetch_options", "uniqueKey", "popupMatchSelectWidth", "fetch_options_on_open"];
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
6
  import { isNil, numberLikeCompare } from '@noah-libjs/utils';
@@ -8,7 +8,6 @@ import { Row, Col } from 'antd';
8
8
  import React__default, { useMemo } from 'react';
9
9
  import { p as packs, u as use_options, g as getInputStyle, a as getMarshal, b as get_mode, c as check_multiple, S as Select_L, d as parse_MC_value } from './index.js';
10
10
  import { s as styles } from './index.module.js';
11
- import '@ant-design/icons';
12
11
  import 'dayjs';
13
12
  import 'rc-select';
14
13
  import 'rc-tree';
@@ -56,12 +55,14 @@ var MySelect = function MySelect(props) {
56
55
  uniqueKey = props.uniqueKey,
57
56
  _props$popupMatchSele = props.popupMatchSelectWidth,
58
57
  popupMatchSelectWidth = _props$popupMatchSele === void 0 ? 140 : _props$popupMatchSele,
58
+ fetch_options_on_open = props.fetch_options_on_open,
59
59
  others = _objectWithoutProperties(props, _excluded);
60
60
  var _use_options = use_options(props),
61
61
  options = _use_options.options,
62
62
  loading = _use_options.loading,
63
63
  data = _use_options.data,
64
- setData = _use_options.setData;
64
+ setData = _use_options.setData,
65
+ process_options = _use_options.process_options;
65
66
  var _style = getInputStyle(props);
66
67
  var marshal = getMarshal(props);
67
68
  var needToRenderComponent = options.some(function (_) {
@@ -139,7 +140,12 @@ var MySelect = function MySelect(props) {
139
140
  });
140
141
  // 多选不支持 非 marshal 不支持
141
142
  var isR = !is_multiple && marshal && target;
142
- var select_node = loading ? /*#__PURE__*/React__default.createElement("span", null, "'\u6570\u636E\u52A0\u8F7D\u4E2D...'") : /*#__PURE__*/React__default.createElement(Select_L, _objectSpread(_objectSpread({
143
+ var select_node = loading && !fetch_options_on_open ? /*#__PURE__*/React__default.createElement("span", null, "'\u6570\u636E\u52A0\u8F7D\u4E2D...'") : /*#__PURE__*/React__default.createElement(Select_L, _objectSpread(_objectSpread({
144
+ onOpenChange: function onOpenChange(v) {
145
+ if (v && fetch_options_on_open) {
146
+ process_options();
147
+ }
148
+ },
143
149
  loading: loading,
144
150
  className: _warning ? styles['warning'] : undefined,
145
151
  style: _style,
@@ -7,7 +7,6 @@ import React__default, { useRef, useEffect } from 'react';
7
7
  import { p as packs, a as getMarshal, u as use_options, C as Checkbox_L, d as parse_MC_value } from './index.js';
8
8
  import MyCheckbox_DisplayFC from './root.19.js';
9
9
  import { s as styles } from './index.module.js';
10
- import '@ant-design/icons';
11
10
  import 'antd';
12
11
  import 'dayjs';
13
12
  import 'rc-select';
@@ -1,7 +1,6 @@
1
1
  import { u as use_options } from './index.js';
2
2
  import '@noah-libjs/utils';
3
3
  import 'react';
4
- import '@ant-design/icons';
5
4
  import 'antd';
6
5
  import 'dayjs';
7
6
  import 'rc-select';
@@ -5,7 +5,6 @@ import React__default, { useRef, useEffect } from 'react';
5
5
  import { c as componentMap } from './components.js';
6
6
  import { u as use_options } from './index.js';
7
7
  import '@noah-libjs/utils';
8
- import '@ant-design/icons';
9
8
  import 'antd';
10
9
  import 'dayjs';
11
10
  import 'rc-select';
@@ -5,7 +5,6 @@ import React__default, { useEffect } from 'react';
5
5
  import { c as componentMap } from './components.js';
6
6
  import { u as use_options } from './index.js';
7
7
  import '@noah-libjs/utils';
8
- import '@ant-design/icons';
9
8
  import 'antd';
10
9
  import 'dayjs';
11
10
  import 'rc-select';