pne-ui 4.3.1 → 4.4.0
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/search-ui/SearchUI.js +4 -0
- package/cjs/component/search-ui/SearchUI.js.map +1 -1
- package/cjs/component/search-ui/filters/CriterionContainer.js +3 -0
- package/cjs/component/search-ui/filters/CriterionContainer.js.map +1 -1
- package/cjs/component/search-ui/filters/component/criterion/OtpStatusCriterion.d.ts +2 -0
- package/cjs/component/search-ui/filters/component/criterion/OtpStatusCriterion.js +18 -0
- package/cjs/component/search-ui/filters/component/criterion/OtpStatusCriterion.js.map +1 -0
- package/cjs/component/search-ui/filters/state/actions.js +18 -0
- package/cjs/component/search-ui/filters/state/actions.js.map +1 -1
- package/cjs/component/search-ui/filters/state/initial.js +1 -0
- package/cjs/component/search-ui/filters/state/initial.js.map +1 -1
- package/cjs/component/search-ui/filters/state/retention.js +1 -0
- package/cjs/component/search-ui/filters/state/retention.js.map +1 -1
- package/cjs/component/search-ui/filters/state/type.d.ts +2 -1
- package/cjs/component/search-ui/filters/state/undo.js +1 -0
- package/cjs/component/search-ui/filters/state/undo.js.map +1 -1
- package/cjs/component/search-ui/filters/types.d.ts +7 -0
- package/cjs/component/search-ui/filters/types.js +7 -1
- package/cjs/component/search-ui/filters/types.js.map +1 -1
- package/cjs/component/search-ui/state/initial.js +1 -0
- package/cjs/component/search-ui/state/initial.js.map +1 -1
- package/cjs/component/search-ui/state/store.d.ts +2 -0
- 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 -23
- package/cjs/component/table/PneTablePaginationActions.js +123 -168
- package/cjs/component/table/PneTablePaginationActions.js.map +1 -1
- package/cjs/component/table/PneTableSelectionControls.js.map +1 -1
- package/cjs/component/table/PneTableToolbar.d.ts +0 -14
- 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/cjs/exports/search.d.ts +1 -1
- package/cjs/exports/search.js +2 -1
- package/cjs/exports/search.js.map +1 -1
- package/esm/component/search-ui/SearchUI.js +4 -0
- package/esm/component/search-ui/SearchUI.js.map +1 -1
- package/esm/component/search-ui/filters/CriterionContainer.js +3 -0
- package/esm/component/search-ui/filters/CriterionContainer.js.map +1 -1
- package/esm/component/search-ui/filters/component/criterion/OtpStatusCriterion.d.ts +2 -0
- package/esm/component/search-ui/filters/component/criterion/OtpStatusCriterion.js +13 -0
- package/esm/component/search-ui/filters/component/criterion/OtpStatusCriterion.js.map +1 -0
- package/esm/component/search-ui/filters/state/actions.js +18 -0
- package/esm/component/search-ui/filters/state/actions.js.map +1 -1
- package/esm/component/search-ui/filters/state/initial.js +1 -0
- package/esm/component/search-ui/filters/state/initial.js.map +1 -1
- package/esm/component/search-ui/filters/state/retention.js +1 -0
- package/esm/component/search-ui/filters/state/retention.js.map +1 -1
- package/esm/component/search-ui/filters/state/type.d.ts +2 -1
- package/esm/component/search-ui/filters/state/undo.js +1 -0
- package/esm/component/search-ui/filters/state/undo.js.map +1 -1
- package/esm/component/search-ui/filters/types.d.ts +7 -0
- package/esm/component/search-ui/filters/types.js +6 -0
- package/esm/component/search-ui/filters/types.js.map +1 -1
- package/esm/component/search-ui/state/initial.js +1 -0
- package/esm/component/search-ui/state/initial.js.map +1 -1
- package/esm/component/search-ui/state/store.d.ts +2 -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 -23
- package/esm/component/table/PneTablePaginationActions.js +124 -167
- package/esm/component/table/PneTablePaginationActions.js.map +1 -1
- package/esm/component/table/PneTableSelectionControls.js.map +1 -1
- package/esm/component/table/PneTableToolbar.d.ts +0 -14
- 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/esm/exports/search.d.ts +1 -1
- package/esm/exports/search.js +1 -1
- package/esm/exports/search.js.map +1 -1
- package/package.json +1 -1
- package/cjs/component/table/tableLayoutMeasurement.d.ts +0 -34
- package/cjs/component/table/tableLayoutMeasurement.js +0 -81
- package/cjs/component/table/tableLayoutMeasurement.js.map +0 -1
- package/esm/component/table/tableLayoutMeasurement.d.ts +0 -34
- package/esm/component/table/tableLayoutMeasurement.js +0 -75
- 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/esm/exports/search.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { SearchUI, type SearchParams, type SearchUIDataSource, type SearchUIProps, type SearchUITableHeaderFactory, type SearchUITableRowFactory, type SearchUIView, type SearchUIViewSort, type SearchUIViewTableStateOnActivate, type SearchUIViewsConfig, } from '../component/search-ui/SearchUI';
|
|
2
2
|
export type { SearchUITableFactoryContext, SearchUITableSelectionConfig, SearchUITableSelectionController, SearchUITableSelectionRenderContext, SearchUITableSelectionScope, SearchUITableSelectionScopeContext, } from '../component/search-ui/SearchUITableSelection';
|
|
3
3
|
export { SearchUIFilters, type SearchUIFiltersConfig, type SearchUIFiltersProps, type DateRangeCriterionConfig, type TransactionTypesCriterionConfig, } from '../component/search-ui/filters/SearchUIFilters';
|
|
4
|
-
export { CriterionTypeEnum, CSV_CHARSETS, type CsvCharset, CUSTOMER_LEVEL_DEPENDENCIES, CustomerLevel, DATE_RANGE_SPEC_TYPES, ExactCriterionSearchLabelEnum, GroupingType, GetCustomerLevelsRequest, LinkedEntityTypeEnum, MultichoiceFilterTypeEnum, MultigetCriterion, ORDER_SEARCH_LABELS, OrderSearchLabel, SearchCriteria, SearchUICriterionAvailabilityRule, SearchUIConditions, SearchUIConditionsInput, SearchUIDateRangeSpec, TIME_ZONE_OFFSET_HOURS, type TimeZoneOffsetHours, TRANSACTION_DATE_TYPES, TRANSACTION_RECURRENT_FILTERS, TRANSACTION_REPORT_SCOPES, type TransactionDateType, type TransactionRecurrentFilter, type TransactionReportScope, TransactionSessionGroup, TransactionSessionStatus, TransactionSessionStatuses, DateRangeSpec, } from '../component/search-ui/filters/types';
|
|
4
|
+
export { CriterionTypeEnum, CSV_CHARSETS, type CsvCharset, CUSTOMER_LEVEL_DEPENDENCIES, CustomerLevel, DATE_RANGE_SPEC_TYPES, ExactCriterionSearchLabelEnum, GroupingType, GetCustomerLevelsRequest, LinkedEntityTypeEnum, MultichoiceFilterTypeEnum, MultigetCriterion, ORDER_SEARCH_LABELS, OrderSearchLabel, OTP_STATUS_CRITERION_VALUES, type OtpStatusCriterion, type OtpStatusSearchValue, SearchCriteria, SearchUICriterionAvailabilityRule, SearchUIConditions, SearchUIConditionsInput, SearchUIDateRangeSpec, TIME_ZONE_OFFSET_HOURS, type TimeZoneOffsetHours, TRANSACTION_DATE_TYPES, TRANSACTION_RECURRENT_FILTERS, TRANSACTION_REPORT_SCOPES, type TransactionDateType, type TransactionRecurrentFilter, type TransactionReportScope, TransactionSessionGroup, TransactionSessionStatus, TransactionSessionStatuses, DateRangeSpec, } from '../component/search-ui/filters/types';
|
|
5
5
|
export { SearchUIProvider, type SearchUIDefaults } from '../component/search-ui/SearchUIProvider';
|
|
6
6
|
export { MultigetSelect, MultigetSelectActions, type MultigetSelectActionsProps, type MultigetSelectProps, } from '../component/search-ui/multiget_select/MultigetSelect';
|
|
7
7
|
export { MultigetSelectStoreProvider } from '../component/search-ui/multiget_select/state/IsolatedStoreProvider';
|
package/esm/exports/search.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { SearchUI, } from '../component/search-ui/SearchUI';
|
|
2
2
|
export { SearchUIFilters, } from '../component/search-ui/filters/SearchUIFilters';
|
|
3
|
-
export { CriterionTypeEnum, CSV_CHARSETS, CUSTOMER_LEVEL_DEPENDENCIES, DATE_RANGE_SPEC_TYPES, ExactCriterionSearchLabelEnum, LinkedEntityTypeEnum, MultichoiceFilterTypeEnum, ORDER_SEARCH_LABELS, TIME_ZONE_OFFSET_HOURS, TRANSACTION_DATE_TYPES, TRANSACTION_RECURRENT_FILTERS, TRANSACTION_REPORT_SCOPES, } from '../component/search-ui/filters/types';
|
|
3
|
+
export { CriterionTypeEnum, CSV_CHARSETS, CUSTOMER_LEVEL_DEPENDENCIES, DATE_RANGE_SPEC_TYPES, ExactCriterionSearchLabelEnum, LinkedEntityTypeEnum, MultichoiceFilterTypeEnum, ORDER_SEARCH_LABELS, OTP_STATUS_CRITERION_VALUES, TIME_ZONE_OFFSET_HOURS, TRANSACTION_DATE_TYPES, TRANSACTION_RECURRENT_FILTERS, TRANSACTION_REPORT_SCOPES, } from '../component/search-ui/filters/types';
|
|
4
4
|
export { SearchUIProvider } from '../component/search-ui/SearchUIProvider';
|
|
5
5
|
export { MultigetSelect, MultigetSelectActions, } from '../component/search-ui/multiget_select/MultigetSelect';
|
|
6
6
|
export { MultigetSelectStoreProvider } from '../component/search-ui/multiget_select/state/IsolatedStoreProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/exports/search.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,GAUX,MAAM,iCAAiC,CAAA;AASxC,OAAO,EACH,eAAe,GAKlB,MAAM,gDAAgD,CAAA;AACvD,OAAO,EACH,iBAAiB,EACjB,YAAY,EAEZ,2BAA2B,EAE3B,qBAAqB,EACrB,6BAA6B,EAG7B,oBAAoB,EACpB,yBAAyB,EAEzB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/exports/search.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,GAUX,MAAM,iCAAiC,CAAA;AASxC,OAAO,EACH,eAAe,GAKlB,MAAM,gDAAgD,CAAA;AACvD,OAAO,EACH,iBAAiB,EACjB,YAAY,EAEZ,2BAA2B,EAE3B,qBAAqB,EACrB,6BAA6B,EAG7B,oBAAoB,EACpB,yBAAyB,EAEzB,mBAAmB,EAEnB,2BAA2B,EAQ3B,sBAAsB,EAEtB,sBAAsB,EACtB,6BAA6B,EAC7B,yBAAyB,GAQ5B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAyB,MAAM,yCAAyC,CAAA;AACjG,OAAO,EACH,cAAc,EACd,qBAAqB,GAGxB,MAAM,uDAAuD,CAAA;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oEAAoE,CAAA;AAEhH,OAAO,EACH,sCAAsC,GAGzC,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,34 +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
|
-
/**
|
|
8
|
-
* Extra width a stacked control band must regain before it returns to a wider
|
|
9
|
-
* layout. A layout switch changes the band height, which can add or remove the
|
|
10
|
-
* document scrollbar and therefore change the available width by up to a
|
|
11
|
-
* scrollbar. Without this dead zone those two effects chase each other every
|
|
12
|
-
* frame and the whole table jumps.
|
|
13
|
-
*/
|
|
14
|
-
export declare const TABLE_LAYOUT_HYSTERESIS = 24;
|
|
15
|
-
export declare const measuredLayoutWidthFits: (requiredWidth: number, availableWidth: number) => boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Width a control group needs to render on a single row, independent of the
|
|
18
|
-
* layout it currently renders in.
|
|
19
|
-
*
|
|
20
|
-
* Reading `scrollWidth`/`getBoundingClientRect()` off the live element only
|
|
21
|
-
* reports how wide it *already* is: once the group has been squeezed, wrapped or
|
|
22
|
-
* ellipsised into the space it was given, its measured width equals that space
|
|
23
|
-
* and every fit check becomes tautological. The off-screen clone is therefore
|
|
24
|
-
* forced into an unconstrained single row, and grid/flow containers are
|
|
25
|
-
* normalised to a non-wrapping flex row so the result does not depend on the
|
|
26
|
-
* responsive state the caller is trying to decide.
|
|
27
|
-
*/
|
|
28
|
-
export declare const measureSingleRowWidth: (element: HTMLElement | null | undefined, ownerDocument?: Document | null) => number;
|
|
29
|
-
/**
|
|
30
|
-
* Width available to a responsive band. The band itself is `width: max-content`
|
|
31
|
-
* in its widest layout, so its own box only reports how much space its content
|
|
32
|
-
* already took; the offered space lives on the parent.
|
|
33
|
-
*/
|
|
34
|
-
export declare const measureAvailableWidth: (element: HTMLElement | null) => number;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.measureAvailableWidth = exports.measureSingleRowWidth = exports.measuredLayoutWidthFits = exports.TABLE_LAYOUT_HYSTERESIS = 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
|
-
/**
|
|
11
|
-
* Extra width a stacked control band must regain before it returns to a wider
|
|
12
|
-
* layout. A layout switch changes the band height, which can add or remove the
|
|
13
|
-
* document scrollbar and therefore change the available width by up to a
|
|
14
|
-
* scrollbar. Without this dead zone those two effects chase each other every
|
|
15
|
-
* frame and the whole table jumps.
|
|
16
|
-
*/
|
|
17
|
-
exports.TABLE_LAYOUT_HYSTERESIS = 24;
|
|
18
|
-
const measuredLayoutWidthFits = (requiredWidth, availableWidth) => requiredWidth < availableWidth + exports.TABLE_LAYOUT_MEASUREMENT_TOLERANCE;
|
|
19
|
-
exports.measuredLayoutWidthFits = measuredLayoutWidthFits;
|
|
20
|
-
/**
|
|
21
|
-
* Width a control group needs to render on a single row, independent of the
|
|
22
|
-
* layout it currently renders in.
|
|
23
|
-
*
|
|
24
|
-
* Reading `scrollWidth`/`getBoundingClientRect()` off the live element only
|
|
25
|
-
* reports how wide it *already* is: once the group has been squeezed, wrapped or
|
|
26
|
-
* ellipsised into the space it was given, its measured width equals that space
|
|
27
|
-
* and every fit check becomes tautological. The off-screen clone is therefore
|
|
28
|
-
* forced into an unconstrained single row, and grid/flow containers are
|
|
29
|
-
* normalised to a non-wrapping flex row so the result does not depend on the
|
|
30
|
-
* responsive state the caller is trying to decide.
|
|
31
|
-
*/
|
|
32
|
-
const measureSingleRowWidth = (element, ownerDocument) => {
|
|
33
|
-
if (!element) {
|
|
34
|
-
return 0;
|
|
35
|
-
}
|
|
36
|
-
const renderedWidth = Math.max(element.scrollWidth, element.getBoundingClientRect().width);
|
|
37
|
-
const measurementDocument = ownerDocument ?? element.ownerDocument;
|
|
38
|
-
if (!measurementDocument?.body) {
|
|
39
|
-
return renderedWidth;
|
|
40
|
-
}
|
|
41
|
-
const clone = element.cloneNode(true);
|
|
42
|
-
Object.assign(clone.style, {
|
|
43
|
-
display: 'flex',
|
|
44
|
-
flexWrap: 'nowrap',
|
|
45
|
-
height: 'auto',
|
|
46
|
-
left: '-100000px',
|
|
47
|
-
maxWidth: 'none',
|
|
48
|
-
minWidth: '0',
|
|
49
|
-
pointerEvents: 'none',
|
|
50
|
-
position: 'fixed',
|
|
51
|
-
top: '0',
|
|
52
|
-
visibility: 'hidden',
|
|
53
|
-
width: 'max-content',
|
|
54
|
-
});
|
|
55
|
-
clone.setAttribute('aria-hidden', 'true');
|
|
56
|
-
measurementDocument.body.appendChild(clone);
|
|
57
|
-
try {
|
|
58
|
-
return Math.max(renderedWidth, clone.scrollWidth, clone.getBoundingClientRect().width);
|
|
59
|
-
}
|
|
60
|
-
finally {
|
|
61
|
-
clone.remove();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
exports.measureSingleRowWidth = measureSingleRowWidth;
|
|
65
|
-
/**
|
|
66
|
-
* Width available to a responsive band. The band itself is `width: max-content`
|
|
67
|
-
* in its widest layout, so its own box only reports how much space its content
|
|
68
|
-
* already took; the offered space lives on the parent.
|
|
69
|
-
*/
|
|
70
|
-
const measureAvailableWidth = (element) => {
|
|
71
|
-
if (!element) {
|
|
72
|
-
return 0;
|
|
73
|
-
}
|
|
74
|
-
const parent = element.parentElement;
|
|
75
|
-
const parentWidth = parent
|
|
76
|
-
? parent.clientWidth || parent.getBoundingClientRect().width
|
|
77
|
-
: 0;
|
|
78
|
-
return parentWidth || element.clientWidth || element.getBoundingClientRect().width;
|
|
79
|
-
};
|
|
80
|
-
exports.measureAvailableWidth = measureAvailableWidth;
|
|
81
|
-
//# 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;AAEnD;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,EAAE,CAAA;AAElC,MAAM,uBAAuB,GAAG,CACnC,aAAqB,EACrB,cAAsB,EACf,EAAE,CAAC,aAAa,GAAG,cAAc,GAAG,0CAAkC,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qBAAqB,yBA4CjC;AAED;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,OAA2B,EAAU,EAAE;IACzE,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,CAAC,CAAA;IACZ,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAA;IACpC,MAAM,WAAW,GAAG,MAAM;QACtB,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC,KAAK;QAC5D,CAAC,CAAC,CAAC,CAAA;IAEP,OAAO,WAAW,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAA;AACtF,CAAC,CAAA;AAXY,QAAA,qBAAqB,yBAWjC"}
|
|
@@ -1,34 +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
|
-
/**
|
|
8
|
-
* Extra width a stacked control band must regain before it returns to a wider
|
|
9
|
-
* layout. A layout switch changes the band height, which can add or remove the
|
|
10
|
-
* document scrollbar and therefore change the available width by up to a
|
|
11
|
-
* scrollbar. Without this dead zone those two effects chase each other every
|
|
12
|
-
* frame and the whole table jumps.
|
|
13
|
-
*/
|
|
14
|
-
export declare const TABLE_LAYOUT_HYSTERESIS = 24;
|
|
15
|
-
export declare const measuredLayoutWidthFits: (requiredWidth: number, availableWidth: number) => boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Width a control group needs to render on a single row, independent of the
|
|
18
|
-
* layout it currently renders in.
|
|
19
|
-
*
|
|
20
|
-
* Reading `scrollWidth`/`getBoundingClientRect()` off the live element only
|
|
21
|
-
* reports how wide it *already* is: once the group has been squeezed, wrapped or
|
|
22
|
-
* ellipsised into the space it was given, its measured width equals that space
|
|
23
|
-
* and every fit check becomes tautological. The off-screen clone is therefore
|
|
24
|
-
* forced into an unconstrained single row, and grid/flow containers are
|
|
25
|
-
* normalised to a non-wrapping flex row so the result does not depend on the
|
|
26
|
-
* responsive state the caller is trying to decide.
|
|
27
|
-
*/
|
|
28
|
-
export declare const measureSingleRowWidth: (element: HTMLElement | null | undefined, ownerDocument?: Document | null) => number;
|
|
29
|
-
/**
|
|
30
|
-
* Width available to a responsive band. The band itself is `width: max-content`
|
|
31
|
-
* in its widest layout, so its own box only reports how much space its content
|
|
32
|
-
* already took; the offered space lives on the parent.
|
|
33
|
-
*/
|
|
34
|
-
export declare const measureAvailableWidth: (element: HTMLElement | null) => number;
|
|
@@ -1,75 +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
|
-
/**
|
|
8
|
-
* Extra width a stacked control band must regain before it returns to a wider
|
|
9
|
-
* layout. A layout switch changes the band height, which can add or remove the
|
|
10
|
-
* document scrollbar and therefore change the available width by up to a
|
|
11
|
-
* scrollbar. Without this dead zone those two effects chase each other every
|
|
12
|
-
* frame and the whole table jumps.
|
|
13
|
-
*/
|
|
14
|
-
export const TABLE_LAYOUT_HYSTERESIS = 24;
|
|
15
|
-
export const measuredLayoutWidthFits = (requiredWidth, availableWidth) => requiredWidth < availableWidth + TABLE_LAYOUT_MEASUREMENT_TOLERANCE;
|
|
16
|
-
/**
|
|
17
|
-
* Width a control group needs to render on a single row, independent of the
|
|
18
|
-
* layout it currently renders in.
|
|
19
|
-
*
|
|
20
|
-
* Reading `scrollWidth`/`getBoundingClientRect()` off the live element only
|
|
21
|
-
* reports how wide it *already* is: once the group has been squeezed, wrapped or
|
|
22
|
-
* ellipsised into the space it was given, its measured width equals that space
|
|
23
|
-
* and every fit check becomes tautological. The off-screen clone is therefore
|
|
24
|
-
* forced into an unconstrained single row, and grid/flow containers are
|
|
25
|
-
* normalised to a non-wrapping flex row so the result does not depend on the
|
|
26
|
-
* responsive state the caller is trying to decide.
|
|
27
|
-
*/
|
|
28
|
-
export const measureSingleRowWidth = (element, ownerDocument) => {
|
|
29
|
-
if (!element) {
|
|
30
|
-
return 0;
|
|
31
|
-
}
|
|
32
|
-
const renderedWidth = Math.max(element.scrollWidth, element.getBoundingClientRect().width);
|
|
33
|
-
const measurementDocument = ownerDocument ?? element.ownerDocument;
|
|
34
|
-
if (!measurementDocument?.body) {
|
|
35
|
-
return renderedWidth;
|
|
36
|
-
}
|
|
37
|
-
const clone = element.cloneNode(true);
|
|
38
|
-
Object.assign(clone.style, {
|
|
39
|
-
display: 'flex',
|
|
40
|
-
flexWrap: 'nowrap',
|
|
41
|
-
height: 'auto',
|
|
42
|
-
left: '-100000px',
|
|
43
|
-
maxWidth: 'none',
|
|
44
|
-
minWidth: '0',
|
|
45
|
-
pointerEvents: 'none',
|
|
46
|
-
position: 'fixed',
|
|
47
|
-
top: '0',
|
|
48
|
-
visibility: 'hidden',
|
|
49
|
-
width: 'max-content',
|
|
50
|
-
});
|
|
51
|
-
clone.setAttribute('aria-hidden', 'true');
|
|
52
|
-
measurementDocument.body.appendChild(clone);
|
|
53
|
-
try {
|
|
54
|
-
return Math.max(renderedWidth, clone.scrollWidth, clone.getBoundingClientRect().width);
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
clone.remove();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Width available to a responsive band. The band itself is `width: max-content`
|
|
62
|
-
* in its widest layout, so its own box only reports how much space its content
|
|
63
|
-
* already took; the offered space lives on the parent.
|
|
64
|
-
*/
|
|
65
|
-
export const measureAvailableWidth = (element) => {
|
|
66
|
-
if (!element) {
|
|
67
|
-
return 0;
|
|
68
|
-
}
|
|
69
|
-
const parent = element.parentElement;
|
|
70
|
-
const parentWidth = parent
|
|
71
|
-
? parent.clientWidth || parent.getBoundingClientRect().width
|
|
72
|
-
: 0;
|
|
73
|
-
return parentWidth || element.clientWidth || element.getBoundingClientRect().width;
|
|
74
|
-
};
|
|
75
|
-
//# 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;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAEzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,aAAqB,EACrB,cAAsB,EACf,EAAE,CAAC,aAAa,GAAG,cAAc,GAAG,kCAAkC,CAAA;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACjC,OAAuC,EACvC,aAA+B,EACzB,EAAE;IACR,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,CAAC,CAAA;IACZ,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAC1B,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,qBAAqB,EAAE,CAAC,KAAK,CACxC,CAAA;IACD,MAAM,mBAAmB,GAAG,aAAa,IAAI,OAAO,CAAC,aAAa,CAAA;IAElE,IAAI,CAAC,mBAAmB,EAAE,IAAI,EAAE,CAAC;QAC7B,OAAO,aAAa,CAAA;IACxB,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAgB,CAAA;IACpD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC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