@gravity-ui/dynamic-forms 5.23.1 → 5.25.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.
Files changed (142) hide show
  1. package/build/cjs/lib/kit/i18n/en.json +34 -0
  2. package/build/cjs/lib/kit/i18n/ru.json +34 -0
  3. package/build/cjs/lib/unstable/core/SchemaRendererNode/SchemaRendererNode.js +25 -19
  4. package/build/cjs/lib/unstable/core/SchemaRendererNode/utils.d.ts +3 -0
  5. package/build/cjs/lib/unstable/core/SchemaRendererNode/utils.js +25 -1
  6. package/build/cjs/lib/unstable/core/types/components.d.ts +3 -13
  7. package/build/cjs/lib/unstable/core/types/schema.d.ts +14 -7
  8. package/build/cjs/lib/unstable/core/types/validation.d.ts +1 -1
  9. package/build/cjs/lib/unstable/core/useSchemaRenderer/types/state.d.ts +3 -0
  10. package/build/cjs/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +1 -1
  11. package/build/cjs/lib/unstable/core/utils/definers.d.ts +27 -13
  12. package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +2 -1
  13. package/build/cjs/lib/unstable/kit/components/HTMLContent/HTMLContent.js +12 -2
  14. package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +3 -0
  15. package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.d.ts +1 -0
  16. package/build/cjs/lib/unstable/kit/components/LayoutContainer/LayoutContainer.js +2 -2
  17. package/build/cjs/lib/unstable/kit/constants/index.d.ts +1 -0
  18. package/build/cjs/lib/unstable/kit/constants/index.js +3 -1
  19. package/build/cjs/lib/unstable/kit/constants/messages.d.ts +2 -0
  20. package/build/cjs/lib/unstable/kit/constants/messages.js +89 -0
  21. package/build/cjs/lib/unstable/kit/entities/Alert/Alert.css +16 -0
  22. package/build/cjs/lib/unstable/kit/entities/Alert/Alert.js +26 -7
  23. package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.d.ts +0 -1
  24. package/build/cjs/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +4 -2
  25. package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.d.ts +0 -1
  26. package/build/cjs/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +7 -5
  27. package/build/cjs/lib/unstable/kit/entities/FewOfNested/FewOfNested.css +3 -0
  28. package/build/cjs/lib/unstable/kit/entities/Label/Label.js +4 -4
  29. package/build/cjs/lib/unstable/kit/entities/Monaco/Monaco.js +3 -1
  30. package/build/cjs/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +0 -1
  31. package/build/cjs/lib/unstable/kit/entities/ObjectInline/ObjectInline.d.ts +0 -1
  32. package/build/cjs/lib/unstable/kit/entities/OneOfNested/OneOfNested.css +3 -0
  33. package/build/cjs/lib/unstable/kit/entities/TextContent/TextContent.js +4 -4
  34. package/build/cjs/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.d.ts +0 -1
  35. package/build/cjs/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.js +3 -1
  36. package/build/cjs/lib/unstable/kit/form-entities/CheckboxInput/CheckboxInput.js +3 -1
  37. package/build/cjs/lib/unstable/kit/form-entities/ColorPickerInput/ColorPickerInput.js +3 -1
  38. package/build/cjs/lib/unstable/kit/form-entities/DateInput/DateInput.js +3 -2
  39. package/build/cjs/lib/unstable/kit/form-entities/FileInput/FileInput.js +3 -1
  40. package/build/cjs/lib/unstable/kit/form-entities/MultiSelectInput/MultiSelectInput.js +4 -2
  41. package/build/cjs/lib/unstable/kit/form-entities/NumberInput/NumberInput.js +3 -2
  42. package/build/cjs/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +3 -2
  43. package/build/cjs/lib/unstable/kit/form-entities/PasswordInput/PasswordInput.js +3 -2
  44. package/build/cjs/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +3 -1
  45. package/build/cjs/lib/unstable/kit/form-entities/RangeSliderInput/RangeSliderInput.js +9 -8
  46. package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +4 -0
  47. package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.d.ts +1 -1
  48. package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +30 -3
  49. package/build/cjs/lib/unstable/kit/form-entities/SelectInput/SelectInput.d.ts +1 -2
  50. package/build/cjs/lib/unstable/kit/form-entities/SelectInput/SelectInput.js +4 -2
  51. package/build/cjs/lib/unstable/kit/form-entities/SliderInput/SliderInput.js +3 -1
  52. package/build/cjs/lib/unstable/kit/form-entities/StringInput/StringInput.js +3 -2
  53. package/build/cjs/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +4 -3
  54. package/build/cjs/lib/unstable/kit/form-entities/SwitchInput/SwitchInput.js +3 -1
  55. package/build/cjs/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +3 -2
  56. package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +8 -6
  57. package/build/cjs/lib/unstable/kit/form-layouts/FormRow/FormRow.css +3 -0
  58. package/build/cjs/lib/unstable/kit/form-layouts/FormRow/FormRow.js +8 -6
  59. package/build/cjs/lib/unstable/kit/index.d.ts +1 -0
  60. package/build/cjs/lib/unstable/kit/index.js +1 -0
  61. package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.js +33 -29
  62. package/build/cjs/lib/unstable/kit/layouts/Card/Card.js +8 -6
  63. package/build/cjs/lib/unstable/kit/layouts/Section/Section.js +8 -6
  64. package/build/cjs/lib/unstable/kit/layouts/Transparent/Transparent.js +5 -3
  65. package/build/cjs/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +7 -5
  66. package/build/cjs/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +7 -5
  67. package/build/cjs/lib/unstable/kit/utils/index.d.ts +1 -1
  68. package/build/cjs/lib/unstable/kit/utils/index.js +1 -7
  69. package/build/cjs/lib/unstable/kit/utils/transformer.d.ts +10 -17
  70. package/build/cjs/lib/unstable/kit/utils/transformer.js +543 -2773
  71. package/build/esm/lib/kit/i18n/en.json +34 -0
  72. package/build/esm/lib/kit/i18n/ru.json +34 -0
  73. package/build/esm/lib/unstable/core/SchemaRendererNode/SchemaRendererNode.js +26 -20
  74. package/build/esm/lib/unstable/core/SchemaRendererNode/utils.d.ts +3 -0
  75. package/build/esm/lib/unstable/core/SchemaRendererNode/utils.js +22 -0
  76. package/build/esm/lib/unstable/core/types/components.d.ts +3 -13
  77. package/build/esm/lib/unstable/core/types/schema.d.ts +14 -7
  78. package/build/esm/lib/unstable/core/types/validation.d.ts +1 -1
  79. package/build/esm/lib/unstable/core/useSchemaRenderer/types/state.d.ts +3 -0
  80. package/build/esm/lib/unstable/core/useSchemaRenderer/useSchemaRenderer.js +1 -1
  81. package/build/esm/lib/unstable/core/utils/definers.d.ts +27 -13
  82. package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.d.ts +2 -1
  83. package/build/esm/lib/unstable/kit/components/HTMLContent/HTMLContent.js +12 -2
  84. package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.css +3 -0
  85. package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.d.ts +1 -0
  86. package/build/esm/lib/unstable/kit/components/LayoutContainer/LayoutContainer.js +2 -2
  87. package/build/esm/lib/unstable/kit/constants/index.d.ts +1 -0
  88. package/build/esm/lib/unstable/kit/constants/index.js +1 -0
  89. package/build/esm/lib/unstable/kit/constants/messages.d.ts +2 -0
  90. package/build/esm/lib/unstable/kit/constants/messages.js +85 -0
  91. package/build/esm/lib/unstable/kit/entities/Alert/Alert.css +16 -0
  92. package/build/esm/lib/unstable/kit/entities/Alert/Alert.d.ts +1 -0
  93. package/build/esm/lib/unstable/kit/entities/Alert/Alert.js +29 -9
  94. package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.d.ts +0 -1
  95. package/build/esm/lib/unstable/kit/entities/ArrayEntity/ArrayEntity.js +4 -2
  96. package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.d.ts +0 -1
  97. package/build/esm/lib/unstable/kit/entities/ArrayTable/ArrayTable.js +7 -5
  98. package/build/esm/lib/unstable/kit/entities/FewOfNested/FewOfNested.css +3 -0
  99. package/build/esm/lib/unstable/kit/entities/Label/Label.js +5 -5
  100. package/build/esm/lib/unstable/kit/entities/Monaco/Monaco.js +3 -1
  101. package/build/esm/lib/unstable/kit/entities/ObjectEntity/ObjectEntity.d.ts +0 -1
  102. package/build/esm/lib/unstable/kit/entities/ObjectInline/ObjectInline.d.ts +0 -1
  103. package/build/esm/lib/unstable/kit/entities/OneOfNested/OneOfNested.css +3 -0
  104. package/build/esm/lib/unstable/kit/entities/TextContent/TextContent.js +5 -5
  105. package/build/esm/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.d.ts +0 -1
  106. package/build/esm/lib/unstable/kit/form-entities/CheckboxGroupInput/CheckboxGroupInput.js +3 -1
  107. package/build/esm/lib/unstable/kit/form-entities/CheckboxInput/CheckboxInput.js +3 -1
  108. package/build/esm/lib/unstable/kit/form-entities/ColorPickerInput/ColorPickerInput.js +3 -1
  109. package/build/esm/lib/unstable/kit/form-entities/DateInput/DateInput.js +3 -2
  110. package/build/esm/lib/unstable/kit/form-entities/FileInput/FileInput.js +3 -1
  111. package/build/esm/lib/unstable/kit/form-entities/MultiSelectInput/MultiSelectInput.js +4 -2
  112. package/build/esm/lib/unstable/kit/form-entities/NumberInput/NumberInput.js +3 -2
  113. package/build/esm/lib/unstable/kit/form-entities/NumberWithScaleInput/NumberWithScaleInput.js +3 -2
  114. package/build/esm/lib/unstable/kit/form-entities/PasswordInput/PasswordInput.js +3 -2
  115. package/build/esm/lib/unstable/kit/form-entities/RadioGroupInput/RadioGroupInput.js +3 -1
  116. package/build/esm/lib/unstable/kit/form-entities/RangeSliderInput/RangeSliderInput.js +9 -8
  117. package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +4 -0
  118. package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.d.ts +1 -1
  119. package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +30 -3
  120. package/build/esm/lib/unstable/kit/form-entities/SelectInput/SelectInput.d.ts +1 -2
  121. package/build/esm/lib/unstable/kit/form-entities/SelectInput/SelectInput.js +4 -2
  122. package/build/esm/lib/unstable/kit/form-entities/SliderInput/SliderInput.js +3 -1
  123. package/build/esm/lib/unstable/kit/form-entities/StringInput/StringInput.js +3 -2
  124. package/build/esm/lib/unstable/kit/form-entities/StringNumberWithScaleInput/StringNumberWithScaleInput.js +4 -3
  125. package/build/esm/lib/unstable/kit/form-entities/SwitchInput/SwitchInput.js +3 -1
  126. package/build/esm/lib/unstable/kit/form-entities/TextAreaInput/TextAreaInput.js +3 -2
  127. package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +8 -6
  128. package/build/esm/lib/unstable/kit/form-layouts/FormRow/FormRow.css +3 -0
  129. package/build/esm/lib/unstable/kit/form-layouts/FormRow/FormRow.js +8 -6
  130. package/build/esm/lib/unstable/kit/index.d.ts +1 -0
  131. package/build/esm/lib/unstable/kit/index.js +1 -0
  132. package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.js +33 -29
  133. package/build/esm/lib/unstable/kit/layouts/Card/Card.js +8 -6
  134. package/build/esm/lib/unstable/kit/layouts/Section/Section.js +8 -6
  135. package/build/esm/lib/unstable/kit/layouts/Transparent/Transparent.js +5 -3
  136. package/build/esm/lib/unstable/kit/overview-layouts/OverviewColumn/OverviewColumn.js +7 -5
  137. package/build/esm/lib/unstable/kit/overview-layouts/OverviewRow/OverviewRow.js +7 -5
  138. package/build/esm/lib/unstable/kit/utils/index.d.ts +1 -1
  139. package/build/esm/lib/unstable/kit/utils/index.js +1 -1
  140. package/build/esm/lib/unstable/kit/utils/transformer.d.ts +10 -17
  141. package/build/esm/lib/unstable/kit/utils/transformer.js +544 -2773
  142. package/package.json +1 -1
