@fundamental-ngx/core 0.33.4-rc.6 → 0.33.4

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 (156) hide show
  1. package/README.md +1 -3
  2. package/action-bar/package.json +3 -3
  3. package/action-sheet/package.json +3 -3
  4. package/alert/package.json +3 -3
  5. package/avatar/avatar.component.d.ts +2 -0
  6. package/avatar/esm2020/avatar.component.mjs +8 -5
  7. package/avatar/fesm2015/fundamental-ngx-core-avatar.mjs +7 -4
  8. package/avatar/fesm2015/fundamental-ngx-core-avatar.mjs.map +1 -1
  9. package/avatar/fesm2020/fundamental-ngx-core-avatar.mjs +7 -4
  10. package/avatar/fesm2020/fundamental-ngx-core-avatar.mjs.map +1 -1
  11. package/avatar/package.json +3 -3
  12. package/avatar-group/package.json +3 -3
  13. package/bar/package.json +3 -3
  14. package/breadcrumb/package.json +3 -3
  15. package/busy-indicator/package.json +3 -3
  16. package/button/package.json +3 -3
  17. package/calendar/package.json +3 -3
  18. package/card/package.json +3 -3
  19. package/carousel/package.json +3 -3
  20. package/checkbox/checkbox/checkbox.component.d.ts +30 -35
  21. package/checkbox/esm2020/checkbox/checkbox.component.mjs +61 -80
  22. package/checkbox/fesm2015/fundamental-ngx-core-checkbox.mjs +59 -77
  23. package/checkbox/fesm2015/fundamental-ngx-core-checkbox.mjs.map +1 -1
  24. package/checkbox/fesm2020/fundamental-ngx-core-checkbox.mjs +59 -77
  25. package/checkbox/fesm2020/fundamental-ngx-core-checkbox.mjs.map +1 -1
  26. package/checkbox/package.json +3 -3
  27. package/combobox/package.json +3 -3
  28. package/date-picker/package.json +3 -3
  29. package/datetime/package.json +3 -3
  30. package/datetime-picker/package.json +3 -3
  31. package/dialog/package.json +3 -3
  32. package/dynamic-page/package.json +3 -3
  33. package/dynamic-side-content/package.json +3 -3
  34. package/esm2020/avatar/avatar.component.mjs +8 -5
  35. package/esm2020/checkbox/checkbox/checkbox.component.mjs +61 -80
  36. package/esm2020/input-group/input-group.component.mjs +2 -2
  37. package/esm2020/list/list-item/list-item.component.mjs +6 -2
  38. package/esm2020/multi-input/multi-input.component.mjs +38 -11
  39. package/esm2020/utils/helpers/range-selector.mjs +113 -0
  40. package/esm2020/utils/public_api.mjs +2 -1
  41. package/facets/package.json +3 -3
  42. package/feed-input/package.json +3 -3
  43. package/feed-list-item/package.json +3 -3
  44. package/fesm2015/fundamental-ngx-core-avatar.mjs +7 -4
  45. package/fesm2015/fundamental-ngx-core-avatar.mjs.map +1 -1
  46. package/fesm2015/fundamental-ngx-core-checkbox.mjs +59 -77
  47. package/fesm2015/fundamental-ngx-core-checkbox.mjs.map +1 -1
  48. package/fesm2015/fundamental-ngx-core-input-group.mjs +2 -2
  49. package/fesm2015/fundamental-ngx-core-list.mjs +5 -1
  50. package/fesm2015/fundamental-ngx-core-list.mjs.map +1 -1
  51. package/fesm2015/fundamental-ngx-core-multi-input.mjs +40 -11
  52. package/fesm2015/fundamental-ngx-core-multi-input.mjs.map +1 -1
  53. package/fesm2015/fundamental-ngx-core-utils.mjs +114 -1
  54. package/fesm2015/fundamental-ngx-core-utils.mjs.map +1 -1
  55. package/fesm2020/fundamental-ngx-core-avatar.mjs +7 -4
  56. package/fesm2020/fundamental-ngx-core-avatar.mjs.map +1 -1
  57. package/fesm2020/fundamental-ngx-core-checkbox.mjs +59 -77
  58. package/fesm2020/fundamental-ngx-core-checkbox.mjs.map +1 -1
  59. package/fesm2020/fundamental-ngx-core-input-group.mjs +2 -2
  60. package/fesm2020/fundamental-ngx-core-list.mjs +5 -1
  61. package/fesm2020/fundamental-ngx-core-list.mjs.map +1 -1
  62. package/fesm2020/fundamental-ngx-core-multi-input.mjs +38 -11
  63. package/fesm2020/fundamental-ngx-core-multi-input.mjs.map +1 -1
  64. package/fesm2020/fundamental-ngx-core-utils.mjs +114 -1
  65. package/fesm2020/fundamental-ngx-core-utils.mjs.map +1 -1
  66. package/file-uploader/package.json +3 -3
  67. package/fixed-card-layout/package.json +3 -3
  68. package/flexible-column-layout/package.json +3 -3
  69. package/form/package.json +3 -3
  70. package/formatted-text/package.json +3 -3
  71. package/grid-list/package.json +3 -3
  72. package/icon/package.json +3 -3
  73. package/illustrated-message/package.json +3 -3
  74. package/infinite-scroll/package.json +3 -3
  75. package/info-label/package.json +3 -3
  76. package/inline-help/package.json +3 -3
  77. package/input-group/esm2020/input-group.component.mjs +2 -2
  78. package/input-group/fesm2015/fundamental-ngx-core-input-group.mjs +2 -2
  79. package/input-group/fesm2020/fundamental-ngx-core-input-group.mjs +2 -2
  80. package/input-group/package.json +3 -3
  81. package/layout-grid/package.json +3 -3
  82. package/layout-panel/package.json +3 -3
  83. package/link/package.json +3 -3
  84. package/list/esm2020/list-item/list-item.component.mjs +6 -2
  85. package/list/fesm2015/fundamental-ngx-core-list.mjs +5 -1
  86. package/list/fesm2015/fundamental-ngx-core-list.mjs.map +1 -1
  87. package/list/fesm2020/fundamental-ngx-core-list.mjs +5 -1
  88. package/list/fesm2020/fundamental-ngx-core-list.mjs.map +1 -1
  89. package/list/package.json +3 -3
  90. package/menu/package.json +3 -3
  91. package/message-box/package.json +3 -3
  92. package/message-page/package.json +2 -2
  93. package/message-strip/package.json +3 -3
  94. package/message-toast/package.json +3 -3
  95. package/micro-process-flow/package.json +3 -3
  96. package/mobile-mode/package.json +3 -3
  97. package/multi-input/esm2020/multi-input.component.mjs +38 -11
  98. package/multi-input/fesm2015/fundamental-ngx-core-multi-input.mjs +40 -11
  99. package/multi-input/fesm2015/fundamental-ngx-core-multi-input.mjs.map +1 -1
  100. package/multi-input/fesm2020/fundamental-ngx-core-multi-input.mjs +38 -11
  101. package/multi-input/fesm2020/fundamental-ngx-core-multi-input.mjs.map +1 -1
  102. package/multi-input/multi-input.component.d.ts +8 -1
  103. package/multi-input/package.json +3 -3
  104. package/nested-list/package.json +3 -3
  105. package/notification/package.json +3 -3
  106. package/object-identifier/package.json +3 -3
  107. package/object-marker/package.json +3 -3
  108. package/object-number/package.json +3 -3
  109. package/object-status/package.json +3 -3
  110. package/package.json +7 -7
  111. package/pagination/package.json +3 -3
  112. package/panel/package.json +3 -3
  113. package/popover/package.json +3 -3
  114. package/product-switch/package.json +3 -3
  115. package/progress-indicator/package.json +1 -1
  116. package/quick-view/package.json +3 -3
  117. package/radio/package.json +3 -3
  118. package/rating-indicator/package.json +3 -3
  119. package/resizable-card-layout/package.json +3 -3
  120. package/scroll-spy/package.json +3 -3
  121. package/scrollbar/package.json +3 -3
  122. package/segmented-button/package.json +3 -3
  123. package/select/package.json +3 -3
  124. package/shared/package.json +3 -3
  125. package/shellbar/package.json +3 -3
  126. package/side-navigation/package.json +3 -3
  127. package/slider/package.json +3 -3
  128. package/split-button/package.json +3 -3
  129. package/splitter/package.json +3 -3
  130. package/status-indicator/package.json +3 -3
  131. package/step-input/package.json +3 -3
  132. package/switch/package.json +3 -3
  133. package/table/package.json +3 -3
  134. package/tabs/package.json +3 -3
  135. package/tests/package.json +2 -2
  136. package/text/package.json +3 -3
  137. package/tile/package.json +3 -3
  138. package/time/package.json +3 -3
  139. package/time-picker/package.json +3 -3
  140. package/timeline/package.json +3 -3
  141. package/title/package.json +3 -3
  142. package/token/package.json +3 -3
  143. package/toolbar/package.json +3 -3
  144. package/tree/package.json +3 -3
  145. package/upload-collection/package.json +3 -3
  146. package/utils/esm2020/helpers/range-selector.mjs +113 -0
  147. package/utils/esm2020/public_api.mjs +2 -1
  148. package/utils/fesm2015/fundamental-ngx-core-utils.mjs +114 -1
  149. package/utils/fesm2015/fundamental-ngx-core-utils.mjs.map +1 -1
  150. package/utils/fesm2020/fundamental-ngx-core-utils.mjs +114 -1
  151. package/utils/fesm2020/fundamental-ngx-core-utils.mjs.map +1 -1
  152. package/utils/helpers/range-selector.d.ts +84 -0
  153. package/utils/package.json +6 -6
  154. package/utils/public_api.d.ts +1 -0
  155. package/vertical-navigation/package.json +3 -3
  156. package/wizard/package.json +3 -3
