@yoobic/yobi 8.5.0-35 → 8.5.0-36

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.
@@ -326,7 +326,7 @@ const YooEntityQueryBuilderComponent = class {
326
326
  }
327
327
  renderFilters() {
328
328
  var _a, _b;
329
- if ((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) {
329
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) && (this.isOpen || this.alwaysShow)) {
330
330
  const filteredFields = this.getFilterFields();
331
331
  if (filteredFields && filteredFields.length > 0) {
332
332
  const { slides, data } = filtersHelpers.filterRenderFormDynamic(filteredFields, ((_b = this.values) === null || _b === void 0 ? void 0 : _b.filters) || [], this.formFilter, null, null, true, null, !this.floating);
@@ -1384,6 +1384,7 @@ const YooFormCreatorComponent = class {
1384
1384
  const movedItem = this.currentSlides[this.selectedPageIndex].items[oldParentIndex];
1385
1385
  const numberOfFieldsToMove = index$3.getNumberOfSequentialFields(movedItem) + 1;
1386
1386
  const itemsToMove = this.currentSlides[this.selectedPageIndex].items.slice(oldParentIndex, oldParentIndex + numberOfFieldsToMove);
1387
+ this.shiftUnattachedConditions(newIndex, oldIndex);
1387
1388
  this.currentSlides[this.selectedPageIndex].items.splice(oldParentIndex, numberOfFieldsToMove);
1388
1389
  this.currentSlides[this.selectedPageIndex].items.splice(newParentIndex, 0, ...itemsToMove);
1389
1390
  this.toggleInvisibleDiv();
@@ -1571,8 +1572,14 @@ const YooFormCreatorComponent = class {
1571
1572
  }
1572
1573
  }
1573
1574
  moveSelectedFields(itemId, slideIndex, selectedFields) {
1575
+ var _a;
1574
1576
  selectedFields = selectedFields ? selectedFields : this.selectedFields;
1575
1577
  if (selectedFields && selectedFields.length > 0) {
1578
+ this.unattachedParentConditions = lodash.compact((_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedCondition) => {
1579
+ if (unattachedCondition.slideIndex !== slideIndex) {
1580
+ return unattachedCondition;
1581
+ }
1582
+ }));
1576
1583
  let itemIndex = 0;
1577
1584
  let positionOffset = 0;
1578
1585
  const fieldsToMove = [];
@@ -1819,6 +1826,7 @@ const YooFormCreatorComponent = class {
1819
1826
  }
1820
1827
  if (index !== undefined && index < this.parentBlockIndices.length && !field) {
1821
1828
  indexToAdd = this.parentBlockIndices[index];
1829
+ this.shiftUnattachedConditions(indexToAdd);
1822
1830
  }
1823
1831
  else if (field && index > -1) {
1824
1832
  if (((_e = this.currentExpandedBlockLocation) === null || _e === void 0 ? void 0 : _e.itemIndex) === index && !field) {
@@ -1848,6 +1856,18 @@ const YooFormCreatorComponent = class {
1848
1856
  this.forceSortableRefresh = true;
1849
1857
  }
1850
1858
  }
1859
+ shiftUnattachedConditions(newIndex, oldIndex) {
1860
+ var _a;
1861
+ this.unattachedParentConditions = (_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedParentCondition) => {
1862
+ if (newIndex <= unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex && (overlays.isNullOrUndefined(oldIndex) || oldIndex > unattachedParentCondition.itemIndex)) {
1863
+ unattachedParentCondition.itemIndex += 1;
1864
+ }
1865
+ else if (oldIndex < unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex) {
1866
+ unattachedParentCondition.itemIndex -= 1;
1867
+ }
1868
+ return unattachedParentCondition;
1869
+ });
1870
+ }
1851
1871
  onFormFieldMove(event, up) {
1852
1872
  if (event && event.detail) {
1853
1873
  const { slideIndex, itemIndex } = overlays.findField(this.currentSlides, event.detail.name);
@@ -1861,6 +1881,7 @@ const YooFormCreatorComponent = class {
1861
1881
  const newPosition = up ? itemIndex - 1 : itemIndex + 1;
1862
1882
  this.currentSlides[slideIndex].items.splice(itemIndex, 1);
1863
1883
  this.currentSlides[slideIndex].items.splice(newPosition, 0, duplicatedField);
1884
+ this.shiftUnattachedConditions(newPosition, itemIndex);
1864
1885
  this.emitNewSlidesAndRerender();
1865
1886
  }
1866
1887
  }
@@ -307,7 +307,7 @@ export class YooEntityQueryBuilderComponent {
307
307
  }
308
308
  renderFilters() {
309
309
  var _a, _b;
310
- if ((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) {
310
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) && (this.isOpen || this.alwaysShow)) {
311
311
  const filteredFields = this.getFilterFields();
312
312
  if (filteredFields && filteredFields.length > 0) {
313
313
  const { slides, data } = filterRenderFormDynamic(filteredFields, ((_b = this.values) === null || _b === void 0 ? void 0 : _b.filters) || [], this.formFilter, null, null, true, null, !this.floating);
@@ -1311,6 +1311,7 @@ export class YooFormCreatorComponent {
1311
1311
  const movedItem = this.currentSlides[this.selectedPageIndex].items[oldParentIndex];
1312
1312
  const numberOfFieldsToMove = getNumberOfSequentialFields(movedItem) + 1;
1313
1313
  const itemsToMove = this.currentSlides[this.selectedPageIndex].items.slice(oldParentIndex, oldParentIndex + numberOfFieldsToMove);
1314
+ this.shiftUnattachedConditions(newIndex, oldIndex);
1314
1315
  this.currentSlides[this.selectedPageIndex].items.splice(oldParentIndex, numberOfFieldsToMove);
1315
1316
  this.currentSlides[this.selectedPageIndex].items.splice(newParentIndex, 0, ...itemsToMove);
1316
1317
  this.toggleInvisibleDiv();
@@ -1498,8 +1499,14 @@ export class YooFormCreatorComponent {
1498
1499
  }
1499
1500
  }
1500
1501
  moveSelectedFields(itemId, slideIndex, selectedFields) {
1502
+ var _a;
1501
1503
  selectedFields = selectedFields ? selectedFields : this.selectedFields;
1502
1504
  if (selectedFields && selectedFields.length > 0) {
1505
+ this.unattachedParentConditions = compact((_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedCondition) => {
1506
+ if (unattachedCondition.slideIndex !== slideIndex) {
1507
+ return unattachedCondition;
1508
+ }
1509
+ }));
1503
1510
  let itemIndex = 0;
1504
1511
  let positionOffset = 0;
1505
1512
  const fieldsToMove = [];
@@ -1746,6 +1753,7 @@ export class YooFormCreatorComponent {
1746
1753
  }
1747
1754
  if (index !== undefined && index < this.parentBlockIndices.length && !field) {
1748
1755
  indexToAdd = this.parentBlockIndices[index];
1756
+ this.shiftUnattachedConditions(indexToAdd);
1749
1757
  }
1750
1758
  else if (field && index > -1) {
1751
1759
  if (((_e = this.currentExpandedBlockLocation) === null || _e === void 0 ? void 0 : _e.itemIndex) === index && !field) {
@@ -1775,6 +1783,18 @@ export class YooFormCreatorComponent {
1775
1783
  this.forceSortableRefresh = true;
1776
1784
  }
1777
1785
  }
1786
+ shiftUnattachedConditions(newIndex, oldIndex) {
1787
+ var _a;
1788
+ this.unattachedParentConditions = (_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedParentCondition) => {
1789
+ if (newIndex <= unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex && (isNullOrUndefined(oldIndex) || oldIndex > unattachedParentCondition.itemIndex)) {
1790
+ unattachedParentCondition.itemIndex += 1;
1791
+ }
1792
+ else if (oldIndex < unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex) {
1793
+ unattachedParentCondition.itemIndex -= 1;
1794
+ }
1795
+ return unattachedParentCondition;
1796
+ });
1797
+ }
1778
1798
  onFormFieldMove(event, up) {
1779
1799
  if (event && event.detail) {
1780
1800
  const { slideIndex, itemIndex } = findField(this.currentSlides, event.detail.name);
@@ -1788,6 +1808,7 @@ export class YooFormCreatorComponent {
1788
1808
  const newPosition = up ? itemIndex - 1 : itemIndex + 1;
1789
1809
  this.currentSlides[slideIndex].items.splice(itemIndex, 1);
1790
1810
  this.currentSlides[slideIndex].items.splice(newPosition, 0, duplicatedField);
1811
+ this.shiftUnattachedConditions(newPosition, itemIndex);
1791
1812
  this.emitNewSlidesAndRerender();
1792
1813
  }
1793
1814
  }
@@ -322,7 +322,7 @@ const YooEntityQueryBuilderComponent = class {
322
322
  }
323
323
  renderFilters() {
324
324
  var _a, _b;
325
- if ((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) {
325
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) && (this.isOpen || this.alwaysShow)) {
326
326
  const filteredFields = this.getFilterFields();
327
327
  if (filteredFields && filteredFields.length > 0) {
328
328
  const { slides, data } = filterRenderFormDynamic(filteredFields, ((_b = this.values) === null || _b === void 0 ? void 0 : _b.filters) || [], this.formFilter, null, null, true, null, !this.floating);
@@ -1380,6 +1380,7 @@ const YooFormCreatorComponent = class {
1380
1380
  const movedItem = this.currentSlides[this.selectedPageIndex].items[oldParentIndex];
1381
1381
  const numberOfFieldsToMove = getNumberOfSequentialFields(movedItem) + 1;
1382
1382
  const itemsToMove = this.currentSlides[this.selectedPageIndex].items.slice(oldParentIndex, oldParentIndex + numberOfFieldsToMove);
1383
+ this.shiftUnattachedConditions(newIndex, oldIndex);
1383
1384
  this.currentSlides[this.selectedPageIndex].items.splice(oldParentIndex, numberOfFieldsToMove);
1384
1385
  this.currentSlides[this.selectedPageIndex].items.splice(newParentIndex, 0, ...itemsToMove);
1385
1386
  this.toggleInvisibleDiv();
@@ -1567,8 +1568,14 @@ const YooFormCreatorComponent = class {
1567
1568
  }
1568
1569
  }
1569
1570
  moveSelectedFields(itemId, slideIndex, selectedFields) {
1571
+ var _a;
1570
1572
  selectedFields = selectedFields ? selectedFields : this.selectedFields;
1571
1573
  if (selectedFields && selectedFields.length > 0) {
1574
+ this.unattachedParentConditions = compact((_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedCondition) => {
1575
+ if (unattachedCondition.slideIndex !== slideIndex) {
1576
+ return unattachedCondition;
1577
+ }
1578
+ }));
1572
1579
  let itemIndex = 0;
1573
1580
  let positionOffset = 0;
1574
1581
  const fieldsToMove = [];
@@ -1815,6 +1822,7 @@ const YooFormCreatorComponent = class {
1815
1822
  }
1816
1823
  if (index !== undefined && index < this.parentBlockIndices.length && !field) {
1817
1824
  indexToAdd = this.parentBlockIndices[index];
1825
+ this.shiftUnattachedConditions(indexToAdd);
1818
1826
  }
1819
1827
  else if (field && index > -1) {
1820
1828
  if (((_e = this.currentExpandedBlockLocation) === null || _e === void 0 ? void 0 : _e.itemIndex) === index && !field) {
@@ -1844,6 +1852,18 @@ const YooFormCreatorComponent = class {
1844
1852
  this.forceSortableRefresh = true;
1845
1853
  }
1846
1854
  }
1855
+ shiftUnattachedConditions(newIndex, oldIndex) {
1856
+ var _a;
1857
+ this.unattachedParentConditions = (_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedParentCondition) => {
1858
+ if (newIndex <= unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex && (isNullOrUndefined(oldIndex) || oldIndex > unattachedParentCondition.itemIndex)) {
1859
+ unattachedParentCondition.itemIndex += 1;
1860
+ }
1861
+ else if (oldIndex < unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex) {
1862
+ unattachedParentCondition.itemIndex -= 1;
1863
+ }
1864
+ return unattachedParentCondition;
1865
+ });
1866
+ }
1847
1867
  onFormFieldMove(event, up) {
1848
1868
  if (event && event.detail) {
1849
1869
  const { slideIndex, itemIndex } = findField(this.currentSlides, event.detail.name);
@@ -1857,6 +1877,7 @@ const YooFormCreatorComponent = class {
1857
1877
  const newPosition = up ? itemIndex - 1 : itemIndex + 1;
1858
1878
  this.currentSlides[slideIndex].items.splice(itemIndex, 1);
1859
1879
  this.currentSlides[slideIndex].items.splice(newPosition, 0, duplicatedField);
1880
+ this.shiftUnattachedConditions(newPosition, itemIndex);
1860
1881
  this.emitNewSlidesAndRerender();
1861
1882
  }
1862
1883
  }
@@ -322,7 +322,7 @@ const YooEntityQueryBuilderComponent = class {
322
322
  }
323
323
  renderFilters() {
324
324
  var _a, _b;
325
- if ((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) {
325
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.fields) && (this.isOpen || this.alwaysShow)) {
326
326
  const filteredFields = this.getFilterFields();
327
327
  if (filteredFields && filteredFields.length > 0) {
328
328
  const { slides, data } = filterRenderFormDynamic(filteredFields, ((_b = this.values) === null || _b === void 0 ? void 0 : _b.filters) || [], this.formFilter, null, null, true, null, !this.floating);
@@ -1380,6 +1380,7 @@ const YooFormCreatorComponent = class {
1380
1380
  const movedItem = this.currentSlides[this.selectedPageIndex].items[oldParentIndex];
1381
1381
  const numberOfFieldsToMove = getNumberOfSequentialFields(movedItem) + 1;
1382
1382
  const itemsToMove = this.currentSlides[this.selectedPageIndex].items.slice(oldParentIndex, oldParentIndex + numberOfFieldsToMove);
1383
+ this.shiftUnattachedConditions(newIndex, oldIndex);
1383
1384
  this.currentSlides[this.selectedPageIndex].items.splice(oldParentIndex, numberOfFieldsToMove);
1384
1385
  this.currentSlides[this.selectedPageIndex].items.splice(newParentIndex, 0, ...itemsToMove);
1385
1386
  this.toggleInvisibleDiv();
@@ -1567,8 +1568,14 @@ const YooFormCreatorComponent = class {
1567
1568
  }
1568
1569
  }
1569
1570
  moveSelectedFields(itemId, slideIndex, selectedFields) {
1571
+ var _a;
1570
1572
  selectedFields = selectedFields ? selectedFields : this.selectedFields;
1571
1573
  if (selectedFields && selectedFields.length > 0) {
1574
+ this.unattachedParentConditions = compact((_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedCondition) => {
1575
+ if (unattachedCondition.slideIndex !== slideIndex) {
1576
+ return unattachedCondition;
1577
+ }
1578
+ }));
1572
1579
  let itemIndex = 0;
1573
1580
  let positionOffset = 0;
1574
1581
  const fieldsToMove = [];
@@ -1815,6 +1822,7 @@ const YooFormCreatorComponent = class {
1815
1822
  }
1816
1823
  if (index !== undefined && index < this.parentBlockIndices.length && !field) {
1817
1824
  indexToAdd = this.parentBlockIndices[index];
1825
+ this.shiftUnattachedConditions(indexToAdd);
1818
1826
  }
1819
1827
  else if (field && index > -1) {
1820
1828
  if (((_e = this.currentExpandedBlockLocation) === null || _e === void 0 ? void 0 : _e.itemIndex) === index && !field) {
@@ -1844,6 +1852,18 @@ const YooFormCreatorComponent = class {
1844
1852
  this.forceSortableRefresh = true;
1845
1853
  }
1846
1854
  }
1855
+ shiftUnattachedConditions(newIndex, oldIndex) {
1856
+ var _a;
1857
+ this.unattachedParentConditions = (_a = this.unattachedParentConditions) === null || _a === void 0 ? void 0 : _a.map((unattachedParentCondition) => {
1858
+ if (newIndex <= unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex && (isNullOrUndefined(oldIndex) || oldIndex > unattachedParentCondition.itemIndex)) {
1859
+ unattachedParentCondition.itemIndex += 1;
1860
+ }
1861
+ else if (oldIndex < unattachedParentCondition.itemIndex && unattachedParentCondition.slideIndex === this.selectedPageIndex) {
1862
+ unattachedParentCondition.itemIndex -= 1;
1863
+ }
1864
+ return unattachedParentCondition;
1865
+ });
1866
+ }
1847
1867
  onFormFieldMove(event, up) {
1848
1868
  if (event && event.detail) {
1849
1869
  const { slideIndex, itemIndex } = findField(this.currentSlides, event.detail.name);
@@ -1857,6 +1877,7 @@ const YooFormCreatorComponent = class {
1857
1877
  const newPosition = up ? itemIndex - 1 : itemIndex + 1;
1858
1878
  this.currentSlides[slideIndex].items.splice(itemIndex, 1);
1859
1879
  this.currentSlides[slideIndex].items.splice(newPosition, 0, duplicatedField);
1880
+ this.shiftUnattachedConditions(newPosition, itemIndex);
1860
1881
  this.emitNewSlidesAndRerender();
1861
1882
  }
1862
1883
  }
@@ -659,6 +659,7 @@ export declare class YooFormCreatorComponent {
659
659
  onCustomFieldAdded(customFieldId: string, selectedCustomFormField?: ICustomFormField, indexToAdd?: number): void;
660
660
  onAddNewCondition(conditionType: ConditionType, pageCondition: boolean, condition: ICondition): void;
661
661
  onFormFieldAdd(fieldDescription: IFormFieldDescription, index?: number, field?: IFormField): void;
662
+ shiftUnattachedConditions(newIndex: number, oldIndex?: number): void;
662
663
  onFormFieldMove(event: CustomEvent<{
663
664
  name: string;
664
665
  }>, up: boolean): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoobic/yobi",
3
- "version": "8.5.0-35",
3
+ "version": "8.5.0-36",
4
4
  "description": "Yobi - Yoobic Design System",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.cjs.js",