@pdg/react-form 1.0.71 → 1.0.72

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.
@@ -74,12 +74,28 @@ export interface FormRangeValueItemNameCommands {
74
74
  getFormValueFromName(): string;
75
75
  getFormValueToName(): string;
76
76
  }
77
+ export interface FormYearMonthValueItemCommands {
78
+ getYear(): number | null;
79
+ setYear(year: number): void;
80
+ getMonth(): number | null;
81
+ setMonth(month: number): void;
82
+ }
77
83
  export interface FormYearMonthValueItemNameCommands {
78
84
  getFormValueYearNameSuffix(): string;
79
85
  getFormValueMonthNameSuffix(): string;
80
86
  getFormValueYearName(): string;
81
87
  getFormValueMonthName(): string;
82
88
  }
89
+ export interface FormYearMonthRangeValueItemCommands {
90
+ getFromYear(): number | null;
91
+ setFromYear(year: number): void;
92
+ getFromMonth(): number | null;
93
+ setFromMonth(month: number): void;
94
+ getToYear(): number | null;
95
+ setToYear(year: number): void;
96
+ getToMonth(): number | null;
97
+ setToMonth(month: number): void;
98
+ }
83
99
  export interface FormYearMonthRangeValueItemNameCommands {
84
100
  getFormValueFromYearNameSuffix(): string;
85
101
  getFormValueFromMonthNameSuffix(): string;
@@ -90,7 +106,7 @@ export interface FormYearMonthRangeValueItemNameCommands {
90
106
  getFormValueToYearName(): string;
91
107
  getFormValueToMonthName(): string;
92
108
  }
93
- export interface FormValueItemCommands<T, AllowUndefinedValue extends boolean = true, ItemType = any> extends FormValueItemBaseCommands<T, AllowUndefinedValue>, Partial<FormArrayValueItemCommands>, Partial<FormItemsValueItemCommands<ItemType>>, Partial<FormCheckValueItemCommands<T>>, Partial<FormMultipleValueItemCommands>, Partial<FormLoadingValueItemCommands>, Partial<FormDateValueItemCommands>, Partial<FormRangeValueItemCommands<T>>, Partial<FormRangeValueItemNameCommands>, Partial<FormYearMonthValueItemNameCommands>, Partial<FormYearMonthRangeValueItemNameCommands> {
109
+ export interface FormValueItemCommands<T, AllowUndefinedValue extends boolean = true, ItemType = any> extends FormValueItemBaseCommands<T, AllowUndefinedValue>, Partial<FormArrayValueItemCommands>, Partial<FormItemsValueItemCommands<ItemType>>, Partial<FormCheckValueItemCommands<T>>, Partial<FormMultipleValueItemCommands>, Partial<FormLoadingValueItemCommands>, Partial<FormDateValueItemCommands>, Partial<FormRangeValueItemCommands<T>>, Partial<FormRangeValueItemNameCommands>, Partial<FormYearMonthValueItemCommands>, Partial<FormYearMonthValueItemNameCommands>, Partial<FormYearMonthRangeValueItemCommands>, Partial<FormYearMonthRangeValueItemNameCommands> {
94
110
  }
95
111
  export interface FormValueItemCommandsMap<T, AllowUndefinedValue extends boolean = true, ItemType = any> {
96
112
  [key: string]: FormValueItemCommands<T, AllowUndefinedValue, ItemType> | undefined;
@@ -1,4 +1,4 @@
1
- import { FormValueItemProps, FormValueItemBaseCommands, FormYearMonthValueItemNameCommands } from '../../@types';
1
+ import { FormValueItemProps, FormValueItemBaseCommands, FormYearMonthValueItemNameCommands, FormYearMonthValueItemCommands } from '../../@types';
2
2
  import { CommonSxProps } from '../../@types';
3
3
  import { ReactNode } from 'react';
4
4
  import { PrivateMonthPickerBaseValue, PrivateMonthPickerValue } from '../../@private';
@@ -24,5 +24,5 @@ export interface FormMonthPickerProps extends CommonSxProps, FormValueItemProps<
24
24
  formValueMonthNameSuffix?: string;
25
25
  }
26
26
  export declare const FormMonthPickerDefaultProps: Required<Pick<FormMonthPickerProps, 'format' | 'formValueYearNameSuffix' | 'formValueMonthNameSuffix' | 'minValue' | 'maxValue'>>;
27
- export interface FormMonthPickerCommands extends FormValueItemBaseCommands<FormMonthPickerValue, false>, FormYearMonthValueItemNameCommands {
27
+ export interface FormMonthPickerCommands extends FormValueItemBaseCommands<FormMonthPickerValue, false>, FormYearMonthValueItemCommands, FormYearMonthValueItemNameCommands {
28
28
  }
@@ -1,4 +1,4 @@
1
- import { FormValueItemProps, FormValueItemBaseCommands, FormRangeValueItemCommands, FormYearMonthRangeValueItemNameCommands } from '../../@types';
1
+ import { FormValueItemProps, FormValueItemBaseCommands, FormRangeValueItemCommands, FormYearMonthRangeValueItemNameCommands, FormYearMonthRangeValueItemCommands } from '../../@types';
2
2
  import { CommonSxProps } from '../../@types';
3
3
  import { ReactNode } from 'react';
4
4
  import { PrivateInputDatePickerProps, PrivateMonthRangePickerBaseValue, PrivateMonthRangePickerValue } from '../../@private';
@@ -32,5 +32,5 @@ export interface FormMonthRangePickerProps extends CommonSxProps, Omit<FormValue
32
32
  formValueToMonthNameSuffix?: string;
33
33
  }
34
34
  export declare const FormMonthRangePickerDefaultProps: Required<Pick<FormMonthRangePickerProps, 'format' | 'minValue' | 'maxValue' | 'formValueFromYearNameSuffix' | 'formValueFromMonthNameSuffix' | 'formValueToYearNameSuffix' | 'formValueToMonthNameSuffix'>>;
35
- export interface FormMonthRangePickerCommands extends FormValueItemBaseCommands<FormMonthRangePickerValue, false>, FormRangeValueItemCommands<FormMonthRangePickerBaseValue>, FormYearMonthRangeValueItemNameCommands {
35
+ export interface FormMonthRangePickerCommands extends FormValueItemBaseCommands<FormMonthRangePickerValue, false>, FormRangeValueItemCommands<FormMonthRangePickerBaseValue>, FormYearMonthRangeValueItemCommands, FormYearMonthRangeValueItemNameCommands {
36
36
  }
package/dist/index.esm.js CHANGED
@@ -14238,6 +14238,18 @@ var FormMonthPicker = React__default.forwardRef(function (_a, ref) {
14238
14238
  lastData = data;
14239
14239
  setData(data);
14240
14240
  },
14241
+ getYear: function () { return (lastValue ? lastValue.year : null); },
14242
+ setYear: function (year) {
14243
+ lastValue = getFinalValue(lastValue
14244
+ ? { year: year, month: lastValue.month }
14245
+ : { year: year, month: year === new Date().getFullYear() ? new Date().getMonth() + 1 : 1 });
14246
+ setValue(lastValue);
14247
+ },
14248
+ getMonth: function () { return (lastValue ? lastValue.month : null); },
14249
+ setMonth: function (month) {
14250
+ lastValue = getFinalValue(lastValue ? { year: lastValue.year, month: month } : { year: new Date().getFullYear(), month: month });
14251
+ setValue(lastValue);
14252
+ },
14241
14253
  isExceptValue: function () { return !!exceptValue; },
14242
14254
  isDisabled: function () { return lastDisabled; },
14243
14255
  setDisabled: function (disabled) {
@@ -14608,6 +14620,42 @@ var FormMonthRangePicker = React__default.forwardRef(function (_a, ref) {
14608
14620
  lastValue = [lastValue[0], value];
14609
14621
  setValue(lastValue);
14610
14622
  },
14623
+ getFromYear: function () { return (lastValue[0] ? lastValue[0].year : null); },
14624
+ setFromYear: function (year) {
14625
+ lastValue = getFinalValue([
14626
+ lastValue[0]
14627
+ ? { year: year, month: lastValue[0].month }
14628
+ : { year: year, month: year === new Date().getFullYear() ? new Date().getMonth() + 1 : 1 },
14629
+ lastValue[1],
14630
+ ]);
14631
+ setValue(lastValue);
14632
+ },
14633
+ getFromMonth: function () { return (lastValue[0] ? lastValue[0].month : null); },
14634
+ setFromMonth: function (month) {
14635
+ lastValue = getFinalValue([
14636
+ lastValue[0] ? { year: lastValue[0].year, month: month } : { year: new Date().getFullYear(), month: month },
14637
+ lastValue[1],
14638
+ ]);
14639
+ setValue(lastValue);
14640
+ },
14641
+ getToYear: function () { return (lastValue[1] ? lastValue[1].year : null); },
14642
+ setToYear: function (year) {
14643
+ lastValue = getFinalValue([
14644
+ lastValue[0],
14645
+ lastValue[1]
14646
+ ? { year: year, month: lastValue[1].month }
14647
+ : { year: year, month: year === new Date().getFullYear() ? new Date().getMonth() + 1 : 1 },
14648
+ ]);
14649
+ setValue(lastValue);
14650
+ },
14651
+ getToMonth: function () { return (lastValue[1] ? lastValue[1].month : null); },
14652
+ setToMonth: function (month) {
14653
+ lastValue = getFinalValue([
14654
+ lastValue[0],
14655
+ lastValue[1] ? { year: lastValue[1].year, month: month } : { year: new Date().getFullYear(), month: month },
14656
+ ]);
14657
+ setValue(lastValue);
14658
+ },
14611
14659
  isExceptValue: function () { return !!exceptValue; },
14612
14660
  isDisabled: function () { return lastDisabled; },
14613
14661
  setDisabled: function (disabled) {