@kne/react-form-antd 2.0.16 → 2.0.17-alpha.0.0

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.
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useState, useRef, useEffect, useMemo, useCallback } from 'react';
1
+ import React, { forwardRef, useState, useRef, useEffect, useMemo, useCallback, useImperativeHandle } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
4
  import ReactForm__default, { preset as preset$1, useSubmit, useReset } from '@kne/react-form';
@@ -49,7 +49,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
49
49
  return target;
50
50
  }
51
51
 
52
- const _excluded$6 = ["className", "cache", "enterSubmit", "scrollToError", "scrollProps", "type", "size", "children"];
52
+ const _excluded$7 = ["className", "cache", "enterSubmit", "scrollToError", "scrollProps", "type", "size", "children"];
53
53
  const {
54
54
  ScrollToError,
55
55
  EnterSubmit,
@@ -68,7 +68,7 @@ const Form = forwardRef((_ref, ref) => {
68
68
  size,
69
69
  children
70
70
  } = _ref,
71
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
71
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
72
72
 
73
73
  let computedClass = 'react-form';
74
74
 
@@ -433,17 +433,23 @@ const {
433
433
  } = DatePicker$1;
434
434
 
435
435
  const _DatePicker = props => {
436
- const render = useOnChange$8(props);
436
+ const render = useOnChange$8(Object.assign({
437
+ placeholder: `请选择${props.label}`
438
+ }, props));
437
439
  return render(DatePicker$1);
438
440
  };
439
441
 
440
442
  const _MonthPicker = props => {
441
- const render = useOnChange$8(props);
443
+ const render = useOnChange$8(Object.assign({
444
+ placeholder: `请选择${props.label}`
445
+ }, props));
442
446
  return render(MonthPicker);
443
447
  };
444
448
 
445
449
  const _RangePicker$1 = props => {
446
- const render = useOnChange$8(props); // if(props.selectToday){
450
+ const render = useOnChange$8(Object.assign({
451
+ placeholder: `请选择${props.label}`
452
+ }, props)); // if(props.selectToday){
447
453
  // return render(RangePickerToday);
448
454
  // }
449
455
 
@@ -451,7 +457,9 @@ const _RangePicker$1 = props => {
451
457
  };
452
458
 
453
459
  const _WeekPicker = props => {
454
- const render = useOnChange$8(props);
460
+ const render = useOnChange$8(Object.assign({
461
+ placeholder: `请选择${props.label}`
462
+ }, props));
455
463
  return render(WeekPicker);
456
464
  };
457
465
 
@@ -459,11 +467,17 @@ _DatePicker.MonthPicker = _MonthPicker;
459
467
  _DatePicker.RangePicker = _RangePicker$1;
460
468
  _DatePicker.WeekPicker = _WeekPicker;
461
469
 
470
+ const _excluded$6 = ["soFarButtonText"];
462
471
  const {
463
472
  useOnChange: useOnChange$7
464
473
  } = hooks;
465
474
 
466
- const PickerToday = props => {
475
+ const PickerToday = _ref => {
476
+ let {
477
+ soFarButtonText
478
+ } = _ref,
479
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
480
+
467
481
  // console.log('>>>>data', data);
468
482
  const [data, onChange] = useControlValue(props);
469
483
  const ref_d = useRef();
@@ -505,7 +519,7 @@ const PickerToday = props => {
505
519
  ref_d.current.blur();
506
520
  onChange([newData.start || '', '至今']);
507
521
  }
508
- }, "\u81F3\u4ECA");
522
+ }, soFarButtonText || '至今');
509
523
  };
510
524
 
