react-antd-xform 1.0.7 → 1.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.
@@ -16,16 +16,16 @@ const modelUtils = {
16
16
  if (!((_a = field.config) == null ? void 0 : _a.htmlId)) {
17
17
  continue;
18
18
  }
19
- const div = document.querySelector(
20
- `*[data-xform-id="${field.config.htmlId}"]`
21
- );
19
+ const div = document.querySelector(`*[data-xform-id="${field.config.htmlId}"]`);
22
20
  if (!div) {
23
21
  continue;
24
22
  }
25
23
  if (typeof div.scrollIntoViewIfNeeded === "function") {
26
24
  div.scrollIntoViewIfNeeded();
27
25
  } else {
28
- div.scrollIntoView({ block: "nearest" });
26
+ div.scrollIntoView({
27
+ block: "nearest"
28
+ });
29
29
  }
30
30
  return;
31
31
  }
@@ -36,23 +36,31 @@ const modelUtils = {
36
36
  if (!((_a = field.config) == null ? void 0 : _a.htmlId)) {
37
37
  continue;
38
38
  }
39
- const div = document.querySelector(
40
- `*[data-xform-id="${field.config.htmlId}"]`
41
- );
39
+ const div = document.querySelector(`*[data-xform-id="${field.config.htmlId}"]`);
42
40
  if (!div) {
43
41
  continue;
44
42
  }
45
- div.animate(
46
- [
47
- { offset: 0, transform: "translateX(0)" },
48
- { offset: 0.065, transform: "translateX(-6px) rotateY(-9deg)" },
49
- { offset: 0.185, transform: "translateX(5px) rotateY(7deg)" },
50
- { offset: 0.315, transform: "translateX(-3px) rotateY(-5deg)" },
51
- { offset: 0.435, transform: "translateX(2px) rotateY(3deg)" },
52
- { offset: 0.5, transform: "translateX(0)" }
53
- ],
54
- { duration: 750 }
55
- );
43
+ div.animate([{
44
+ offset: 0,
45
+ transform: "translateX(0)"
46
+ }, {
47
+ offset: 0.065,
48
+ transform: "translateX(-6px) rotateY(-9deg)"
49
+ }, {
50
+ offset: 0.185,
51
+ transform: "translateX(5px) rotateY(7deg)"
52
+ }, {
53
+ offset: 0.315,
54
+ transform: "translateX(-3px) rotateY(-5deg)"
55
+ }, {
56
+ offset: 0.435,
57
+ transform: "translateX(2px) rotateY(3deg)"
58
+ }, {
59
+ offset: 0.5,
60
+ transform: "translateX(0)"
61
+ }], {
62
+ duration: 750
63
+ });
56
64
  }
57
65
  },
