pne-ui 4.3.0 → 4.3.2
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/README.md +29 -6
- package/cjs/component/table/AbstractTable.d.ts +15 -0
- package/cjs/component/table/AbstractTable.js.map +1 -1
- package/cjs/component/table/PneTablePaginationActions.d.ts +0 -15
- package/cjs/component/table/PneTablePaginationActions.js +123 -185
- package/cjs/component/table/PneTablePaginationActions.js.map +1 -1
- package/cjs/component/table/PneTableSelectionControls.js +1 -9
- package/cjs/component/table/PneTableSelectionControls.js.map +1 -1
- package/cjs/component/table/PneTableToolbar.d.ts +0 -9
- package/cjs/component/table/PneTableToolbar.js +28 -100
- package/cjs/component/table/PneTableToolbar.js.map +1 -1
- package/cjs/component/table/measureNaturalWidth.d.ts +21 -0
- package/cjs/component/table/measureNaturalWidth.js +42 -0
- package/cjs/component/table/measureNaturalWidth.js.map +1 -0
- package/esm/component/table/AbstractTable.d.ts +15 -0
- package/esm/component/table/AbstractTable.js.map +1 -1
- package/esm/component/table/PneTablePaginationActions.d.ts +0 -15
- package/esm/component/table/PneTablePaginationActions.js +124 -184
- package/esm/component/table/PneTablePaginationActions.js.map +1 -1
- package/esm/component/table/PneTableSelectionControls.js +1 -9
- package/esm/component/table/PneTableSelectionControls.js.map +1 -1
- package/esm/component/table/PneTableToolbar.d.ts +0 -9
- package/esm/component/table/PneTableToolbar.js +28 -98
- package/esm/component/table/PneTableToolbar.js.map +1 -1
- package/esm/component/table/measureNaturalWidth.d.ts +21 -0
- package/esm/component/table/measureNaturalWidth.js +38 -0
- package/esm/component/table/measureNaturalWidth.js.map +1 -0
- package/package.json +1 -1
- package/cjs/component/table/tableLayoutMeasurement.d.ts +0 -7
- package/cjs/component/table/tableLayoutMeasurement.js +0 -12
- package/cjs/component/table/tableLayoutMeasurement.js.map +0 -1
- package/esm/component/table/tableLayoutMeasurement.d.ts +0 -7
- package/esm/component/table/tableLayoutMeasurement.js +0 -8
- package/esm/component/table/tableLayoutMeasurement.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Width an element needs to lay its content out on a single row.
|
|
3
|
+
*
|
|
4
|
+
* This is deliberately *not* the measurement that made the control bands flap
|
|
5
|
+
* before. That code measured the elements it had just laid out, so the answer
|
|
6
|
+
* described the space the band had already been given and every fit check was
|
|
7
|
+
* self-confirming; with two such bands measuring each other, fractional CSS
|
|
8
|
+
* pixels were enough to start an endless ResizeObserver cycle.
|
|
9
|
+
*
|
|
10
|
+
* A natural width does not depend on the space offered: it is a property of the
|
|
11
|
+
* content alone. A layout decision taken from it therefore cannot feed back into
|
|
12
|
+
* the measurement, which is what lets the bands place their rows from CSS and
|
|
13
|
+
* measure only when their content changes - never on resize.
|
|
14
|
+
*
|
|
15
|
+
* The element is measured in place, by briefly taking it out of flow rather than
|
|
16
|
+
* by cloning it into `document.body`. A clone leaves inherited styles and
|
|
17
|
+
* ancestor selectors behind, so it measures a different element than the one on
|
|
18
|
+
* screen; taken out of flow, the element keeps its own cascade. Callers must run
|
|
19
|
+
* this inside `useLayoutEffect`, where the swap happens before paint.
|
|
20
|
+
*/
|
|
21
|
+
export declare const measureNaturalWidth: (element: HTMLElement | null | undefined) => number;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Width an element needs to lay its content out on a single row.
|
|
3
|
+
*
|
|
4
|
+
* This is deliberately *not* the measurement that made the control bands flap
|
|
5
|
+
* before. That code measured the elements it had just laid out, so the answer
|
|
6
|
+
* described the space the band had already been given and every fit check was
|
|
7
|
+
* self-confirming; with two such bands measuring each other, fractional CSS
|
|
8
|
+
* pixels were enough to start an endless ResizeObserver cycle.
|
|
9
|
+
*
|
|
10
|
+
* A natural width does not depend on the space offered: it is a property of the
|
|
11
|
+
* content alone. A layout decision taken from it therefore cannot feed back into
|
|
12
|
+
* the measurement, which is what lets the bands place their rows from CSS and
|
|
13
|
+
* measure only when their content changes - never on resize.
|
|
14
|
+
*
|
|
15
|
+
* The element is measured in place, by briefly taking it out of flow rather than
|
|
16
|
+
* by cloning it into `document.body`. A clone leaves inherited styles and
|
|
17
|
+
* ancestor selectors behind, so it measures a different element than the one on
|
|
18
|
+
* screen; taken out of flow, the element keeps its own cascade. Callers must run
|
|
19
|
+
* this inside `useLayoutEffect`, where the swap happens before paint.
|
|
20
|
+
*/
|
|
21
|
+
export const measureNaturalWidth = (element) => {
|
|
22
|
+
if (!element) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
const savedCssText = element.style.cssText;
|
|
26
|
+
Object.assign(element.style, {
|
|
27
|
+
left: '-99999px',
|
|
28
|
+
maxWidth: 'none',
|
|
29
|
+
position: 'fixed',
|
|
30
|
+
top: '0',
|
|
31
|
+
visibility: 'hidden',
|
|
32
|
+
width: 'max-content',
|
|
33
|
+
});
|
|
34
|
+
const naturalWidth = element.getBoundingClientRect().width;
|
|
35
|
+
element.style.cssText = savedCssText;
|
|
36
|
+
return naturalWidth;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=measureNaturalWidth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureNaturalWidth.js","sourceRoot":"","sources":["../../../src/component/table/measureNaturalWidth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAuC,EAAU,EAAE;IACnF,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,CAAC,CAAA;IACZ,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAA;IAE1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;QACzB,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,OAAO;QACjB,GAAG,EAAE,GAAG;QACR,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,aAAa;KACvB,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAA;IAE1D,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,YAAY,CAAA;IAEpC,OAAO,YAAY,CAAA;AACvB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSSOM integer measurements such as clientWidth/scrollWidth can disagree with
|
|
3
|
-
* fractional DOMRect widths by less than one CSS pixel. Treat that difference
|
|
4
|
-
* as fitting so nested responsive controls cannot oscillate at a rounding edge.
|
|
5
|
-
*/
|
|
6
|
-
export declare const TABLE_LAYOUT_MEASUREMENT_TOLERANCE = 1;
|
|
7
|
-
export declare const measuredLayoutWidthFits: (requiredWidth: number, availableWidth: number) => boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.measuredLayoutWidthFits = exports.TABLE_LAYOUT_MEASUREMENT_TOLERANCE = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* CSSOM integer measurements such as clientWidth/scrollWidth can disagree with
|
|
6
|
-
* fractional DOMRect widths by less than one CSS pixel. Treat that difference
|
|
7
|
-
* as fitting so nested responsive controls cannot oscillate at a rounding edge.
|
|
8
|
-
*/
|
|
9
|
-
exports.TABLE_LAYOUT_MEASUREMENT_TOLERANCE = 1;
|
|
10
|
-
const measuredLayoutWidthFits = (requiredWidth, availableWidth) => requiredWidth < availableWidth + exports.TABLE_LAYOUT_MEASUREMENT_TOLERANCE;
|
|
11
|
-
exports.measuredLayoutWidthFits = measuredLayoutWidthFits;
|
|
12
|
-
//# sourceMappingURL=tableLayoutMeasurement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableLayoutMeasurement.js","sourceRoot":"","sources":["../../../src/component/table/tableLayoutMeasurement.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,kCAAkC,GAAG,CAAC,CAAA;AAE5C,MAAM,uBAAuB,GAAG,CACnC,aAAqB,EACrB,cAAsB,EACf,EAAE,CAAC,aAAa,GAAG,cAAc,GAAG,0CAAkC,CAAA;AAHpE,QAAA,uBAAuB,2BAG6C"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSSOM integer measurements such as clientWidth/scrollWidth can disagree with
|
|
3
|
-
* fractional DOMRect widths by less than one CSS pixel. Treat that difference
|
|
4
|
-
* as fitting so nested responsive controls cannot oscillate at a rounding edge.
|
|
5
|
-
*/
|
|
6
|
-
export declare const TABLE_LAYOUT_MEASUREMENT_TOLERANCE = 1;
|
|
7
|
-
export declare const measuredLayoutWidthFits: (requiredWidth: number, availableWidth: number) => boolean;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSSOM integer measurements such as clientWidth/scrollWidth can disagree with
|
|
3
|
-
* fractional DOMRect widths by less than one CSS pixel. Treat that difference
|
|
4
|
-
* as fitting so nested responsive controls cannot oscillate at a rounding edge.
|
|
5
|
-
*/
|
|
6
|
-
export const TABLE_LAYOUT_MEASUREMENT_TOLERANCE = 1;
|
|
7
|
-
export const measuredLayoutWidthFits = (requiredWidth, availableWidth) => requiredWidth < availableWidth + TABLE_LAYOUT_MEASUREMENT_TOLERANCE;
|
|
8
|
-
//# sourceMappingURL=tableLayoutMeasurement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableLayoutMeasurement.js","sourceRoot":"","sources":["../../../src/component/table/tableLayoutMeasurement.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAA;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,aAAqB,EACrB,cAAsB,EACf,EAAE,CAAC,aAAa,GAAG,cAAc,GAAG,kCAAkC,CAAA"}
|