511
525
  return /*#__PURE__*/React.createElement("div", {
@@ -559,7 +573,9 @@ const {
559
573
  } = hooks;
560
574
 
561
575
  const InputField = props => {
562
- const render = useDecorator$2(props);
576
+ const render = useDecorator$2(Object.assign({
577
+ placeholder: `请输入${props.label}`
578
+ }, props));
563
579
  return render(Input$1);
564
580
  };
565
581
 
@@ -572,7 +588,9 @@ const {
572
588
  } = hooks;
573
589
 
574
590
  const InputNumberField = props => {
575
- const render = useDecorator$1(props);
591
+ const render = useDecorator$1(Object.assign({
592
+ placeholder: `请输入${props.label}`
593
+ }, props));
576
594
  return render(InputNumber$1);
577
595
  };
578
596
 
@@ -611,14 +629,548 @@ const {
611
629
  } = hooks;
612
630
 
613
631
  const _Select = props => {
614
- const render = useOnChange$5(props);
632
+ const render = useOnChange$5(Object.assign({
633
+ placeholder: `请选择${props.label}`
634
+ }, props));
615
635
  return render(Select$1);
616
636
  };
617
637
 
618
638
  _Select.Option = Select$1.Option;
619
639
  _Select.OptGroup = Select$1.OptGroup;
620
640
 
621
- const _excluded$4 = ["data", "setData", "refresh", "isLoading", "children"];
641
+ /**
642
+ * Copyright (c) 2014-present, Facebook, Inc.
643
+ * All rights reserved.
644
+ *
645
+ * This source code is licensed under the BSD-style license found in the
646
+ * LICENSE file in the root directory of this source tree. An additional grant
647
+ * of patent rights can be found in the PATENTS file in the same directory.
648
+ *
649
+ * @providesModule EventSubscription
650
+ * @typechecks
651
+ */
652
+ /**
653
+ * EventSubscription represents a subscription to a particular event. It can
654
+ * remove its own subscription.
655
+ */
656
+
657
+ var EventSubscription = /*#__PURE__*/function () {
658
+ /**
659
+ * @param {EventSubscriptionVendor} subscriber the subscriber that controls
660
+ * this subscription.
661
+ */
662
+ function EventSubscription(subscriber) {
663
+ this.subscriber = subscriber;
664
+ }
665
+ /**
666
+ * Removes this subscription from the subscriber that controls it.
667
+ */
668
+
669
+
670
+ var _proto = EventSubscription.prototype;
671
+
672
+ _proto.remove = function remove() {
673
+ if (this.subscriber) {
674
+ this.subscriber.removeSubscription(this);
675
+ this.subscriber = null;
676
+ }
677
+ };
678
+
679
+ return EventSubscription;
680
+ }();
681
+
682
+ var EventSubscription_1 = EventSubscription;
683
+
684
+ /**
685
+ * Copyright (c) 2014-present, Facebook, Inc.
686
+ * All rights reserved.
687
+ *
688
+ * This source code is licensed under the BSD-style license found in the
689
+ * LICENSE file in the root directory of this source tree. An additional grant
690
+ * of patent rights can be found in the PATENTS file in the same directory.
691
+ *
692
+ * @providesModule EmitterSubscription
693
+ * @typechecks
694
+ */
695
+
696
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
697
+
698
+
699
+ /**
700
+ * EmitterSubscription represents a subscription with listener and context data.
701
+ */
702
+
703
+
704
+ var EmitterSubscription = /*#__PURE__*/function (_EventSubscription) {
705
+ _inheritsLoose(EmitterSubscription, _EventSubscription);
706
+
707
+ /**
708
+ * @param {EventSubscriptionVendor} subscriber - The subscriber that controls
709
+ * this subscription
710
+ * @param {function} listener - Function to invoke when the specified event is
711
+ * emitted
712
+ * @param {*} context - Optional context object to use when invoking the
713
+ * listener
714
+ */
715
+ function EmitterSubscription(subscriber, listener, context) {
716
+ var _this;
717
+
718
+ _this = _EventSubscription.call(this, subscriber) || this;
719
+ _this.listener = listener;
720
+ _this.context = context;
721
+ return _this;
722
+ }
723
+
724
+ return EmitterSubscription;
725
+ }(EventSubscription_1);
726
+
727
+ var EmitterSubscription_1 = EmitterSubscription;
728
+
729
+ /**
730
+ * Copyright (c) 2013-present, Facebook, Inc.
731
+ *
732
+ * This source code is licensed under the MIT license found in the
733
+ * LICENSE file in the root directory of this source tree.
734
+ *
735
+ *
736
+ */
737
+
738
+ var validateFormat = process.env.NODE_ENV !== "production" ? function (format) {
739
+ if (format === undefined) {
740
+ throw new Error('invariant(...): Second argument must be a string.');
741
+ }
742
+ } : function (format) {};
743
+ /**
744
+ * Use invariant() to assert state which your program assumes to be true.
745
+ *
746
+ * Provide sprintf-style format (only %s is supported) and arguments to provide
747
+ * information about what broke and what you were expecting.
748
+ *
749
+ * The invariant message will be stripped in production, but the invariant will
750
+ * remain to ensure logic does not differ in production.
751
+ */
752
+
753
+ function invariant(condition, format) {
754
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
755
+ args[_key - 2] = arguments[_key];
756
+ }
757
+
758
+ validateFormat(format);
759
+
760
+ if (!condition) {
761
+ var error;
762
+
763
+ if (format === undefined) {
764
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
765
+ } else {
766
+ var argIndex = 0;
767
+ error = new Error(format.replace(/%s/g, function () {
768
+ return String(args[argIndex++]);
769
+ }));
770
+ error.name = 'Invariant Violation';
771
+ }
772
+
773
+ error.framesToPop = 1; // Skip invariant's own stack frame.
774
+
775
+ throw error;
776
+ }
777
+ }
778
+
779
+ var invariant_1 = invariant;
780
+
781
+ /**
782
+ * Copyright (c) 2014-present, Facebook, Inc.
783
+ * All rights reserved.
784
+ *
785
+ * This source code is licensed under the BSD-style license found in the
786
+ * LICENSE file in the root directory of this source tree. An additional grant
787
+ * of patent rights can be found in the PATENTS file in the same directory.
788
+ *
789
+ * @providesModule EventSubscriptionVendor
790
+ * @typechecks
791
+ */
792
+
793
+
794
+ /**
795
+ * EventSubscriptionVendor stores a set of EventSubscriptions that are
796
+ * subscribed to a particular event type.
797
+ */
798
+
799
+
800
+ var EventSubscriptionVendor = /*#__PURE__*/function () {
801
+ function EventSubscriptionVendor() {
802
+ this._subscriptionsForType = {};
803
+ this._currentSubscription = null;
804
+ }
805
+ /**
806
+ * Adds a subscription keyed by an event type.
807
+ *
808
+ * @param {string} eventType
809
+ * @param {EventSubscription} subscription
810
+ */
811
+
812
+
813
+ var _proto = EventSubscriptionVendor.prototype;
814
+
815
+ _proto.addSubscription = function addSubscription(eventType, subscription) {
816
+ !(subscription.subscriber === this) ? process.env.NODE_ENV !== "production" ? invariant_1(false, 'The subscriber of the subscription is incorrectly set.') : invariant_1(false) : void 0;
817
+
818
+ if (!this._subscriptionsForType[eventType]) {
819
+ this._subscriptionsForType[eventType] = [];
820
+ }
821
+
822
+ var key = this._subscriptionsForType[eventType].length;
823
+
824
+ this._subscriptionsForType[eventType].push(subscription);
825
+
826
+ subscription.eventType = eventType;
827
+ subscription.key = key;
828
+ return subscription;
829
+ }
830
+ /**
831
+ * Removes a bulk set of the subscriptions.
832
+ *
833
+ * @param {?string} eventType - Optional name of the event type whose
834
+ * registered supscriptions to remove, if null remove all subscriptions.
835
+ */
836
+ ;
837
+
838
+ _proto.removeAllSubscriptions = function removeAllSubscriptions(eventType) {
839
+ if (eventType === undefined) {
840
+ this._subscriptionsForType = {};
841
+ } else {
842
+ delete this._subscriptionsForType[eventType];
843
+ }
844
+ }
845
+ /**
846
+ * Removes a specific subscription. Instead of calling this function, call
847
+ * `subscription.remove()` directly.
848
+ *
849
+ * @param {object} subscription
850
+ */
851
+ ;
852
+
853
+ _proto.removeSubscription = function removeSubscription(subscription) {
854
+ var eventType = subscription.eventType;
855
+ var key = subscription.key;
856
+ var subscriptionsForType = this._subscriptionsForType[eventType];
857
+
858
+ if (subscriptionsForType) {
859
+ delete subscriptionsForType[key];
860
+ }
861
+ }
862
+ /**
863
+ * Returns the array of subscriptions that are currently registered for the
864
+ * given event type.
865
+ *
866
+ * Note: This array can be potentially sparse as subscriptions are deleted
867
+ * from it when they are removed.
868
+ *
869
+ * TODO: This returns a nullable array. wat?
870
+ *
871
+ * @param {string} eventType
872
+ * @return {?array}
873
+ */
874
+ ;
875
+
876
+ _proto.getSubscriptionsForType = function getSubscriptionsForType(eventType) {
877
+ return this._subscriptionsForType[eventType];
878
+ };
879
+
880
+ return EventSubscriptionVendor;
881
+ }();
882
+
883
+ var EventSubscriptionVendor_1 = EventSubscriptionVendor;
884
+
885
+ /**
886
+ * Copyright (c) 2013-present, Facebook, Inc.
887
+ *
888
+ * This source code is licensed under the MIT license found in the
889
+ * LICENSE file in the root directory of this source tree.
890
+ *
891
+ *
892
+ */
893
+ function makeEmptyFunction(arg) {
894
+ return function () {
895
+ return arg;
896
+ };
897
+ }
898
+ /**
899
+ * This function accepts and discards inputs; it has no side effects. This is
900
+ * primarily useful idiomatically for overridable function endpoints which
901
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
902
+ */
903
+
904
+
905
+ var emptyFunction = function emptyFunction() {};
906
+
907
+ emptyFunction.thatReturns = makeEmptyFunction;
908
+ emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
909
+ emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
910
+ emptyFunction.thatReturnsNull = makeEmptyFunction(null);
911
+
912
+ emptyFunction.thatReturnsThis = function () {
913
+ return this;
914
+ };
915
+
916
+ emptyFunction.thatReturnsArgument = function (arg) {
917
+ return arg;
918
+ };
919
+
920
+ var emptyFunction_1 = emptyFunction;
921
+
922
+ /**
923
+ * Copyright (c) 2014-present, Facebook, Inc.
924
+ * All rights reserved.
925
+ *
926
+ * This source code is licensed under the BSD-style license found in the
927
+ * LICENSE file in the root directory of this source tree. An additional grant
928
+ * of patent rights can be found in the PATENTS file in the same directory.
929
+ *
930
+ * @providesModule BaseEventEmitter
931
+ * @typechecks
932
+ */
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+ /**
941
+ * @class BaseEventEmitter
942
+ * @description
943
+ * An EventEmitter is responsible for managing a set of listeners and publishing
944
+ * events to them when it is told that such events happened. In addition to the
945
+ * data for the given event it also sends a event control object which allows
946
+ * the listeners/handlers to prevent the default behavior of the given event.
947
+ *
948
+ * The emitter is designed to be generic enough to support all the different
949
+ * contexts in which one might want to emit events. It is a simple multicast
950
+ * mechanism on top of which extra functionality can be composed. For example, a
951
+ * more advanced emitter may use an EventHolder and EventFactory.
952
+ */
953
+
954
+
955
+ var BaseEventEmitter = /*#__PURE__*/function () {
956
+ /**
957
+ * @constructor
958
+ */
959
+ function BaseEventEmitter() {
960
+ this._subscriber = new EventSubscriptionVendor_1();
961
+ this._currentSubscription = null;
962
+ }
963
+ /**
964
+ * Adds a listener to be invoked when events of the specified type are
965
+ * emitted. An optional calling context may be provided. The data arguments
966
+ * emitted will be passed to the listener function.
967
+ *
968
+ * TODO: Annotate the listener arg's type. This is tricky because listeners
969
+ * can be invoked with varargs.
970
+ *
971
+ * @param {string} eventType - Name of the event to listen to
972
+ * @param {function} listener - Function to invoke when the specified event is
973
+ * emitted
974
+ * @param {*} context - Optional context object to use when invoking the
975
+ * listener
976
+ */
977
+
978
+
979
+ var _proto = BaseEventEmitter.prototype;
980
+
981
+ _proto.addListener = function addListener(eventType, listener, context) {
982
+ return this._subscriber.addSubscription(eventType, new EmitterSubscription_1(this._subscriber, listener, context));
983
+ }
984
+ /**
985
+ * Similar to addListener, except that the listener is removed after it is
986
+ * invoked once.
987
+ *
988
+ * @param {string} eventType - Name of the event to listen to
989
+ * @param {function} listener - Function to invoke only once when the
990
+ * specified event is emitted
991
+ * @param {*} context - Optional context object to use when invoking the
992
+ * listener
993
+ */
994
+ ;
995
+
996
+ _proto.once = function once(eventType, listener, context) {
997
+ var emitter = this;
998
+ return this.addListener(eventType, function () {
999
+ emitter.removeCurrentListener();
1000
+ listener.apply(context, arguments);
1001
+ });
1002
+ }
1003
+ /**
1004
+ * Removes all of the registered listeners, including those registered as
1005
+ * listener maps.
1006
+ *
1007
+ * @param {?string} eventType - Optional name of the event whose registered
1008
+ * listeners to remove
1009
+ */
1010
+ ;
1011
+
1012
+ _proto.removeAllListeners = function removeAllListeners(eventType) {
1013
+ this._subscriber.removeAllSubscriptions(eventType);
1014
+ }
1015
+ /**
1016
+ * Provides an API that can be called during an eventing cycle to remove the
1017
+ * last listener that was invoked. This allows a developer to provide an event
1018
+ * object that can remove the listener (or listener map) during the
1019
+ * invocation.
1020
+ *
1021
+ * If it is called when not inside of an emitting cycle it will throw.
1022
+ *
1023
+ * @throws {Error} When called not during an eventing cycle
1024
+ *
1025
+ * @example
1026
+ * var subscription = emitter.addListenerMap({
1027
+ * someEvent: function(data, event) {
1028
+ * console.log(data);
1029
+ * emitter.removeCurrentListener();
1030
+ * }
1031
+ * });
1032
+ *
1033
+ * emitter.emit('someEvent', 'abc'); // logs 'abc'
1034
+ * emitter.emit('someEvent', 'def'); // does not log anything
1035
+ */
1036
+ ;
1037
+
1038
+ _proto.removeCurrentListener = function removeCurrentListener() {
1039
+ !!!this._currentSubscription ? process.env.NODE_ENV !== "production" ? invariant_1(false, 'Not in an emitting cycle; there is no current subscription') : invariant_1(false) : void 0;
1040
+
1041
+ this._subscriber.removeSubscription(this._currentSubscription);
1042
+ }
1043
+ /**
1044
+ * Returns an array of listeners that are currently registered for the given
1045
+ * event.
1046
+ *
1047
+ * @param {string} eventType - Name of the event to query
1048
+ * @return {array}
1049
+ */
1050
+ ;
1051
+
1052
+ _proto.listeners = function listeners(eventType)
1053
+ /* TODO: Array<EventSubscription> */
1054
+ {
1055
+ var subscriptions = this._subscriber.getSubscriptionsForType(eventType);
1056
+
1057
+ return subscriptions ? subscriptions.filter(emptyFunction_1.thatReturnsTrue).map(function (subscription) {
1058
+ return subscription.listener;
1059
+ }) : [];
1060
+ }
1061
+ /**
1062
+ * Emits an event of the given type with the given data. All handlers of that
1063
+ * particular type will be notified.
1064
+ *
1065
+ * @param {string} eventType - Name of the event to emit
1066
+ * @param {*} Arbitrary arguments to be passed to each registered listener
1067
+ *
1068
+ * @example
1069
+ * emitter.addListener('someEvent', function(message) {
1070
+ * console.log(message);
1071
+ * });
1072
+ *
1073
+ * emitter.emit('someEvent', 'abc'); // logs 'abc'
1074
+ */
1075
+ ;
1076
+
1077
+ _proto.emit = function emit(eventType) {
1078
+ var subscriptions = this._subscriber.getSubscriptionsForType(eventType);
1079
+
1080
+ if (subscriptions) {
1081
+ var keys = Object.keys(subscriptions);
1082
+
1083
+ for (var ii = 0; ii < keys.length; ii++) {
1084
+ var key = keys[ii];
1085
+ var subscription = subscriptions[key]; // The subscription may have been removed during this event loop.
1086
+
1087
+ if (subscription) {
1088
+ this._currentSubscription = subscription;
1089
+
1090
+ this.__emitToSubscription.apply(this, [subscription].concat(Array.prototype.slice.call(arguments)));
1091
+ }
1092
+ }
1093
+
1094
+ this._currentSubscription = null;
1095
+ }
1096
+ }
1097
+ /**
1098
+ * Provides a hook to override how the emitter emits an event to a specific
1099
+ * subscription. This allows you to set up logging and error boundaries
1100
+ * specific to your environment.
1101
+ *
1102
+ * @param {EmitterSubscription} subscription
1103
+ * @param {string} eventType
1104
+ * @param {*} Arbitrary arguments to be passed to each registered listener
1105
+ */
1106
+ ;
1107
+
1108
+ _proto.__emitToSubscription = function __emitToSubscription(subscription, eventType) {
1109
+ var args = Array.prototype.slice.call(arguments, 2);
1110
+ subscription.listener.apply(subscription.context, args);
1111
+ };
1112
+
1113
+ return BaseEventEmitter;
1114
+ }();
1115
+
1116
+ var BaseEventEmitter_1 = BaseEventEmitter;
1117
+
1118
+ /**
1119
+ * Copyright (c) 2014-present, Facebook, Inc.
1120
+ * All rights reserved.
1121
+ *
1122
+ * This source code is licensed under the BSD-style license found in the
1123
+ * LICENSE file in the root directory of this source tree. An additional grant
1124
+ * of patent rights can be found in the PATENTS file in the same directory.
1125
+ */
1126
+
1127
+ var fbemitter = {
1128
+ EventEmitter: BaseEventEmitter_1,
1129
+ EmitterSubscription : EmitterSubscription_1
1130
+ };
1131
+
1132
+ var fbemitter_1 = fbemitter;
1133
+
1134
+ const {
1135
+ EventEmitter
1136
+ } = fbemitter_1;
1137
+
1138
+ class FormEventEmitter extends EventEmitter {
1139
+ constructor(options) {
1140
+ super();
1141
+ const {
1142
+ debug,
1143
+ name = 'event'
1144
+ } = Object.assign({}, options);
1145
+ this.debug = debug;
1146
+ this.name = name;
1147
+ }
1148
+
1149
+ emit(...args) {
1150
+ if (this.debug) {
1151
+ console.log(`[${this.name}][debug]:`, ...args);
1152
+ }
1153
+
1154
+ super.emit(...args);
1155
+ }
1156
+
1157
+ }
1158
+
1159
+ const useEvent = debug => {
1160
+ const debugRef = useRef(debug);
1161
+ return useMemo(() => {
1162
+ const emitter = new FormEventEmitter(debugRef.current);
1163
+ return {
1164
+ addListener: (...args) => emitter.addListener(...args),
1165
+ emit: (...args) => emitter.emit(...args),
1166
+ removeAllListeners: (...args) => emitter.removeAllListeners(...args),
1167
+ listeners: (...args) => emitter.listeners(...args),
1168
+ once: (...args) => emitter.once(...args)
1169
+ };
1170
+ }, []);
1171
+ };
1172
+
1173
+ const _excluded$4 = ["data", "setData", "refresh", "reload", "emitter", "isLoading", "children"];
622
1174
  const {
623
1175
  useOnChange: useOnChange$4
624
1176
  } = hooks;
@@ -628,11 +1180,29 @@ const _SelectFetch = withFetch(_ref => {
628
1180
  data,
629
1181
  setData,
630
1182
  refresh,
1183
+ reload,
1184
+ emitter,
631
1185
  isLoading,
632
1186
  children
633
1187
  } = _ref,
634
1188
  props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
635
1189
 
1190
+ const refreshRef = useRef(refresh);
1191
+ refreshRef.current = refresh;
1192
+ const reloadRef = useRef(reload);
1193
+ reloadRef.current = reload;
1194
+ const setDataRef = useRef(setData);
1195
+ setDataRef.current = setData;
1196
+ useEffect(() => {
1197
+ const token1 = emitter.addListener('select-fetch-refresh', () => refreshRef.current());
1198
+ const token2 = emitter.addListener('select-fetch-reload', () => reloadRef.current());
1199
+ const token3 = emitter.addListener('select-fetch-set-data', () => setDataRef.current());
1200
+ return () => {
1201
+ token1 && token1.remove();
1202
+ token2 && token2.remove();
1203
+ token3 && token3.remove();
1204
+ };
1205
+ }, [emitter]);
636
1206
  return /*#__PURE__*/React.createElement(Select$1, props, children({
637
1207
  data,
638
1208
  refresh,
@@ -641,11 +1211,22 @@ const _SelectFetch = withFetch(_ref => {
641
1211
  }));
642
1212
  });
643
1213
 
644
- const SelectFetch$1 = props => {
645
- const render = useOnChange$4(props);
1214
+ const SelectFetch$1 = forwardRef((props, ref) => {
1215
+ const emitter = useEvent();
1216
+ useImperativeHandle(ref, () => {
1217
+ return {
1218
+ refresh: () => emitter.emit('select-fetch-refresh'),
1219
+ reload: () => emitter.emit('select-fetch-reload'),
1220
+ setData: data => emitter.emit('select-fetch-set-data', data)
1221
+ };
1222
+ }, [emitter]);
1223
+ const render = useOnChange$4(Object.assign({
1224
+ placeholder: `请选择${props.label}`
1225
+ }, props, {
1226
+ emitter
1227
+ }));
646
1228
  return render(_SelectFetch);
647
- };
648
-
1229
+ });
649
1230
  SelectFetch$1.Option = Select$1.Option;
650
1231
  SelectFetch$1.OptGroup = Select$1.OptGroup;
651
1232
 
@@ -669,7 +1250,9 @@ const {
669
1250
  } = hooks;
670
1251
 
671
1252
  const TextArea$1 = props => {
672
- const render = useDecorator(props);
1253
+ const render = useDecorator(Object.assign({
1254
+ placeholder: `请输入${props.label}`
1255
+ }, props));
673
1256
  return render(Input$1.TextArea);
674
1257
  };
675
1258
 
@@ -681,12 +1264,16 @@ const {
681
1264
  } = TimePicker$1;
682
1265
 
683
1266
  const _TimePicker = props => {
684
- const render = useOnChange$2(props);
1267
+ const render = useOnChange$2(Object.assign({
1268
+ placeholder: `请选择${props.label}`
1269
+ }, props));
685
1270
  return render(TimePicker$1);
686
1271
  };
687
1272
 
688
1273
  const _RangePicker = props => {
689
- const render = useOnChange$2(props);
1274
+ const render = useOnChange$2(Object.assign({
1275
+ placeholder: `请选择${props.label}`
1276
+ }, props));
690
1277
  return render(RangePicker);
691
1278
  };
692
1279
 
@@ -697,7 +1284,9 @@ const {
697
1284
  } = hooks;
698
1285
 
699
1286
  const _TreeSelect = props => {
700
- const render = useOnChange$1(props);
1287
+ const render = useOnChange$1(Object.assign({
1288
+ placeholder: `请选择${props.label}`
1289
+ }, props));
701
1290
  return render(TreeSelect$1);
702
1291
  };
703
1292