@@ -2605,6 +2605,119 @@ class DynamicComponentContainer {
2605
2605
  }
2606
2606
  }
2607
2607
 
2608
+ /**
2609
+ * Utility type, that allows to track and select ranges of elements while using multi-selection.
2610
+ *
2611
+ * @usage
2612
+ * Imagine we have a simple list of checkboxes:
2613
+ * ```html
2614
+ * <input
2615
+ * #checkboxInput
2616
+ * *ngFor="let o of options; let idx = index"
2617
+ * type="checkbox"
2618
+ * [checked]="selectionModel.checked(o)"
2619
+ * (click)="toggle(idx, $event)"
2620
+ * >
2621
+ * ```
2622
+ * With the given layout the logic should be as follows:
2623
+ * ```typescript
2624
+ * export class YourComponent {
2625
+ * options = ['a', 'b', 'c'];
2626
+ * readonly selectionModel = new SelectionModel(true);
2627
+ *
2628
+ * private readonly _rangeSelector = new RangeSelector();
2629
+ *
2630
+ *
2631
+ * toggle(idx: number, event: PointerEvent): void {
2632
+ * // getting the toggled value of the checkbox
2633
+ * const toggledSelection = event.target.value;
2634
+ *
2635
+ * // registering the selection of current checkbox
2636
+ * this._rangeSelector.onRangeElementToggled(idx, event);
2637
+ *
2638
+ * // Apply value to each element in range.
2639
+ * // If checkbox was toggled without shift pressed or without previously selected one,
2640
+ * // this method will select only it.
2641
+ * this._rangeSelector.applyValueToEachInRange(idx => {
2642
+ * if (toggledSelection) {
2643
+ * this.selectionModel.select(options[idx]);
2644
+ * } else {
2645
+ * this.selectionModel.deselect(options[idx]);
2646
+ * }
2647
+ * });
2648
+ * }
2649
+ * }
2650
+ * ```
2651
+ */
2652
+ class RangeSelector {
2653
+ constructor() {
2654
+ /** @hidden */
2655
+ this._previousSelectedIndex = null;
2656
+ }
2657
+ /**
2658
+ * Last registered selection state (either multiple or single).
2659
+ * Is updated on each `onRangeElementClicked` invokation. Will be `null` initially or once `reset()` is called.
2660
+ */
2661
+ get lastRangeSelectionState() {
2662
+ return this._state ? { ...this._state } : null;
2663
+ }
2664
+ /**
2665
+ * The method that should be used to register each checkbox toggle.
2666
+ * Accepts two arguments: `index` and `event`. If none provided, will reset existing state.
2667
+ * Otherwise will register current index as last checked.
2668
+ *
2669
+ * If toggling was done with "shift" pressed and there's a previously registered index, will register a range selection.
2670
+ * At the same time if checkbox was toggled without shift pressed or without previously selected one, this method will select only it.
2671
+ *
2672
+ * After calling this method it's recommended to use `applyValueToEachInRange` to actually toggle each checkbox in range.
2673
+ *
2674
+ * See usage example on this class itself.
2675
+ */
2676
+ onRangeElementToggled(index, event) {
2677
+ if (this._isNonNegativeInteger(this._previousSelectedIndex) &&
2678
+ this._isNonNegativeInteger(index) &&
2679
+ event?.shiftKey) {
2680
+ this._state = {
2681
+ isRangeSelection: true,
2682
+ from: Math.min(this._previousSelectedIndex, index),
2683
+ to: Math.max(this._previousSelectedIndex, index)
2684
+ };
2685
+ this._previousSelectedIndex = index;
2686
+ }
2687
+ else if (this._isNonNegativeInteger(index)) {
2688
+ this._state = { isRangeSelection: false, from: index, to: index };
2689
+ this._previousSelectedIndex = index;
2690
+ }
2691
+ else {
2692
+ this.reset();
2693
+ }
2694
+ return this.lastRangeSelectionState;
2695
+ }
2696
+ /**
2697
+ * Allows to apply selection to each item in selection range.
2698
+ * Accepts a function to apply selection to each item by registered index.
2699
+ *
2700
+ * See usage example on this class itself.
2701
+ */
2702
+ applyValueToEachInRange(selectionMethod) {
2703
+ const state = this.lastRangeSelectionState;
2704
+ if (this._isNonNegativeInteger(state?.from) && this._isNonNegativeInteger(state.to)) {
2705
+ for (let index = state.from; index <= state.to; index++) {
2706
+ selectionMethod(index);
2707
+ }
2708
+ }
2709
+ }
2710
+ /** Resets selection state. Useful when the list of selectable items is changed (e.g. by filtering, sorting, page change) */
2711
+ reset() {
2712
+ this._state = null;
2713
+ this._previousSelectedIndex = null;
2714
+ }
2715
+ /** @hidden */
2716
+ _isNonNegativeInteger(num) {
2717
+ return Number.isInteger(num) && num >= 0;
2718
+ }
2719
+ }
2720
+
2608
2721
  var ContentDensityEnum;
