@pretable/core 0.3.2 → 0.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/dist/index.cjs +19 -0
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.mjs +19 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2071,5 +2071,24 @@ function createGrid(options) {
|
|
|
2071
2071
|
};
|
|
2072
2072
|
}
|
|
2073
2073
|
|
|
2074
|
+
// src/number-formats.ts
|
|
2075
|
+
function currencyOptions(options, currencySign) {
|
|
2076
|
+
return {
|
|
2077
|
+
...options,
|
|
2078
|
+
style: "currency",
|
|
2079
|
+
currency: options.currency,
|
|
2080
|
+
currencySign
|
|
2081
|
+
};
|
|
2082
|
+
}
|
|
2083
|
+
var numberFormats = {
|
|
2084
|
+
money(options) {
|
|
2085
|
+
return currencyOptions(options, "standard");
|
|
2086
|
+
},
|
|
2087
|
+
accounting(options) {
|
|
2088
|
+
return currencyOptions(options, "accounting");
|
|
2089
|
+
}
|
|
2090
|
+
};
|
|
2091
|
+
|
|
2074
2092
|
exports.GROUP_COLUMN_ID = GROUP_COLUMN_ID;
|
|
2075
2093
|
exports.createGrid = createGrid;
|
|
2094
|
+
exports.numberFormats = numberFormats;
|
package/dist/index.d.cts
CHANGED
|
@@ -146,6 +146,8 @@ interface PretableColumn<TRow extends PretableRow = PretableRow> {
|
|
|
146
146
|
options?: ColumnOption[];
|
|
147
147
|
value?: (row: TRow) => unknown;
|
|
148
148
|
format?: (input: PretableFormatInput<TRow>) => string;
|
|
149
|
+
/** Native, opt-in number presentation. Applied only to number and bigint values; it does not affect sorting, filtering, aggregation, or editing. */
|
|
150
|
+
numberFormat?: Intl.NumberFormatOptions;
|
|
149
151
|
/**
|
|
150
152
|
* Render this column's aggregate on a group row.
|
|
151
153
|
*
|
|
@@ -695,4 +697,22 @@ interface PretableGrid<TRow extends PretableRow = PretableRow> {
|
|
|
695
697
|
*/
|
|
696
698
|
declare function createGrid<TRow extends PretableRow = PretableRow>(options: PretableGridOptions<TRow>): PretableGrid<TRow>;
|
|
697
699
|
|
|
698
|
-
|
|
700
|
+
/**
|
|
701
|
+
* Options for Pretable's currency number-format presets.
|
|
702
|
+
*
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
type PretableCurrencyFormatOptions = Omit<Intl.NumberFormatOptions, "style" | "currency" | "currencySign"> & {
|
|
706
|
+
currency: string;
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Native number-format presets for money and accounting presentation.
|
|
710
|
+
*
|
|
711
|
+
* @public
|
|
712
|
+
*/
|
|
713
|
+
declare const numberFormats: {
|
|
714
|
+
readonly money: (options: PretableCurrencyFormatOptions) => Intl.NumberFormatOptions;
|
|
715
|
+
readonly accounting: (options: PretableCurrencyFormatOptions) => Intl.NumberFormatOptions;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
export { type AutosizeOptions, type ColumnAlign, type ColumnFilter, type ColumnOption, type ColumnType, type FilterOperator, type FilterValue, GROUP_COLUMN_ID, type PretableAggregateFormatInput, type PretableAggregateSpec, type PretableAggregator, type PretableCellAddress, type PretableCellRange, type PretableColumn, type PretableCurrencyFormatOptions, type PretableDataRow, type PretableEditInput, type PretableEditState, type PretableEditStatus, type PretableFocusDirection, type PretableFocusState, type PretableFormatInput, type PretableGrid, type PretableGridOptions, type PretableGridSnapshot, type PretableGroupColumnOptions, type PretableGroupRow, type PretableMatchingTotal, type PretableMoveFocusOptions, type PretableProcessingAuthority, type PretableProcessingOptions, type PretableResultMeta, type PretableRow, type PretableRowRange, type PretableRowSelectionTriState, type PretableSelectionState, type PretableSortDirection, type PretableSortEntry, type PretableTransaction, type PretableViewportState, type PretableVisibleRow, createGrid, numberFormats };
|
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,8 @@ interface PretableColumn<TRow extends PretableRow = PretableRow> {
|
|
|
146
146
|
options?: ColumnOption[];
|
|
147
147
|
value?: (row: TRow) => unknown;
|
|
148
148
|
format?: (input: PretableFormatInput<TRow>) => string;
|
|
149
|
+
/** Native, opt-in number presentation. Applied only to number and bigint values; it does not affect sorting, filtering, aggregation, or editing. */
|
|
150
|
+
numberFormat?: Intl.NumberFormatOptions;
|
|
149
151
|
/**
|
|
150
152
|
* Render this column's aggregate on a group row.
|
|
151
153
|
*
|
|
@@ -695,4 +697,22 @@ interface PretableGrid<TRow extends PretableRow = PretableRow> {
|
|
|
695
697
|
*/
|
|
696
698
|
declare function createGrid<TRow extends PretableRow = PretableRow>(options: PretableGridOptions<TRow>): PretableGrid<TRow>;
|
|
697
699
|
|
|
698
|
-
|
|
700
|
+
/**
|
|
701
|
+
* Options for Pretable's currency number-format presets.
|
|
702
|
+
*
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
type PretableCurrencyFormatOptions = Omit<Intl.NumberFormatOptions, "style" | "currency" | "currencySign"> & {
|
|
706
|
+
currency: string;
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Native number-format presets for money and accounting presentation.
|
|
710
|
+
*
|
|
711
|
+
* @public
|
|
712
|
+
*/
|
|
713
|
+
declare const numberFormats: {
|
|
714
|
+
readonly money: (options: PretableCurrencyFormatOptions) => Intl.NumberFormatOptions;
|
|
715
|
+
readonly accounting: (options: PretableCurrencyFormatOptions) => Intl.NumberFormatOptions;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
export { type AutosizeOptions, type ColumnAlign, type ColumnFilter, type ColumnOption, type ColumnType, type FilterOperator, type FilterValue, GROUP_COLUMN_ID, type PretableAggregateFormatInput, type PretableAggregateSpec, type PretableAggregator, type PretableCellAddress, type PretableCellRange, type PretableColumn, type PretableCurrencyFormatOptions, type PretableDataRow, type PretableEditInput, type PretableEditState, type PretableEditStatus, type PretableFocusDirection, type PretableFocusState, type PretableFormatInput, type PretableGrid, type PretableGridOptions, type PretableGridSnapshot, type PretableGroupColumnOptions, type PretableGroupRow, type PretableMatchingTotal, type PretableMoveFocusOptions, type PretableProcessingAuthority, type PretableProcessingOptions, type PretableResultMeta, type PretableRow, type PretableRowRange, type PretableRowSelectionTriState, type PretableSelectionState, type PretableSortDirection, type PretableSortEntry, type PretableTransaction, type PretableViewportState, type PretableVisibleRow, createGrid, numberFormats };
|
package/dist/index.mjs
CHANGED
|
@@ -2069,4 +2069,22 @@ function createGrid(options) {
|
|
|
2069
2069
|
};
|
|
2070
2070
|
}
|
|
2071
2071
|
|
|
2072
|
-
|
|
2072
|
+
// src/number-formats.ts
|
|
2073
|
+
function currencyOptions(options, currencySign) {
|
|
2074
|
+
return {
|
|
2075
|
+
...options,
|
|
2076
|
+
style: "currency",
|
|
2077
|
+
currency: options.currency,
|
|
2078
|
+
currencySign
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
var numberFormats = {
|
|
2082
|
+
money(options) {
|
|
2083
|
+
return currencyOptions(options, "standard");
|
|
2084
|
+
},
|
|
2085
|
+
accounting(options) {
|
|
2086
|
+
return currencyOptions(options, "accounting");
|
|
2087
|
+
}
|
|
2088
|
+
};
|
|
2089
|
+
|
|
2090
|
+
export { GROUP_COLUMN_ID, createGrid, numberFormats };
|