@mono-lit/helper 0.0.7 → 0.0.9
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/{data-source-options-CS0w0wlO.js → data-source-options-BM4r4PRw.js} +1 -1
- package/dist/{data-source-options-lDR-g9Eb.js → data-source-options-fxT5QIX4.js} +1 -1
- package/dist/{data-source-read-Cp_h7NIf.js → data-source-read-BL266IW0.js} +20 -1
- package/dist/{data-source-read-DTJ_Mnez.js → data-source-read-HyBCRg1t.js} +20 -1
- package/dist/{export-D27RJa1w.js → export-ixRdCS2y.js} +1 -1
- package/dist/export.js +1 -1
- package/dist/index.js +6 -6
- package/dist/{index.node-Mg0Snp0t.js → index.node-DTqDBca7.js} +3 -3
- package/dist/index.node.js +6 -6
- package/dist/{mono-data-chart-BAH9Zb3p.js → mono-data-chart-NKPdAgVq.js} +2 -2
- package/dist/{mono-data-dropdown-BsY5IuIo.js → mono-data-dropdown-B2iRpJuI.js} +1 -1
- package/dist/{mono-data-grid-CZFjpnOD.js → mono-data-grid-e9ZVBlNN.js} +210 -9
- package/dist/{mono-data-grid-kV4jYu2g.js → mono-data-grid-llJCX9MC.js} +209 -8
- package/dist/src/components/table/mono-data-grid.d.ts +36 -0
- package/dist/src/utils/data-source-read.d.ts +10 -1
- package/dist/ui/chart.js +1 -1
- package/dist/ui/dropdown-table.js +1 -1
- package/dist/ui/index.css +13 -5
- package/dist/ui/shadow/chart.js +2 -2
- package/dist/ui/shadow/dropdown-table.js +1 -1
- package/dist/ui/shadow/table.js +4 -4
- package/dist/ui/shadow/tag-input.js +1 -1
- package/dist/ui/table.js +3 -3
- package/dist/ui/tag-input.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as isPath, r as mergePatch, t as getFieldValue } from "./field-path-BabiMrrA.js";
|
|
2
2
|
import { D as compileFilterPredicate, E as andPredicates, T as andFilters, f as mergeSearchFields } from "./normalize-error-BmLbgANw.js";
|
|
3
|
-
import { i as searchFilterOf, s as flattenLeaves, t as isDataSourceLike } from "./data-source-read-
|
|
3
|
+
import { i as searchFilterOf, s as flattenLeaves, t as isDataSourceLike } from "./data-source-read-HyBCRg1t.js";
|
|
4
4
|
import { t as resolveMaybeReactive } from "./reactive-Dtd-esHO.js";
|
|
5
5
|
import { s as odataStringToArray, t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as isPath, r as mergePatch, t as getFieldValue } from "./field-path-BabiMrrA.js";
|
|
2
|
-
import { i as searchFilterOf, s as flattenLeaves, t as isDataSourceLike } from "./data-source-read-
|
|
2
|
+
import { i as searchFilterOf, s as flattenLeaves, t as isDataSourceLike } from "./data-source-read-BL266IW0.js";
|
|
3
3
|
import { n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-ChDSaAUH.js";
|
|
4
4
|
import { h as mergeSearchFields } from "./normalize-error-D93O4q8g.js";
|
|
5
5
|
import { t as resolveMaybeReactive } from "./reactive-Dtd-esHO.js";
|
|
@@ -98,6 +98,21 @@ function collectGroupPaths(nodes) {
|
|
|
98
98
|
* the same DataSource is usually bound to a live grid, so paging state must
|
|
99
99
|
* either be left alone (the store path) or restored exactly (the array path).
|
|
100
100
|
*/
|
|
101
|
+
/**
|
|
102
|
+
* Store-level load options a DataSource sends on every request that have no accessor and are not
|
|
103
|
+
* composed by the drain itself (filter / search / sort / select are). Whitelisted, not copied
|
|
104
|
+
* wholesale: `_storeLoadOptions` also carries `group`, paging and total-count state, which would
|
|
105
|
+
* turn a flat chunked read into something else.
|
|
106
|
+
*/
|
|
107
|
+
const INHERITED_LOAD_OPTIONS = ["expand", "customQueryParams"];
|
|
108
|
+
/** The {@link INHERITED_LOAD_OPTIONS} the source currently carries. */
|
|
109
|
+
function inheritedLoadOptionsOf(source) {
|
|
110
|
+
const lo = typeof source.loadOptions === "function" ? source.loadOptions() : null;
|
|
111
|
+
const out = {};
|
|
112
|
+
if (!lo || typeof lo !== "object") return out;
|
|
113
|
+
for (const k of INHERITED_LOAD_OPTIONS) if (lo[k] !== void 0 && lo[k] !== null) out[k] = lo[k];
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
101
116
|
/** Stop runaway loops if a backend keeps returning full chunks forever. */
|
|
102
117
|
const MAX_SKIP = 1e7;
|
|
103
118
|
/** A devextreme DataSource: it both loads and holds a current page. */
|
|
@@ -162,12 +177,16 @@ async function readAllRows(source, options = {}) {
|
|
|
162
177
|
const filter = andFilters(andFilters(src.filter?.() ?? null, searchFilterOf(src) ?? null), options.filter ?? null);
|
|
163
178
|
const sort = options.sort ?? src.sort?.() ?? null;
|
|
164
179
|
const select = options.select ?? src.select?.() ?? null;
|
|
180
|
+
const loadOptions = {
|
|
181
|
+
...inheritedLoadOptionsOf(src),
|
|
182
|
+
...options.loadOptions ?? {}
|
|
183
|
+
};
|
|
165
184
|
return drainStore(store, {
|
|
166
185
|
chunkSize,
|
|
167
186
|
...select ? { select } : {},
|
|
168
187
|
...filter ? { filter } : {},
|
|
169
188
|
...sort ? { sort } : {},
|
|
170
|
-
...
|
|
189
|
+
...Object.keys(loadOptions).length ? { loadOptions } : {}
|
|
171
190
|
});
|
|
172
191
|
}
|
|
173
192
|
return readArrayDataSource(src);
|
|
@@ -98,6 +98,21 @@ function collectGroupPaths(nodes) {
|
|
|
98
98
|
* the same DataSource is usually bound to a live grid, so paging state must
|
|
99
99
|
* either be left alone (the store path) or restored exactly (the array path).
|
|
100
100
|
*/
|
|
101
|
+
/**
|
|
102
|
+
* Store-level load options a DataSource sends on every request that have no accessor and are not
|
|
103
|
+
* composed by the drain itself (filter / search / sort / select are). Whitelisted, not copied
|
|
104
|
+
* wholesale: `_storeLoadOptions` also carries `group`, paging and total-count state, which would
|
|
105
|
+
* turn a flat chunked read into something else.
|
|
106
|
+
*/
|
|
107
|
+
const INHERITED_LOAD_OPTIONS = ["expand", "customQueryParams"];
|
|
108
|
+
/** The {@link INHERITED_LOAD_OPTIONS} the source currently carries. */
|
|
109
|
+
function inheritedLoadOptionsOf(source) {
|
|
110
|
+
const lo = typeof source.loadOptions === "function" ? source.loadOptions() : null;
|
|
111
|
+
const out = {};
|
|
112
|
+
if (!lo || typeof lo !== "object") return out;
|
|
113
|
+
for (const k of INHERITED_LOAD_OPTIONS) if (lo[k] !== void 0 && lo[k] !== null) out[k] = lo[k];
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
101
116
|
/** Stop runaway loops if a backend keeps returning full chunks forever. */
|
|
102
117
|
const MAX_SKIP = 1e7;
|
|
103
118
|
/** A devextreme DataSource: it both loads and holds a current page. */
|
|
@@ -162,12 +177,16 @@ async function readAllRows(source, options = {}) {
|
|
|
162
177
|
const filter = andFilters(andFilters(src.filter?.() ?? null, searchFilterOf(src) ?? null), options.filter ?? null);
|
|
163
178
|
const sort = options.sort ?? src.sort?.() ?? null;
|
|
164
179
|
const select = options.select ?? src.select?.() ?? null;
|
|
180
|
+
const loadOptions = {
|
|
181
|
+
...inheritedLoadOptionsOf(src),
|
|
182
|
+
...options.loadOptions ?? {}
|
|
183
|
+
};
|
|
165
184
|
return drainStore(store, {
|
|
166
185
|
chunkSize,
|
|
167
186
|
...select ? { select } : {},
|
|
168
187
|
...filter ? { filter } : {},
|
|
169
188
|
...sort ? { sort } : {},
|
|
170
|
-
...
|
|
189
|
+
...Object.keys(loadOptions).length ? { loadOptions } : {}
|
|
171
190
|
});
|
|
172
191
|
}
|
|
173
192
|
return readArrayDataSource(src);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as stripDirectives, i as escapeCellText, n as parseMarkdown, o as __commonJSMin, r as encodeDirective, s as __toESM } from "./markdown-uGlE_OfJ.js";
|
|
2
|
-
import { n as isReadableSource, r as readAllRows } from "./data-source-read-
|
|
2
|
+
import { n as isReadableSource, r as readAllRows } from "./data-source-read-HyBCRg1t.js";
|
|
3
3
|
import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
|
|
4
4
|
import { t as DEFAULT_STYLES } from "./excel-BXzr3uI1.js";
|
|
5
5
|
|
package/dist/export.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as escapeCellText, d as __toESM, l as stripDirectives, o as parseMarkdown, s as encodeDirective, t as DEFAULT_STYLES, u as __commonJSMin } from "./styles-D-ergrfR.js";
|
|
2
|
-
import { n as isReadableSource, r as readAllRows } from "./data-source-read-
|
|
2
|
+
import { n as isReadableSource, r as readAllRows } from "./data-source-read-BL266IW0.js";
|
|
3
3
|
import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
|
|
4
4
|
|
|
5
5
|
//#region src/export/download.ts
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { a as parseFieldPath, c as toODataClause, l as toODataSelector, n as isPath, r as mergePatch, s as setFieldValue, t as getFieldValue } from "./field-path-BabiMrrA.js";
|
|
2
|
-
import { a as buildGroups, c as isGroupNode, o as collectGroupPaths, s as flattenLeaves } from "./data-source-read-
|
|
2
|
+
import { a as buildGroups, c as isGroupNode, o as collectGroupPaths, s as flattenLeaves } from "./data-source-read-BL266IW0.js";
|
|
3
3
|
import { _ as plainSearchFields, b as searchRemoteFilter, c as resolveErrorMessages, d as DEFAULT_SEARCH_OPERATION, f as MonoSourceSearch, g as parseSearchValue, h as mergeSearchFields, l as setErrorMessages, m as isFoldableSearch, n as describeError, p as SEARCH_FIELDS_KEYS, r as errorStatus, s as normalizeError, t as DEFAULT_ERROR_MESSAGES, v as readSearchField, x as searchRowPredicate, y as resolveSearchFields } from "./normalize-error-D93O4q8g.js";
|
|
4
|
-
import { h as monoArraySource } from "./data-source-options-
|
|
4
|
+
import { h as monoArraySource } from "./data-source-options-fxT5QIX4.js";
|
|
5
5
|
import { t as resolveMaybeReactive } from "./reactive-Dtd-esHO.js";
|
|
6
|
-
import { t as monoDataGrid } from "./mono-data-grid-
|
|
6
|
+
import { t as monoDataGrid } from "./mono-data-grid-llJCX9MC.js";
|
|
7
7
|
import { d as OPERATOR_ARITY, l as treeToArray, m as operatorsFor, n as arrayToTree, s as odataStringToArray, t as arrayToODataString, u as DEFAULT_TEXTS } from "./filter-odata-Bi27XUpQ.js";
|
|
8
8
|
import { t as monoFilterBuilder } from "./filter-builder-C0T3pMx2.js";
|
|
9
9
|
import { C as resetMonoSkeleton, a as resetMonoUI, c as stopMonoSizeAttributes, i as getMonoUIStatus, m as isMonoSsrApp, n as createMonoUI, o as applyMonoSizeAttributes, p as getMonoSkeletonStatus, r as getMonoUI, s as startMonoSizeAttributes } from "./mono-ui-kvLVIf1V.js";
|
|
10
10
|
import { t as monoForm } from "./mono-form-controller-BrA10erm.js";
|
|
11
11
|
import { t as monoModal } from "./mono-modal-controller-ClObbHUs.js";
|
|
12
|
-
import { i as composeApply, n as buildChartApply, r as buildChartOdataRequest, t as monoChart } from "./mono-data-chart-
|
|
13
|
-
import { t as monoDataDropdown } from "./mono-data-dropdown-
|
|
12
|
+
import { i as composeApply, n as buildChartApply, r as buildChartOdataRequest, t as monoChart } from "./mono-data-chart-NKPdAgVq.js";
|
|
13
|
+
import { t as monoDataDropdown } from "./mono-data-dropdown-B2iRpJuI.js";
|
|
14
14
|
import { a as monoTooltip, c as getMonoTooltipGlobal, t as controlMonoTooltip } from "./control-tooltip-CoPD37_h.js";
|
|
15
15
|
import { a as resetMonoTooltip, n as createMonoTooltip, r as destroyAllMonoTooltips } from "./tooltip-Cu5IrDS9.js";
|
|
16
|
-
import { _ as DEFAULT_FLAVOR, a as flavors, b as themePresets, c as getCurrentFlavor, d as getThemeData, f as isValidFlavor, g as themes, h as resetTheme, i as createThemeClass, l as getCurrentTheme, m as resetFlavor, n as applyTheme, o as getAllFlavors, p as isValidTheme, r as createFlavorClass, s as getAllThemes, t as applyFlavor, u as getFlavorData, v as DEFAULT_THEME, y as flavorPresets } from "./index.node-
|
|
16
|
+
import { _ as DEFAULT_FLAVOR, a as flavors, b as themePresets, c as getCurrentFlavor, d as getThemeData, f as isValidFlavor, g as themes, h as resetTheme, i as createThemeClass, l as getCurrentTheme, m as resetFlavor, n as applyTheme, o as getAllFlavors, p as isValidTheme, r as createFlavorClass, s as getAllThemes, t as applyFlavor, u as getFlavorData, v as DEFAULT_THEME, y as flavorPresets } from "./index.node-DTqDBca7.js";
|
|
17
17
|
|
|
18
18
|
export { DEFAULT_ERROR_MESSAGES, DEFAULT_FLAVOR, DEFAULT_SEARCH_OPERATION, DEFAULT_THEME, OPERATOR_ARITY as MONO_FILTER_OPERATOR_ARITY, DEFAULT_TEXTS as MONO_FILTER_TEXTS, MonoSourceSearch, SEARCH_FIELDS_KEYS, applyFlavor, applyMonoSizeAttributes, applyTheme, arrayToODataString, arrayToTree, buildChartApply, buildChartOdataRequest, buildGroups, collectGroupPaths, composeApply, monoChart as controlMonoChart, monoChart, monoDataDropdown as controlMonoDataDropdown, monoDataDropdown, monoFilterBuilder as controlMonoFilterBuilder, monoFilterBuilder, monoForm as controlMonoForm, monoForm, monoModal as controlMonoModal, monoModal, monoDataGrid as controlMonoTable, monoDataGrid, controlMonoTooltip, createFlavorClass, createMonoTooltip, createMonoUI, createThemeClass, describeError, destroyAllMonoTooltips, errorStatus, flattenLeaves, flavorPresets, flavors, getAllFlavors, getAllThemes, getCurrentFlavor, getCurrentTheme, getFieldValue, getFlavorData, getMonoSkeletonStatus, getMonoTooltipGlobal, getMonoUI, getMonoUIStatus, getThemeData, isFoldableSearch, isGroupNode, isMonoSsrApp, isPath, isValidFlavor, isValidTheme, mergePatch, mergeSearchFields, monoArraySource, operatorsFor as monoFilterOperatorsFor, monoTooltip, normalizeError, odataStringToArray, parseFieldPath, parseSearchValue, plainSearchFields, readSearchField, resetFlavor, resetMonoSkeleton, resetMonoTooltip, resetMonoUI, resetTheme, resolveErrorMessages, resolveMaybeReactive, resolveSearchFields, searchRemoteFilter, searchRowPredicate, setErrorMessages, setFieldValue, startMonoSizeAttributes, stopMonoSizeAttributes, themePresets, themes, toODataClause, toODataSelector, treeToArray };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./normalize-error-D93O4q8g.js";
|
|
2
|
-
import "./mono-data-grid-
|
|
2
|
+
import "./mono-data-grid-llJCX9MC.js";
|
|
3
3
|
import "./mono-ui-kvLVIf1V.js";
|
|
4
|
-
import "./mono-data-chart-
|
|
5
|
-
import "./mono-data-dropdown-
|
|
4
|
+
import "./mono-data-chart-NKPdAgVq.js";
|
|
5
|
+
import "./mono-data-dropdown-B2iRpJuI.js";
|
|
6
6
|
import "./tooltip-Cu5IrDS9.js";
|
|
7
7
|
|
|
8
8
|
//#region src/data/theme/presets.json
|
package/dist/index.node.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { a as parseFieldPath, c as toODataClause, l as toODataSelector, n as isPath, r as mergePatch, s as setFieldValue, t as getFieldValue } from "./field-path-BabiMrrA.js";
|
|
2
|
-
import { a as buildGroups, c as isGroupNode, o as collectGroupPaths, s as flattenLeaves } from "./data-source-read-
|
|
2
|
+
import { a as buildGroups, c as isGroupNode, o as collectGroupPaths, s as flattenLeaves } from "./data-source-read-BL266IW0.js";
|
|
3
3
|
import { _ as plainSearchFields, b as searchRemoteFilter, c as resolveErrorMessages, d as DEFAULT_SEARCH_OPERATION, f as MonoSourceSearch, g as parseSearchValue, h as mergeSearchFields, l as setErrorMessages, m as isFoldableSearch, n as describeError, p as SEARCH_FIELDS_KEYS, r as errorStatus, s as normalizeError, t as DEFAULT_ERROR_MESSAGES, v as readSearchField, x as searchRowPredicate, y as resolveSearchFields } from "./normalize-error-D93O4q8g.js";
|
|
4
|
-
import { h as monoArraySource } from "./data-source-options-
|
|
4
|
+
import { h as monoArraySource } from "./data-source-options-fxT5QIX4.js";
|
|
5
5
|
import { t as resolveMaybeReactive } from "./reactive-Dtd-esHO.js";
|
|
6
|
-
import { t as monoDataGrid } from "./mono-data-grid-
|
|
6
|
+
import { t as monoDataGrid } from "./mono-data-grid-llJCX9MC.js";
|
|
7
7
|
import { d as OPERATOR_ARITY, l as treeToArray, m as operatorsFor, n as arrayToTree, s as odataStringToArray, t as arrayToODataString, u as DEFAULT_TEXTS } from "./filter-odata-Bi27XUpQ.js";
|
|
8
8
|
import { t as monoFilterBuilder } from "./filter-builder-C0T3pMx2.js";
|
|
9
9
|
import { C as resetMonoSkeleton, a as resetMonoUI, c as stopMonoSizeAttributes, i as getMonoUIStatus, m as isMonoSsrApp, n as createMonoUI, o as applyMonoSizeAttributes, p as getMonoSkeletonStatus, r as getMonoUI, s as startMonoSizeAttributes } from "./mono-ui-kvLVIf1V.js";
|
|
10
10
|
import { t as monoForm } from "./mono-form-controller-BrA10erm.js";
|
|
11
11
|
import { t as monoModal } from "./mono-modal-controller-ClObbHUs.js";
|
|
12
|
-
import { i as composeApply, n as buildChartApply, r as buildChartOdataRequest, t as monoChart } from "./mono-data-chart-
|
|
13
|
-
import { t as monoDataDropdown } from "./mono-data-dropdown-
|
|
12
|
+
import { i as composeApply, n as buildChartApply, r as buildChartOdataRequest, t as monoChart } from "./mono-data-chart-NKPdAgVq.js";
|
|
13
|
+
import { t as monoDataDropdown } from "./mono-data-dropdown-B2iRpJuI.js";
|
|
14
14
|
import { a as monoTooltip, c as getMonoTooltipGlobal, t as controlMonoTooltip } from "./control-tooltip-CoPD37_h.js";
|
|
15
15
|
import { a as resetMonoTooltip, n as createMonoTooltip, r as destroyAllMonoTooltips } from "./tooltip-Cu5IrDS9.js";
|
|
16
|
-
import { _ as DEFAULT_FLAVOR, a as flavors, b as themePresets, c as getCurrentFlavor, d as getThemeData, f as isValidFlavor, g as themes, h as resetTheme, i as createThemeClass, l as getCurrentTheme, m as resetFlavor, n as applyTheme, o as getAllFlavors, p as isValidTheme, r as createFlavorClass, s as getAllThemes, t as applyFlavor, u as getFlavorData, v as DEFAULT_THEME, y as flavorPresets } from "./index.node-
|
|
16
|
+
import { _ as DEFAULT_FLAVOR, a as flavors, b as themePresets, c as getCurrentFlavor, d as getThemeData, f as isValidFlavor, g as themes, h as resetTheme, i as createThemeClass, l as getCurrentTheme, m as resetFlavor, n as applyTheme, o as getAllFlavors, p as isValidTheme, r as createFlavorClass, s as getAllThemes, t as applyFlavor, u as getFlavorData, v as DEFAULT_THEME, y as flavorPresets } from "./index.node-DTqDBca7.js";
|
|
17
17
|
|
|
18
18
|
export { DEFAULT_ERROR_MESSAGES, DEFAULT_FLAVOR, DEFAULT_SEARCH_OPERATION, DEFAULT_THEME, OPERATOR_ARITY as MONO_FILTER_OPERATOR_ARITY, DEFAULT_TEXTS as MONO_FILTER_TEXTS, MonoSourceSearch, SEARCH_FIELDS_KEYS, applyFlavor, applyMonoSizeAttributes, applyTheme, arrayToODataString, arrayToTree, buildChartApply, buildChartOdataRequest, buildGroups, collectGroupPaths, composeApply, monoChart as controlMonoChart, monoChart, monoDataDropdown as controlMonoDataDropdown, monoDataDropdown, monoFilterBuilder as controlMonoFilterBuilder, monoFilterBuilder, monoForm as controlMonoForm, monoForm, monoModal as controlMonoModal, monoModal, monoDataGrid as controlMonoTable, monoDataGrid, controlMonoTooltip, createFlavorClass, createMonoTooltip, createMonoUI, createThemeClass, describeError, destroyAllMonoTooltips, errorStatus, flattenLeaves, flavorPresets, flavors, getAllFlavors, getAllThemes, getCurrentFlavor, getCurrentTheme, getFieldValue, getFlavorData, getMonoSkeletonStatus, getMonoTooltipGlobal, getMonoUI, getMonoUIStatus, getThemeData, isFoldableSearch, isGroupNode, isMonoSsrApp, isPath, isValidFlavor, isValidTheme, mergePatch, mergeSearchFields, monoArraySource, operatorsFor as monoFilterOperatorsFor, monoTooltip, normalizeError, odataStringToArray, parseFieldPath, parseSearchValue, plainSearchFields, readSearchField, resetFlavor, resetMonoSkeleton, resetMonoTooltip, resetMonoUI, resetTheme, resolveErrorMessages, resolveMaybeReactive, resolveSearchFields, searchRemoteFilter, searchRowPredicate, setErrorMessages, setFieldValue, startMonoSizeAttributes, stopMonoSizeAttributes, themePresets, themes, toODataClause, toODataSelector, treeToArray };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as isPath, t as getFieldValue } from "./field-path-BabiMrrA.js";
|
|
2
|
-
import { r as readAllRows } from "./data-source-read-
|
|
2
|
+
import { r as readAllRows } from "./data-source-read-BL266IW0.js";
|
|
3
3
|
import { n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-ChDSaAUH.js";
|
|
4
4
|
import { n as describeError, o as isCanceled } from "./normalize-error-D93O4q8g.js";
|
|
5
|
-
import { a as resolveDataSourceOptions, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, n as extraLoadOptions, o as toList, p as loadApply, r as mergeDataSourceOptions, u as summaryFilterOf } from "./data-source-options-
|
|
5
|
+
import { a as resolveDataSourceOptions, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, n as extraLoadOptions, o as toList, p as loadApply, r as mergeDataSourceOptions, u as summaryFilterOf } from "./data-source-options-fxT5QIX4.js";
|
|
6
6
|
import { t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
|
|
7
7
|
import { t as createNotifier } from "./notifier-BIrqUzRh.js";
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as createNotifier } from "./notifier-BIrqUzRh.js";
|
|
2
2
|
import { a as parseFieldPath, c as toODataClause, l as toODataSelector, n as isPath, o as projectFields, r as mergePatch, s as setFieldValue, t as getFieldValue } from "./field-path-BabiMrrA.js";
|
|
3
3
|
import { C as resolveSearchEntries, D as compileFilterPredicate, E as andPredicates, O as joinFilters, S as plainSearchColumns, T as andFilters, f as mergeSearchFields, g as customRemoteClause, h as customPredicate, n as describeError, o as isCanceled, u as DEFAULT_SEARCH_FIELDS, v as hasCustomSearch, w as searchEntryFor, y as hasWildcardSearch } from "./normalize-error-BmLbgANw.js";
|
|
4
|
-
import { a as buildGroups, c as isGroupNode, i as searchFilterOf, o as collectGroupPaths, r as readAllRows, s as flattenLeaves } from "./data-source-read-
|
|
5
|
-
import { a as resolveDataSourceOptions, c as composeSummaryApply, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, l as summaryAliases, m as storeRows, n as extraLoadOptions, o as toList, p as loadApply, s as buildSummaryApply, t as dataSourceOptionsKey, u as summaryFilterOf } from "./data-source-options-
|
|
4
|
+
import { a as buildGroups, c as isGroupNode, i as searchFilterOf, o as collectGroupPaths, r as readAllRows, s as flattenLeaves } from "./data-source-read-HyBCRg1t.js";
|
|
5
|
+
import { a as resolveDataSourceOptions, c as composeSummaryApply, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, l as summaryAliases, m as storeRows, n as extraLoadOptions, o as toList, p as loadApply, s as buildSummaryApply, t as dataSourceOptionsKey, u as summaryFilterOf } from "./data-source-options-BM4r4PRw.js";
|
|
6
6
|
import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
|
|
7
7
|
import { t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
|
|
8
8
|
import { t as monoFilterBuilder } from "./filter-builder-B6Y2mmbM.js";
|
|
@@ -444,6 +444,9 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
444
444
|
const chunkSize = Math.max(1, opts.chunkSize ?? 100);
|
|
445
445
|
let suppressSync = false;
|
|
446
446
|
let allRows = [];
|
|
447
|
+
let browserRows = null;
|
|
448
|
+
let browserPageIndex = 0;
|
|
449
|
+
let browserPageSize = 0;
|
|
447
450
|
let scrollMode = "off";
|
|
448
451
|
let accumulated = [];
|
|
449
452
|
let scrollNextPage = 0;
|
|
@@ -2147,16 +2150,21 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2147
2150
|
* column sort follows — applied to the group field itself if it is one.
|
|
2148
2151
|
*/
|
|
2149
2152
|
function effectiveSort() {
|
|
2150
|
-
const keys = ctrl.sorts.map((s) => ({
|
|
2151
|
-
|
|
2153
|
+
const keys = ctrl.sorts.filter((s) => !isBrowserSortKey(s.field)).map((s) => ({
|
|
2154
|
+
field: s.field,
|
|
2155
|
+
selector: declaredSortSelector(s.field) ?? s.field,
|
|
2152
2156
|
desc: s.order === "desc"
|
|
2153
2157
|
}));
|
|
2154
|
-
|
|
2158
|
+
const entry = (k) => ({
|
|
2159
|
+
selector: k.selector,
|
|
2160
|
+
desc: k.desc
|
|
2161
|
+
});
|
|
2162
|
+
if (!groupFields.length) return keys.length ? keys.map(entry) : null;
|
|
2155
2163
|
const list = groupFields.map((f) => ({
|
|
2156
2164
|
selector: f,
|
|
2157
|
-
desc: keys.find((k) => k.
|
|
2165
|
+
desc: keys.find((k) => k.field === f)?.desc ?? false
|
|
2158
2166
|
}));
|
|
2159
|
-
for (const k of keys) if (!groupFields.includes(k.
|
|
2167
|
+
for (const k of keys) if (!groupFields.includes(k.field)) list.push(entry(k));
|
|
2160
2168
|
return list;
|
|
2161
2169
|
}
|
|
2162
2170
|
/**
|
|
@@ -2571,6 +2579,10 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2571
2579
|
syncScroll();
|
|
2572
2580
|
return;
|
|
2573
2581
|
}
|
|
2582
|
+
if (browserRows && browserSortActive()) {
|
|
2583
|
+
syncBrowser();
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2574
2586
|
if (pageSizeAll) {
|
|
2575
2587
|
ctrl.grouped = false;
|
|
2576
2588
|
ctrl.items = allRows;
|
|
@@ -2734,6 +2746,11 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2734
2746
|
await loadScrollPage(true);
|
|
2735
2747
|
return;
|
|
2736
2748
|
}
|
|
2749
|
+
if (browserSortActive()) {
|
|
2750
|
+
await loadBrowserSorted();
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2753
|
+
browserRows = null;
|
|
2737
2754
|
if (pageSizeAll && !isGrouped()) {
|
|
2738
2755
|
await loadAllChunked();
|
|
2739
2756
|
return;
|
|
@@ -2755,6 +2772,11 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2755
2772
|
await loadScrollPage(true);
|
|
2756
2773
|
return;
|
|
2757
2774
|
}
|
|
2775
|
+
if (browserSortActive()) {
|
|
2776
|
+
await loadBrowserSorted();
|
|
2777
|
+
return;
|
|
2778
|
+
}
|
|
2779
|
+
browserRows = null;
|
|
2758
2780
|
if (pageSizeAll && !isGrouped()) {
|
|
2759
2781
|
await loadAllChunked();
|
|
2760
2782
|
return;
|
|
@@ -2791,6 +2813,11 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2791
2813
|
if (serverMode()) await fetchVisibleRows();
|
|
2792
2814
|
return;
|
|
2793
2815
|
}
|
|
2816
|
+
if (browserRows && browserSortActive()) {
|
|
2817
|
+
browserPageIndex = Math.max(0, pageIndex);
|
|
2818
|
+
syncBrowser();
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2794
2821
|
const s = bound;
|
|
2795
2822
|
if (!s) return;
|
|
2796
2823
|
s.pageIndex?.(Math.max(0, pageIndex));
|
|
@@ -2808,6 +2835,15 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2808
2835
|
}
|
|
2809
2836
|
const s = bound;
|
|
2810
2837
|
if (!s) return;
|
|
2838
|
+
if (browserRows && browserSortActive()) {
|
|
2839
|
+
if (!all) {
|
|
2840
|
+
browserPageSize = Math.max(1, pageSize);
|
|
2841
|
+
s.pageSize?.(browserPageSize);
|
|
2842
|
+
}
|
|
2843
|
+
browserPageIndex = 0;
|
|
2844
|
+
syncBrowser();
|
|
2845
|
+
return;
|
|
2846
|
+
}
|
|
2811
2847
|
if (all) {
|
|
2812
2848
|
await loadAllChunked();
|
|
2813
2849
|
return;
|
|
@@ -2854,6 +2890,127 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2854
2890
|
ctrl.loading = bound?.isLoading?.() ?? false;
|
|
2855
2891
|
sync();
|
|
2856
2892
|
}
|
|
2893
|
+
const BROWSER_SORT_MAX_ROWS = 5e3;
|
|
2894
|
+
/** The active sort keys when ANY of them sorts in the browser, else `null`. */
|
|
2895
|
+
function browserSortKeys() {
|
|
2896
|
+
if (!ctrl.sorts.some((s) => isBrowserSortKey(s.field))) return null;
|
|
2897
|
+
return ctrl.sorts.map((s) => {
|
|
2898
|
+
const browser = isBrowserSortKey(s.field);
|
|
2899
|
+
return {
|
|
2900
|
+
field: s.field,
|
|
2901
|
+
selector: declaredSortSelector(s.field) ?? s.field,
|
|
2902
|
+
desc: s.order === "desc",
|
|
2903
|
+
aggregate: browser ? declaredSortConfig(s.field).aggregate ?? "sum" : null
|
|
2904
|
+
};
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
/** Browser sort applies: a browser-sorted column is active on a flat, paged, bound table. */
|
|
2908
|
+
function browserSortActive() {
|
|
2909
|
+
return !!bound && !isGrouped() && !serverMode() && !scrollActive() && !!browserSortKeys();
|
|
2910
|
+
}
|
|
2911
|
+
/** The smallest `maxRows` any active browser-sorted column declares (default 5000). */
|
|
2912
|
+
function browserSortCap() {
|
|
2913
|
+
const caps = ctrl.sorts.filter((s) => isBrowserSortKey(s.field)).map((s) => Number(declaredSortConfig(s.field).maxRows)).filter((n) => Number.isFinite(n) && n > 0);
|
|
2914
|
+
return caps.length ? Math.min(...caps) : BROWSER_SORT_MAX_ROWS;
|
|
2915
|
+
}
|
|
2916
|
+
/** A row's matches for `selector` reduced to one sortable value. */
|
|
2917
|
+
function browserSortValue(row, selector, aggregate) {
|
|
2918
|
+
const raw = getFieldValue(row, selector);
|
|
2919
|
+
if (!aggregate) return raw;
|
|
2920
|
+
const list = Array.isArray(raw) ? raw : raw == null ? [] : [raw];
|
|
2921
|
+
if (aggregate === "count") return list.length;
|
|
2922
|
+
const nums = list.map(Number).filter((n) => Number.isFinite(n));
|
|
2923
|
+
if (!nums.length) return aggregate === "sum" ? 0 : null;
|
|
2924
|
+
if (aggregate === "min") return Math.min(...nums);
|
|
2925
|
+
if (aggregate === "max") return Math.max(...nums);
|
|
2926
|
+
const sum = nums.reduce((a, b) => a + b, 0);
|
|
2927
|
+
return aggregate === "avg" ? sum / nums.length : sum;
|
|
2928
|
+
}
|
|
2929
|
+
/** Empties last in either direction; numbers numerically; text numeric-aware. */
|
|
2930
|
+
function compareBrowserValues(a, b) {
|
|
2931
|
+
const ea = a == null || a === "";
|
|
2932
|
+
const eb = b == null || b === "";
|
|
2933
|
+
if (ea || eb) return ea === eb ? 0 : ea ? 1 : -1;
|
|
2934
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
2935
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
2936
|
+
return String(a).localeCompare(String(b), void 0, { numeric: true });
|
|
2937
|
+
}
|
|
2938
|
+
/** Every matching row, sorted by the active keys (stable). */
|
|
2939
|
+
function sortBrowserRows(rows) {
|
|
2940
|
+
const keys = browserSortKeys() ?? [];
|
|
2941
|
+
const decorated = rows.map((row, i) => ({
|
|
2942
|
+
row,
|
|
2943
|
+
i,
|
|
2944
|
+
v: keys.map((k) => browserSortValue(row, k.selector, k.aggregate))
|
|
2945
|
+
}));
|
|
2946
|
+
decorated.sort((x, y) => {
|
|
2947
|
+
for (let k = 0; k < keys.length; k++) {
|
|
2948
|
+
const ex = x.v[k] == null || x.v[k] === "";
|
|
2949
|
+
const ey = y.v[k] == null || y.v[k] === "";
|
|
2950
|
+
const c = compareBrowserValues(x.v[k], y.v[k]);
|
|
2951
|
+
if (c) return ex || ey ? c : keys[k].desc ? -c : c;
|
|
2952
|
+
}
|
|
2953
|
+
return x.i - y.i;
|
|
2954
|
+
});
|
|
2955
|
+
return decorated.map((d) => d.row);
|
|
2956
|
+
}
|
|
2957
|
+
/** Too many rows to sort in the browser: drop those keys, warn, load normally. */
|
|
2958
|
+
async function refuseBrowserSort(count, cap) {
|
|
2959
|
+
const fields = ctrl.sorts.filter((s) => isBrowserSortKey(s.field)).map((s) => s.field);
|
|
2960
|
+
console.warn(`[monoDataGrid] sort: "${fields.join("\", \"")}" sorts in the browser and needs every row, but ${count} match (maxRows ${cap}) — sort cleared.`);
|
|
2961
|
+
ctrl.sorts = ctrl.sorts.filter((s) => !isBrowserSortKey(s.field));
|
|
2962
|
+
syncPrimarySort();
|
|
2963
|
+
browserRows = null;
|
|
2964
|
+
applySourceSort();
|
|
2965
|
+
notify();
|
|
2966
|
+
await load();
|
|
2967
|
+
}
|
|
2968
|
+
/** Read every matching row, sort it in memory, show the first page. */
|
|
2969
|
+
async function loadBrowserSorted() {
|
|
2970
|
+
const s = bound;
|
|
2971
|
+
if (!s) return;
|
|
2972
|
+
const cap = browserSortCap();
|
|
2973
|
+
const known = s.totalCount?.();
|
|
2974
|
+
if (typeof known === "number" && known > cap) {
|
|
2975
|
+
await refuseBrowserSort(known, cap);
|
|
2976
|
+
return;
|
|
2977
|
+
}
|
|
2978
|
+
if (!browserPageSize) browserPageSize = Math.max(1, s.pageSize?.() || ctrl.pageSize || 20);
|
|
2979
|
+
ctrl.loading = true;
|
|
2980
|
+
notify();
|
|
2981
|
+
let rows = [];
|
|
2982
|
+
try {
|
|
2983
|
+
await runLoad(async () => {
|
|
2984
|
+
rows = await readAllFromSource();
|
|
2985
|
+
});
|
|
2986
|
+
} finally {
|
|
2987
|
+
ctrl.loading = false;
|
|
2988
|
+
}
|
|
2989
|
+
if (rows.length > cap) {
|
|
2990
|
+
await refuseBrowserSort(rows.length, cap);
|
|
2991
|
+
return;
|
|
2992
|
+
}
|
|
2993
|
+
browserRows = sortBrowserRows(rows);
|
|
2994
|
+
browserPageIndex = 0;
|
|
2995
|
+
sync();
|
|
2996
|
+
recomputeSummaries();
|
|
2997
|
+
}
|
|
2998
|
+
/** Map the in-memory sorted rows (current page, or all) onto `ctrl`. */
|
|
2999
|
+
function syncBrowser() {
|
|
3000
|
+
const rows = browserRows ?? [];
|
|
3001
|
+
const size = pageSizeAll ? Math.max(1, rows.length) : Math.max(1, browserPageSize);
|
|
3002
|
+
const pageCount = Math.max(1, Math.ceil(rows.length / size));
|
|
3003
|
+
browserPageIndex = Math.min(Math.max(0, browserPageIndex), pageCount - 1);
|
|
3004
|
+
const start = browserPageIndex * size;
|
|
3005
|
+
ctrl.grouped = false;
|
|
3006
|
+
ctrl.items = rows.slice(start, start + size);
|
|
3007
|
+
ctrl.pageIndex = browserPageIndex;
|
|
3008
|
+
ctrl.pageSize = size;
|
|
3009
|
+
ctrl.pageSizeAll = pageSizeAll;
|
|
3010
|
+
ctrl.totalCount = rows.length;
|
|
3011
|
+
ctrl.pageCount = pageCount;
|
|
3012
|
+
render();
|
|
3013
|
+
}
|
|
2857
3014
|
/** Scroll modes only apply to a flat (ungrouped, non-server) grid. */
|
|
2858
3015
|
function scrollActive() {
|
|
2859
3016
|
return scrollMode !== "off" && !isGrouped() && !serverMode();
|
|
@@ -3786,6 +3943,41 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
3786
3943
|
});
|
|
3787
3944
|
ctrl.sorts = marked.map((m) => m.s);
|
|
3788
3945
|
}
|
|
3946
|
+
/**
|
|
3947
|
+
* The source selector a column DECLARED via `sort.selector`, if any — what the
|
|
3948
|
+
* DataSource / array source orders by in place of the field. Resolved like
|
|
3949
|
+
* `declaredSortIndex`: central `props.th` config first, then the element's own
|
|
3950
|
+
* `:sort.prop`. A blank string counts as not declared.
|
|
3951
|
+
*/
|
|
3952
|
+
function declaredSortSelector(field) {
|
|
3953
|
+
const sel = declaredSortConfig(field).selector;
|
|
3954
|
+
return typeof sel === "string" && sel.trim() ? sel.trim() : void 0;
|
|
3955
|
+
}
|
|
3956
|
+
/**
|
|
3957
|
+
* A column's declared sort OBJECT — the element's `:sort.prop` with central
|
|
3958
|
+
* `props.th` config merged over it (props win key by key, as everywhere). `{}`
|
|
3959
|
+
* for `sort: true` / no config.
|
|
3960
|
+
*/
|
|
3961
|
+
function declaredSortConfig(field) {
|
|
3962
|
+
const asObj = (sort) => typeof sort === "object" && sort ? sort : {};
|
|
3963
|
+
let fromEl = {};
|
|
3964
|
+
for (const el of columnEls) if (el.field === field && typeof el.sort === "object" && el.sort) {
|
|
3965
|
+
fromEl = asObj(el.sort);
|
|
3966
|
+
break;
|
|
3967
|
+
}
|
|
3968
|
+
return {
|
|
3969
|
+
...fromEl,
|
|
3970
|
+
...asObj((elementProps.th ?? []).find((c) => c?.field === field)?.sort)
|
|
3971
|
+
};
|
|
3972
|
+
}
|
|
3973
|
+
/**
|
|
3974
|
+
* Whether a sorted column is sorted IN THE BROWSER — its selector fans out over a
|
|
3975
|
+
* collection (`[*]`, which no source can order by) or it declares an `aggregate`.
|
|
3976
|
+
*/
|
|
3977
|
+
function isBrowserSortKey(field) {
|
|
3978
|
+
const sel = declaredSortSelector(field);
|
|
3979
|
+
return !!sel && parseFieldPath(sel).hasWildcard || !!declaredSortConfig(field).aggregate;
|
|
3980
|
+
}
|
|
3789
3981
|
/** Keep the single-value mirrors pointing at the primary key. */
|
|
3790
3982
|
function syncPrimarySort() {
|
|
3791
3983
|
ctrl.sortField = ctrl.sorts[0]?.field ?? null;
|
|
@@ -3974,14 +4166,23 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
3974
4166
|
* see the intermediate full-list state.
|
|
3975
4167
|
*/
|
|
3976
4168
|
async function getData() {
|
|
4169
|
+
if (browserRows && browserSortActive()) return [...browserRows];
|
|
4170
|
+
return readAllFromSource();
|
|
4171
|
+
}
|
|
4172
|
+
/** `getData`'s read — every matching row from the source, in its own order. */
|
|
4173
|
+
async function readAllFromSource() {
|
|
3977
4174
|
const s = bound;
|
|
3978
4175
|
if (!s) return [];
|
|
4176
|
+
const loadOptions = {};
|
|
4177
|
+
if (resolvedOpts.expand !== void 0) loadOptions.expand = resolvedOpts.expand;
|
|
4178
|
+
if (resolvedOpts.customQueryParams !== void 0) loadOptions.customQueryParams = resolvedOpts.customQueryParams;
|
|
3979
4179
|
suppressSync = true;
|
|
3980
4180
|
try {
|
|
3981
4181
|
return await readAllRows(s, {
|
|
3982
4182
|
chunkSize,
|
|
3983
4183
|
select: opts.select ?? toList(resolvedOpts.select),
|
|
3984
|
-
sort: mergedSort()
|
|
4184
|
+
sort: mergedSort(),
|
|
4185
|
+
...Object.keys(loadOptions).length ? { loadOptions } : {}
|
|
3985
4186
|
});
|
|
3986
4187
|
} finally {
|
|
3987
4188
|
suppressSync = false;
|
|
@@ -4015,7 +4216,7 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
4015
4216
|
});
|
|
4016
4217
|
}
|
|
4017
4218
|
async function exportReport(options) {
|
|
4018
|
-
const { exportTable } = await import("./export-
|
|
4219
|
+
const { exportTable } = await import("./export-ixRdCS2y.js");
|
|
4019
4220
|
return exportTable(options);
|
|
4020
4221
|
}
|
|
4021
4222
|
function subscribe(cb) {
|