selective-ui 1.4.3 → 1.4.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.
- package/dist/selective-ui.esm.js +42 -5
- package/dist/selective-ui.esm.js.map +1 -1
- package/dist/selective-ui.esm.min.js +2 -2
- package/dist/selective-ui.esm.min.js.br +0 -0
- package/dist/selective-ui.min.js +2 -2
- package/dist/selective-ui.min.js.br +0 -0
- package/dist/selective-ui.umd.js +43 -6
- package/dist/selective-ui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/ts/components/accessorybox.ts +39 -4
- package/src/ts/components/selectbox.ts +9 -5
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { MixedAdapter } from "../adapter/mixed-adapter";
|
|
|
2
2
|
import { Lifecycle } from "../core/base/lifecycle";
|
|
3
3
|
import { ModelManager } from "../core/model-manager";
|
|
4
4
|
import { OptionModel } from "../models/option-model";
|
|
5
|
+
import { SelectBoxAction } from "../types/components/searchbox.type";
|
|
5
6
|
import { LifecycleState } from "../types/core/base/lifecycle.type";
|
|
6
7
|
import { MixedItem } from "../types/core/base/mixed-adapter.type";
|
|
7
8
|
import { MountViewResult } from "../types/utils/libs.type";
|
|
@@ -113,6 +114,36 @@ export class AccessoryBox extends Lifecycle {
|
|
|
113
114
|
if (options) this.initialize(options);
|
|
114
115
|
}
|
|
115
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Internal SelectBox action bridge used by the accessory box to communicate
|
|
119
|
+
* with the parent SelectBox instance.
|
|
120
|
+
*
|
|
121
|
+
* This reference is intentionally lightweight and acts as a direct integration
|
|
122
|
+
* point between chip interactions and the main Select component behavior.
|
|
123
|
+
*
|
|
124
|
+
* Current responsibilities:
|
|
125
|
+
* - Read runtime interaction state:
|
|
126
|
+
* - `readonly`
|
|
127
|
+
* - `disabled`
|
|
128
|
+
* - Trigger synchronized change propagation through:
|
|
129
|
+
* - `change(null, true)`
|
|
130
|
+
*
|
|
131
|
+
* Usage flow:
|
|
132
|
+
* - When a chip remove button is clicked:
|
|
133
|
+
* 1) AccessoryBox checks `readonly` / `disabled`
|
|
134
|
+
* 2) Updates `modelData.selectedNonTrigger = false`
|
|
135
|
+
* 3) Delegates the final change pipeline back to the SelectBox instance
|
|
136
|
+
* through `internalInstance.change(...)`
|
|
137
|
+
*
|
|
138
|
+
* Notes:
|
|
139
|
+
* - This property is optional because the AccessoryBox can exist before the
|
|
140
|
+
* parent SelectBox finishes wiring dependencies.
|
|
141
|
+
* - The instance is not owned by AccessoryBox and therefore is not destroyed
|
|
142
|
+
* during {@link destroy}.
|
|
143
|
+
* - Intended for internal framework communication only.
|
|
144
|
+
*/
|
|
145
|
+
public internalInstance?: SelectBoxAction = null;
|
|
146
|
+
|
|
116
147
|
/**
|
|
117
148
|
* Stores options and starts lifecycle initialization.
|
|
118
149
|
*
|
|
@@ -265,6 +296,7 @@ export class AccessoryBox extends Lifecycle {
|
|
|
265
296
|
public setModelData(modelDatas: OptionModel[]): void {
|
|
266
297
|
if (!this.node || !this.options) return;
|
|
267
298
|
this.node.replaceChildren();
|
|
299
|
+
const superThis = this;
|
|
268
300
|
|
|
269
301
|
if (modelDatas.length > 0 && this.options.multiple) {
|
|
270
302
|
modelDatas.forEach((modelData) => {
|
|
@@ -282,10 +314,13 @@ export class AccessoryBox extends Lifecycle {
|
|
|
282
314
|
title: `${this.options!.textAccessoryDeselect}${modelData.textContent}`,
|
|
283
315
|
onclick: async (evt: MouseEvent) => {
|
|
284
316
|
evt.preventDefault();
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
317
|
+
const instance = superThis.internalInstance;
|
|
318
|
+
if (instance.readonly || instance.disabled) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
modelData.selectedNonTrigger = false;
|
|
323
|
+
instance?.change(null, true);
|
|
289
324
|
},
|
|
290
325
|
},
|
|
291
326
|
},
|
|
@@ -132,7 +132,7 @@ export class SelectBox extends Lifecycle {
|
|
|
132
132
|
*
|
|
133
133
|
* @internal
|
|
134
134
|
*/
|
|
135
|
-
private isOpen = false;
|
|
135
|
+
private isOpen: boolean = false;
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* Tracks whether an initial AJAX load has been performed at least once.
|
|
@@ -140,7 +140,7 @@ export class SelectBox extends Lifecycle {
|
|
|
140
140
|
*
|
|
141
141
|
* @internal
|
|
142
142
|
*/
|
|
143
|
-
private hasLoadedOnce = false;
|
|
143
|
+
private hasLoadedOnce: boolean = false;
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Tracks whether the instance is in "pre-search" mode (a search is about to happen).
|
|
@@ -148,7 +148,7 @@ export class SelectBox extends Lifecycle {
|
|
|
148
148
|
*
|
|
149
149
|
* @internal
|
|
150
150
|
*/
|
|
151
|
-
private isBeforeSearch = false;
|
|
151
|
+
private isBeforeSearch: boolean = false;
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
* Tracks whether {@link deInit} has already run.
|
|
@@ -158,7 +158,7 @@ export class SelectBox extends Lifecycle {
|
|
|
158
158
|
*
|
|
159
159
|
* @internal
|
|
160
160
|
*/
|
|
161
|
-
private hasDeInitialized = false;
|
|
161
|
+
private hasDeInitialized: boolean = false;
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Selective context (global helper / registry).
|
|
@@ -227,6 +227,7 @@ export class SelectBox extends Lifecycle {
|
|
|
227
227
|
if (!this.options || !this.node) return;
|
|
228
228
|
this.options.readonly = value;
|
|
229
229
|
this.node.classList.toggle("readonly", value);
|
|
230
|
+
this.node.dataset["readonly"] = String(!!value);
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
/**
|
|
@@ -474,8 +475,11 @@ export class SelectBox extends Lifecycle {
|
|
|
474
475
|
Refresher.resizeBox(select, this.node, true);
|
|
475
476
|
select.classList.add("init");
|
|
476
477
|
|
|
477
|
-
// initial mask
|
|
478
478
|
const action = this.getAction();
|
|
479
|
+
container.accessorybox.internalInstance = action;
|
|
480
|
+
this.oldValue = action.value;
|
|
481
|
+
|
|
482
|
+
// initial mask
|
|
479
483
|
action?.change?.(null, false);
|
|
480
484
|
|
|
481
485
|
if (this.options.preload) {
|