@@ -35,6 +35,40 @@
35
35
  "Value can't be longer than {{count}} items",
36
36
  "Value can't be longer than {{count}} items"
37
37
  ],
38
+ "label-sr_error-additional-items": "Maximum allowed number of items is {{count}}",
39
+ "label-sr_error-additional-properties": "Maximum allowed number of properties is {{count}}",
40
+ "label-sr_error-any-of": "Incorrect value in field",
41
+ "label-sr_error-const": "Value must be {{expected}}",
42
+ "label-sr_error-contains": "At least one item must be added",
43
+ "label-sr_error-contains-min": "At least one item matching the condition must be added",
44
+ "label-sr_error-dependencies": "Field \"{{property}}\" is required",
45
+ "label-sr_error-enum": "Value {{value}} cannot be used",
46
+ "label-sr_error-exclusive-maximum": "Value must be less than {{count}}",
47
+ "label-sr_error-exclusive-minimum": "Value must be greater than {{count}}",
48
+ "label-sr_error-max-items": "Maximum allowed number of items is {{count}}",
49
+ "label-sr_error-max-length": "Maximum allowed number of characters is {{count}}",
50
+ "label-sr_error-max-properties": "Maximum allowed number of properties is {{count}}",
51
+ "label-sr_error-maximum": "Value must be less than or equal to {{count}}",
52
+ "label-sr_error-min-items": "Minimum allowed number of items is {{count}}",
53
+ "label-sr_error-min-length": "Minimum allowed number of characters is {{count}}",
54
+ "label-sr_error-min-properties": "Minimum allowed number of properties is {{count}}",
55
+ "label-sr_error-minimum": "Value must be greater than or equal to {{count}}",
56
+ "label-sr_error-multiple-of": "Value must be a multiple of {{count}}",
57
+ "label-sr_error-not": "Value cannot be used",
58
+ "label-sr_error-one-of": "Incorrect value in field",
59
+ "label-sr_error-pattern": "Value must match the pattern - {{pattern}}",
60
+ "label-sr_error-property-names": "Invalid property name \"{{property}}\"",
61
+ "label-sr_error-required": "Empty field",
62
+ "label-sr_error-type": "Value must be {{expected}}",
63
+ "label-sr_error-type-or": " or {{type}}",
64
+ "label-sr_error-unique-items": "Values must be unique",
65
+ "label-sr_type-array": "an array",
66
+ "label-sr_type-boolean": "a boolean",
67
+ "label-sr_type-integer": "an integer",
68
+ "label-sr_type-null": "null",
69
+ "label-sr_type-number": "a number",
70
+ "label-sr_type-object": "an object",
71
+ "label-sr_type-string": "a string",
38
72
  "label_error-min-number": "Value must be an integer no less than {{count}}",