58
66
  validateAll: action(function(model, trigger = "*") {
@@ -64,29 +72,21 @@ const modelUtils = {
64
72
  if (!field.isMounted) {
65
73
  return;
66
74
  }
67
- promises.push(
68
- field.validate(trigger).then(
69
- action((error) => {
70
- if (error) {
71
- hasError = true;
72
- observableSetIn(errors, field.path, error);
73
- errorFields.push(field);
74
- }
75
- })
76
- )
77
- );
75
+ promises.push(field.validate(trigger).then(action((error) => {
76
+ if (error) {
77
+ hasError = true;
78
+ observableSetIn(errors, field.path, error);
79
+ errorFields.push(field);
80
+ }
81
+ })));
78
82
  });
79
83
  model.iterateChecks((check) => {
80
- promises.push(
81
- check.validate().then(
82
- action((error) => {
83
- if (error) {
84
- hasError = true;
85
- observableSetIn(errors, check.path, error);
86
- }
87
- })
88
- )
89
- );
84
+ promises.push(check.validate().then(action((error) => {
85
+ if (error) {
86
+ hasError = true;
87
+ observableSetIn(errors, check.path, error);
88
+ }
89
+ })));
90
90
  });
91
91
  return Promise.all(promises).then(() => ({
92
92
  hasError,
@@ -103,7 +103,11 @@ const modelUtils = {
103
103
  animateErrorFields = false,
104
104
  scrollToFirstError = true
105
105
  } = options;
106
- const { hasError, errors, errorFields } = await modelUtils.validateAll(model);
106
+ const {
107
+ hasError,
108
+ errors,
109
+ errorFields
110
+ } = await modelUtils.validateAll(model);
107
111
  if (hasError) {
108
112
  if (scrollToFirstError) {
109
113
  modelUtils.scrollToFirstError(errorFields);
@@ -114,15 +118,17 @@ const modelUtils = {
114
118
  onError == null ? void 0 : onError(errors, model);
115
119
  } else if (typeof onSubmit === "function") {
116
120
  runInAction(() => {
117
- const result = observable(
118
- valueFilter === "all" ? toJS(model.values) : model._valueShape === "array" ? [] : {}
119
- );
120
- _mergeValuesFromViewToTarget(result, model, { mergeDefaultValue });
121
+ const result = observable(valueFilter === "all" ? toJS(model.values) : model._valueShape === "array" ? [] : {});
122
+ _mergeValuesFromViewToTarget(result, model, {
123
+ mergeDefaultValue
124
+ });
121
125
  onSubmit(toJS(result), model);
122
126
  });
123
127
  }
124
128
  }),
125
- reset: action(function(model, { onReset } = {}) {
129
+ reset: action(function(model, {
130
+ onReset
131
+ } = {}) {
126
132
  model.values = {};
127
133
  modelUtils.clearError(model);
128
134
  onReset == null ? void 0 : onReset(model);
@@ -132,7 +138,9 @@ const modelUtils = {
132
138
  }),
133
139
  mergeValuesFromViewToView: _mergeValuesFromViewToTarget
134
140
  };
135
- function _mergeValuesFromViewToTarget(target, model, { mergeDefaultValue = true } = {}) {
141
+ function _mergeValuesFromViewToTarget(target, model, {
142
+ mergeDefaultValue = true
143
+ } = {}) {
136
144
  model.iterateFields((field) => {
137
145
  if (!field.isMounted) {
138
146
  return;
@@ -37,27 +37,23 @@ class FormModel {
37
37
  this._fieldIdGenerator = new IdGenerator("Field");
38
38
  this.id = this._modelIdGenerator.getNextId();
39
39
  this._values = composeValue(initValues, {});
40
- if (this._values == null) {
41
- console.warn("[xform] FormModel 根节点的初始 values 不能为 null");
42
- }
40
+ if (this._values == null) ;
43
41
  }
44
- makeObservable(
45
- this,
46
- {
47
- // root model 才会使用 this._values
48
- _values: this._modelType === ModelType.rootModel ? observable : false,
49
- values: computed,
50
- state: observable,
51
- setValue: action,
52
- // 注意 name 是可以变化的;在数组元素调换位置的情况下 name 会进行变更
53
- name: observable.ref,
54
- path: computed,
55
- _selfDeleted: observable.ref,
56
- isDeleted: computed,
57
- _markDeleted: action
58
- },
59
- { name: `${this.id}(${this.name})` }
60
- );
42
+ makeObservable(this, {
43
+ // root model 才会使用 this._values
44
+ _values: this._modelType === ModelType.rootModel ? observable : false,
45
+ values: computed,
46
+ state: observable,
47
+ setValue: action,
48
+ // 注意 name 是可以变化的;在数组元素调换位置的情况下 name 会进行变更
49
+ name: observable.ref,
50
+ path: computed,
51
+ _selfDeleted: observable.ref,
52
+ isDeleted: computed,
53
+ _markDeleted: action
54
+ }, {
55
+ name: `${this.id}(${this.name})`
56
+ });
61
57
  }
62
58
  get values() {
63
59
  if (this._modelType === ModelType.rootModel) {
@@ -68,15 +64,9 @@ class FormModel {
68
64
  }
69
65
  set values(nextValues) {
70
66
  if (this.isDeleted) {
71
- console.warn(
72
- "[xform] 对已删除的 Model 进行赋值将被忽略。请不要对已删除的 Model/Field 进行操作。"
73
- );
74
67
  return;
75
68
  }
76
69
  if (this._modelType === ModelType.rootModel) {
77
- if (nextValues == null) {
78
- console.warn("[xform] FormModel 根节点的 values 不能设置为 null/undefined");
79
- }
80
70
  this._values = nextValues;
81
71
  } else {
82
72
  this.parent.setValue(this.name, nextValues);
@@ -94,9 +84,6 @@ class FormModel {
94
84
  }
95
85
  setValue(name, value) {
96
86
  if (this.isDeleted) {
97
- console.warn(
98
- "[xform] 对已删除的 Model 进行赋值将被忽略。请不要对已删除的 Model/Field 进行操作。"
99
- );
100
87
  return;
101
88
  }
102
89
  if (this._modelType === ModelType.subModel && this.values == null) {
@@ -159,10 +146,7 @@ class FormModel {
159
146
  this._valueShape = valueShape;
160
147
  this._subModels = valueShape === "object" ? {} : [];
161
148
  } else {
162
- invariant(
163
- this._valueShape === valueShape,
164
- "[xform] FormModel 的结构需要在使用过程中保持一致,一个数据索引对应的结构不能从数组变为对象,也不能从对象变为数组"
165
- );
149
+ invariant(this._valueShape === valueShape, "[xform] FormModel 的结构需要在使用过程中保持一致,一个数据索引对应的结构不能从数组变为对象,也不能从对象变为数组");
166
150
  }
167
151
  }
168
152
  /** 递归前序遍历该 model 下所有的 model 对象(包含 model 本身) */
@@ -244,7 +228,6 @@ class Check {
244
228
  }
245
229
  _track(config) {
246
230
  if (this.isMounted) {
247
- console.warn(`[xform] check \`${this.path.join(".")}\` 已在视图中被加载。`);
248
231
  return;
249
232
  }
250
233
  this.config = config;
@@ -259,7 +242,9 @@ class Check {
259
242
  if (!this.isMounted) {
260
243
  return;
261
244
  }
262
- const { validate } = this.config;
245
+ const {
246
+ validate
247
+ } = this.config;
263
248
  let cancelled = false;
264
249
  (_a = this.cancelValidation) == null ? void 0 : _a.call(this);
265
250
  this.validating = true;
@@ -299,9 +284,6 @@ const _Field = class _Field {
299
284
  this.handleChange = (nextValue, ...rest) => {
300
285
  var _a, _b, _c;
301
286
  if (nextValue === void 0 && ((_a = this.config) == null ? void 0 : _a.defaultValue) !== void 0) {
302
- console.warn(
303
- "[xform] xform 中所有组件均为受控用法,不支持 onChange(undefined),该调用将自动变为 onChange(null)"
304
- );
305
287
  nextValue = null;
306
288
  }
307
289
  this.value = nextValue;
@@ -339,22 +321,18 @@ const _Field = class _Field {
339
321
  }
340
322
  const name = this.name;
341
323
  const forkName = this._forkName;
342
- makeObservable(
343
- this,
344
- {
345
- state: observable,
346
- value: computed,
347
- path: computed,
348
- validate: action,
349
- handleBlur: action,
350
- handleChange: action,
351
- clear: action,
352
- isDeleted: computed
353
- },
354
- {
355
- name: `${this.id}(${name}${forkName === _Field.ORIGINAL ? "" : "#" + forkName})`
356
- }
357
- );
324
+ makeObservable(this, {
325
+ state: observable,
326
+ value: computed,
327
+ path: computed,
328
+ validate: action,
329
+ handleBlur: action,
330
+ handleChange: action,
331
+ clear: action,
332
+ isDeleted: computed
333
+ }, {
334
+ name: `${this.id}(${name}${forkName === _Field.ORIGINAL ? "" : "#" + forkName})`
335
+ });
358
336
  if (forkName === _Field.ORIGINAL) {
359
337
  this._forkMap = /* @__PURE__ */ new Map();
360
338
  } else {
@@ -382,9 +360,6 @@ const _Field = class _Field {
382
360
  }
383
361
  set value(value) {
384
362
  if (this.isDeleted) {
385
- console.warn(
386
- "[xform] 对已删除的 Field 进行赋值将被忽略。请不要对已删除的 Model/Field 进行操作。"
387
- );
388
363
  return;
389
364
  }
390
365
  if (this.fieldType === FieldType.normal) {
@@ -393,22 +368,13 @@ const _Field = class _Field {
393
368
  this._tupleParts.forEach((part, index) => {
394
369
  this.parent.setValue(part, value == null ? value : value[index]);
395
370
  });
396
- } else if (this.fieldType === FieldType.readonly) {
397
- console.warn(
398
- "[xform] 对只读 Field 进行赋值将被忽略,请检查是否为 FormItem 设置了 props.name 或 props.field."
399
- );
400
- }
371
+ } else if (this.fieldType === FieldType.readonly) ;
401
372
  }
402
373
  get path() {
403
374
  return this.parent.path.concat([this.name]);
404
375
  }
405
376
  _track(config) {
406
377
  if (this.isMounted) {
407
- console.warn(
408
- `[xform] field \`${this.path.join(
409
- "."
410
- )}\` 已在视图中被加载,你需要 fork 该字段来进行多次加载.`
411
- );
412
378
  return;
413
379
  }
414
380
  this.config = config;
@@ -422,9 +388,16 @@ const _Field = class _Field {
422
388
  if (this._forkMap.has(forkName)) {
423
389
  return this._forkMap.get(forkName);
424
390
  } else {
425
- const common = { parent: this.parent, name: this.name, forkName };
391
+ const common = {
392
+ parent: this.parent,
393
+ name: this.name,
394
+ forkName
395
+ };
426
396
  if (this.fieldType === FieldType.normal) {
427
- return new _Field({ fieldType: FieldType.normal, ...common });
397
+ return new _Field({
398
+ fieldType: FieldType.normal,
399
+ ...common
400
+ });
428
401
  } else if (this.fieldType === FieldType.tuple) {
429
402
  return new _Field({
430
403
  fieldType: FieldType.tuple,
@@ -214,6 +214,17 @@ export interface FormItemCreationOptions {
214
214
  /** 组件是否具有固有宽度,默认为 true。该选项为 true 时,controlWidth 将不对组件产生效果 */
215
215
  hasIntrinsicWidth?: boolean;
216
216
  }
217
+ export interface BaseOptionType {
218
+ disabled?: boolean;
219
+ className?: string;
220
+ title?: string;
221
+ [name: string]: any;
222
+ }
223
+ export interface DefaultOptionType extends BaseOptionType {
224
+ label?: React.ReactNode;
225
+ value?: string | number | null;
226
+ children?: Omit<DefaultOptionType, 'children'>[];
227
+ }
217
228
  export interface FormItemProps extends Omit<FieldConfig<any>, 'defaultValueProp' | 'valueProp' | 'htmlId'> {
218
229
  use?: boolean;
219
230
  component: string | React.ComponentType<FormItemComponentProps>;
@@ -236,6 +247,7 @@ export interface FormItemProps extends Omit<FieldConfig<any>, 'defaultValueProp'
236
247
  rightNode?: React.ReactNode;
237
248
  isPreview?: boolean;
238
249
  variant?: Variant;
250
+ options?: DefaultOptionType[];
239
251
  }
240
252
  export interface FormItemViewProps {
241
253
  /** `<label />` 的 id 属性 */
@@ -7,6 +7,24 @@ import weekOfYear from "../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/p
7
7
  dayjs.extend(weekOfYear);
8
8
  dayjs.extend(weekYear);
9
9
  dayjs.extend(isoweek);
10
+ if (!dayjs.__patchedForAntd__) {
11
+ dayjs.__patchedForAntd__ = true;
12
+ if (!dayjs.prototype.weekday) {
13
+ dayjs.prototype.weekday = function() {
14
+ return this.day();
15
+ };
16
+ }
17
+ if (!dayjs.prototype.localeData) {
18
+ dayjs.prototype.localeData = function() {
19
+ return {
20
+ firstDayOfWeek: () => 1,
21
+ // 默认中文环境周一开头
22
+ weekdaysShort: () => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
23
+ monthsShort: () => "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_")
24
+ };
25
+ };
26
+ }
27
+ }
10
28
  function isEmptyValue(value) {
11
29
  return !value && value !== 0 || Array.isArray(value) && value.length === 0;
12
30
  }
@@ -32,7 +50,12 @@ const withValueChangeHandler = (Component) => {
32
50
  };
33
51
  const withDayjsTransformAntdDate = (Component) => {
34
52
  return (props) => {
35
- const { value, onChange, picker, ...restProps } = props;
53
+ const {
54
+ value,
55
+ onChange,
56
+ picker,
57
+ ...restProps
58
+ } = props;
36
59
  const parsedValue = useMemo(() => {
37
60
  if (!value) return void 0;
38
61
  if (picker === "week") {
@@ -52,36 +75,39 @@ const withDayjsTransformAntdDate = (Component) => {
52
75
  }
53
76
  return void 0;
54
77
  }, [value, picker]);
55
- const handleChange = useCallback(
56
- (dayjsDate, dateString) => {
57
- if (!dayjsDate || !dayjsDate.isValid()) {
58
- onChange == null ? void 0 : onChange(null);
59
- return;
60
- }
61
- let formattedValue;
62
- if (picker === "week") {
63
- const year = dayjsDate.year();
64
- const week = dayjsDate.week();
65
- formattedValue = `${year}-${week}`;
66
- } else if (picker === "month") {
67
- formattedValue = dayjsDate.format("YYYY-MM");
68
- } else if (picker === "quarter") {
69
- formattedValue = dayjsDate.format("YYYY-Q");
70
- } else if (picker === "year") {
71
- formattedValue = dayjsDate.format("YYYY");
72
- } else {
73
- formattedValue = dayjsDate.format("YYYY-MM-DD");
74
- }
75
- onChange == null ? void 0 : onChange(formattedValue);
76
- },
77
- [onChange, picker]
78
- );
78
+ const handleChange = useCallback((dayjsDate, dateString) => {
79
+ if (!dayjsDate || !dayjsDate.isValid()) {
80
+ onChange == null ? void 0 : onChange(null);
81
+ return;
82
+ }
83
+ let formattedValue;
84
+ if (picker === "week") {
85
+ const year = dayjsDate.year();
86
+ const week = dayjsDate.week();
87
+ formattedValue = `${year}-${week}`;
88
+ } else if (picker === "month") {
89
+ formattedValue = dayjsDate.format("YYYY-MM");
90
+ } else if (picker === "quarter") {
91
+ formattedValue = dayjsDate.format("YYYY-Q");
92
+ } else if (picker === "year") {
93
+ formattedValue = dayjsDate.format("YYYY");
94
+ } else {
95
+ formattedValue = dayjsDate.format("YYYY-MM-DD");
96
+ }
97
+ onChange == null ? void 0 : onChange(formattedValue);
98
+ }, [onChange, picker]);
79
99
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ...restProps, picker, value: parsedValue, onChange: handleChange });
80
100
  };
81
101
  };
82
102
  const withDayjsTransformAntdDateRangePicker = (Component) => {
83
103
  return (props) => {
84
- const { value, onChange, format, picker = "date", ...restProps } = props;
104
+ const {
105
+ value,
106
+ onChange,
107
+ format,
108
+ picker = "date",
109
+ ...restProps
110
+ } = props;
85
111
  const resolvedFormat = format || DEFAULT_FORMATS[picker] || DEFAULT_FORMATS.date;
86
112
  const parsedValue = useMemo(() => {
87
113
  if (isEmptyDateValue(value)) {
@@ -130,57 +156,49 @@ const withDayjsTransformAntdDateRangePicker = (Component) => {
130
156
  }
131
157
  return [isValidStart ? start : null, isValidEnd ? end : null];
132
158
  }, [value, picker, resolvedFormat]);
133
- const handleChange = useCallback(
134
- (dates, dateStrings) => {
135
- if (!dates || !dates[0] && !dates[1]) {
136
- onChange == null ? void 0 : onChange(null);
137
- return;
138
- }
139
- const [start, end] = dates;
140
- const formatValue = (dayjsObj, type) => {
141
- if (!dayjsObj || !dayjsObj.isValid()) return "";
142
- switch (type) {
143
- case "week":
144
- return `${dayjsObj.year()}-W${dayjsObj.week()}`;
145
- case "month":
146
- return dayjsObj.format("YYYY-MM");
147
- case "quarter": {
148
- const year = dayjsObj.year();
149
- const quarter = Math.floor(dayjsObj.month() / 3) + 1;
150
- return `${year}-Q${quarter}`;
151
- }
152
- case "year":
153
- return dayjsObj.format("YYYY");
154
- case "date":
155
- default:
156
- return dayjsObj.format(resolvedFormat);
159
+ const handleChange = useCallback((dates, dateStrings) => {
160
+ if (!dates || !dates[0] && !dates[1]) {
161
+ onChange == null ? void 0 : onChange(null);
162
+ return;
163
+ }
164
+ const [start, end] = dates;
165
+ const formatValue = (dayjsObj, type) => {
166
+ if (!dayjsObj || !dayjsObj.isValid()) return "";
167
+ switch (type) {
168
+ case "week":
169
+ return `${dayjsObj.year()}-W${dayjsObj.week()}`;
170
+ case "month":
171
+ return dayjsObj.format("YYYY-MM");
172
+ case "quarter": {
173
+ const year = dayjsObj.year();
174
+ const quarter = Math.floor(dayjsObj.month() / 3) + 1;
175
+ return `${year}-Q${quarter}`;
157
176
  }
158
- };
159
- const formatted = [formatValue(start, picker), formatValue(end, picker)];
160
- if (!formatted[0] && !formatted[1]) {
161
- onChange == null ? void 0 : onChange(null);
162
- } else {
163
- onChange == null ? void 0 : onChange(formatted);
177
+ case "year":
178
+ return dayjsObj.format("YYYY");
179
+ case "date":
180
+ default:
181
+ return dayjsObj.format(resolvedFormat);
164
182
  }
165
- },
166
- [onChange, picker, resolvedFormat]
167
- );
168
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
169
- Component,
170
- {
171
- ...restProps,
172
- picker,
173
- format: resolvedFormat,
174
- value: parsedValue,
175
- onChange: handleChange,
176
- allowClear: restProps.allowClear ?? true
183
+ };
184
+ const formatted = [formatValue(start, picker), formatValue(end, picker)];
185
+ if (!formatted[0] && !formatted[1]) {
186
+ onChange == null ? void 0 : onChange(null);
187
+ } else {
188
+ onChange == null ? void 0 : onChange(formatted);
177
189
  }
178
- );
190
+ }, [onChange, picker, resolvedFormat]);
191
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ...restProps, picker, format: resolvedFormat, value: parsedValue, onChange: handleChange, allowClear: restProps.allowClear ?? true });
179
192
  };
180
193
  };
181
194
  const withDayjsTransformAntdTime = (Component) => {
182
195
  return (props) => {
183
- const { value, onChange, format = DEFAULT_FORMAT_TIME, ...restProps } = props;
196
+ const {
197
+ value,
198
+ onChange,
199
+ format = DEFAULT_FORMAT_TIME,
200
+ ...restProps
201
+ } = props;
184
202
  const parsedValue = useMemo(() => {
185
203
  if (!value) return void 0;
186
204
  const stringValue = String(value).trim();
@@ -188,23 +206,25 @@ const withDayjsTransformAntdTime = (Component) => {
188
206
  const parsed = dayjs(stringValue, format, true);
189
207
  return parsed.isValid() ? parsed : void 0;
190
208
  }, [value, format]);
191
- const handleChange = useCallback(
192
- (time, timeString) => {
193
- if (!time || !time.isValid()) {
194
- onChange == null ? void 0 : onChange(null);
195
- return;
196
- }
197
- const formatted = time.format(format);
198
- onChange == null ? void 0 : onChange(formatted);
199
- },
200
- [onChange, format]
201
- );
209
+ const handleChange = useCallback((time, timeString) => {
210
+ if (!time || !time.isValid()) {
211
+ onChange == null ? void 0 : onChange(null);
212
+ return;
213
+ }
214
+ const formatted = time.format(format);
215
+ onChange == null ? void 0 : onChange(formatted);
216
+ }, [onChange, format]);
202
217
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ...restProps, format, value: parsedValue, onChange: handleChange });
203
218
  };
204
219
  };
205
220
  const withDayjsTransformAntdTimeRange = (Component) => {
206
221
  return (props) => {
207
- const { value, onChange, format = DEFAULT_FORMAT_TIME, ...restProps } = props;
222
+ const {
223
+ value,
224
+ onChange,
225
+ format = DEFAULT_FORMAT_TIME,
226
+ ...restProps
227
+ } = props;
208
228
  const parsedValue = useMemo(() => {
209
229
  if (!value || !Array.isArray(value)) return void 0;
210
230
  const [startStr, endStr] = value;
@@ -216,32 +236,29 @@ const withDayjsTransformAntdTimeRange = (Component) => {
216
236
  if (!isValidStart && !isValidEnd) return void 0;
217
237
  return [isValidStart ? start : null, isValidEnd ? end : null];
218
238
  }, [value, format]);
219
- const handleChange = useCallback(
220
- (times, timeStrings) => {
221
- if (!times) {
222
- onChange == null ? void 0 : onChange(null);
223
- return;
224
- }
225
- const [start, end] = times;
226
- const formatted = [
227
- (start == null ? void 0 : start.isValid()) ? start.format(format) : "",
228
- (end == null ? void 0 : end.isValid()) ? end.format(format) : ""
229
- ];
230
- if (!formatted[0] && !formatted[1]) {
231
- onChange == null ? void 0 : onChange(null);
232
- } else {
233
- onChange == null ? void 0 : onChange(formatted);
234
- }
235
- },
236
- [onChange, format]
237
- );
239
+ const handleChange = useCallback((times, timeStrings) => {
240
+ if (!times) {
241
+ onChange == null ? void 0 : onChange(null);
242
+ return;
243
+ }
244
+ const [start, end] = times;
245
+ const formatted = [(start == null ? void 0 : start.isValid()) ? start.format(format) : "", (end == null ? void 0 : end.isValid()) ? end.format(format) : ""];
246
+ if (!formatted[0] && !formatted[1]) {
247
+ onChange == null ? void 0 : onChange(null);
248
+ } else {
249
+ onChange == null ? void 0 : onChange(formatted);
250
+ }
251
+ }, [onChange, format]);
238
252
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ...restProps, format, value: parsedValue, onChange: handleChange });
239
253
  };
240
254
  };
241
255
  const withInjectedProps = (injectedProps) => {
242
256
  return (Component) => {
243
257
  const WrappedComponent = React.forwardRef((props, ref) => {
244
- const mergedProps = { ...injectedProps, ...props };
258
+ const mergedProps = {
259
+ ...injectedProps,
260
+ ...props
261
+ };
245
262
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ref, ...mergedProps });
246
263
  });
247
264
  WrappedComponent.displayName = `WithInjectedProps(${Component.displayName || Component.name})`;
@@ -140,7 +140,9 @@ const ALL_COMPONENTS = Object.keys(COMPONENT_MAP).map((name) => {
140
140
  component = withDayjsTransformAntdTimeRange(component);
141
141
  break;
142
142
  case "multiSelect":
143
- component = withInjectedProps({ mode: "multiple" })(component);
143
+ component = withInjectedProps({
144
+ mode: "multiple"
145
+ })(component);
144
146
  break;
145
147
  case "colorPicker":
146
148
  component = withColorPickerHandler(component);