selective-ui 1.0.2 → 1.0.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 (67) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -2
  3. package/dist/selective-ui.css +567 -567
  4. package/dist/selective-ui.css.map +1 -1
  5. package/dist/selective-ui.esm.js +6186 -6047
  6. package/dist/selective-ui.esm.js.map +1 -1
  7. package/dist/selective-ui.esm.min.js +1 -1
  8. package/dist/selective-ui.esm.min.js.br +0 -0
  9. package/dist/selective-ui.min.js +2 -2
  10. package/dist/selective-ui.min.js.br +0 -0
  11. package/dist/selective-ui.umd.js +6186 -6047
  12. package/dist/selective-ui.umd.js.map +1 -1
  13. package/package.json +68 -68
  14. package/src/css/components/accessorybox.css +63 -63
  15. package/src/css/components/directive.css +19 -19
  16. package/src/css/components/empty-state.css +25 -25
  17. package/src/css/components/loading-state.css +25 -25
  18. package/src/css/components/optgroup.css +61 -61
  19. package/src/css/components/option-handle.css +33 -33
  20. package/src/css/components/option.css +129 -129
  21. package/src/css/components/placeholder.css +14 -14
  22. package/src/css/components/popup.css +38 -38
  23. package/src/css/components/searchbox.css +28 -28
  24. package/src/css/components/selectbox.css +53 -53
  25. package/src/css/index.css +74 -74
  26. package/src/js/adapter/mixed-adapter.js +434 -434
  27. package/src/js/components/accessorybox.js +124 -124
  28. package/src/js/components/directive.js +37 -37
  29. package/src/js/components/empty-state.js +67 -67
  30. package/src/js/components/loading-state.js +59 -59
  31. package/src/js/components/option-handle.js +113 -113
  32. package/src/js/components/placeholder.js +56 -56
  33. package/src/js/components/popup.js +470 -470
  34. package/src/js/components/searchbox.js +167 -167
  35. package/src/js/components/selectbox.js +749 -692
  36. package/src/js/core/base/adapter.js +162 -162
  37. package/src/js/core/base/model.js +59 -59
  38. package/src/js/core/base/recyclerview.js +82 -82
  39. package/src/js/core/base/view.js +62 -62
  40. package/src/js/core/model-manager.js +286 -286
  41. package/src/js/core/search-controller.js +603 -521
  42. package/src/js/index.js +136 -136
  43. package/src/js/models/group-model.js +142 -142
  44. package/src/js/models/option-model.js +236 -236
  45. package/src/js/services/dataset-observer.js +73 -73
  46. package/src/js/services/ea-observer.js +87 -87
  47. package/src/js/services/effector.js +403 -403
  48. package/src/js/services/refresher.js +39 -39
  49. package/src/js/services/resize-observer.js +151 -151
  50. package/src/js/services/select-observer.js +60 -60
  51. package/src/js/types/adapter.type.js +32 -32
  52. package/src/js/types/effector.type.js +23 -23
  53. package/src/js/types/ievents.type.js +10 -10
  54. package/src/js/types/libs.type.js +27 -27
  55. package/src/js/types/model.type.js +11 -11
  56. package/src/js/types/recyclerview.type.js +11 -11
  57. package/src/js/types/resize-observer.type.js +18 -18
  58. package/src/js/types/view.group.type.js +12 -12
  59. package/src/js/types/view.option.type.js +14 -14
  60. package/src/js/types/view.type.js +10 -10
  61. package/src/js/utils/guard.js +46 -46
  62. package/src/js/utils/ievents.js +83 -83
  63. package/src/js/utils/istorage.js +60 -60
  64. package/src/js/utils/libs.js +618 -618
  65. package/src/js/utils/selective.js +385 -385
  66. package/src/js/views/group-view.js +102 -102
  67. package/src/js/views/option-view.js +152 -152
