@yoobic/yobi 8.5.19 → 8.5.20

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.
@@ -272,7 +272,7 @@ const YooFormAutocompleteComponent = class {
272
272
  });
273
273
  }
274
274
  if (!this.isMultiple()) {
275
- this.selection = index$1.isPresent(value) ? [value] : value;
275
+ this.selection = index$1.isPresent(value) || (lodash.isArray(value) && !value.length) ? [value] : value;
276
276
  await this.hideContainer();
277
277
  }
278
278
  }
@@ -838,6 +838,9 @@ const YooFormAutocompleteComponent = class {
838
838
  if (this.value) {
839
839
  if (this.value.indexOf(newTag) === -1) {
840
840
  this.value = [...this.value, newTag];
841
+ if (this.max > 0) {
842
+ this.value = this.value.slice(-this.max);
843
+ }
841
844
  }
842
845
  }
843
846
  else {
@@ -944,10 +947,9 @@ const YooFormAutocompleteComponent = class {
944
947
  }
945
948
  renderEntities(hasIconPrefix, cardTagSingle = false) {
946
949
  var _a;
947
- return (index.h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, i) => {
950
+ return (index.h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, index$2) => {
948
951
  var _a, _b;
949
- let entitySelection = selection;
950
- const unEditedSelection = entitySelection;
952
+ let entitySelection = lodash.clone(selection);
951
953
  if (this.idOnly) {
952
954
  entitySelection = this.getFullIdItemSelection(this.webGrid || null, entitySelection) || entitySelection;
953
955
  if (this.collectionName === 'groups' && !((_a = this.webGrid) === null || _a === void 0 ? void 0 : _a.items)) {
@@ -967,10 +969,10 @@ const YooFormAutocompleteComponent = class {
967
969
  return (entitySelection && [
968
970
  index.h("div", { class: { 'single-entity-container': this.isFilter } }, index.h("div", { class: "operator-container" }, `${this.isFilter ? this.filterOperator : ''}`), index.h("yoo-entity", { class: {
969
971
  'autocomplete autocomplete-selected': true,
970
- last: i === this.selection.length - 1,
972
+ last: index$2 === this.selection.length - 1,
971
973
  bold: this.color === 'transparent',
972
974
  'hide-icon': this.host.classList.contains('hide-icon')
973
- }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => commonHelpers.execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(unEditedSelection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
975
+ }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => commonHelpers.execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(selection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
974
976
  ]);
975
977
  })));
976
978
  }
@@ -91,6 +91,7 @@ const YooFormHotzonesCreatorComponent = class {
91
91
  }
92
92
  return hotzone.style;
93
93
  }) || [];
94
+ this.emitValues();
94
95
  }
95
96
  });
96
97
  (_b = this.editor) === null || _b === void 0 ? void 0 : _b.on('addshape', () => {
@@ -1,7 +1,7 @@
1
1
  import { FormFieldType } from '@shared/interfaces';
2
2
  import { findParent, getAsyncExtraData, getModalAnimation, getRandomFileName, groupsResolver, isImage, isIonic, isNullOrUndefined, isPresent, isValid, isWeb, MONGODB_ID_REGEX, resizeImage, showAlert, showModal, translate, translateMulti } from '@shared/utils';
3
3
  import { h, Host } from '@stencil/core';
4
- import { compact, debounce, isArray, isNumber, isString, uniq } from 'lodash-es';
4
+ import { clone, compact, debounce, isArray, isNumber, isString, uniq } from 'lodash-es';
5
5
  import { execHandlerAndStopEvent, getAppContext, showImageCropper } from '../../../utils/helpers/common-helpers';
6
6
  import { getFormBottomPosition, setValidator, setValueAndValidateInput } from '../../../utils/helpers/form-input-helpers';
7
7
  const AUTOCOMPLETE_DROPDOWN_HEIGHT = 272;
@@ -252,7 +252,7 @@ export class YooFormAutocompleteComponent {
252
252
  });
253
253
  }
254
254
  if (!this.isMultiple()) {
255
- this.selection = isPresent(value) ? [value] : value;
255
+ this.selection = isPresent(value) || (isArray(value) && !value.length) ? [value] : value;
256
256
  await this.hideContainer();
257
257
  }
258
258
  }
@@ -818,6 +818,9 @@ export class YooFormAutocompleteComponent {
818
818
  if (this.value) {
819
819
  if (this.value.indexOf(newTag) === -1) {
820
820
  this.value = [...this.value, newTag];
821
+ if (this.max > 0) {
822
+ this.value = this.value.slice(-this.max);
823
+ }
821
824
  }
822
825
  }
823
826
  else {
@@ -924,10 +927,9 @@ export class YooFormAutocompleteComponent {
924
927
  }
925
928
  renderEntities(hasIconPrefix, cardTagSingle = false) {
926
929
  var _a;
927
- return (h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, i) => {
930
+ return (h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, index) => {
928
931
  var _a, _b;
929
- let entitySelection = selection;
930
- const unEditedSelection = entitySelection;
932
+ let entitySelection = clone(selection);
931
933
  if (this.idOnly) {
932
934
  entitySelection = this.getFullIdItemSelection(this.webGrid || null, entitySelection) || entitySelection;
933
935
  if (this.collectionName === 'groups' && !((_a = this.webGrid) === null || _a === void 0 ? void 0 : _a.items)) {
@@ -947,10 +949,10 @@ export class YooFormAutocompleteComponent {
947
949
  return (entitySelection && [
948
950
  h("div", { class: { 'single-entity-container': this.isFilter } }, h("div", { class: "operator-container" }, `${this.isFilter ? this.filterOperator : ''}`), h("yoo-entity", { class: {
949
951
  'autocomplete autocomplete-selected': true,
950
- last: i === this.selection.length - 1,
952
+ last: index === this.selection.length - 1,
951
953
  bold: this.color === 'transparent',
952
954
  'hide-icon': this.host.classList.contains('hide-icon')
953
- }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(unEditedSelection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
955
+ }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(selection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
954
956
  ]);
955
957
  })));
956
958
  }
@@ -89,6 +89,7 @@ export class YooFormHotzonesCreatorComponent {
89
89
  }
90
90
  return hotzone.style;
91
91
  }) || [];
92
+ this.emitValues();
92
93
  }
93
94
  });
94
95
  (_b = this.editor) === null || _b === void 0 ? void 0 : _b.on('addshape', () => {
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as Host, g as getElement } from './index-a6a92b3d.js';
2
2
  import { c as FormFieldType } from './index-4bbbf966.js';
3
3
  import './index-895ced34.js';
4
- import { $ as debounce, i as isArray, n as compact, l as uniq, p as isString, a as isNumber } from './lodash-777f91de.js';
4
+ import { $ as debounce, i as isArray, n as compact, l as uniq, p as isString, t as clone, a as isNumber } from './lodash-777f91de.js';
5
5
  import { i as showImageCropper, h as execHandlerAndStopEvent, g as getAppContext } from './common-helpers-603b83b1.js';
6
6
  import { s as setValidator, f as getFormBottomPosition, a as setValueAndValidateInput } from './form-input-helpers-cf470e44.js';
7
7
  import { k as isNullOrUndefined, H as isWeb, G as showModal, F as getModalAnimation, aM as isPresent, aj as showAlert, t as translate, cB as isIonic, X as findParent, W as getAsyncExtraData, f6 as isValid, am as isImage, f7 as resizeImage, f8 as getRandomFileName, eF as MONGODB_ID_REGEX, a3 as translateMulti, e3 as groupsResolver } from './index-7dd54470.js';
@@ -268,7 +268,7 @@ const YooFormAutocompleteComponent = class {
268
268
  });
269
269
  }
270
270
  if (!this.isMultiple()) {
271
- this.selection = isPresent(value) ? [value] : value;
271
+ this.selection = isPresent(value) || (isArray(value) && !value.length) ? [value] : value;
272
272
  await this.hideContainer();
273
273
  }
274
274
  }
@@ -834,6 +834,9 @@ const YooFormAutocompleteComponent = class {
834
834
  if (this.value) {
835
835
  if (this.value.indexOf(newTag) === -1) {
836
836
  this.value = [...this.value, newTag];
837
+ if (this.max > 0) {
838
+ this.value = this.value.slice(-this.max);
839
+ }
837
840
  }
838
841
  }
839
842
  else {
@@ -940,10 +943,9 @@ const YooFormAutocompleteComponent = class {
940
943
  }
941
944
  renderEntities(hasIconPrefix, cardTagSingle = false) {
942
945
  var _a;
943
- return (h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, i) => {
946
+ return (h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, index) => {
944
947
  var _a, _b;
945
- let entitySelection = selection;
946
- const unEditedSelection = entitySelection;
948
+ let entitySelection = clone(selection);
947
949
  if (this.idOnly) {
948
950
  entitySelection = this.getFullIdItemSelection(this.webGrid || null, entitySelection) || entitySelection;
949
951
  if (this.collectionName === 'groups' && !((_a = this.webGrid) === null || _a === void 0 ? void 0 : _a.items)) {
@@ -963,10 +965,10 @@ const YooFormAutocompleteComponent = class {
963
965
  return (entitySelection && [
964
966
  h("div", { class: { 'single-entity-container': this.isFilter } }, h("div", { class: "operator-container" }, `${this.isFilter ? this.filterOperator : ''}`), h("yoo-entity", { class: {
965
967
  'autocomplete autocomplete-selected': true,
966
- last: i === this.selection.length - 1,
968
+ last: index === this.selection.length - 1,
967
969
  bold: this.color === 'transparent',
968
970
  'hide-icon': this.host.classList.contains('hide-icon')
969
- }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(unEditedSelection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
971
+ }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(selection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
970
972
  ]);
971
973
  })));
972
974
  }
@@ -87,6 +87,7 @@ const YooFormHotzonesCreatorComponent = class {
87
87
  }
88
88
  return hotzone.style;
89
89
  }) || [];
90
+ this.emitValues();
90
91
  }
91
92
  });
92
93
  (_b = this.editor) === null || _b === void 0 ? void 0 : _b.on('addshape', () => {
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, i as createEvent, h, e as Host, g as getElement } from './index-a6a92b3d.js';
2
2
  import { c as FormFieldType } from './index-4bbbf966.js';
3
3
  import './index-895ced34.js';
4
- import { $ as debounce, i as isArray, n as compact, l as uniq, p as isString, a as isNumber } from './lodash-777f91de.js';
4
+ import { $ as debounce, i as isArray, n as compact, l as uniq, p as isString, t as clone, a as isNumber } from './lodash-777f91de.js';
5
5
  import { i as showImageCropper, h as execHandlerAndStopEvent, g as getAppContext } from './common-helpers-603b83b1.js';
6
6
  import { s as setValidator, f as getFormBottomPosition, a as setValueAndValidateInput } from './form-input-helpers-cf470e44.js';
7
7
  import { k as isNullOrUndefined, H as isWeb, G as showModal, F as getModalAnimation, aM as isPresent, aj as showAlert, t as translate, cB as isIonic, X as findParent, W as getAsyncExtraData, f6 as isValid, am as isImage, f7 as resizeImage, f8 as getRandomFileName, eF as MONGODB_ID_REGEX, a3 as translateMulti, e3 as groupsResolver } from './index-7dd54470.js';
@@ -268,7 +268,7 @@ const YooFormAutocompleteComponent = class {
268
268
  });
269
269
  }
270
270
  if (!this.isMultiple()) {
271
- this.selection = isPresent(value) ? [value] : value;
271
+ this.selection = isPresent(value) || (isArray(value) && !value.length) ? [value] : value;
272
272
  await this.hideContainer();
273
273
  }
274
274
  }
@@ -834,6 +834,9 @@ const YooFormAutocompleteComponent = class {
834
834
  if (this.value) {
835
835
  if (this.value.indexOf(newTag) === -1) {
836
836
  this.value = [...this.value, newTag];
837
+ if (this.max > 0) {
838
+ this.value = this.value.slice(-this.max);
839
+ }
837
840
  }
838
841
  }
839
842
  else {
@@ -940,10 +943,9 @@ const YooFormAutocompleteComponent = class {
940
943
  }
941
944
  renderEntities(hasIconPrefix, cardTagSingle = false) {
942
945
  var _a;
943
- return (h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, i) => {
946
+ return (h("div", { class: { 'entity-container': true, empty: !this.selection || this.selection.length <= 0, prefix: hasIconPrefix } }, (_a = this.selection) === null || _a === void 0 ? void 0 : _a.map((selection, index) => {
944
947
  var _a, _b;
945
- let entitySelection = selection;
946
- const unEditedSelection = entitySelection;
948
+ let entitySelection = clone(selection);
947
949
  if (this.idOnly) {
948
950
  entitySelection = this.getFullIdItemSelection(this.webGrid || null, entitySelection) || entitySelection;
949
951
  if (this.collectionName === 'groups' && !((_a = this.webGrid) === null || _a === void 0 ? void 0 : _a.items)) {
@@ -963,10 +965,10 @@ const YooFormAutocompleteComponent = class {
963
965
  return (entitySelection && [
964
966
  h("div", { class: { 'single-entity-container': this.isFilter } }, h("div", { class: "operator-container" }, `${this.isFilter ? this.filterOperator : ''}`), h("yoo-entity", { class: {
965
967
  'autocomplete autocomplete-selected': true,
966
- last: i === this.selection.length - 1,
968
+ last: index === this.selection.length - 1,
967
969
  bold: this.color === 'transparent',
968
970
  'hide-icon': this.host.classList.contains('hide-icon')
969
- }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(unEditedSelection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
971
+ }, readonly: this.readonly, clearable: this.isMultiple(), columnDefinition: this.columnDefinition, useTranslate: this.useTranslate, customModel: this.customModel, displayType: cardTagSingle ? 'card-tag-single' : this.getDisplayType(), forceText: cardTagSingle, entityType: this.getEntityType(), item: entitySelection, onClosed: (ev) => execHandlerAndStopEvent(ev, () => this.onSelectionRemoved(selection)), isCollapsible: false, displaySize: this.size, valuesColor: (_b = this.valuesColor) === null || _b === void 0 ? void 0 : _b.find((e) => e.key === title) }))
970
972
  ]);
971
973
  })));
972
974
  }
@@ -87,6 +87,7 @@ const YooFormHotzonesCreatorComponent = class {
87
87
  }
88
88
  return hotzone.style;
89
89
  }) || [];
90
+ this.emitValues();
90
91
  }
91
92
  });
92
93
  (_b = this.editor) === null || _b === void 0 ? void 0 : _b.on('addshape', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoobic/yobi",
3
- "version": "8.5.19",
3
+ "version": "8.5.20",
4
4
  "description": "Yobi - Yoobic Design System",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.cjs.js",