@cloud-ru/uikit-product-calculator 1.6.1 → 1.7.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 1.7.0 (2026-05-07)
7
+
8
+
9
+ ### Features
10
+
11
+ * **SITE-11087:** update calc notebooks ([3709f40](https://github.com/cloud-ru-tech/uikit-product/commit/3709f40bb7aeb272e45b92fd8968ab7e51ee562c))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 1.6.1 (2026-04-30)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -77,18 +77,23 @@ exports.EVOLUTION_NOTEBOOKS_CONFIG = {
77
77
  type: components_1.CONTROL.Stepper,
78
78
  accessorKey: 'workingHours',
79
79
  defaultValue: 1,
80
- uiProps: { min: 1 },
81
- decoratorProps: { label: 'Время работы' },
82
- watchedControls: { period: 'workingHoursSpecification' },
83
- relateFn: ({ period }) => {
80
+ uiProps: { min: 1, max: 1, postfix: 'час' },
81
+ decoratorProps: { label: 'Время работы за период' },
82
+ watchedControls: { period: 'workingHoursSpecification', workingHours: 'workingHours' },
83
+ relateFn: ({ period, workingHours }) => {
84
84
  const maxWorkingAmount = (0, utils_1.getMaxWorkingHoursAmount)(period, {
85
- hour: 24,
86
- day: 31,
87
- month: 12,
85
+ hour: 1,
86
+ day: 24,
87
+ month: 720,
88
88
  });
89
+ const isStepperDisabled = maxWorkingAmount === 1;
89
90
  return {
90
91
  uiProps: {
92
+ min: 1,
91
93
  max: maxWorkingAmount,
94
+ showHint: !isStepperDisabled,
95
+ disabled: isStepperDisabled,
96
+ postfix: (0, utils_1.getNumeralWord)(workingHours, ['час', 'часа', 'часов']),
92
97
  },
93
98
  };
94
99
  },
@@ -97,13 +102,9 @@ exports.EVOLUTION_NOTEBOOKS_CONFIG = {
97
102
  type: components_1.CONTROL.SelectSingle,
98
103
  accessorKey: 'workingHoursSpecification',
99
104
  defaultValue: constants_1.WorkingHoursSpecification.Hour,
100
- items: constants_1.WORKING_HOURS_ITEMS,
105
+ items: constants_1.WORKING_HOURS_PER_PERIOD_ITEMS,
101
106
  uiProps: { showClearButton: false, searchable: false },
102
107
  decoratorProps: { label: 'Период' },
103
- onChangePeriod: (period, setValue) => {
104
- setValue([['workingHoursSpecification', period]]);
105
- },
106
- canChangeWholePricePeriod: true,
107
108
  },
108
109
  },
109
110
  };
@@ -1,6 +1,6 @@
1
1
  import { CONTROL } from '../../../../components';
2
- import { WORKING_HOURS_ITEMS, WorkingHoursSpecification } from '../../../../constants';
3
- import { DEFAULT_NOTEBOOKS_CONFIG_VALUE, getDefaultNotebooksConfigParams, getMaxWorkingHoursAmount, getNotebookConfigParamsByInstance, } from '../../../utils';
2
+ import { WORKING_HOURS_PER_PERIOD_ITEMS, WorkingHoursSpecification } from '../../../../constants';
3
+ import { DEFAULT_NOTEBOOKS_CONFIG_VALUE, getDefaultNotebooksConfigParams, getMaxWorkingHoursAmount, getNotebookConfigParamsByInstance, getNumeralWord, } from '../../../utils';
4
4
  const DEFAULT_CONFIG_PARAMS = getDefaultNotebooksConfigParams();
5
5
  const configItems = [
6
6
  { value: 'ncpu.medium.4', label: '1 vCPU, 4 ГБ RAM' },
@@ -74,18 +74,23 @@ export const EVOLUTION_NOTEBOOKS_CONFIG = {
74
74
  type: CONTROL.Stepper,
75
75
  accessorKey: 'workingHours',
76
76
  defaultValue: 1,
77
- uiProps: { min: 1 },
78
- decoratorProps: { label: 'Время работы' },
79
- watchedControls: { period: 'workingHoursSpecification' },
80
- relateFn: ({ period }) => {
77
+ uiProps: { min: 1, max: 1, postfix: 'час' },
78
+ decoratorProps: { label: 'Время работы за период' },
79
+ watchedControls: { period: 'workingHoursSpecification', workingHours: 'workingHours' },
80
+ relateFn: ({ period, workingHours }) => {
81
81
  const maxWorkingAmount = getMaxWorkingHoursAmount(period, {
82
- hour: 24,
83
- day: 31,
84
- month: 12,
82
+ hour: 1,
83
+ day: 24,
84
+ month: 720,
85
85
  });
86
+ const isStepperDisabled = maxWorkingAmount === 1;
86
87
  return {
87
88
  uiProps: {
89
+ min: 1,
88
90
  max: maxWorkingAmount,
91
+ showHint: !isStepperDisabled,
92
+ disabled: isStepperDisabled,
93
+ postfix: getNumeralWord(workingHours, ['час', 'часа', 'часов']),
89
94
  },
90
95
  };
91
96
  },
@@ -94,13 +99,9 @@ export const EVOLUTION_NOTEBOOKS_CONFIG = {
94
99
  type: CONTROL.SelectSingle,
95
100
  accessorKey: 'workingHoursSpecification',
96
101
  defaultValue: WorkingHoursSpecification.Hour,
97
- items: WORKING_HOURS_ITEMS,
102
+ items: WORKING_HOURS_PER_PERIOD_ITEMS,
98
103
  uiProps: { showClearButton: false, searchable: false },
99
104
  decoratorProps: { label: 'Период' },
100
- onChangePeriod: (period, setValue) => {
101
- setValue([['workingHoursSpecification', period]]);
102
- },
103
- canChangeWholePricePeriod: true,
104
105
  },
105
106
  },
106
107
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-calculator",
3
3
  "title": "Calculator",
4
- "version": "1.6.1",
4
+ "version": "1.7.0",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -71,5 +71,5 @@
71
71
  "devDependencies": {
72
72
  "@types/lodash": "4.17.13"
73
73
  },
74
- "gitHead": "46f40e7ec89f4173d660983a5f0368937d45bf9d"
74
+ "gitHead": "389dde91f58f699641258e4ec600443313bf2988"
75
75
  }
@@ -1,10 +1,11 @@
1
1
  import { CONTROL, FormConfig } from '../../../../components';
2
- import { WORKING_HOURS_ITEMS, WorkingHoursSpecification } from '../../../../constants';
2
+ import { WORKING_HOURS_PER_PERIOD_ITEMS, WorkingHoursSpecification } from '../../../../constants';
3
3
  import {
4
4
  DEFAULT_NOTEBOOKS_CONFIG_VALUE,
5
5
  getDefaultNotebooksConfigParams,
6
6
  getMaxWorkingHoursAmount,
7
7
  getNotebookConfigParamsByInstance,
8
+ getNumeralWord,
8
9
  } from '../../../utils';
9
10
 
10
11
  const DEFAULT_CONFIG_PARAMS = getDefaultNotebooksConfigParams();
@@ -85,19 +86,24 @@ export const EVOLUTION_NOTEBOOKS_CONFIG: FormConfig = {
85
86
  type: CONTROL.Stepper,
86
87
  accessorKey: 'workingHours',
87
88
  defaultValue: 1,
88
- uiProps: { min: 1 },
89
- decoratorProps: { label: 'Время работы' },
90
- watchedControls: { period: 'workingHoursSpecification' },
91
- relateFn: ({ period }) => {
89
+ uiProps: { min: 1, max: 1, postfix: 'час' },
90
+ decoratorProps: { label: 'Время работы за период' },
91
+ watchedControls: { period: 'workingHoursSpecification', workingHours: 'workingHours' },
92
+ relateFn: ({ period, workingHours }) => {
92
93
  const maxWorkingAmount = getMaxWorkingHoursAmount(period, {
93
- hour: 24,
94
- day: 31,
95
- month: 12,
94
+ hour: 1,
95
+ day: 24,
96
+ month: 720,
96
97
  });
98
+ const isStepperDisabled = maxWorkingAmount === 1;
97
99
 
98
100
  return {
99
101
  uiProps: {
102
+ min: 1,
100
103
  max: maxWorkingAmount,
104
+ showHint: !isStepperDisabled,
105
+ disabled: isStepperDisabled,
106
+ postfix: getNumeralWord(workingHours, ['час', 'часа', 'часов']),
101
107
  },
102
108
  };
103
109
  },
@@ -106,13 +112,9 @@ export const EVOLUTION_NOTEBOOKS_CONFIG: FormConfig = {
106
112
  type: CONTROL.SelectSingle,
107
113
  accessorKey: 'workingHoursSpecification',
108
114
  defaultValue: WorkingHoursSpecification.Hour,
109
- items: WORKING_HOURS_ITEMS,
115
+ items: WORKING_HOURS_PER_PERIOD_ITEMS,
110
116
  uiProps: { showClearButton: false, searchable: false },
111
117
  decoratorProps: { label: 'Период' },
112
- onChangePeriod: (period, setValue) => {
113
- setValue([['workingHoursSpecification', period]]);
114
- },
115
- canChangeWholePricePeriod: true,
116
118
  },
117
119
  },
118
120
  };