@@ -1,114 +1,114 @@
1
- import { iEvents } from "../utils/ievents.js";
2
- import {Libs} from "../utils/libs.js";
3
-
4
- /**
5
- * @class
6
- */
7
- export class OptionHandle {
8
- nodeMounted;
9
- /**
10
- * @type {HTMLDivElement}
11
- */
12
- node;
13
-
14
- options = null;
15
-
16
- /** @type {Function[]} */
17
- #ActionOnSelectAll = [];
18
-
19
- /** @type {Function[]} */
20
- #ActionOnDeSelectAll = [];
21
-
22
- /**
23
- * Represents an option handle component that provides "Select All" and "Deselect All" actions
24
- * for multiple-selection lists. Includes methods to show/hide the handle, refresh its visibility,
25
- * and register callbacks for select/deselect events.
26
- */
27
- constructor(options = null) {
28
- if (options) {
29
- this.init(options);
30
- }
31
- }
32
-
33
- /**
34
- * Initializes the option handle UI with "Select All" and "Deselect All" buttons,
35
- * wiring their click events to trigger registered callbacks.
36
- *
37
- * @param {object} options - Configuration object containing text labels and feature flags.
38
- */
39
- init(options) {
40
- this.nodeMounted = Libs.mountNode({
41
- OptionHandle: {
42
- tag: {node: "div", classList: ["selective-ui-option-handle", "hide"]},
43
- child: {
44
- SelectAll: {
45
- tag: {node: "a", classList: "selective-ui-option-handle-item", textContent: options.textSelectAll, onclick: () => {
46
- iEvents.callFunctions(this.#ActionOnSelectAll);
47
- }}
48
- },
49
- DeSelectAll: {
50
- tag: {node: "a", classList: "selective-ui-option-handle-item", textContent: options.textDeselectAll, onclick: () => {
51
- iEvents.callFunctions(this.#ActionOnDeSelectAll);
52
- }}
53
- }
54
- }
55
- }
56
- });
57
- this.node = this.nodeMounted.view;
58
- this.options = options;
59
- }
60
-
61
- /**
62
- * Determines whether the option handle should be available based on configuration.
63
- *
64
- * @returns {boolean} - True if multiple selection and select-all features are enabled.
65
- */
66
- available() {
67
- return Libs.string2Boolean(this.options.multiple) && Libs.string2Boolean(this.options.selectall);
68
- }
69
-
70
- /**
71
- * Refreshes the visibility of the option handle based on availability.
72
- * Shows the handle if available; hides it otherwise.
73
- */
74
- refresh() {
75
- if (this.available()) {
76
- this.show();
77
- }
78
- else {
79
- this.hide();
80
- }
81
- }
82
-
83
- /**
84
- * Makes the option handle visible by removing the "hide" class.
85
- */
86
- show() {
87
- this.node.classList.remove("hide");
88
- }
89
-
90
- /**
91
- * Hides the option handle by adding the "hide" class.
92
- */
93
- hide() {
94
- this.node.classList.add("hide");
95
- }
96
-
97
- /**
98
- * Registers a callback to be executed when "Select All" is clicked.
99
- *
100
- * @param {Function|null} action - The function to call on select-all action.
101
- */
102
- OnSelectAll(action = null) {
103
- this.#ActionOnSelectAll.push(action);
104
- }
105
-
106
- /**
107
- * Registers a callback to be executed when "Deselect All" is clicked.
108
- *
109
- * @param {Function|null} action - The function to call on deselect-all action.
110
- */
111
- OnDeSelectAll(action = null) {
112
- this.#ActionOnDeSelectAll.push(action);
113
- }
1
+ import { iEvents } from "../utils/ievents.js";
2
+ import {Libs} from "../utils/libs.js";
3
+
4
+ /**
5
+ * @class
6
+ */
7
+ export class OptionHandle {
8
+ nodeMounted;
9
+ /**
10
+ * @type {HTMLDivElement}
11
+ */
12
+ node;
13
+
14
+ options = null;
15
+
16
+ /** @type {Function[]} */
17
+ #ActionOnSelectAll = [];
18
+
19
+ /** @type {Function[]} */
20
+ #ActionOnDeSelectAll = [];
21
+
22
+ /**
23
+ * Represents an option handle component that provides "Select All" and "Deselect All" actions
24
+ * for multiple-selection lists. Includes methods to show/hide the handle, refresh its visibility,
25
+ * and register callbacks for select/deselect events.
26
+ */
27
+ constructor(options = null) {
28
+ if (options) {
29
+ this.init(options);
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Initializes the option handle UI with "Select All" and "Deselect All" buttons,
35
+ * wiring their click events to trigger registered callbacks.
36
+ *
37
+ * @param {object} options - Configuration object containing text labels and feature flags.
38
+ */
39
+ init(options) {
40
+ this.nodeMounted = Libs.mountNode({
41
+ OptionHandle: {
42
+ tag: {node: "div", classList: ["selective-ui-option-handle", "hide"]},
43
+ child: {
44
+ SelectAll: {
45
+ tag: {node: "a", classList: "selective-ui-option-handle-item", textContent: options.textSelectAll, onclick: () => {
46
+ iEvents.callFunctions(this.#ActionOnSelectAll);
47
+ }}
48
+ },
49
+ DeSelectAll: {
50
+ tag: {node: "a", classList: "selective-ui-option-handle-item", textContent: options.textDeselectAll, onclick: () => {
51
+ iEvents.callFunctions(this.#ActionOnDeSelectAll);
52
+ }}
53
+ }
54
+ }
55
+ }
56
+ });
57
+ this.node = this.nodeMounted.view;
58
+ this.options = options;
59
+ }
60
+
61
+ /**
62
+ * Determines whether the option handle should be available based on configuration.
63
+ *
64
+ * @returns {boolean} - True if multiple selection and select-all features are enabled.
65
+ */
66
+ available() {
67
+ return Libs.string2Boolean(this.options.multiple) && Libs.string2Boolean(this.options.selectall);
68
+ }
69
+
70
+ /**
71
+ * Refreshes the visibility of the option handle based on availability.
72
+ * Shows the handle if available; hides it otherwise.
73
+ */
74
+ refresh() {
75
+ if (this.available()) {
76
+ this.show();
77
+ }
78
+ else {
79
+ this.hide();
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Makes the option handle visible by removing the "hide" class.
85
+ */
86
+ show() {
87
+ this.node.classList.remove("hide");
88
+ }
89
+
90
+ /**
91
+ * Hides the option handle by adding the "hide" class.
92
+ */
93
+ hide() {
94
+ this.node.classList.add("hide");
95
+ }
96
+
97
+ /**
98
+ * Registers a callback to be executed when "Select All" is clicked.
99
+ *
100
+ * @param {Function|null} action - The function to call on select-all action.
101
+ */
102
+ OnSelectAll(action = null) {
103
+ this.#ActionOnSelectAll.push(action);
104
+ }
105
+
106
+ /**
107
+ * Registers a callback to be executed when "Deselect All" is clicked.
108
+ *
109
+ * @param {Function|null} action - The function to call on deselect-all action.
110
+ */
111
+ OnDeSelectAll(action = null) {
112
+ this.#ActionOnDeSelectAll.push(action);
113
+ }
114
114
  }
@@ -1,57 +1,57 @@
1
- import {Libs} from "../utils/libs.js";
2
-
3
- /**
4
- * @class
5
- */
6
- export class PlaceHolder {
7
- /**
8
- * Represents a placeholder component for the Select UI, allowing dynamic updates to placeholder text.
9
- * Supports HTML content based on configuration and provides methods to get or set the placeholder value.
10
- */
11
- constructor(options) {
12
- options && this.init(options);
13
- }
14
-
15
- /**
16
- * @type {Element}
17
- */
18
- node = null;
19
-
20
- #options = null;
21
-
22
- /**
23
- * Initializes the placeholder element with provided options and renders its initial content.
24
- *
25
- * @param {object} options - Configuration object containing placeholder text and HTML allowance.
26
- */
27
- init(options) {
28
- this.node = Libs.nodeCreator({
29
- node: "div", classList: "selective-ui-placeholder", innerHTML: options.placeholder
30
- });
31
- this.#options = options;
32
- }
33
-
34
- /**
35
- * Retrieves the current placeholder text from the configuration.
36
- *
37
- * @returns {string} - The current placeholder text.
38
- */
39
- get() {
40
- return this.#options.placeholder
41
- }
42
-
43
- /**
44
- * Updates the placeholder text and optionally saves it to the configuration.
45
- * Applies HTML sanitization based on the allowHtml setting.
46
- *
47
- * @param {string} value - The new placeholder text.
48
- * @param {boolean} [isSave=true] - Whether to persist the new value in the configuration.
49
- */
50
- set(value, isSave = true) {
51
- if (isSave) {
52
- this.#options.placeholder = value;
53
- }
54
- value = Libs.tagTranslate(value);
55
- this.node.innerHTML = this.#options.allowHtml ? value : Libs.stripHtml(value);
56
- }
1
+ import {Libs} from "../utils/libs.js";
2
+
3
+ /**
4
+ * @class
5
+ */
6
+ export class PlaceHolder {
7
+ /**
8
+ * Represents a placeholder component for the Select UI, allowing dynamic updates to placeholder text.
9
+ * Supports HTML content based on configuration and provides methods to get or set the placeholder value.
10
+ */
11
+ constructor(options) {
12
+ options && this.init(options);
13
+ }
14
+
15
+ /**
16
+ * @type {Element}
17
+ */
18
+ node = null;
19
+
20
+ #options = null;
21
+
22
+ /**
23
+ * Initializes the placeholder element with provided options and renders its initial content.
24
+ *
25
+ * @param {object} options - Configuration object containing placeholder text and HTML allowance.
26
+ */
27
+ init(options) {
28
+ this.node = Libs.nodeCreator({
29
+ node: "div", classList: "selective-ui-placeholder", innerHTML: options.placeholder
30
+ });
31
+ this.#options = options;
32
+ }
33
+
34
+ /**
35
+ * Retrieves the current placeholder text from the configuration.
36
+ *
37
+ * @returns {string} - The current placeholder text.
38
+ */
39
+ get() {
40
+ return this.#options.placeholder
41
+ }
42
+
43
+ /**
44
+ * Updates the placeholder text and optionally saves it to the configuration.
45
+ * Applies HTML sanitization based on the allowHtml setting.
46
+ *
47
+ * @param {string} value - The new placeholder text.
48
+ * @param {boolean} [isSave=true] - Whether to persist the new value in the configuration.
49
+ */
50
+ set(value, isSave = true) {
51
+ if (isSave) {
52
+ this.#options.placeholder = value;
53
+ }
54
+ value = Libs.tagTranslate(value);
55
+ this.node.innerHTML = this.#options.allowHtml ? value : Libs.stripHtml(value);
56
+ }
57
57
  }