@supersoniks/concorde 3.1.10 → 3.1.12
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/build-infos.json +1 -1
- package/concorde-core.bundle.js +133 -132
- package/concorde-core.es.js +619 -601
- package/dist/concorde-core.bundle.js +133 -132
- package/dist/concorde-core.es.js +619 -601
- package/package.json +1 -1
- package/src/core/components/functional/queue/queue.ts +5 -3
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +21 -6
- package/src/core/components/ui/pop/pop.ts +3 -1
- package/src/core/directives/DataProvider.ts +11 -6
- package/src/core/mixins/FormElement.ts +4 -0
- package/src/core/utils/Objects.ts +13 -4
package/package.json
CHANGED
|
@@ -52,6 +52,8 @@ export default class Queue extends Subscriber(LitElement, {} as QueueProps) {
|
|
|
52
52
|
@property() resultCount = 0;
|
|
53
53
|
@property({ type: Boolean }) noLazyload = false;
|
|
54
54
|
|
|
55
|
+
@property({ type: String }) loader = "inline";
|
|
56
|
+
|
|
55
57
|
@property() filteredFields = "";
|
|
56
58
|
disconnectedCallback() {
|
|
57
59
|
for (const dataProvider of this.listDataProviders) {
|
|
@@ -214,11 +216,11 @@ export default class Queue extends Subscriber(LitElement, {} as QueueProps) {
|
|
|
214
216
|
if (e) {
|
|
215
217
|
this.publisher.lastFetchedData = e.detail.fetchedData;
|
|
216
218
|
if (e.detail.requestId < this.requestId) return;
|
|
217
|
-
this.resultCount += e.detail.props
|
|
219
|
+
this.resultCount += e.detail.props?.length || 0;
|
|
218
220
|
|
|
219
221
|
if (
|
|
220
222
|
!e.detail.isFirstLoad ||
|
|
221
|
-
!e.detail.props
|
|
223
|
+
!e.detail.props?.length ||
|
|
222
224
|
this.dataProviderExpression.indexOf("$offset") == -1
|
|
223
225
|
) {
|
|
224
226
|
this.publisher.resultCount = this.resultCount;
|
|
@@ -298,7 +300,7 @@ export default class Queue extends Subscriber(LitElement, {} as QueueProps) {
|
|
|
298
300
|
return html`
|
|
299
301
|
<sonic-list
|
|
300
302
|
fetch
|
|
301
|
-
loader="
|
|
303
|
+
loader="${this.loader}"
|
|
302
304
|
cache=${this.cache}
|
|
303
305
|
displayContents
|
|
304
306
|
lazyBoundsRatio=${this.lazyBoundsRatio}
|
|
@@ -59,6 +59,7 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
59
59
|
@property({ type: Boolean }) readonly: boolean | null = null;
|
|
60
60
|
|
|
61
61
|
@property({ type: String }) dataProviderExpression = "";
|
|
62
|
+
@property({ type: Number }) minSearchLength = 0;
|
|
62
63
|
@property({ type: Boolean }) select?: boolean;
|
|
63
64
|
@property({ type: String }) key = "";
|
|
64
65
|
/** The parameter name to use in dataProviderExpression route */
|
|
@@ -72,6 +73,8 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
72
73
|
@state() hasInputPrefix = false;
|
|
73
74
|
_resizeController = new ResizeController(this, {});
|
|
74
75
|
|
|
76
|
+
@state() isPopVisible = false;
|
|
77
|
+
|
|
75
78
|
/**
|
|
76
79
|
* Les dataProviders
|
|
77
80
|
*/
|
|
@@ -100,7 +103,6 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
100
103
|
private updateSearchParameter = (value: string) => {
|
|
101
104
|
if (value == "") {
|
|
102
105
|
this.lastValidSearch = "";
|
|
103
|
-
|
|
104
106
|
return;
|
|
105
107
|
}
|
|
106
108
|
const found = this.queryQueueListItem(
|
|
@@ -116,6 +118,10 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
116
118
|
}
|
|
117
119
|
};
|
|
118
120
|
|
|
121
|
+
private updatePopContentVisibility = (value: string) => {
|
|
122
|
+
this.isPopVisible = (value?.length || 0) >= this.minSearchLength;
|
|
123
|
+
};
|
|
124
|
+
|
|
119
125
|
private initSearchParameter = () => {
|
|
120
126
|
this.queryQueueListItem(
|
|
121
127
|
this.initQueueDataProvider,
|
|
@@ -133,8 +139,6 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
133
139
|
};
|
|
134
140
|
|
|
135
141
|
private findSearchedItem = (listItem: ListItem) => {
|
|
136
|
-
console.log(this.propertyName);
|
|
137
|
-
|
|
138
142
|
const value =
|
|
139
143
|
this.propertyName === "_self"
|
|
140
144
|
? listItem
|
|
@@ -174,8 +178,12 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
174
178
|
};
|
|
175
179
|
|
|
176
180
|
connectedCallback() {
|
|
181
|
+
console.log(this.value, this.getAttribute("value"));
|
|
182
|
+
|
|
177
183
|
super.connectedCallback();
|
|
178
184
|
|
|
185
|
+
console.log(this.value, this.getAttribute("value"));
|
|
186
|
+
|
|
179
187
|
/**
|
|
180
188
|
* Nom de la valeur de recherche
|
|
181
189
|
* Si non défini, on utilise name
|
|
@@ -225,6 +233,8 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
225
233
|
* et qu'elle est différente de la derniere recherche valide on désactive la selection
|
|
226
234
|
*/
|
|
227
235
|
this.countPublisher?.onAssign(this.updateActiveSelection);
|
|
236
|
+
|
|
237
|
+
this.searchPublisher?.onAssign(this.updatePopContentVisibility);
|
|
228
238
|
}
|
|
229
239
|
|
|
230
240
|
disconnectedCallback() {
|
|
@@ -237,6 +247,8 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
237
247
|
getPublisher(this.initQueueDataProvider).delete();
|
|
238
248
|
getPublisher(this.searchDataProvider).delete();
|
|
239
249
|
getPublisher(this.queueDataProvider).delete();
|
|
250
|
+
|
|
251
|
+
this.searchPublisher?.offAssign(this.updatePopContentVisibility);
|
|
240
252
|
}
|
|
241
253
|
|
|
242
254
|
/**
|
|
@@ -297,10 +309,11 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
297
309
|
name="${ifDefined(this.searchParameter || this.name)}"
|
|
298
310
|
placeholder="${ifDefined(this.placeholder)}"
|
|
299
311
|
?readonly="${this.readonly}"
|
|
300
|
-
autocomplete="
|
|
312
|
+
autocomplete="${Math.random()}"
|
|
301
313
|
clearable
|
|
302
314
|
inlineContent
|
|
303
315
|
size=${this.size}
|
|
316
|
+
value="${ifDefined(this.searchPublisher?.get() || this.value)}"
|
|
304
317
|
>
|
|
305
318
|
<slot
|
|
306
319
|
name="prefix"
|
|
@@ -322,7 +335,9 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
322
335
|
<sonic-menu
|
|
323
336
|
slot="content"
|
|
324
337
|
class="custom-scroll"
|
|
325
|
-
style="${this.offsetWidth
|
|
338
|
+
style="${this.offsetWidth
|
|
339
|
+
? `width: ${this.offsetWidth}px`
|
|
340
|
+
: ""}; display:${this.isPopVisible ? "block" : "none"};"
|
|
326
341
|
>
|
|
327
342
|
<sonic-queue
|
|
328
343
|
dataProvider="${this.queueDataProvider}"
|
|
@@ -336,7 +351,7 @@ export class InputAutocomplete extends TemplatesContainer(
|
|
|
336
351
|
</sonic-queue>
|
|
337
352
|
<sonic-queue
|
|
338
353
|
noLazyload
|
|
339
|
-
|
|
354
|
+
loader="no-loader"
|
|
340
355
|
dataProvider="${this.initQueueDataProvider}"
|
|
341
356
|
filteredFields=${this.filteredFields}
|
|
342
357
|
dataProviderExpression="${this.dataProviderExpression}"
|
|
@@ -213,13 +213,15 @@ export class Pop extends LitElement {
|
|
|
213
213
|
this.resizeObserver.observe(this.popContent);
|
|
214
214
|
}
|
|
215
215
|
disconnectedCallback(): void {
|
|
216
|
+
if (this.popContent) {
|
|
217
|
+
this.resizeObserver.unobserve(this.popContent);
|
|
218
|
+
}
|
|
216
219
|
super.disconnectedCallback();
|
|
217
220
|
Pop.pops.delete(this);
|
|
218
221
|
if (Pop.pops.size == 0) {
|
|
219
222
|
document.removeEventListener("pointerdown", this._handleClosePop);
|
|
220
223
|
document.removeEventListener("click", this._handleClosePop);
|
|
221
224
|
}
|
|
222
|
-
this.resizeObserver.unobserve(this.popContent);
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
computePosition(placement: PopPlacement) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {AsyncDirective, PartInfo} from "lit/async-directive.js";
|
|
2
|
-
import {directive} from "lit/directive.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { AsyncDirective, PartInfo } from "lit/async-directive.js";
|
|
2
|
+
import { directive } from "lit/directive.js";
|
|
3
|
+
import {
|
|
4
|
+
PublisherManager,
|
|
5
|
+
PublisherProxy,
|
|
6
|
+
} from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
7
|
+
import { noChange } from "lit";
|
|
5
8
|
import Objects from "../utils/Objects";
|
|
6
|
-
import {SearchableDomElement} from "../utils/HTML";
|
|
9
|
+
import { SearchableDomElement } from "../utils/HTML";
|
|
7
10
|
import Publisher from "../utils/PublisherProxy";
|
|
8
11
|
type Observable = PublisherProxy | string | (() => unknown);
|
|
9
12
|
function getObservables(observable: Observable): Set<PublisherProxy> {
|
|
@@ -28,7 +31,9 @@ function getObservables(observable: Observable): Set<PublisherProxy> {
|
|
|
28
31
|
class ObserveDirective extends AsyncDirective {
|
|
29
32
|
observables: Set<PublisherProxy> = new Set();
|
|
30
33
|
unsubscribe(): void {
|
|
31
|
-
this.observables.forEach((publisher: PublisherProxy) =>
|
|
34
|
+
this.observables.forEach((publisher: PublisherProxy) =>
|
|
35
|
+
publisher.offAssign(this.onAssign)
|
|
36
|
+
);
|
|
32
37
|
}
|
|
33
38
|
observable?: Observable;
|
|
34
39
|
node?: SearchableDomElement;
|
|
@@ -157,6 +157,7 @@ const Form = <T extends Constructor<SubscriberInterface>>(superClass: T) => {
|
|
|
157
157
|
)
|
|
158
158
|
value = "";
|
|
159
159
|
if (this._value == value) return;
|
|
160
|
+
if (!value) console.trace(this.name, this._value, value);
|
|
160
161
|
this._value = value;
|
|
161
162
|
this.updateDataValue();
|
|
162
163
|
this.requestUpdate();
|
|
@@ -281,6 +282,9 @@ const Form = <T extends Constructor<SubscriberInterface>>(superClass: T) => {
|
|
|
281
282
|
this.formDataProvider = this.getAncestorAttributeValue(
|
|
282
283
|
"formDataProvider"
|
|
283
284
|
) as string;
|
|
285
|
+
if (this.value) {
|
|
286
|
+
this.setAttribute("value", this.value as string);
|
|
287
|
+
}
|
|
284
288
|
super.connectedCallback();
|
|
285
289
|
this.addKeyboardNavigation();
|
|
286
290
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {TypeAndRecordOfType} from "../_types/types";
|
|
1
|
+
import { TypeAndRecordOfType } from "../_types/types";
|
|
2
2
|
|
|
3
3
|
class Objects {
|
|
4
4
|
/**
|
|
@@ -38,7 +38,10 @@ class Objects {
|
|
|
38
38
|
const val2 = object2[key];
|
|
39
39
|
const areObjects = Objects.isObject(val1) && Objects.isObject(val2);
|
|
40
40
|
const areEqual = useStrictComparaison ? val1 !== val2 : val1 != val2;
|
|
41
|
-
if (
|
|
41
|
+
if (
|
|
42
|
+
(areObjects && !Objects.deepEqual(val1, val2)) ||
|
|
43
|
+
(!areObjects && areEqual)
|
|
44
|
+
) {
|
|
42
45
|
return false;
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -83,13 +86,19 @@ class Objects {
|
|
|
83
86
|
return obj;
|
|
84
87
|
}
|
|
85
88
|
/*eslint-enable @typescript-eslint/no-explicit-any*/
|
|
86
|
-
static getURLSearchArray(
|
|
89
|
+
static getURLSearchArray(
|
|
90
|
+
sourceObject?: TypeAndRecordOfType<string>,
|
|
91
|
+
prefix = ""
|
|
92
|
+
) {
|
|
87
93
|
let arr: string[] = [];
|
|
88
94
|
for (let key in sourceObject) {
|
|
89
95
|
const value = (sourceObject as TypeAndRecordOfType<string>)[key];
|
|
90
96
|
if (prefix) key = prefix + "[" + key + "]";
|
|
91
97
|
if (Objects.isObject(value)) {
|
|
92
|
-
arr = [
|
|
98
|
+
arr = [
|
|
99
|
+
...arr,
|
|
100
|
+
...this.getURLSearchArray(value as TypeAndRecordOfType<string>, key),
|
|
101
|
+
];
|
|
93
102
|
} else {
|
|
94
103
|
arr.push(`${key}=${value}`);
|
|
95
104
|
}
|