sti-antd-package 0.0.24 → 0.0.26

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,6 +1,6 @@
1
- import { CheckboxForm } from "../types";
2
1
  import { CheckboxOptionType } from "antd";
3
2
  import React, { Ref } from "react";
3
+ import { FormItemCheckboxProps } from "../../Form/Item";
4
4
  export interface CheckboxGroupComponentRef<T> {
5
5
  value: () => T[];
6
6
  setValue: React.Dispatch<React.SetStateAction<T[]>>;
@@ -12,5 +12,5 @@ interface CheckboxGroup<T> {
12
12
  onChange?: (checkedValue: T[]) => void;
13
13
  ref?: Ref<CheckboxGroupComponentRef<T>>;
14
14
  }
15
- export type CheckboxGroupComponentProps<T> = CheckboxGroup<T> & CheckboxForm;
15
+ export type CheckboxGroupComponentProps<T> = CheckboxGroup<T> & FormItemCheckboxProps;
16
16
  export {};
@@ -1,8 +1,5 @@
1
- import { formColLayout } from "../../constants";
1
+ import { FormItemCheckboxProps } from "../Form/Item";
2
2
  import { CheckboxChangeEvent } from "antd";
3
- import { ValidateStatus } from "antd/es/form/FormItem";
4
- import { ShouldUpdate } from "rc-field-form/lib/Field";
5
- import { NamePath, Rule, RuleObject } from "rc-field-form/lib/interface";
6
3
  import { Ref } from "react";
7
4
  export interface CheckboxComponentRef {
8
5
  checked: () => boolean;
@@ -15,21 +12,5 @@ interface Checkbox {
15
12
  children?: React.ReactNode;
16
13
  ref?: Ref<CheckboxComponentRef>;
17
14
  }
18
- export interface CheckboxForm {
19
- noItem?: boolean;
20
- loading?: boolean;
21
- disabled?: boolean;
22
- removeError?: (name?: NamePath) => void;
23
- formColLayout?: typeof formColLayout;
24
- name?: NamePath;
25
- label?: React.ReactNode;
26
- required?: boolean;
27
- rules?: Rule[];
28
- ruleType?: RuleObject['type'];
29
- ruleMessage?: string;
30
- validateStatus?: ValidateStatus;
31
- help?: React.ReactNode;
32
- shouldUpdate?: ShouldUpdate<string | string[]>;
33
- }
34
- export type CheckboxComponentProps = Checkbox & CheckboxForm;
15
+ export type CheckboxComponentProps = Checkbox & FormItemCheckboxProps;
35
16
  export {};
@@ -2,12 +2,12 @@ import { DatePickerFormatType, formColLayout } from "../../constants";
2
2
  import { Variant } from "antd/es/config-provider";
3
3
  import { SizeType } from "antd/es/config-provider/SizeContext";
4
4
  import { DatePickerProps } from "antd/es/date-picker";
5
+ import { PickerClassNames } from "antd/es/date-picker/generatePicker/interface";
5
6
  import { Rule } from "antd/es/form";
6
7
  import { ValidateStatus } from "antd/es/form/FormItem";
7
8
  import { Dayjs } from "dayjs";
8
9
  import { ShouldUpdate } from "rc-field-form/lib/Field";
9
10
  import { NamePath } from "rc-field-form/lib/interface";
10
- import { SemanticStructure } from "rc-picker/lib/interface";
11
11
  import { Ref } from "react";
12
12
  export interface DatePickerComponentRef {
13
13
  value: () => Dayjs | null;
@@ -17,9 +17,14 @@ export interface DatePickerComponentProps {
17
17
  noItem?: boolean;
18
18
  size?: SizeType;
19
19
  variant?: Variant;
20
+ placeholder?: string;
21
+ prefix?: React.ReactNode;
22
+ prefixCls?: string[];
23
+ suffixIcon?: React.ReactNode;
20
24
  picker?: DatePickerProps['picker'];
21
25
  format?: DatePickerFormatType;
22
26
  loading?: boolean;
27
+ readOnly?: boolean;
23
28
  disabled?: boolean;
24
29
  disabledDate?: DatePickerProps['disabledDate'];
25
30
  disabledTime?: DatePickerProps['disabledTime'];
@@ -32,7 +37,7 @@ export interface DatePickerComponentProps {
32
37
  name?: NamePath;
33
38
  label?: React.ReactNode;
34
39
  classNames?: string[];
35
- className?: Partial<Record<SemanticStructure, string>>;
40
+ className?: PickerClassNames;
36
41
  required?: boolean;
37
42
  rules?: Rule[];
38
43
  ruleMessage?: string;
@@ -3,11 +3,11 @@ import { DatePicker, DatePickerProps } from "antd";
3
3
  import { Variant } from "antd/es/config-provider";
4
4
  import { SizeType } from "antd/es/config-provider/SizeContext";
5
5
  import { RangePickerProps } from "antd/es/date-picker";
6
+ import { PickerClassNames } from "antd/es/date-picker/generatePicker/interface";
6
7
  import { ValidateStatus } from "antd/es/form/FormItem";
7
8
  import dayjs from "dayjs";
8
9
  import { ShouldUpdate } from "rc-field-form/lib/Field";
9
10
  import { NamePath, Rule } from "rc-field-form/lib/interface";
10
- import { SemanticStructure } from "rc-picker/lib/interface";
11
11
  import { RangeValueType } from "rc-picker/lib/PickerInput/RangePicker";
12
12
  import { Ref } from "react";
13
13
  export interface DateRangePickerComponentRef {
@@ -18,9 +18,14 @@ export interface DateRangePickerComponentProps {
18
18
  noItem?: boolean;
19
19
  size?: SizeType;
20
20
  variant?: Variant;
21
+ placeholder?: [string, string];
22
+ prefix?: React.ReactNode;
23
+ prefixCls?: string[];
24
+ suffixIcon?: React.ReactNode;
21
25
  picker?: DatePickerProps['picker'];
22
26
  format?: DatePickerFormatType;
23
27
  loading?: boolean;
28
+ readOnly?: boolean;
24
29
  disabled?: boolean;
25
30
  disabledDate?: RangePickerProps['disabledDate'];
26
31
  disabledTime?: RangePickerProps['disabledTime'];
@@ -33,7 +38,7 @@ export interface DateRangePickerComponentProps {
33
38
  name?: NamePath;
34
39
  label?: React.ReactNode;
35
40
  classNames?: string[];
36
- className?: Partial<Record<SemanticStructure, string>>;
41
+ className?: PickerClassNames;
37
42
  required?: boolean;
38
43
  rules?: Rule[];
39
44
  ruleMessage?: string;
@@ -3,6 +3,24 @@ import { ValidateStatus } from "antd/es/form/FormItem";
3
3
  import { ShouldUpdate } from "rc-field-form/lib/Field";
4
4
  import { NamePath, Rule, RuleObject, Store, StoreValue } from "rc-field-form/lib/interface";
5
5
  import React from "react";
6
+ export interface FormItemDefaultProps {
7
+ noItem?: boolean;
8
+ loading?: boolean;
9
+ disabled?: boolean;
10
+ removeError?: (name?: NamePath) => void;
11
+ formColLayout?: typeof formColLayout;
12
+ name?: NamePath;
13
+ label?: React.ReactNode;
14
+ required?: boolean;
15
+ }
16
+ export type FormItemCheckboxProps = FormItemDefaultProps & {
17
+ rules?: Rule[];
18
+ ruleType?: RuleObject['type'];
19
+ ruleMessage?: string;
20
+ validateStatus?: ValidateStatus;
21
+ help?: React.ReactNode;
22
+ shouldUpdate?: ShouldUpdate<string | string[]>;
23
+ };
6
24
  export interface FormItemComponentProps {
7
25
  noItem?: boolean;
8
26
  formColLayout?: typeof formColLayout;
@@ -17,8 +17,9 @@ export interface SelectComponentProps {
17
17
  variant?: Variant;
18
18
  size?: SizeType;
19
19
  suffixIcon?: React.ReactNode;
20
- className?: string[];
20
+ classNames?: string[];
21
21
  loading?: boolean;
22
+ readOnly?: boolean;
22
23
  disabled?: boolean;
23
24
  open?: boolean;
24
25
  filterOption?: SelectProps['filterOption'];
package/dist/index.d.ts CHANGED
@@ -16,9 +16,9 @@ import { AnyObject } from 'antd/es/_util/type';
16
16
  import { AxiosResponse } from 'axios';
17
17
  import { ColumnOrColumnGroup } from 'react-data-grid';
18
18
  import { DatePickerProps, RangePickerProps } from 'antd/es/date-picker';
19
+ import { PickerClassNames } from 'antd/es/date-picker/generatePicker/interface';
19
20
  import { Rule as Rule$2, RuleObject as RuleObject$2 } from 'antd/es/form';
20
21
  import dayjs, { Dayjs } from 'dayjs';
21
- import { SemanticStructure } from 'rc-picker/lib/interface';
22
22
  import { RangeValueType } from 'rc-picker/lib/PickerInput/RangePicker';
23
23
  import { valueType } from 'antd/es/statistic/utils';
24
24
  import { OnValueChange } from 'react-number-format';
@@ -191,34 +191,59 @@ interface CascaderComponentProps<OptionType extends DefaultOptionType, ValueFiel
191
191
 
192
192
  declare const CascaderComponent: <OptionType extends DefaultOptionType, ValueField extends keyof OptionType>({ noItem, size, classNames, variant, expandTrigger, open, disabled, suffixIcon, placeholder, value, defaultValue, options, displayRender, onChange, onSearch, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, ref, }: CascaderComponentProps<OptionType, ValueField>) => React$1.ReactElement;
193
193
 
194
- interface CheckboxComponentRef {
195
- checked: () => boolean;
196
- setChecked: React.Dispatch<React.SetStateAction<boolean>>;
197
- }
198
- interface Checkbox {
199
- checked?: boolean;
200
- defaultChecked?: boolean;
201
- onChange?: (event: CheckboxChangeEvent) => void;
202
- children?: React.ReactNode;
203
- ref?: Ref<CheckboxComponentRef>;
204
- }
205
- interface CheckboxForm {
194
+ interface FormItemDefaultProps {
206
195
  noItem?: boolean;
207
196
  loading?: boolean;
208
197
  disabled?: boolean;
209
198
  removeError?: (name?: NamePath) => void;
210
199
  formColLayout?: typeof _default;
211
200
  name?: NamePath;
212
- label?: React.ReactNode;
201
+ label?: React$1.ReactNode;
213
202
  required?: boolean;
203
+ }
204
+ type FormItemCheckboxProps = FormItemDefaultProps & {
214
205
  rules?: Rule$1[];
215
206
  ruleType?: RuleObject$1['type'];
216
207
  ruleMessage?: string;
217
208
  validateStatus?: ValidateStatus;
218
- help?: React.ReactNode;
209
+ help?: React$1.ReactNode;
210
+ shouldUpdate?: ShouldUpdate<string | string[]>;
211
+ };
212
+ interface FormItemComponentProps {
213
+ noItem?: boolean;
214
+ formColLayout?: typeof _default;
215
+ name?: NamePath;
216
+ label?: React$1.ReactNode;
217
+ trigger?: string;
218
+ normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
219
+ required?: boolean;
220
+ rules?: Rule$1[];
221
+ ruleType?: RuleObject$1['type'];
222
+ ruleMessage?: string;
223
+ ruleTransform?: (value: StoreValue) => StoreValue;
224
+ ruleMin?: number;
225
+ ruleMax?: number;
226
+ valuePropName?: string;
227
+ validateStatus?: ValidateStatus;
228
+ help?: React$1.ReactNode;
219
229
  shouldUpdate?: ShouldUpdate<string | string[]>;
230
+ children?: React$1.ReactNode;
220
231
  }
221
- type CheckboxComponentProps = Checkbox & CheckboxForm;
232
+
233
+ declare const FormItemComponent: React$1.FC<FormItemComponentProps>;
234
+
235
+ interface CheckboxComponentRef {
236
+ checked: () => boolean;
237
+ setChecked: React.Dispatch<React.SetStateAction<boolean>>;
238
+ }
239
+ interface Checkbox {
240
+ checked?: boolean;
241
+ defaultChecked?: boolean;
242
+ onChange?: (event: CheckboxChangeEvent) => void;
243
+ children?: React.ReactNode;
244
+ ref?: Ref<CheckboxComponentRef>;
245
+ }
246
+ type CheckboxComponentProps = Checkbox & FormItemCheckboxProps;
222
247
 
223
248
  declare const CheckboxComponent$1: React$1.FC<CheckboxComponentProps>;
224
249
 
@@ -233,7 +258,7 @@ interface CheckboxGroup<T> {
233
258
  onChange?: (checkedValue: T[]) => void;
234
259
  ref?: Ref<CheckboxGroupComponentRef<T>>;
235
260
  }
236
- type CheckboxGroupComponentProps<T> = CheckboxGroup<T> & CheckboxForm;
261
+ type CheckboxGroupComponentProps<T> = CheckboxGroup<T> & FormItemCheckboxProps;
237
262
 
238
263
  declare const CheckboxComponent: <T>({ noItem, loading, disabled, options, value, defaultValue, onChange, removeError, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, shouldUpdate, ref, }: CheckboxGroupComponentProps<T>) => react_jsx_runtime.JSX.Element;
239
264
 
@@ -370,9 +395,14 @@ interface DatePickerComponentProps {
370
395
  noItem?: boolean;
371
396
  size?: SizeType;
372
397
  variant?: Variant;
398
+ placeholder?: string;
399
+ prefix?: React.ReactNode;
400
+ prefixCls?: string[];
401
+ suffixIcon?: React.ReactNode;
373
402
  picker?: DatePickerProps['picker'];
374
403
  format?: DatePickerFormatType;
375
404
  loading?: boolean;
405
+ readOnly?: boolean;
376
406
  disabled?: boolean;
377
407
  disabledDate?: DatePickerProps['disabledDate'];
378
408
  disabledTime?: DatePickerProps['disabledTime'];
@@ -385,7 +415,7 @@ interface DatePickerComponentProps {
385
415
  name?: NamePath;
386
416
  label?: React.ReactNode;
387
417
  classNames?: string[];
388
- className?: Partial<Record<SemanticStructure, string>>;
418
+ className?: PickerClassNames;
389
419
  required?: boolean;
390
420
  rules?: Rule$2[];
391
421
  ruleMessage?: string;
@@ -405,9 +435,14 @@ interface DateRangePickerComponentProps {
405
435
  noItem?: boolean;
406
436
  size?: SizeType;
407
437
  variant?: Variant;
438
+ placeholder?: [string, string];
439
+ prefix?: React.ReactNode;
440
+ prefixCls?: string[];
441
+ suffixIcon?: React.ReactNode;
408
442
  picker?: DatePickerProps$1['picker'];
409
443
  format?: DatePickerFormatType;
410
444
  loading?: boolean;
445
+ readOnly?: boolean;
411
446
  disabled?: boolean;
412
447
  disabledDate?: RangePickerProps['disabledDate'];
413
448
  disabledTime?: RangePickerProps['disabledTime'];
@@ -420,7 +455,7 @@ interface DateRangePickerComponentProps {
420
455
  name?: NamePath;
421
456
  label?: React.ReactNode;
422
457
  classNames?: string[];
423
- className?: Partial<Record<SemanticStructure, string>>;
458
+ className?: PickerClassNames;
424
459
  required?: boolean;
425
460
  rules?: Rule$1[];
426
461
  ruleMessage?: string;
@@ -450,29 +485,6 @@ interface DropdownButtonComponentProps<T> {
450
485
 
451
486
  declare const DropdownButtonComponent: <T>({ trigger, placement, menuItems, disabled, data, }: DropdownButtonComponentProps<T>) => React$1.ReactElement;
452
487
 
453
- interface FormItemComponentProps {
454
- noItem?: boolean;
455
- formColLayout?: typeof _default;
456
- name?: NamePath;
457
- label?: React$1.ReactNode;
458
- trigger?: string;
459
- normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
460
- required?: boolean;
461
- rules?: Rule$1[];
462
- ruleType?: RuleObject$1['type'];
463
- ruleMessage?: string;
464
- ruleTransform?: (value: StoreValue) => StoreValue;
465
- ruleMin?: number;
466
- ruleMax?: number;
467
- valuePropName?: string;
468
- validateStatus?: ValidateStatus;
469
- help?: React$1.ReactNode;
470
- shouldUpdate?: ShouldUpdate<string | string[]>;
471
- children?: React$1.ReactNode;
472
- }
473
-
474
- declare const FormItemComponent: React$1.FC<FormItemComponentProps>;
475
-
476
488
  interface IconCheckOrCloseProps {
477
489
  check: boolean;
478
490
  classNames?: string[];
@@ -621,8 +633,9 @@ interface SelectComponentProps {
621
633
  variant?: Variant;
622
634
  size?: SizeType;
623
635
  suffixIcon?: React.ReactNode;
624
- className?: string[];
636
+ classNames?: string[];
625
637
  loading?: boolean;
638
+ readOnly?: boolean;
626
639
  disabled?: boolean;
627
640
  open?: boolean;
628
641
  filterOption?: SelectProps['filterOption'];
package/dist/index.esm.js CHANGED
@@ -5493,7 +5493,7 @@ var formColLayout = {
5493
5493
  notInline: {},
5494
5494
  };
5495
5495
 
5496
- const DatePickerComponent = ({ noItem, size, variant, picker, format, disabledDate, disabledTime, loading, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5496
+ const DatePickerComponent = ({ noItem, size, variant, placeholder, prefix, prefixCls, suffixIcon, picker, format, disabledDate, disabledTime, loading, readOnly, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5497
5497
  const [valueDate, setValueDate] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null);
5498
5498
  const handleChange = (date, dateString) => {
5499
5499
  setValueDate(date);
@@ -5506,13 +5506,13 @@ const DatePickerComponent = ({ noItem, size, variant, picker, format, disabledDa
5506
5506
  }));
5507
5507
  const classDate = [styleCSS['w-100']];
5508
5508
  classNames && classDate.push(...classNames);
5509
- const datePicker = !loading ? (jsxRuntimeExports.jsx(DatePicker, { className: classDate === null || classDate === void 0 ? void 0 : classDate.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowClear: !required, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: value !== null && value !== void 0 ? value : valueDate, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(Skeleton.Input, { block: true, active: true });
5509
+ const datePicker = !loading ? (jsxRuntimeExports.jsx(DatePicker, { className: classDate === null || classDate === void 0 ? void 0 : classDate.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, placeholder: placeholder, prefix: prefix, prefixCls: prefixCls === null || prefixCls === void 0 ? void 0 : prefixCls.join(' '), suffixIcon: suffixIcon, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowClear: !required, readOnly: readOnly, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: value !== null && value !== void 0 ? value : valueDate, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(Skeleton.Input, { block: true, active: true });
5510
5510
  return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: "date", ruleMessage: ruleMessage, rules: rules, validateStatus: validateStatus, help: help, shouldUpdate: shouldUpdate, children: datePicker })))
5511
5511
  : datePicker }));
5512
5512
  };
5513
5513
 
5514
5514
  const { RangePicker } = DatePicker;
5515
- const DateRangePickerComponent = ({ noItem, size, variant, picker, format, disabledDate, disabledTime, loading, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5515
+ const DateRangePickerComponent = ({ noItem, size, variant, placeholder, prefix, prefixCls, suffixIcon, picker, format, disabledDate, disabledTime, loading, readOnly, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5516
5516
  var _a;
5517
5517
  const [valueDateRange, setValueDateRange] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null);
5518
5518
  const handleChange = (date, dateStrings) => {
@@ -5526,7 +5526,7 @@ const DateRangePickerComponent = ({ noItem, size, variant, picker, format, disab
5526
5526
  }));
5527
5527
  const classDateRange = [styleCSS['w-100']];
5528
5528
  classNames && classDateRange.push(...classNames);
5529
- const datePicker = !loading ? (jsxRuntimeExports.jsx(RangePicker, { className: classDateRange.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowEmpty: !required, allowClear: !required, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: (_a = value !== null && value !== void 0 ? value : valueDateRange) !== null && _a !== void 0 ? _a : null, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(Skeleton.Input, { block: true, active: true });
5529
+ const datePicker = !loading ? (jsxRuntimeExports.jsx(RangePicker, { className: classDateRange.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, placeholder: placeholder, prefix: prefix, prefixCls: prefixCls === null || prefixCls === void 0 ? void 0 : prefixCls.join(' '), suffixIcon: suffixIcon, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowEmpty: !required, allowClear: !required, readOnly: readOnly, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: (_a = value !== null && value !== void 0 ? value : valueDateRange) !== null && _a !== void 0 ? _a : null, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(Skeleton.Input, { block: true, active: true });
5530
5530
  return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: "array", ruleMessage: ruleMessage, rules: rules, validateStatus: validateStatus, help: help, shouldUpdate: shouldUpdate, children: datePicker })))
5531
5531
  : datePicker }));
5532
5532
  };
@@ -7574,15 +7574,19 @@ const RadioComponent = ({ buttonStyle, options, optionType, onChange, noItem, lo
7574
7574
  : radio }));
7575
7575
  };
7576
7576
 
7577
- var css_248z$4 = ".style-module_select__vcvBg {\n width: 100%;\n max-width: 100%;\n}\n\n.style-module_add-item-divider__mnSq1 {\n margin: 8px 0;\n}\n\n.style-module_add-item-space__yOxDs {\n padding: 0 8px 4px;\n}\n\n.style-module_add-item-link__lmjLu {\n white-space: nowrap;\n}";
7578
- var styleSelect = {"select":"style-module_select__vcvBg","add-item-divider":"style-module_add-item-divider__mnSq1","add-item-space":"style-module_add-item-space__yOxDs","add-item-link":"style-module_add-item-link__lmjLu"};
7577
+ var css_248z$4 = ".style-module_select__vcvBg {\n width: 100%;\n max-width: 100%;\n}\n\n.style-module_add-item-divider__mnSq1 {\n margin: 8px 0;\n}\n\n.style-module_add-item-space__yOxDs {\n padding: 0 8px 4px;\n}\n\n.style-module_add-item-link__lmjLu {\n white-space: nowrap;\n}\n\n.style-module_select__vcvBg.style-module_readonly__1gDhg>div {\n cursor: auto !important;\n color: inherit !important;\n}";
7578
+ var styleSelect = {"select":"style-module_select__vcvBg","add-item-divider":"style-module_add-item-divider__mnSq1","add-item-space":"style-module_add-item-space__yOxDs","add-item-link":"style-module_add-item-link__lmjLu","readonly":"style-module_readonly__1gDhg"};
7579
7579
  styleInject(css_248z$4);
7580
7580
 
7581
7581
  const { Link } = Typography;
7582
- const SelectComponent = ({ noItem, showSearch, mode, variant, size, suffixIcon, className, loading, disabled, open, filterOption, placeholder, value, defaultValue, removeError, onChange, onKeyDown, onSearch, onFocus, notFoundContent, tokenSeparators, options, style, addItem, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
7582
+ const SelectComponent = ({ noItem, showSearch, mode, variant, size, suffixIcon, classNames, loading, readOnly, disabled, open, filterOption, placeholder, value, defaultValue, removeError, onChange, onKeyDown, onSearch, onFocus, notFoundContent, tokenSeparators, options, style, addItem, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
7583
7583
  const [addItemValue, setAddItemValue] = useState('');
7584
- const classNameSelect = [styleSelect['select']];
7585
- className && classNameSelect.push(...className);
7584
+ const classNameSelect = useMemo$1(() => {
7585
+ const className = [styleSelect['select']];
7586
+ classNames && className.push(...classNames);
7587
+ readOnly && className.push(styleSelect['readonly']);
7588
+ return className;
7589
+ }, [classNames, readOnly]);
7586
7590
  const handleAddItem = (_) => {
7587
7591
  var _a;
7588
7592
  (_a = addItem === null || addItem === void 0 ? void 0 : addItem.onClick) === null || _a === void 0 ? void 0 : _a.call(addItem, addItemValue);
@@ -7594,7 +7598,7 @@ const SelectComponent = ({ noItem, showSearch, mode, variant, size, suffixIcon,
7594
7598
  };
7595
7599
  const popupRender = menu => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [menu, addItem &&
7596
7600
  jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Divider, { className: styleSelect['add-item-divider'] }), jsxRuntimeExports.jsxs(Space, { align: "center", className: styleSelect['add-item-space'], children: [jsxRuntimeExports.jsx(Input$2, { placeholder: "Please enter item", value: addItemValue, onChange: event => setAddItemValue(event.target.value) }), jsxRuntimeExports.jsxs(Link, { className: styleSelect['add-item-link'], onClick: handleAddItem, children: [jsxRuntimeExports.jsx(RefIcon$5, {}), " Add item"] })] })] })] }));
7597
- const select = !loading ? (jsxRuntimeExports.jsx(Select, { mode: mode, showSearch: showSearch, variant: variant, allowClear: !required, size: size, suffixIcon: suffixIcon, className: classNameSelect.join(' '), disabled: disabled, open: open, filterOption: filterOption, placeholder: placeholder, value: value, defaultValue: defaultValue, onChange: (value, event) => {
7601
+ const select = !loading ? (jsxRuntimeExports.jsx(Select, { mode: mode, showSearch: showSearch, variant: variant, allowClear: !required, size: size, suffixIcon: suffixIcon, className: classNameSelect.join(' '), disabled: disabled !== null && disabled !== void 0 ? disabled : readOnly, open: open, filterOption: filterOption, placeholder: placeholder, value: value, defaultValue: defaultValue, onChange: (value, event) => {
7598
7602
  removeError === null || removeError === void 0 ? void 0 : removeError(name);
7599
7603
  onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
7600
7604
  }, onKeyDown: onKeyDown, onSearch: onSearch, onFocus: onFocus, notFoundContent: notFoundContent, tokenSeparators: tokenSeparators, options: options === null || options === void 0 ? void 0 : options.filter(option => option.value !== undefined), optionLabelProp: "label", optionRender: optionRender, popupRender: popupRender, style: style })) : jsxRuntimeExports.jsx(Skeleton.Input, { block: true, active: true });
package/dist/index.js CHANGED
@@ -5512,7 +5512,7 @@ var formColLayout = {
5512
5512
  notInline: {},
5513
5513
  };
5514
5514
 
5515
- const DatePickerComponent = ({ noItem, size, variant, picker, format, disabledDate, disabledTime, loading, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5515
+ const DatePickerComponent = ({ noItem, size, variant, placeholder, prefix, prefixCls, suffixIcon, picker, format, disabledDate, disabledTime, loading, readOnly, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5516
5516
  const [valueDate, setValueDate] = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null);
5517
5517
  const handleChange = (date, dateString) => {
5518
5518
  setValueDate(date);
@@ -5525,13 +5525,13 @@ const DatePickerComponent = ({ noItem, size, variant, picker, format, disabledDa
5525
5525
  }));
5526
5526
  const classDate = [styleCSS['w-100']];
5527
5527
  classNames && classDate.push(...classNames);
5528
- const datePicker = !loading ? (jsxRuntimeExports.jsx(antd.DatePicker, { className: classDate === null || classDate === void 0 ? void 0 : classDate.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowClear: !required, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: value !== null && value !== void 0 ? value : valueDate, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(antd.Skeleton.Input, { block: true, active: true });
5528
+ const datePicker = !loading ? (jsxRuntimeExports.jsx(antd.DatePicker, { className: classDate === null || classDate === void 0 ? void 0 : classDate.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, placeholder: placeholder, prefix: prefix, prefixCls: prefixCls === null || prefixCls === void 0 ? void 0 : prefixCls.join(' '), suffixIcon: suffixIcon, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowClear: !required, readOnly: readOnly, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: value !== null && value !== void 0 ? value : valueDate, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(antd.Skeleton.Input, { block: true, active: true });
5529
5529
  return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: "date", ruleMessage: ruleMessage, rules: rules, validateStatus: validateStatus, help: help, shouldUpdate: shouldUpdate, children: datePicker })))
5530
5530
  : datePicker }));
5531
5531
  };
5532
5532
 
5533
5533
  const { RangePicker } = antd.DatePicker;
5534
- const DateRangePickerComponent = ({ noItem, size, variant, picker, format, disabledDate, disabledTime, loading, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5534
+ const DateRangePickerComponent = ({ noItem, size, variant, placeholder, prefix, prefixCls, suffixIcon, picker, format, disabledDate, disabledTime, loading, readOnly, disabled, value, defaultValue, removeError, onChange, style, formColLayout, name, label, classNames = [], className, required, rules, ruleMessage, validateStatus, help, shouldUpdate, ref, }) => {
5535
5535
  var _a;
5536
5536
  const [valueDateRange, setValueDateRange] = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null);
5537
5537
  const handleChange = (date, dateStrings) => {
@@ -5545,7 +5545,7 @@ const DateRangePickerComponent = ({ noItem, size, variant, picker, format, disab
5545
5545
  }));
5546
5546
  const classDateRange = [styleCSS['w-100']];
5547
5547
  classNames && classDateRange.push(...classNames);
5548
- const datePicker = !loading ? (jsxRuntimeExports.jsx(RangePicker, { className: classDateRange.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowEmpty: !required, allowClear: !required, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: (_a = value !== null && value !== void 0 ? value : valueDateRange) !== null && _a !== void 0 ? _a : null, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(antd.Skeleton.Input, { block: true, active: true });
5548
+ const datePicker = !loading ? (jsxRuntimeExports.jsx(RangePicker, { className: classDateRange.join(' '), classNames: className, size: size !== null && size !== void 0 ? size : 'middle', variant: variant, placeholder: placeholder, prefix: prefix, prefixCls: prefixCls === null || prefixCls === void 0 ? void 0 : prefixCls.join(' '), suffixIcon: suffixIcon, picker: picker, format: datePickerFormat[format !== null && format !== void 0 ? format : 'default'], allowEmpty: !required, allowClear: !required, readOnly: readOnly, disabled: disabled, disabledDate: disabledDate, disabledTime: disabledTime, value: (_a = value !== null && value !== void 0 ? value : valueDateRange) !== null && _a !== void 0 ? _a : null, onChange: handleChange, style: style })) : jsxRuntimeExports.jsx(antd.Skeleton.Input, { block: true, active: true });
5549
5549
  return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: "array", ruleMessage: ruleMessage, rules: rules, validateStatus: validateStatus, help: help, shouldUpdate: shouldUpdate, children: datePicker })))
5550
5550
  : datePicker }));
5551
5551
  };
@@ -7593,15 +7593,19 @@ const RadioComponent = ({ buttonStyle, options, optionType, onChange, noItem, lo
7593
7593
  : radio }));
7594
7594
  };
7595
7595
 
7596
- var css_248z$4 = ".style-module_select__vcvBg {\n width: 100%;\n max-width: 100%;\n}\n\n.style-module_add-item-divider__mnSq1 {\n margin: 8px 0;\n}\n\n.style-module_add-item-space__yOxDs {\n padding: 0 8px 4px;\n}\n\n.style-module_add-item-link__lmjLu {\n white-space: nowrap;\n}";
7597
- var styleSelect = {"select":"style-module_select__vcvBg","add-item-divider":"style-module_add-item-divider__mnSq1","add-item-space":"style-module_add-item-space__yOxDs","add-item-link":"style-module_add-item-link__lmjLu"};
7596
+ var css_248z$4 = ".style-module_select__vcvBg {\n width: 100%;\n max-width: 100%;\n}\n\n.style-module_add-item-divider__mnSq1 {\n margin: 8px 0;\n}\n\n.style-module_add-item-space__yOxDs {\n padding: 0 8px 4px;\n}\n\n.style-module_add-item-link__lmjLu {\n white-space: nowrap;\n}\n\n.style-module_select__vcvBg.style-module_readonly__1gDhg>div {\n cursor: auto !important;\n color: inherit !important;\n}";
7597
+ var styleSelect = {"select":"style-module_select__vcvBg","add-item-divider":"style-module_add-item-divider__mnSq1","add-item-space":"style-module_add-item-space__yOxDs","add-item-link":"style-module_add-item-link__lmjLu","readonly":"style-module_readonly__1gDhg"};
7598
7598
  styleInject(css_248z$4);
7599
7599
 
7600
7600
  const { Link } = antd.Typography;
7601
- const SelectComponent = ({ noItem, showSearch, mode, variant, size, suffixIcon, className, loading, disabled, open, filterOption, placeholder, value, defaultValue, removeError, onChange, onKeyDown, onSearch, onFocus, notFoundContent, tokenSeparators, options, style, addItem, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
7601
+ const SelectComponent = ({ noItem, showSearch, mode, variant, size, suffixIcon, classNames, loading, readOnly, disabled, open, filterOption, placeholder, value, defaultValue, removeError, onChange, onKeyDown, onSearch, onFocus, notFoundContent, tokenSeparators, options, style, addItem, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
7602
7602
  const [addItemValue, setAddItemValue] = React.useState('');
7603
- const classNameSelect = [styleSelect['select']];
7604
- className && classNameSelect.push(...className);
7603
+ const classNameSelect = React.useMemo(() => {
7604
+ const className = [styleSelect['select']];
7605
+ classNames && className.push(...classNames);
7606
+ readOnly && className.push(styleSelect['readonly']);
7607
+ return className;
7608
+ }, [classNames, readOnly]);
7605
7609
  const handleAddItem = (_) => {
7606
7610
  var _a;
7607
7611
  (_a = addItem === null || addItem === void 0 ? void 0 : addItem.onClick) === null || _a === void 0 ? void 0 : _a.call(addItem, addItemValue);
@@ -7613,7 +7617,7 @@ const SelectComponent = ({ noItem, showSearch, mode, variant, size, suffixIcon,
7613
7617
  };
7614
7618
  const popupRender = menu => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [menu, addItem &&
7615
7619
  jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(antd.Divider, { className: styleSelect['add-item-divider'] }), jsxRuntimeExports.jsxs(antd.Space, { align: "center", className: styleSelect['add-item-space'], children: [jsxRuntimeExports.jsx(antd.Input, { placeholder: "Please enter item", value: addItemValue, onChange: event => setAddItemValue(event.target.value) }), jsxRuntimeExports.jsxs(Link, { className: styleSelect['add-item-link'], onClick: handleAddItem, children: [jsxRuntimeExports.jsx(RefIcon$5, {}), " Add item"] })] })] })] }));
7616
- const select = !loading ? (jsxRuntimeExports.jsx(antd.Select, { mode: mode, showSearch: showSearch, variant: variant, allowClear: !required, size: size, suffixIcon: suffixIcon, className: classNameSelect.join(' '), disabled: disabled, open: open, filterOption: filterOption, placeholder: placeholder, value: value, defaultValue: defaultValue, onChange: (value, event) => {
7620
+ const select = !loading ? (jsxRuntimeExports.jsx(antd.Select, { mode: mode, showSearch: showSearch, variant: variant, allowClear: !required, size: size, suffixIcon: suffixIcon, className: classNameSelect.join(' '), disabled: disabled !== null && disabled !== void 0 ? disabled : readOnly, open: open, filterOption: filterOption, placeholder: placeholder, value: value, defaultValue: defaultValue, onChange: (value, event) => {
7617
7621
  removeError === null || removeError === void 0 ? void 0 : removeError(name);
7618
7622
  onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
7619
7623
  }, onKeyDown: onKeyDown, onSearch: onSearch, onFocus: onFocus, notFoundContent: notFoundContent, tokenSeparators: tokenSeparators, options: options === null || options === void 0 ? void 0 : options.filter(option => option.value !== undefined), optionLabelProp: "label", optionRender: optionRender, popupRender: popupRender, style: style })) : jsxRuntimeExports.jsx(antd.Skeleton.Input, { block: true, active: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sti-antd-package",
3
3
  "description": "STI ANT Design",
4
- "version": "0.0.24",
4
+ "version": "0.0.26",
5
5
  "type": "module",
6
6
  "module": "dist/index.esm.js",
7
7
  "types": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "build": "rollup -c",
13
+ "build": "rm -rf dist && rollup -c",
14
14
  "prepare": "npm run build"
15
15
  },
16
16
  "directories": {