39
73
  "label_error-max-number": "Value must not be greater than {{count}}",
40
74
  "label_error-min-number-with-scale": "Value must be no less than {{count}} {{scale}}",
@@ -35,6 +35,40 @@
35
35
  "Значение не может быть длиннее {{count}} элементов",
36
36
  "Значение не может быть длиннее {{count}} элементов"
37
37
  ],
38
+ "label-sr_error-additional-items": "Максимальное допустимое количество элементов: {{count}}",
39
+ "label-sr_error-additional-properties": "Максимальное допустимое количество свойств: {{count}}",
40
+ "label-sr_error-any-of": "Поле заполнено неправильно",
41
+ "label-sr_error-const": "Значение должно быть равно {{expected}}",
42
+ "label-sr_error-contains": "Необходимо добавить хотя бы один элемент",
43
+ "label-sr_error-contains-min": "Необходимо добавить хотя бы один элемент, удовлетворяющий условию",
44
+ "label-sr_error-dependencies": "Необходимо заполнить поле \"{{property}}\"",
45
+ "label-sr_error-enum": "Значение {{value}} не допустимо к использованию",
46
+ "label-sr_error-exclusive-maximum": "Значение должно быть меньше {{count}}",
47
+ "label-sr_error-exclusive-minimum": "Значение должно быть больше {{count}}",
48
+ "label-sr_error-max-items": "Максимальное допустимое количество элементов: {{count}}",
49
+ "label-sr_error-max-length": "Максимальное допустимое количество символов: {{count}}",
50
+ "label-sr_error-max-properties": "Максимальное допустимое количество свойств: {{count}}",
51
+ "label-sr_error-maximum": "Значение должно быть меньше или равно {{count}}",
52
+ "label-sr_error-min-items": "Минимальное допустимое количество элементов: {{count}}",
53
+ "label-sr_error-min-length": "Минимальное допустимое количество символов: {{count}}",
54
+ "label-sr_error-min-properties": "Минимальное допустимое количество свойств: {{count}}",
55
+ "label-sr_error-minimum": "Значение должно быть больше или равно {{count}}",
56
+ "label-sr_error-multiple-of": "Значение должно быть кратно {{count}}",
57
+ "label-sr_error-not": "Значение не допустимо к использованию",
58
+ "label-sr_error-one-of": "Поле заполнено неправильно",
59
+ "label-sr_error-pattern": "Значение должно удовлетворять шаблону - {{pattern}}",
60
+ "label-sr_error-property-names": "Недопустимое имя свойства \"{{property}}\"",
61
+ "label-sr_error-required": "Поле не заполнено",
62
+ "label-sr_error-type": "Значение должно быть {{expected}}",
63
+ "label-sr_error-type-or": " или {{type}}",
64
+ "label-sr_error-unique-items": "Значения должны быть уникальными",
65
+ "label-sr_type-array": "массивом",
66
+ "label-sr_type-boolean": "булевым значением",
67
+ "label-sr_type-integer": "целым числом",
68
+ "label-sr_type-null": "null",
69
+ "label-sr_type-number": "числом",
70
+ "label-sr_type-object": "объектом",
71
+ "label-sr_type-string": "строкой",
38
72
  "label_error-min-number": "Значение должно быть числом не меньше {{count}}",
39
73
  "label_error-max-number": "Значение должно быть числом не больше {{count}}",
40
74
  "label_error-min-number-with-scale": "Значение должно быть не меньше {{count}} {{scale}}",