2609
2722
  (function (ContentDensityEnum) {
2610
2723
  ContentDensityEnum["COMPACT"] = "compact";
@@ -2989,5 +3102,5 @@ function applyMixins(derivedCtor, baseCtors) {
2989
3102
  * Generated bundle index. Do not edit.
2990
3103
  */
2991
3104
 
2992
- export { ANY_LANGUAGE_LETTERS_GROUP_REGEX, ANY_LANGUAGE_LETTERS_REGEX, AbstractFdNgxClass, AutoCompleteDirective, AutoCompleteModule, ContentDensityEnum, ContentDensityService, DECIMAL_NUMBER_UNICODE_GROUP_REGEX, DECIMAL_NUMBER_UNICODE_RANGE, DECIMAL_NUMBER_UNICODE_REGEX, DEFAULT_CONTENT_DENSITY, DefaultTruncateCharCount, DisplayFnPipe, DndItemDirective, DndKeyboardGroupDirective, DndKeyboardItemDirective, DndListDirective, DragAndDropModule, DynamicComponentContainer, DynamicComponentInjector, DynamicComponentService, ELEMENT_REF_EXCEPTION, FocusKeyManagerHelpersModule, FocusKeyManagerItemDirective, FocusKeyManagerListDirective, FocusTrapService, INVALID_DATE_ERROR, InitialFocusDirective, InitialFocusModule, IsCompactDensityPipe, KeyUtil, KeyboardSupportService, LETTERS_UNICODE_RANGE, LIST_ITEM_COMPONENT, LineClampDirective, LineClampModule, LineClampTargetDirective, ListGroupPipe, MOBILE_CONFIG_ERROR, OVERFLOW_PRIORITY_SCORE, OnlyDigitsDirective, OnlyDigitsModule, OverflowListDirective, OverflowListItemDirective, OverflowListModule, PipeModule, RTL_LANGUAGE, ResizeDirective, ResizeHandleDirective, ResizeModule, RtlService, SafePipe, SearchHighlightPipe, THEME_SWITCHER_ROUTER_MISSING_ERROR, TemplateDirective, TemplateModule, ThemesService, TruncateDirective, TruncateModule, TwoDigitsPipe, UtilsModule, ValueByPathPipe, applyCssClass, applyCssStyle, applyMixins, getElementCapacity, getElementWidth, getRandomColorAccent, intersectionObservable, isCompactDensity, isValidContentDensity, parserFileSize, pxToNum, resizeObservable, scrollTop, toNativeElement, uuidv4 };
3105
+ export { ANY_LANGUAGE_LETTERS_GROUP_REGEX, ANY_LANGUAGE_LETTERS_REGEX, AbstractFdNgxClass, AutoCompleteDirective, AutoCompleteModule, ContentDensityEnum, ContentDensityService, DECIMAL_NUMBER_UNICODE_GROUP_REGEX, DECIMAL_NUMBER_UNICODE_RANGE, DECIMAL_NUMBER_UNICODE_REGEX, DEFAULT_CONTENT_DENSITY, DefaultTruncateCharCount, DisplayFnPipe, DndItemDirective, DndKeyboardGroupDirective, DndKeyboardItemDirective, DndListDirective, DragAndDropModule, DynamicComponentContainer, DynamicComponentInjector, DynamicComponentService, ELEMENT_REF_EXCEPTION, FocusKeyManagerHelpersModule, FocusKeyManagerItemDirective, FocusKeyManagerListDirective, FocusTrapService, INVALID_DATE_ERROR, InitialFocusDirective, InitialFocusModule, IsCompactDensityPipe, KeyUtil, KeyboardSupportService, LETTERS_UNICODE_RANGE, LIST_ITEM_COMPONENT, LineClampDirective, LineClampModule, LineClampTargetDirective, ListGroupPipe, MOBILE_CONFIG_ERROR, OVERFLOW_PRIORITY_SCORE, OnlyDigitsDirective, OnlyDigitsModule, OverflowListDirective, OverflowListItemDirective, OverflowListModule, PipeModule, RTL_LANGUAGE, RangeSelector, ResizeDirective, ResizeHandleDirective, ResizeModule, RtlService, SafePipe, SearchHighlightPipe, THEME_SWITCHER_ROUTER_MISSING_ERROR, TemplateDirective, TemplateModule, ThemesService, TruncateDirective, TruncateModule, TwoDigitsPipe, UtilsModule, ValueByPathPipe, applyCssClass, applyCssStyle, applyMixins, getElementCapacity, getElementWidth, getRandomColorAccent, intersectionObservable, isCompactDensity, isValidContentDensity, parserFileSize, pxToNum, resizeObservable, scrollTop, toNativeElement, uuidv4 };
2993
3106
  //# sourceMappingURL=fundamental-ngx-core-utils.mjs.map