@pumpkin-tech/pumpkin-tech-ng 0.2.11 → 0.2.13
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.
|
@@ -119,6 +119,9 @@ class PtechGridDirective {
|
|
|
119
119
|
this.destroy$.next();
|
|
120
120
|
this.destroy$.complete();
|
|
121
121
|
}
|
|
122
|
+
ngOnChanges(_) {
|
|
123
|
+
this.updateCols();
|
|
124
|
+
}
|
|
122
125
|
pickActive(bps) {
|
|
123
126
|
const order = ['xl', 'lg', 'md', 'sm', 'xs']; // prioridade do maior pro menor
|
|
124
127
|
for (const key of order)
|
|
@@ -155,7 +158,7 @@ class PtechGridDirective {
|
|
|
155
158
|
return Number.isFinite(n) ? n : fallback;
|
|
156
159
|
}
|
|
157
160
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechGridDirective, deps: [{ token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Directive });
|
|
158
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: PtechGridDirective, isStandalone: true, selector: "[ptechGrid]", inputs: { ptechCols: "ptechCols", ptechColsXs: "ptechColsXs", ptechColsSm: "ptechColsSm", ptechColsMd: "ptechColsMd", ptechColsLg: "ptechColsLg", ptechColsXl: "ptechColsXl", ptechGap: "ptechGap", ptechVertical: "ptechVertical" }, host: { properties: { "style.gap": "this.gapCss", "style.display": "this.display", "style.gridTemplateColumns": "this.columns" } }, ngImport: i0 });
|
|
161
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: PtechGridDirective, isStandalone: true, selector: "[ptechGrid]", inputs: { ptechCols: "ptechCols", ptechColsXs: "ptechColsXs", ptechColsSm: "ptechColsSm", ptechColsMd: "ptechColsMd", ptechColsLg: "ptechColsLg", ptechColsXl: "ptechColsXl", ptechGap: "ptechGap", ptechVertical: "ptechVertical" }, host: { properties: { "style.gap": "this.gapCss", "style.display": "this.display", "style.gridTemplateColumns": "this.columns" } }, usesOnChanges: true, ngImport: i0 });
|
|
159
162
|
}
|
|
160
163
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechGridDirective, decorators: [{
|
|
161
164
|
type: Directive,
|
|
@@ -221,8 +224,6 @@ class PtechColDirective {
|
|
|
221
224
|
ptechColLg;
|
|
222
225
|
ptechColXl;
|
|
223
226
|
activeBp = null;
|
|
224
|
-
viewportBp = null;
|
|
225
|
-
containerBp = null;
|
|
226
227
|
activeSource = null;
|
|
227
228
|
gridColumn = 'auto / span 12';
|
|
228
229
|
minWidth = '0';
|
|
@@ -236,14 +237,7 @@ class PtechColDirective {
|
|
|
236
237
|
.subscribe(s => {
|
|
237
238
|
if (this.ptechColMode === 'container')
|
|
238
239
|
return;
|
|
239
|
-
this.
|
|
240
|
-
if (this.ptechColMode === 'auto') {
|
|
241
|
-
this.activeBp = this.pickAutoBp();
|
|
242
|
-
this.activeSource = this.containerBp ? 'container' : 'viewport';
|
|
243
|
-
this.updateSpan();
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
this.activeBp = this.viewportBp;
|
|
240
|
+
this.activeBp = this.pickActive(s.breakpoints);
|
|
247
241
|
this.activeSource = 'viewport';
|
|
248
242
|
this.updateSpan();
|
|
249
243
|
});
|
|
@@ -265,23 +259,15 @@ class PtechColDirective {
|
|
|
265
259
|
: w >= 960 ? 'md'
|
|
266
260
|
: w >= 600 ? 'sm'
|
|
267
261
|
: 'xs';
|
|
268
|
-
this.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (nextBp !== this.activeBp || this.activeSource !== 'container') {
|
|
273
|
-
this.activeBp = nextBp;
|
|
274
|
-
this.activeSource = 'container';
|
|
275
|
-
this.updateSpan();
|
|
276
|
-
}
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (this.ptechColMode === 'container' && (bp !== this.activeBp || this.activeSource !== 'container')) {
|
|
262
|
+
if (this.ptechColMode !== 'container')
|
|
263
|
+
return;
|
|
264
|
+
if (bp !== this.activeBp || this.activeSource !== 'container') {
|
|
265
|
+
this.ngZone.run(() => {
|
|
280
266
|
this.activeBp = bp;
|
|
281
267
|
this.activeSource = 'container';
|
|
282
268
|
this.updateSpan();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
285
271
|
});
|
|
286
272
|
});
|
|
287
273
|
this.ro.observe(gridParent);
|
|
@@ -293,6 +279,9 @@ class PtechColDirective {
|
|
|
293
279
|
this.destroy$.next();
|
|
294
280
|
this.destroy$.complete();
|
|
295
281
|
}
|
|
282
|
+
ngOnChanges(_) {
|
|
283
|
+
this.updateSpan();
|
|
284
|
+
}
|
|
296
285
|
findGridParent(el) {
|
|
297
286
|
let p = el.parentElement;
|
|
298
287
|
while (p) {
|
|
@@ -310,14 +299,6 @@ class PtechColDirective {
|
|
|
310
299
|
return key;
|
|
311
300
|
return null;
|
|
312
301
|
}
|
|
313
|
-
pickAutoBp() {
|
|
314
|
-
const rank = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4 };
|
|
315
|
-
if (!this.viewportBp)
|
|
316
|
-
return this.containerBp;
|
|
317
|
-
if (!this.containerBp)
|
|
318
|
-
return this.viewportBp;
|
|
319
|
-
return rank[this.viewportBp] <= rank[this.containerBp] ? this.viewportBp : this.containerBp;
|
|
320
|
-
}
|
|
321
302
|
updateSpan() {
|
|
322
303
|
const span = this.resolveColForBp();
|
|
323
304
|
if (span === this.lastSpan)
|
|
@@ -356,7 +337,7 @@ class PtechColDirective {
|
|
|
356
337
|
return Number.isFinite(n) ? n : fallback;
|
|
357
338
|
}
|
|
358
339
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechColDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Directive });
|
|
359
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: PtechColDirective, isStandalone: true, selector: "[ptechCol]", inputs: { ptechColMode: "ptechColMode", ptechCol: "ptechCol", ptechColXs: "ptechColXs", ptechColSm: "ptechColSm", ptechColMd: "ptechColMd", ptechColLg: "ptechColLg", ptechColXl: "ptechColXl" }, host: { properties: { "style.gridColumn": "this.gridColumn", "style.minWidth": "this.minWidth" } }, ngImport: i0 });
|
|
340
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: PtechColDirective, isStandalone: true, selector: "[ptechCol]", inputs: { ptechColMode: "ptechColMode", ptechCol: "ptechCol", ptechColXs: "ptechColXs", ptechColSm: "ptechColSm", ptechColMd: "ptechColMd", ptechColLg: "ptechColLg", ptechColXl: "ptechColXl" }, host: { properties: { "style.gridColumn": "this.gridColumn", "style.minWidth": "this.minWidth" } }, usesOnChanges: true, ngImport: i0 });
|
|
360
341
|
}
|
|
361
342
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PtechColDirective, decorators: [{
|
|
362
343
|
type: Directive,
|