@@ -13,8 +13,7 @@ const utils_2 = require("./utils");
13
13
  const SchemaRendererNodeComponent = ({ headName, modeOverride, name, schemaOverride, schemaPath, }) => {
14
14
  var _a;
15
15
  const form = (0, react_final_form_1.useForm)();
16
- const firstRenderRef = react_1.default.useRef(true);
17
- const pendingTicksRef = react_1.default.useRef({ input: 0, meta: 0 });
16
+ const compareValuesRef = react_1.default.useRef((0, utils_2.getCompareValues)());
18
17
  const fieldRef = react_1.default.useRef(null);
19
18
  const unsubscribeRef = react_1.default.useRef(null);
20
19
  const [ticks, setTicks] = react_1.default.useState({ input: 0, meta: 0 });
@@ -39,6 +38,17 @@ const SchemaRendererNodeComponent = ({ headName, modeOverride, name, schemaOverr
39
38
  const kit = react_1.default.useMemo(() => (0, utils_2.getRenderKit)({ config: srState === null || srState === void 0 ? void 0 : srState.config, schema }), [schema, srState === null || srState === void 0 ? void 0 : srState.config]);
40
39
  react_1.default.useMemo(() => {
41
40
  var _a;
41
+ if (compareValuesRef.current({
42
+ form,
43
+ jsonDefaultValues,
44
+ headName,
45
+ name,
46
+ default: schema === null || schema === void 0 ? void 0 : schema.default,
47
+ type: schema === null || schema === void 0 ? void 0 : schema.type,
48
+ schemaPath,
49
+ })) {
50
+ return;
51
+ }
42
52
  (_a = unsubscribeRef.current) === null || _a === void 0 ? void 0 : _a.call(unsubscribeRef);
43
53
  const initialState = { schemaPath };
44
54
  let defaultValue = schema === null || schema === void 0 ? void 0 : schema.default;
@@ -48,7 +58,7 @@ const SchemaRendererNodeComponent = ({ headName, modeOverride, name, schemaOverr
48
58
  }
49
59
  catch (_b) { }
50
60
  }
51
- unsubscribeRef.current = form.registerField(name, (f) => {
61
+ const unsubscribe = form.registerField(name, (f) => {
52
62
  const prevF = fieldRef.current;
53
63
  if (prevF) {
54
64
  let inputTick = 0;
@@ -62,23 +72,26 @@ const SchemaRendererNodeComponent = ({ headName, modeOverride, name, schemaOverr
62
72
  metaTick = 1;
63
73
  }
64
74
  if (inputTick + metaTick) {
65
- if (firstRenderRef.current) {
66
- pendingTicksRef.current = { input: inputTick, meta: metaTick };
67
- }
68
- else {
69
- setTicks((t) => ({
70
- input: t.input + inputTick,
71
- meta: t.meta + metaTick,
72
- }));
73
- }
75
+ setTicks((t) => ({
76
+ input: t.input + inputTick,
77
+ meta: t.meta + metaTick,
78
+ }));
74
79
  }
75
80
  }
76
81
  fieldRef.current = f;
77
82
  }, { submitFailed: true, touched: true, validating: true, value: true }, {
78
83
  data: { state: initialState },
79
84
  defaultValue,
85
+ silent: true,
80
86
  validateFields: [(0, utils_1.getServiceFieldName)(useSchemaRenderer_1.SCHEMA_RENDERER_SERVICE_FIELD, headName)],
81
87
  });
88
+ if (defaultValue !== undefined) {
89
+ (0, utils_2.scheduleFlush)(form);
90
+ }
91
+ unsubscribeRef.current = () => {
92
+ unsubscribe();
93
+ (0, utils_2.scheduleFlush)(form);
94
+ };
82
95
  }, [form, jsonDefaultValues, headName, name, schema === null || schema === void 0 ? void 0 : schema.default, schema === null || schema === void 0 ? void 0 : schema.type, schemaPath]);
83
96
  const input = react_1.default.useMemo(() => {
84
97
  var _a;
@@ -103,13 +116,6 @@ const SchemaRendererNodeComponent = ({ headName, modeOverride, name, schemaOverr
103
116
  };
104
117
  }, [error, form, name, ticks.meta]);
105
118
  react_1.default.useEffect(() => {
106
- firstRenderRef.current = false;
107
- if (pendingTicksRef.current.input || pendingTicksRef.current.meta) {
108
- setTicks((t) => ({
109
- input: t.input + pendingTicksRef.current.input,
110
- meta: t.meta + pendingTicksRef.current.meta,
111
- }));
112
- }
113
119
  return () => {
114
120
  var _a;
115
121
  (_a = unsubscribeRef.current) === null || _a === void 0 ? void 0 : _a.call(unsubscribeRef);
@@ -1,3 +1,4 @@
1
+ import type { FormApi } from 'final-form';
1
2
  import { SchemaRendererMode } from '../constants';
2
3
  import type { JsonSchema, NodeEntity, NodeLayout, NodesConfig } from '../types';
3
4
  type GetRenderKitParams<Schema extends JsonSchema> = {
@@ -22,4 +23,6 @@ type GetRenderKitReturn<Schema extends JsonSchema> = {
22
23
  };
23
24
  export declare const getRenderKit: <Schema extends JsonSchema>({ config, schema, }: GetRenderKitParams<Schema>) => GetRenderKitReturn<Schema>;
24
25
  export declare const getAccumulatedSchema: (schemaPath: string, rootSchema?: JsonSchema, override?: JsonSchema, collectedPaths?: Set<string>) => JsonSchema;
26
+ export declare const scheduleFlush: (form: FormApi) => void;
27
+ export declare const getCompareValues: () => (currentValues: Record<string, unknown>) => boolean;
25
28
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccumulatedSchema = exports.getRenderKit = void 0;
3
+ exports.getCompareValues = exports.scheduleFlush = exports.getAccumulatedSchema = exports.getRenderKit = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const get_1 = tslib_1.__importDefault(require("lodash/get"));
6
6
  const isString_1 = tslib_1.__importDefault(require("lodash/isString"));
@@ -160,3 +160,27 @@ const getAccumulatedSchema = (schemaPath, rootSchema, override, collectedPaths =
160
160
  return accumulatedSchema;
161
161
  };
162
162
  exports.getAccumulatedSchema = getAccumulatedSchema;
163
+ const flushes = new WeakMap();
164
+ const scheduleFlush = (form) => {
165
+ if (flushes.get(form)) {
166
+ return;
167
+ }
168
+ flushes.set(form, true);
169
+ queueMicrotask(() => {
170
+ flushes.delete(form);
171
+ form.batch(() => { });
172
+ });
173
+ };
174
+ exports.scheduleFlush = scheduleFlush;
175
+ const getCompareValues = () => {
176
+ let cachedValues;
177
+ return (currentValues) => {
178
+ if (!cachedValues ||
179
+ [...Object.keys(cachedValues), ...Object.keys(currentValues)].some((key) => cachedValues[key] !== currentValues[key])) {
180
+ cachedValues = Object.assign({}, currentValues);
181
+ return false;
182
+ }
183
+ return true;
184
+ };
185
+ };
186
+ exports.getCompareValues = getCompareValues;
@@ -3,31 +3,21 @@ import type { FieldRenderProps } from 'react-final-form';
3
3
  import type { SchemaRendererMode } from '../constants';
4
4
  import type { SchemaToValueType } from './helpers';
5
5
  import type { JsonSchema } from './schema';
6
- export interface DefaultNodeLayoutProps {
7
- copy?: boolean;
8
- hidden?: boolean;
9
- open?: boolean;
10
- required?: boolean;
11
- }
12
6
  export interface NodeLayoutProps<Schema extends JsonSchema, Props extends Record<string, any> = {}, Value extends SchemaToValueType<Schema> = SchemaToValueType<Schema>> extends FieldRenderProps<Value | null | undefined> {
13
7
  children: React.ReactNode;
14
8
  headName: string;
15
9
  mode: SchemaRendererMode;
16
- props: DefaultNodeLayoutProps & Partial<Props>;
10
+ props: Partial<Props>;
17
11
  schema: Schema;
18
12
  schemaPath: string;
19
13
  }
20
14
  export type NodeLayout<Schema extends JsonSchema, Props extends Record<string, any> = {}, Value extends SchemaToValueType<Schema> = SchemaToValueType<Schema>> = React.FC<NodeLayoutProps<Schema, Props, Value>>;
21
- export interface DefaultNodeEntityProps {
22
- disabled?: boolean;
23
- required?: boolean;
24
- }
25
15
  export interface NodeEntityProps<Schema extends JsonSchema, Props extends Record<string, any> = {}, LayoutProps extends Record<string, any> = {}, Value extends SchemaToValueType<Schema> = SchemaToValueType<Schema>> extends FieldRenderProps<Value | null | undefined> {
26
16
  Layout?: NodeLayout<Schema, LayoutProps>;
27
17
  headName: string;
28
- layoutProps?: DefaultNodeLayoutProps & Partial<LayoutProps>;
18
+ layoutProps?: Partial<LayoutProps>;
29
19
  mode: SchemaRendererMode;
30
- props: DefaultNodeEntityProps & Partial<Props>;
20
+ props: Partial<Props>;
31
21
  schema: Schema;
32
22
  schemaPath: string;
33
23
  }
@@ -1,25 +1,32 @@
1
1
  import type { JsonSchemaType, NodeType } from '../constants';
2
- import type { DefaultNodeEntityProps, DefaultNodeLayoutProps, NodeEntity, NodeLayout } from './components';
2
+ import type { NodeEntity, NodeLayout } from './components';
3
3
  import type { ErrorMessages, Validator } from './validation';
4
4
  import type { ArrayValue, FieldValue, ObjectValue } from './values';
5
5
  interface NodeParameters<Type extends NodeType, Schema extends JsonSchema> {
6
6
  nodeParameters?: {
7
7
  entity?: string | NodeEntity<Schema>;
8
- entityProps?: DefaultNodeEntityProps & Record<string, any>;
8
+ entityProps?: Record<string, any>;
9
9
  errorMessages?: Omit<ErrorMessages, 'dependencies' | 'required'> & {
10
10
  dependencies?: ErrorMessages['dependencies'] | Record<string, ErrorMessages['dependencies']>;
11
11
  required?: ErrorMessages['required'] | Record<string, ErrorMessages['required']>;
12
12
  };
13
+ flags?: {
14
+ copy?: boolean;
15
+ disabled?: boolean;
16
+ hidden?: boolean;
17
+ open?: boolean;
18
+ required?: boolean;
19
+ };
13
20
  formEntity?: string | NodeEntity<Schema>;
14
- formEntityProps?: DefaultNodeEntityProps & Record<string, any>;
21
+ formEntityProps?: Record<string, any>;
15
22
  formLayout?: string | NodeLayout<Schema>;
16
- formLayoutProps?: DefaultNodeLayoutProps & Record<string, any>;
23
+ formLayoutProps?: Record<string, any>;
17
24
  layout?: string | NodeLayout<Schema>;
18
- layoutProps?: DefaultNodeLayoutProps & Record<string, any>;
25
+ layoutProps?: Record<string, any>;
19
26
  overviewEntity?: string | NodeEntity<Schema>;
20
- overviewEntityProps?: DefaultNodeEntityProps & Record<string, any>;
27
+ overviewEntityProps?: Record<string, any>;
21
28
  overviewLayout?: string | NodeLayout<Schema>;
22
- overviewLayoutProps?: DefaultNodeLayoutProps & Record<string, any>;
29
+ overviewLayoutProps?: Record<string, any>;
23
30
  type?: Type;
24
31
  validator?: string | Validator<Schema>;
25
32
  };
@@ -12,7 +12,7 @@ export interface ErrorMessages {
12
12
  additionalProperties?: ((e: JSLErrors.AdditionalProperties) => string) | string;
13
13
  anyOf?: ((e: JSLErrors.AnyOf) => string) | string;
14
14
  const?: ((e: JSLErrors.Const) => string) | string;
15
- contains?: ((e: JSLErrors.ContainsAny) => string) | string;
15
+ contains?: ((e: JSLErrors.ContainsAny | JSLErrors.ContainsMin) => string) | string;
16
16
  dependencies?: ((e: JSLErrors.Dependencies) => string) | string;
17
17
  enum?: ((e: JSLErrors.Enum) => string) | string;
18
18
  exclusiveMaximum?: ((e: JSLErrors.ExclusiveMaximum) => string) | string;
@@ -29,6 +29,9 @@ export interface SchemaRendererState<UserContext extends Record<string, unknown>
29
29
  unsubscribe: (id: string) => void;
30
30
  userContext: {
31
31
  MonacoEditor?: React.ComponentType<MonacoEditorProps>;
32
+ RenderHTMLOrMD?: React.ComponentType<{
33
+ content: string;
34
+ }>;
32
35
  } & UserContext;
33
36
  waiters: Record<string, ValidationWaiter | undefined>;
34
37
  }
@@ -72,7 +72,7 @@ const useSchemaRenderer = ({ config, connectValidate = true, errorMessages, json
72
72
  state.dispatchEvent(initialEvents);
73
73
  initialEvents = [];
74
74
  }
75
- }, { data: true }, { data: { state: initialState }, getValidator, validateFields: [headName] });
75
+ }, { data: true }, { data: { state: initialState }, getValidator, silent: true, validateFields: [headName] });
76
76
  prevParamsRef.current = {
77
77
  config,
78
78
  errorMessages,
@@ -1,5 +1,5 @@
1
1
  import type { NodeType } from '../constants';
2
- import type { DefaultNodeEntityProps, DefaultNodeLayoutProps, ErrorMessages, NodeEntity, NodeLayout, NodesConfig, Validator } from '../types';
2
+ import type { ErrorMessages, NodeEntity, NodeLayout, NodesConfig, Validator } from '../types';
3
3
  import type { EntityKind, ExtractNodeEntityProps, ExtractNodeLayoutProps, LayoutKind, NodeComponentProps, NodeTypeConfigKey, SchemaOfNodeType } from '../types/helpers';
4
4
  export declare const defineNodeEntityConfig: <Component extends NodeEntity<any>>(nodeEntityConfig: {
5
5
  Component: Component;
@@ -20,39 +20,53 @@ export declare const defineNodeLayoutConfig: <Component extends NodeLayout<any>>
20
20
  export declare const createNodeParametersDefiner: <Config extends NodesConfig>(_config: Config) => <Type extends NodeType, const Entity extends NodeTypeConfigKey<Config, Type, "formEntities"> | NodeTypeConfigKey<Config, Type, "overviewEntities"> | NodeEntity<SchemaOfNodeType<Type>> | undefined = undefined, const FormEntity extends NodeTypeConfigKey<Config, Type, "formEntities"> | NodeEntity<SchemaOfNodeType<Type>> | undefined = undefined, const OverviewEntity extends NodeTypeConfigKey<Config, Type, "overviewEntities"> | NodeEntity<SchemaOfNodeType<Type>> | undefined = undefined, const Layout extends NodeTypeConfigKey<Config, Type, "formLayouts"> | NodeTypeConfigKey<Config, Type, "overviewLayouts"> | NodeLayout<SchemaOfNodeType<Type>> | undefined = undefined, const FormLayout extends NodeTypeConfigKey<Config, Type, "formLayouts"> | NodeLayout<SchemaOfNodeType<Type>> | undefined = undefined, const OverviewLayout extends NodeTypeConfigKey<Config, Type, "overviewLayouts"> | NodeLayout<SchemaOfNodeType<Type>> | undefined = undefined, const ValidatorRef extends NodeTypeConfigKey<Config, Type, "validators"> | Validator<SchemaOfNodeType<Type>> | undefined = undefined>(nodeParameters: {
21
21
  type: Type;
22
22
  entity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | Entity;
23
- entityProps?: DefaultNodeEntityProps & NodeComponentProps<Config, Type, EntityKind, Entity>;
23
+ entityProps?: NodeComponentProps<Config, Type, EntityKind, Entity>;
24
24
  formEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NodeEntity<SchemaOfNodeType<Type>> | FormEntity;
25
- formEntityProps?: DefaultNodeEntityProps & NodeComponentProps<Config, Type, "formEntities", FormEntity>;
25
+ formEntityProps?: NodeComponentProps<Config, Type, "formEntities", FormEntity>;
26
26
  overviewEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | OverviewEntity;
27
- overviewEntityProps?: DefaultNodeEntityProps & NodeComponentProps<Config, Type, "overviewEntities", OverviewEntity>;
27
+ overviewEntityProps?: NodeComponentProps<Config, Type, "overviewEntities", OverviewEntity>;
28
28
  layout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | Layout;
29
- layoutProps?: DefaultNodeLayoutProps & NodeComponentProps<Config, Type, LayoutKind, Layout>;
29
+ layoutProps?: NodeComponentProps<Config, Type, LayoutKind, Layout>;
30
30
  formLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | FormLayout;
31
- formLayoutProps?: DefaultNodeLayoutProps & NodeComponentProps<Config, Type, "formLayouts", FormLayout>;
31
+ formLayoutProps?: NodeComponentProps<Config, Type, "formLayouts", FormLayout>;
32
32
  overviewLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | OverviewLayout;
33
- overviewLayoutProps?: DefaultNodeLayoutProps & NodeComponentProps<Config, Type, "overviewLayouts", OverviewLayout>;
33
+ overviewLayoutProps?: NodeComponentProps<Config, Type, "overviewLayouts", OverviewLayout>;
34
34
  errorMessages?: Omit<ErrorMessages, "dependencies" | "required"> & {
35
35
  dependencies?: ErrorMessages["dependencies"] | Record<string, ErrorMessages["dependencies"]>;
36
36
  required?: ErrorMessages["required"] | Record<string, ErrorMessages["required"]>;
37
37
  };
38
38
  validator?: NoInfer<NodeTypeConfigKey<Config, Type, "validators">> | Validator<SchemaOfNodeType<Type>> | ValidatorRef;
39
+ flags?: {
40
+ disabled?: boolean;
41
+ copy?: boolean;
42
+ hidden?: boolean;
43
+ open?: boolean;
44
+ required?: boolean;
45
+ };
39
46
  }) => {
40
47
  type: Type;
41
48
  entity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | Entity;
42
- entityProps?: DefaultNodeEntityProps & NodeComponentProps<Config, Type, EntityKind, Entity>;
49
+ entityProps?: NodeComponentProps<Config, Type, EntityKind, Entity>;
43
50
  formEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "formEntities">> | NodeEntity<SchemaOfNodeType<Type>> | FormEntity;
44
- formEntityProps?: DefaultNodeEntityProps & NodeComponentProps<Config, Type, "formEntities", FormEntity>;
51
+ formEntityProps?: NodeComponentProps<Config, Type, "formEntities", FormEntity>;
45
52
  overviewEntity?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewEntities">> | NodeEntity<SchemaOfNodeType<Type>> | OverviewEntity;
46
- overviewEntityProps?: DefaultNodeEntityProps & NodeComponentProps<Config, Type, "overviewEntities", OverviewEntity>;
53
+ overviewEntityProps?: NodeComponentProps<Config, Type, "overviewEntities", OverviewEntity>;
47
54
  layout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | Layout;
48
- layoutProps?: DefaultNodeLayoutProps & NodeComponentProps<Config, Type, LayoutKind, Layout>;
55
+ layoutProps?: NodeComponentProps<Config, Type, LayoutKind, Layout>;
49
56
  formLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "formLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | FormLayout;
50
- formLayoutProps?: DefaultNodeLayoutProps & NodeComponentProps<Config, Type, "formLayouts", FormLayout>;
57
+ formLayoutProps?: NodeComponentProps<Config, Type, "formLayouts", FormLayout>;
51
58
  overviewLayout?: NoInfer<NodeTypeConfigKey<Config, Type, "overviewLayouts">> | NodeLayout<SchemaOfNodeType<Type>> | OverviewLayout;
52
- overviewLayoutProps?: DefaultNodeLayoutProps & NodeComponentProps<Config, Type, "overviewLayouts", OverviewLayout>;
59
+ overviewLayoutProps?: NodeComponentProps<Config, Type, "overviewLayouts", OverviewLayout>;
53
60
  errorMessages?: Omit<ErrorMessages, "dependencies" | "required"> & {
54
61
  dependencies?: ErrorMessages["dependencies"] | Record<string, ErrorMessages["dependencies"]>;
55
62
  required?: ErrorMessages["required"] | Record<string, ErrorMessages["required"]>;
56
63
  };
57
64
  validator?: NoInfer<NodeTypeConfigKey<Config, Type, "validators">> | Validator<SchemaOfNodeType<Type>> | ValidatorRef;
65
+ flags?: {
66
+ disabled?: boolean;
67
+ copy?: boolean;
68
+ hidden?: boolean;
69
+ open?: boolean;
70
+ required?: boolean;
71
+ };
58
72
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type TextProps } from '@gravity-ui/uikit';
3
3
  export interface HTMLContentProps extends TextProps {
4
- html: string;
4
+ content: string;
5
+ headName?: string;
5
6
  }
6
7
  export declare const HTMLContent: React.FC<HTMLContentProps>;
@@ -4,8 +4,18 @@ exports.HTMLContent = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
+ const core_1 = require("../../../core");
7
8
  const HTMLContent = (_a) => {
8
- var { html } = _a, restProps = tslib_1.__rest(_a, ["html"]);
9
- return react_1.default.createElement(uikit_1.Text, Object.assign({}, restProps, { dangerouslySetInnerHTML: { __html: html } }));
9
+ var _b;
10
+ var { content, headName = '___stub-name' } = _a, restProps = tslib_1.__rest(_a, ["content", "headName"]);
11
+ const state = (0, core_1.useSchemaRendererState)({
12
+ headName,
13
+ subscriptions: [core_1.SchemaRendererEventType.UserContext],
14
+ });
15
+ const RenderHTMLOrMD = (_b = state === null || state === void 0 ? void 0 : state.userContext) === null || _b === void 0 ? void 0 : _b.RenderHTMLOrMD;
16
+ if (RenderHTMLOrMD) {
17
+ return react_1.default.createElement(RenderHTMLOrMD, { content: content });
18
+ }
19
+ return react_1.default.createElement(uikit_1.Text, Object.assign({}, restProps, { dangerouslySetInnerHTML: { __html: content } }));
10
20
  };
11
21
  exports.HTMLContent = HTMLContent;
@@ -8,4 +8,7 @@
8
8
  }
9
9
  .sr-layout-container_hide-empty:not(:has([data-fill=populated])) {
10
10
  display: none;
11
+ }
12
+ .sr-layout-container_hidden {
13
+ display: none;
11
14
  }
@@ -3,5 +3,6 @@ import { type FlexProps } from '@gravity-ui/uikit';
3
3
  export interface LayoutContainerProps extends FlexProps {
4
4
  children: React.ReactNode;
5
5
  hideEmpty?: boolean;
6
+ hidden?: boolean;
6
7
  }
7
8
  export declare const LayoutContainer: React.FC<LayoutContainerProps>;
@@ -7,7 +7,7 @@ const uikit_1 = require("@gravity-ui/uikit");
7
7
  const utils_1 = require("../../utils");
8
8
  const b = (0, utils_1.block)('layout-container');
9
9
  const LayoutContainer = (_a) => {
10
- var { className, children, hideEmpty = false } = _a, restProps = tslib_1.__rest(_a, ["className", "children", "hideEmpty"]);
11
- return (react_1.default.createElement(uikit_1.Flex, Object.assign({ className: b({ 'hide-empty': hideEmpty }, className), direction: "column" }, restProps), children));
10
+ var { className, children, hideEmpty = false, hidden = false } = _a, restProps = tslib_1.__rest(_a, ["className", "children", "hideEmpty", "hidden"]);
11
+ return (react_1.default.createElement(uikit_1.Flex, Object.assign({ className: b({ 'hide-empty': hideEmpty, hidden }, className), direction: "column" }, restProps), children));
12
12
  };
13
13
  exports.LayoutContainer = LayoutContainer;
@@ -1,2 +1,3 @@
1
1
  export { DASH, DEFAULT_DATE_FORMAT } from './common';
2
2
  export { config, untypedConfig } from './config';
3
+ export { errorMessages } from './messages';
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.untypedConfig = exports.config = exports.DEFAULT_DATE_FORMAT = exports.DASH = void 0;
3
+ exports.errorMessages = exports.untypedConfig = exports.config = exports.DEFAULT_DATE_FORMAT = exports.DASH = void 0;
4
4
  var common_1 = require("./common");
5
5
  Object.defineProperty(exports, "DASH", { enumerable: true, get: function () { return common_1.DASH; } });
6
6
  Object.defineProperty(exports, "DEFAULT_DATE_FORMAT", { enumerable: true, get: function () { return common_1.DEFAULT_DATE_FORMAT; } });
7
7
  var config_1 = require("./config");
8
8
  Object.defineProperty(exports, "config", { enumerable: true, get: function () { return config_1.config; } });
9
9
  Object.defineProperty(exports, "untypedConfig", { enumerable: true, get: function () { return config_1.untypedConfig; } });
10
+ var messages_1 = require("./messages");
11
+ Object.defineProperty(exports, "errorMessages", { enumerable: true, get: function () { return messages_1.errorMessages; } });
@@ -0,0 +1,2 @@
1
+ import type { ErrorMessages } from '../../core';
2
+ export declare let errorMessages: Required<ErrorMessages>;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.errorMessages = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const get_1 = tslib_1.__importDefault(require("lodash/get"));
6
+ const i18n_1 = tslib_1.__importDefault(require("../../../kit/i18n"));
7
+ const configure_1 = require("../../../kit/i18n/configure");
8
+ const TYPE_I18N_KEYS = {
9
+ array: 'label-sr_type-array',
10
+ boolean: 'label-sr_type-boolean',
11
+ integer: 'label-sr_type-integer',
12
+ null: 'label-sr_type-null',
13
+ number: 'label-sr_type-number',
14
+ object: 'label-sr_type-object',
15
+ string: 'label-sr_type-string',
16
+ };
17
+ const getErrorMessages = () => ({
18
+ additionalItems: (e) => {
19
+ const schema = e.data.schema;
20
+ if (Array.isArray(schema.items)) {
21
+ return (0, i18n_1.default)('label-sr_error-additional-items', { count: schema.items.length });
22
+ }
23
+ return e.message;
24
+ },
25
+ additionalProperties: (e) => {
26
+ const schema = e.data.schema;
27
+ if (schema.properties) {
28
+ return (0, i18n_1.default)('label-sr_error-additional-properties', {
29
+ count: Object.keys(schema.properties).length,
30
+ });
31
+ }
32
+ return e.message;
33
+ },
34
+ anyOf: (0, i18n_1.default)('label-sr_error-any-of'),
35
+ const: (e) => (0, i18n_1.default)('label-sr_error-const', { expected: JSON.stringify(e.data.expected) }),
36
+ contains: (e) => e.code === 'contains-min-error'
37
+ ? (0, i18n_1.default)('label-sr_error-contains-min')
38
+ : (0, i18n_1.default)('label-sr_error-contains'),
39
+ dependencies: (e) => {
40
+ let property = e.data.missingProperty;
41
+ const title = (0, get_1.default)(e, `data.schema.properties.${property}.title`);
42
+ if (typeof title === 'string') {
43
+ property = title;
44
+ }
45
+ return (0, i18n_1.default)('label-sr_error-dependencies', { property });
46
+ },
47
+ enum: (e) => (0, i18n_1.default)('label-sr_error-enum', { value: JSON.stringify(e.data.value) }),
48
+ exclusiveMaximum: (e) => (0, i18n_1.default)('label-sr_error-exclusive-maximum', { count: e.data.maximum }),
49
+ exclusiveMinimum: (e) => (0, i18n_1.default)('label-sr_error-exclusive-minimum', { count: e.data.minimum }),
50
+ maxItems: (e) => (0, i18n_1.default)('label-sr_error-max-items', { count: e.data.maximum }),
51
+ maxLength: (e) => (0, i18n_1.default)('label-sr_error-max-length', { count: e.data.maxLength }),
52
+ maxProperties: (e) => (0, i18n_1.default)('label-sr_error-max-properties', { count: e.data.maxProperties }),
53
+ maximum: (e) => (0, i18n_1.default)('label-sr_error-maximum', { count: e.data.maximum }),
54
+ minItems: (e) => (0, i18n_1.default)('label-sr_error-min-items', { count: e.data.minItems }),
55
+ minLength: (e) => (0, i18n_1.default)('label-sr_error-min-length', { count: e.data.minLength }),
56
+ minProperties: (e) => (0, i18n_1.default)('label-sr_error-min-properties', { count: e.data.minProperties }),
57
+ minimum: (e) => (0, i18n_1.default)('label-sr_error-minimum', { count: e.data.minimum }),
58
+ multipleOf: (e) => (0, i18n_1.default)('label-sr_error-multiple-of', { count: e.data.multipleOf }),
59
+ not: (0, i18n_1.default)('label-sr_error-not'),
60
+ oneOf: (0, i18n_1.default)('label-sr_error-one-of'),
61
+ pattern: (e) => (0, i18n_1.default)('label-sr_error-pattern', { pattern: e.data.pattern }),
62
+ propertyNames: (e) => (0, i18n_1.default)('label-sr_error-property-names', { property: e.data.property }),
63
+ required: (0, i18n_1.default)('label-sr_error-required'),
64
+ type: (e) => {
65
+ const types = e.data.expected.split(',');
66
+ let expected = '';
67
+ types.forEach((t, i, arr) => {
68
+ let type = t.trim();
69
+ if (TYPE_I18N_KEYS[type]) {
70
+ type = (0, i18n_1.default)(TYPE_I18N_KEYS[type]);
71
+ }
72
+ if (i === 0) {
73
+ expected += type;
74
+ }
75
+ else if (i === arr.length - 1) {
76
+ expected += (0, i18n_1.default)('label-sr_error-type-or', { type });
77
+ }
78
+ else {
79
+ expected += `, ${type}`;
80
+ }
81
+ });
82
+ return (0, i18n_1.default)('label-sr_error-type', { expected });
83
+ },
84
+ uniqueItems: (0, i18n_1.default)('label-sr_error-unique-items'),
85
+ });
86
+ exports.errorMessages = getErrorMessages();
87
+ (0, configure_1.subscribeConfigure)(() => {
88
+ exports.errorMessages = getErrorMessages();
89
+ });
@@ -0,0 +1,16 @@
1
+ .sr-alert .g-alert__text-content > div {
2
+ gap: 0 !important;
3
+ }
4
+ .sr-alert_expanded .g-alert__text-content > div {
5
+ gap: calc(var(--g-spacing-base) * 2) !important;
6
+ }
7
+ .sr-alert__title {
8
+ cursor: pointer;
9
+ }
10
+ .sr-alert__message {
11
+ height: 0;
12
+ overflow: hidden;
13
+ }
14
+ .sr-alert__message_expanded {
15
+ height: unset;
16
+ }