@knovator/pagecreator-admin 0.7.4 → 0.7.5

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/index.cjs CHANGED
@@ -1757,7 +1757,8 @@ const TRANSLATION_PAIRS_WIDGET = {
1757
1757
  'widget.tabDeleteTitle': 'Are you sure you want to delete this tab?',
1758
1758
  'widget.widgetTitleInfo': 'HTML is supported',
1759
1759
  'widget.minPerRow': 'Value must be greater than zero',
1760
- 'widget.actionsLabel': 'Actions'
1760
+ 'widget.actionsLabel': 'Actions',
1761
+ 'widget.tabNameRequired': 'Tab Name is required'
1761
1762
  };
1762
1763
  const TRANSLATION_PAIRS_ITEM = {
1763
1764
  'item.title': 'Title',
@@ -4230,6 +4231,7 @@ const DeleteModal = ({
4230
4231
  confirm,
4231
4232
  typeHerePlaceholder
4232
4233
  }) => {
4234
+ var _a;
4233
4235
  const [userInput, setUserInput] = React.useState('');
4234
4236
  React.useEffect(() => {
4235
4237
  setUserInput('');
@@ -4250,13 +4252,14 @@ const DeleteModal = ({
4250
4252
  className: "khb_delete-actions"
4251
4253
  }, /*#__PURE__*/React__default["default"].createElement(Input, {
4252
4254
  placeholder: typeHerePlaceholder || TRANSLATION_PAIRS_COMMON.typeHerePlaceholder,
4255
+ wrapperClassName: "w-full",
4253
4256
  className: "khb_delete-input",
4254
4257
  value: userInput,
4255
4258
  onChange: e => setUserInput(e.target.value)
4256
4259
  }), /*#__PURE__*/React__default["default"].createElement("div", {
4257
4260
  className: "khb_delete-buttons"
4258
4261
  }, /*#__PURE__*/React__default["default"].createElement(Button, {
4259
- disabled: userInput !== (itemData === null || itemData === void 0 ? void 0 : itemData['name']),
4262
+ disabled: userInput.toString().trim() !== ((_a = itemData === null || itemData === void 0 ? void 0 : itemData['name']) === null || _a === void 0 ? void 0 : _a.trim()),
4260
4263
  onClick: onConfirmDelete
4261
4264
  }, confirm || TRANSLATION_PAIRS_COMMON.confirm)))) : null;
4262
4265
  };
@@ -6580,6 +6583,7 @@ const TabItem = ({
6580
6583
  deleteTitle,
6581
6584
  onRemoveTab,
6582
6585
  register,
6586
+ error,
6583
6587
  noButtonText,
6584
6588
  yesButtonText
6585
6589
  }) => {
@@ -6587,8 +6591,13 @@ const TabItem = ({
6587
6591
  type: "text",
6588
6592
  className: "khb_tabs-input",
6589
6593
  autoFocus: true,
6594
+ style: {
6595
+ display: 'block'
6596
+ },
6590
6597
  disabled: isDisabled
6591
- }, register || {})), showDelete ? /*#__PURE__*/React__default["default"].createElement(ConfirmPopOver, {
6598
+ }, register || {})), error && /*#__PURE__*/React__default["default"].createElement("p", {
6599
+ className: "khb_input-error "
6600
+ }, error), showDelete ? /*#__PURE__*/React__default["default"].createElement(ConfirmPopOver, {
6592
6601
  onConfirm: onRemoveTab,
6593
6602
  title: deleteTitle,
6594
6603
  confirmText: yesButtonText,
@@ -6599,6 +6608,7 @@ const TabItem = ({
6599
6608
  };
6600
6609
 
6601
6610
  const Tabs = ({
6611
+ errors,
6602
6612
  activeTab,
6603
6613
  setActiveTab,
6604
6614
  options,
@@ -6615,6 +6625,7 @@ const Tabs = ({
6615
6625
  itemsPlaceholder,
6616
6626
  formatOptionLabel,
6617
6627
  tabCollectionItems,
6628
+ tabNameRequiredText,
6618
6629
  onCollectionItemsIndexChange
6619
6630
  }) => {
6620
6631
  const {
@@ -6641,6 +6652,7 @@ const Tabs = ({
6641
6652
  }, /*#__PURE__*/React__default["default"].createElement(reactTabs.TabList, {
6642
6653
  className: "khb_tabs-list"
6643
6654
  }, tabFields === null || tabFields === void 0 ? void 0 : tabFields.map((field, index) => {
6655
+ var _a, _b, _c;
6644
6656
  return /*#__PURE__*/React__default["default"].createElement(reactTabs.Tab, {
6645
6657
  key: field.id,
6646
6658
  className: classNames__default["default"]('khb_tabs-item', {
@@ -6649,11 +6661,14 @@ const Tabs = ({
6649
6661
  }, /*#__PURE__*/React__default["default"].createElement(TabItem, {
6650
6662
  key: field.id,
6651
6663
  deleteTitle: deleteTitle,
6652
- register: register(`tabs.${index}.name`),
6664
+ register: register(`tabs.${index}.name`, {
6665
+ required: tabNameRequiredText
6666
+ }),
6653
6667
  onRemoveTab: () => {
6654
6668
  removeField(index);
6655
6669
  setActiveTab(index === 0 ? 0 : index - 1);
6656
6670
  },
6671
+ error: (_c = (_b = (_a = errors === null || errors === void 0 ? void 0 : errors['tabs']) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.message,
6657
6672
  noButtonText: noButtonText,
6658
6673
  yesButtonText: yesButtonText,
6659
6674
  showDelete: (tabFields === null || tabFields === void 0 ? void 0 : tabFields.length) > 1
@@ -7099,6 +7114,8 @@ const WidgetForm = ({
7099
7114
  deleteTitle: t('widget.tabDeleteTitle'),
7100
7115
  yesButtonText: t('yesButtonText'),
7101
7116
  noButtonText: t('cancelButtonText'),
7117
+ errors: errors,
7118
+ tabNameRequiredText: t('widget.tabNameRequired'),
7102
7119
  itemsPlaceholder: `Select ${selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.label}...`,
7103
7120
  loadOptions: onChangeSearch,
7104
7121
  isItemsLoading: collectionDataLoading,
package/index.js CHANGED
@@ -1745,7 +1745,8 @@ const TRANSLATION_PAIRS_WIDGET = {
1745
1745
  'widget.tabDeleteTitle': 'Are you sure you want to delete this tab?',
1746
1746
  'widget.widgetTitleInfo': 'HTML is supported',
1747
1747
  'widget.minPerRow': 'Value must be greater than zero',
1748
- 'widget.actionsLabel': 'Actions'
1748
+ 'widget.actionsLabel': 'Actions',
1749
+ 'widget.tabNameRequired': 'Tab Name is required'
1749
1750
  };
1750
1751
  const TRANSLATION_PAIRS_ITEM = {
1751
1752
  'item.title': 'Title',
@@ -4218,6 +4219,7 @@ const DeleteModal = ({
4218
4219
  confirm,
4219
4220
  typeHerePlaceholder
4220
4221
  }) => {
4222
+ var _a;
4221
4223
  const [userInput, setUserInput] = useState('');
4222
4224
  useEffect(() => {
4223
4225
  setUserInput('');
@@ -4238,13 +4240,14 @@ const DeleteModal = ({
4238
4240
  className: "khb_delete-actions"
4239
4241
  }, /*#__PURE__*/React.createElement(Input, {
4240
4242
  placeholder: typeHerePlaceholder || TRANSLATION_PAIRS_COMMON.typeHerePlaceholder,
4243
+ wrapperClassName: "w-full",
4241
4244
  className: "khb_delete-input",
4242
4245
  value: userInput,
4243
4246
  onChange: e => setUserInput(e.target.value)
4244
4247
  }), /*#__PURE__*/React.createElement("div", {
4245
4248
  className: "khb_delete-buttons"
4246
4249
  }, /*#__PURE__*/React.createElement(Button, {
4247
- disabled: userInput !== (itemData === null || itemData === void 0 ? void 0 : itemData['name']),
4250
+ disabled: userInput.toString().trim() !== ((_a = itemData === null || itemData === void 0 ? void 0 : itemData['name']) === null || _a === void 0 ? void 0 : _a.trim()),
4248
4251
  onClick: onConfirmDelete
4249
4252
  }, confirm || TRANSLATION_PAIRS_COMMON.confirm)))) : null;
4250
4253
  };
@@ -6568,6 +6571,7 @@ const TabItem = ({
6568
6571
  deleteTitle,
6569
6572
  onRemoveTab,
6570
6573
  register,
6574
+ error,
6571
6575
  noButtonText,
6572
6576
  yesButtonText
6573
6577
  }) => {
@@ -6575,8 +6579,13 @@ const TabItem = ({
6575
6579
  type: "text",
6576
6580
  className: "khb_tabs-input",
6577
6581
  autoFocus: true,
6582
+ style: {
6583
+ display: 'block'
6584
+ },
6578
6585
  disabled: isDisabled
6579
- }, register || {})), showDelete ? /*#__PURE__*/React.createElement(ConfirmPopOver, {
6586
+ }, register || {})), error && /*#__PURE__*/React.createElement("p", {
6587
+ className: "khb_input-error "
6588
+ }, error), showDelete ? /*#__PURE__*/React.createElement(ConfirmPopOver, {
6580
6589
  onConfirm: onRemoveTab,
6581
6590
  title: deleteTitle,
6582
6591
  confirmText: yesButtonText,
@@ -6587,6 +6596,7 @@ const TabItem = ({
6587
6596
  };
6588
6597
 
6589
6598
  const Tabs = ({
6599
+ errors,
6590
6600
  activeTab,
6591
6601
  setActiveTab,
6592
6602
  options,
@@ -6603,6 +6613,7 @@ const Tabs = ({
6603
6613
  itemsPlaceholder,
6604
6614
  formatOptionLabel,
6605
6615
  tabCollectionItems,
6616
+ tabNameRequiredText,
6606
6617
  onCollectionItemsIndexChange
6607
6618
  }) => {
6608
6619
  const {
@@ -6629,6 +6640,7 @@ const Tabs = ({
6629
6640
  }, /*#__PURE__*/React.createElement(TabList, {
6630
6641
  className: "khb_tabs-list"
6631
6642
  }, tabFields === null || tabFields === void 0 ? void 0 : tabFields.map((field, index) => {
6643
+ var _a, _b, _c;
6632
6644
  return /*#__PURE__*/React.createElement(Tab, {
6633
6645
  key: field.id,
6634
6646
  className: classNames('khb_tabs-item', {
@@ -6637,11 +6649,14 @@ const Tabs = ({
6637
6649
  }, /*#__PURE__*/React.createElement(TabItem, {
6638
6650
  key: field.id,
6639
6651
  deleteTitle: deleteTitle,
6640
- register: register(`tabs.${index}.name`),
6652
+ register: register(`tabs.${index}.name`, {
6653
+ required: tabNameRequiredText
6654
+ }),
6641
6655
  onRemoveTab: () => {
6642
6656
  removeField(index);
6643
6657
  setActiveTab(index === 0 ? 0 : index - 1);
6644
6658
  },
6659
+ error: (_c = (_b = (_a = errors === null || errors === void 0 ? void 0 : errors['tabs']) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.message,
6645
6660
  noButtonText: noButtonText,
6646
6661
  yesButtonText: yesButtonText,
6647
6662
  showDelete: (tabFields === null || tabFields === void 0 ? void 0 : tabFields.length) > 1
@@ -7087,6 +7102,8 @@ const WidgetForm = ({
7087
7102
  deleteTitle: t('widget.tabDeleteTitle'),
7088
7103
  yesButtonText: t('yesButtonText'),
7089
7104
  noButtonText: t('cancelButtonText'),
7105
+ errors: errors,
7106
+ tabNameRequiredText: t('widget.tabNameRequired'),
7090
7107
  itemsPlaceholder: `Select ${selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.label}...`,
7091
7108
  loadOptions: onChangeSearch,
7092
7109
  isItemsLoading: collectionDataLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knovator/pagecreator-admin",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "dependencies": {
5
5
  "classnames": "^2.3.1",
6
6
  "react-beautiful-dnd": "^13.1.0",
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { TabItemProps } from '../../../../types';
3
- declare const TabItem: ({ showDelete, isDisabled, deleteTitle, onRemoveTab, register, noButtonText, yesButtonText, }: TabItemProps) => JSX.Element;
3
+ declare const TabItem: ({ showDelete, isDisabled, deleteTitle, onRemoveTab, register, error, noButtonText, yesButtonText, }: TabItemProps) => JSX.Element;
4
4
  export default TabItem;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { TabsProps } from '../../../../types';
3
- declare const Tabs: ({ activeTab, setActiveTab, options, control, register, listCode, formatItem, deleteTitle, loadOptions, customStyles, noButtonText, yesButtonText, isItemsLoading, itemsPlaceholder, formatOptionLabel, tabCollectionItems, onCollectionItemsIndexChange, }: TabsProps) => JSX.Element;
3
+ declare const Tabs: ({ errors, activeTab, setActiveTab, options, control, register, listCode, formatItem, deleteTitle, loadOptions, customStyles, noButtonText, yesButtonText, isItemsLoading, itemsPlaceholder, formatOptionLabel, tabCollectionItems, tabNameRequiredText, onCollectionItemsIndexChange, }: TabsProps) => JSX.Element;
4
4
  export default Tabs;
@@ -87,6 +87,7 @@ declare const TRANSLATION_PAIRS_WIDGET: {
87
87
  'widget.widgetTitleInfo': string;
88
88
  'widget.minPerRow': string;
89
89
  'widget.actionsLabel': string;
90
+ 'widget.tabNameRequired': string;
90
91
  };
91
92
  declare const TRANSLATION_PAIRS_ITEM: {
92
93
  'item.title': string;
@@ -242,6 +242,7 @@ export interface TabItemProps {
242
242
  register?: any;
243
243
  noButtonText: string;
244
244
  yesButtonText: string;
245
+ error?: string;
245
246
  }
246
247
  export interface TabsProps {
247
248
  activeTab: number;
@@ -255,6 +256,7 @@ export interface TabsProps {
255
256
  }[];
256
257
  deleteTitle: string;
257
258
  listCode: string;
259
+ tabNameRequiredText: string;
258
260
  noButtonText: string;
259
261
  yesButtonText: string;
260
262
  itemsPlaceholder?: string;
@@ -263,6 +265,9 @@ export interface TabsProps {
263
265
  formatItem?: (code: string, data: any) => JSX.Element;
264
266
  onCollectionItemsIndexChange: (index: number, data: DropResult) => void;
265
267
  tabCollectionItems: any[];
268
+ errors?: {
269
+ [key: string]: any;
270
+ };
266
271
  customStyles?: any;
267
272
  loadOptions?: (value?: string, callback?: (options: OptionType[]) => void) => Promise<OptionType[]>;
268
273
  }