@canvas-components/react-list-table 0.3.51 → 0.3.53
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 +47 -14
- package/dist/index.js +48 -15
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,10 @@ var printDesign = require('@canvas-components/print-design');
|
|
|
14
14
|
var print = require('@canvas-components/print');
|
|
15
15
|
var client = require('react-dom/client');
|
|
16
16
|
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
20
|
+
|
|
17
21
|
// #style-inject:#style-inject
|
|
18
22
|
function styleInject(css, { insertAt } = {}) {
|
|
19
23
|
if (!css || typeof document === "undefined") return;
|
|
@@ -4545,6 +4549,7 @@ function createPrintProgress(container, onCancel) {
|
|
|
4545
4549
|
let message = "\u6B63\u5728\u8BFB\u53D6\u6253\u5370\u6570\u636E";
|
|
4546
4550
|
let percent = 0;
|
|
4547
4551
|
let failed = false;
|
|
4552
|
+
let errorTitle = "\u6253\u5370\u5931\u8D25";
|
|
4548
4553
|
let closeTimer;
|
|
4549
4554
|
let resolveClose;
|
|
4550
4555
|
let configuring = false;
|
|
@@ -4575,7 +4580,7 @@ function createPrintProgress(container, onCancel) {
|
|
|
4575
4580
|
reactComponents.ReactModal,
|
|
4576
4581
|
{
|
|
4577
4582
|
open,
|
|
4578
|
-
title: configuring ? "\u76F4\u63A5\u6253\u5370\u8BBE\u7F6E" : failed ?
|
|
4583
|
+
title: configuring ? "\u76F4\u63A5\u6253\u5370\u8BBE\u7F6E" : failed ? errorTitle : "\u6B63\u5728\u51C6\u5907\u6253\u5370",
|
|
4579
4584
|
width: 440,
|
|
4580
4585
|
centered: true,
|
|
4581
4586
|
maskClosable: false,
|
|
@@ -4595,7 +4600,15 @@ function createPrintProgress(container, onCancel) {
|
|
|
4595
4600
|
)
|
|
4596
4601
|
] }),
|
|
4597
4602
|
children: [
|
|
4598
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4603
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4604
|
+
"p",
|
|
4605
|
+
{
|
|
4606
|
+
role: "status",
|
|
4607
|
+
"aria-live": "polite",
|
|
4608
|
+
style: { whiteSpace: "pre-line" },
|
|
4609
|
+
children: message
|
|
4610
|
+
}
|
|
4611
|
+
),
|
|
4599
4612
|
configuring ? /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
4600
4613
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { whiteSpace: "nowrap", flexShrink: 0 }, children: "\u6BCF\u6B21\u6253\u5370\u9875\u6570" }),
|
|
4601
4614
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4652,8 +4665,9 @@ function createPrintProgress(container, onCancel) {
|
|
|
4652
4665
|
percent = value;
|
|
4653
4666
|
render();
|
|
4654
4667
|
},
|
|
4655
|
-
error(text) {
|
|
4668
|
+
error(text, title) {
|
|
4656
4669
|
message = text;
|
|
4670
|
+
errorTitle = title ?? "\u6253\u5370\u5931\u8D25";
|
|
4657
4671
|
failed = true;
|
|
4658
4672
|
render();
|
|
4659
4673
|
},
|
|
@@ -4760,6 +4774,12 @@ async function preparePrintRows(source, options = {}) {
|
|
|
4760
4774
|
}
|
|
4761
4775
|
|
|
4762
4776
|
// src/features/print/direct-print.ts
|
|
4777
|
+
var InvalidPrintTemplateError = class extends Error {
|
|
4778
|
+
constructor(locations) {
|
|
4779
|
+
super("\u6253\u5370\u6A21\u677F\u5DF2\u5931\u6548");
|
|
4780
|
+
__publicField(this, "locations", locations);
|
|
4781
|
+
}
|
|
4782
|
+
};
|
|
4763
4783
|
async function runDirectPrint(container, loadSource, resolveTemplate = (source) => createTableDocument({ ...source, rows: [] }), validate, defaultPagesPerBatch = 50) {
|
|
4764
4784
|
const controller = new AbortController();
|
|
4765
4785
|
const { signal } = controller;
|
|
@@ -4903,9 +4923,16 @@ async function runDirectPrint(container, loadSource, resolveTemplate = (source)
|
|
|
4903
4923
|
} catch (error) {
|
|
4904
4924
|
frame?.remove();
|
|
4905
4925
|
if (!signal.aborted) {
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4926
|
+
if (error instanceof InvalidPrintTemplateError)
|
|
4927
|
+
progress.error(
|
|
4928
|
+
`${error.locations.join("\n")}
|
|
4929
|
+
\u4FEE\u6539\u6A21\u677F\u540E\u53EF\u7EE7\u7EED\u4F7F\u7528\u3002`,
|
|
4930
|
+
"\u6253\u5370\u6A21\u677F\u5DF2\u5931\u6548"
|
|
4931
|
+
);
|
|
4932
|
+
else
|
|
4933
|
+
progress.error(
|
|
4934
|
+
`\u6253\u5370\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
4935
|
+
);
|
|
4909
4936
|
} else await cleanup(true);
|
|
4910
4937
|
} finally {
|
|
4911
4938
|
clearInterval(timer);
|
|
@@ -7274,16 +7301,22 @@ function ReactListTableInner(props, ref) {
|
|
|
7274
7301
|
return document2;
|
|
7275
7302
|
},
|
|
7276
7303
|
(source, document2, data) => {
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
savedPrintTemplates.find(
|
|
7281
|
-
(item) => item.id === key.slice(6)
|
|
7282
|
-
),
|
|
7304
|
+
const saved = key.startsWith("saved:") ? savedPrintTemplates.find((item) => item.id === key.slice(6)) : void 0;
|
|
7305
|
+
if (!reactPrintDesign.isPrintDesignDocumentCompatible(document2, data) || saved && reactPrintDesign.isPrintDesignTemplateInvalid(
|
|
7306
|
+
saved,
|
|
7283
7307
|
getPrintSourceFormat(source),
|
|
7284
7308
|
data
|
|
7285
|
-
))
|
|
7286
|
-
|
|
7309
|
+
)) {
|
|
7310
|
+
const locations = reactPrintDesign.getPrintDesignTemplateInvalidLocations(
|
|
7311
|
+
document2,
|
|
7312
|
+
data,
|
|
7313
|
+
saved?.dataFormat,
|
|
7314
|
+
getPrintSourceFormat(source)
|
|
7315
|
+
);
|
|
7316
|
+
throw new InvalidPrintTemplateError(
|
|
7317
|
+
locations.length ? locations : ["\u6A21\u677F\u4E0E\u5F53\u524D\u6570\u636E\u4E0D\u517C\u5BB9"]
|
|
7318
|
+
);
|
|
7319
|
+
}
|
|
7287
7320
|
},
|
|
7288
7321
|
props.directPrintPagesPerBatch
|
|
7289
7322
|
);
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, memo, forwardRef, useMemo, useRef, useState, useEffect, useImperativeHandle, useLayoutEffect, useContext, useId, Fragment as Fragment$1, useCallback } from 'react';
|
|
2
2
|
import { createPortal, flushSync } from 'react-dom';
|
|
3
3
|
import { getSharedScrollbarSettings, subscribeSharedScrollbarSettings, ReactTooltip, setSharedScrollbarSettings, ReactImagePreview, ReactCheckbox, ReactSortableList, ReactInputNumber, ReactSelect, ReactPagination, ReactFilterPanel, ReactPopup, ReactScrollbarSettingsDialog, ReactScrollbarPositionDialog, ReactModal, ReactButton, ReactInput, ReactPopconfirm, ReactContentScaleProvider, ReactColorPicker, resolveReactScrollbarMode, ReactProgress, ReactAutoComplete, ReactTimeRangePicker, ReactDateTimeRangePicker, ReactDateTimePicker, ReactTimePicker, ReactDateRangePicker, ReactDatePicker, ReactMonthPicker, ReactQuarterPicker, ReactYearPicker, ReactInputRange, ReactCascader, ReactTreeSelect } from '@canvas-components/react-components';
|
|
4
|
-
import { readPrintDesignTemplates, isPrintDesignDocumentCompatible, isPrintDesignTemplateInvalid, ReactPrintDesign } from '@canvas-components/react-print-design';
|
|
4
|
+
import { readPrintDesignTemplates, isPrintDesignDocumentCompatible, isPrintDesignTemplateInvalid, getPrintDesignTemplateInvalidLocations, ReactPrintDesign } from '@canvas-components/react-print-design';
|
|
5
5
|
import { EXPAND_COLUMN, SELECTION_COLUMN, ROW_SELECTION_COLUMN, resetListTableStoredColumnConfig, ListTable, getListTableStoredColumnConfig, saveListTableStoredColumnConfig } from '@canvas-components/list-table';
|
|
6
6
|
export { EXPAND_COLUMN, ROW_SELECTION_COLUMN, SELECTION_COLUMN, getListTableStoredPageSize } from '@canvas-components/list-table';
|
|
7
7
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -13,6 +13,10 @@ import { transformPrintDesignToHtmlBatches, createPrintDesignPage, createPrintDe
|
|
|
13
13
|
import { BROWSER_PRINT_PAPER_SIZES } from '@canvas-components/print';
|
|
14
14
|
import { createRoot } from 'react-dom/client';
|
|
15
15
|
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
19
|
+
|
|
16
20
|
// #style-inject:#style-inject
|
|
17
21
|
function styleInject(css, { insertAt } = {}) {
|
|
18
22
|
if (!css || typeof document === "undefined") return;
|
|
@@ -4544,6 +4548,7 @@ function createPrintProgress(container, onCancel) {
|
|
|
4544
4548
|
let message = "\u6B63\u5728\u8BFB\u53D6\u6253\u5370\u6570\u636E";
|
|
4545
4549
|
let percent = 0;
|
|
4546
4550
|
let failed = false;
|
|
4551
|
+
let errorTitle = "\u6253\u5370\u5931\u8D25";
|
|
4547
4552
|
let closeTimer;
|
|
4548
4553
|
let resolveClose;
|
|
4549
4554
|
let configuring = false;
|
|
@@ -4574,7 +4579,7 @@ function createPrintProgress(container, onCancel) {
|
|
|
4574
4579
|
ReactModal,
|
|
4575
4580
|
{
|
|
4576
4581
|
open,
|
|
4577
|
-
title: configuring ? "\u76F4\u63A5\u6253\u5370\u8BBE\u7F6E" : failed ?
|
|
4582
|
+
title: configuring ? "\u76F4\u63A5\u6253\u5370\u8BBE\u7F6E" : failed ? errorTitle : "\u6B63\u5728\u51C6\u5907\u6253\u5370",
|
|
4578
4583
|
width: 440,
|
|
4579
4584
|
centered: true,
|
|
4580
4585
|
maskClosable: false,
|
|
@@ -4594,7 +4599,15 @@ function createPrintProgress(container, onCancel) {
|
|
|
4594
4599
|
)
|
|
4595
4600
|
] }),
|
|
4596
4601
|
children: [
|
|
4597
|
-
/* @__PURE__ */ jsx(
|
|
4602
|
+
/* @__PURE__ */ jsx(
|
|
4603
|
+
"p",
|
|
4604
|
+
{
|
|
4605
|
+
role: "status",
|
|
4606
|
+
"aria-live": "polite",
|
|
4607
|
+
style: { whiteSpace: "pre-line" },
|
|
4608
|
+
children: message
|
|
4609
|
+
}
|
|
4610
|
+
),
|
|
4598
4611
|
configuring ? /* @__PURE__ */ jsxs("label", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
4599
4612
|
/* @__PURE__ */ jsx("span", { style: { whiteSpace: "nowrap", flexShrink: 0 }, children: "\u6BCF\u6B21\u6253\u5370\u9875\u6570" }),
|
|
4600
4613
|
/* @__PURE__ */ jsx(
|
|
@@ -4651,8 +4664,9 @@ function createPrintProgress(container, onCancel) {
|
|
|
4651
4664
|
percent = value;
|
|
4652
4665
|
render();
|
|
4653
4666
|
},
|
|
4654
|
-
error(text) {
|
|
4667
|
+
error(text, title) {
|
|
4655
4668
|
message = text;
|
|
4669
|
+
errorTitle = title ?? "\u6253\u5370\u5931\u8D25";
|
|
4656
4670
|
failed = true;
|
|
4657
4671
|
render();
|
|
4658
4672
|
},
|
|
@@ -4759,6 +4773,12 @@ async function preparePrintRows(source, options = {}) {
|
|
|
4759
4773
|
}
|
|
4760
4774
|
|
|
4761
4775
|
// src/features/print/direct-print.ts
|
|
4776
|
+
var InvalidPrintTemplateError = class extends Error {
|
|
4777
|
+
constructor(locations) {
|
|
4778
|
+
super("\u6253\u5370\u6A21\u677F\u5DF2\u5931\u6548");
|
|
4779
|
+
__publicField(this, "locations", locations);
|
|
4780
|
+
}
|
|
4781
|
+
};
|
|
4762
4782
|
async function runDirectPrint(container, loadSource, resolveTemplate = (source) => createTableDocument({ ...source, rows: [] }), validate, defaultPagesPerBatch = 50) {
|
|
4763
4783
|
const controller = new AbortController();
|
|
4764
4784
|
const { signal } = controller;
|
|
@@ -4902,9 +4922,16 @@ async function runDirectPrint(container, loadSource, resolveTemplate = (source)
|
|
|
4902
4922
|
} catch (error) {
|
|
4903
4923
|
frame?.remove();
|
|
4904
4924
|
if (!signal.aborted) {
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4925
|
+
if (error instanceof InvalidPrintTemplateError)
|
|
4926
|
+
progress.error(
|
|
4927
|
+
`${error.locations.join("\n")}
|
|
4928
|
+
\u4FEE\u6539\u6A21\u677F\u540E\u53EF\u7EE7\u7EED\u4F7F\u7528\u3002`,
|
|
4929
|
+
"\u6253\u5370\u6A21\u677F\u5DF2\u5931\u6548"
|
|
4930
|
+
);
|
|
4931
|
+
else
|
|
4932
|
+
progress.error(
|
|
4933
|
+
`\u6253\u5370\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
4934
|
+
);
|
|
4908
4935
|
} else await cleanup(true);
|
|
4909
4936
|
} finally {
|
|
4910
4937
|
clearInterval(timer);
|
|
@@ -7273,16 +7300,22 @@ function ReactListTableInner(props, ref) {
|
|
|
7273
7300
|
return document2;
|
|
7274
7301
|
},
|
|
7275
7302
|
(source, document2, data) => {
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
savedPrintTemplates.find(
|
|
7280
|
-
(item) => item.id === key.slice(6)
|
|
7281
|
-
),
|
|
7303
|
+
const saved = key.startsWith("saved:") ? savedPrintTemplates.find((item) => item.id === key.slice(6)) : void 0;
|
|
7304
|
+
if (!isPrintDesignDocumentCompatible(document2, data) || saved && isPrintDesignTemplateInvalid(
|
|
7305
|
+
saved,
|
|
7282
7306
|
getPrintSourceFormat(source),
|
|
7283
7307
|
data
|
|
7284
|
-
))
|
|
7285
|
-
|
|
7308
|
+
)) {
|
|
7309
|
+
const locations = getPrintDesignTemplateInvalidLocations(
|
|
7310
|
+
document2,
|
|
7311
|
+
data,
|
|
7312
|
+
saved?.dataFormat,
|
|
7313
|
+
getPrintSourceFormat(source)
|
|
7314
|
+
);
|
|
7315
|
+
throw new InvalidPrintTemplateError(
|
|
7316
|
+
locations.length ? locations : ["\u6A21\u677F\u4E0E\u5F53\u524D\u6570\u636E\u4E0D\u517C\u5BB9"]
|
|
7317
|
+
);
|
|
7318
|
+
}
|
|
7286
7319
|
},
|
|
7287
7320
|
props.directPrintPagesPerBatch
|
|
7288
7321
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvas-components/react-list-table",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.53",
|
|
4
4
|
"description": "React adapter for the list table core engine.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"pnpm": ">=9.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@canvas-components/react-print-design": "0.1.5",
|
|
32
|
-
"@canvas-components/chart": "0.3.9",
|
|
33
31
|
"@canvas-components/print": "0.1.1",
|
|
34
32
|
"@canvas-components/list-table": "0.3.43",
|
|
35
33
|
"@canvas-components/react-components": "0.3.24",
|
|
36
|
-
"@canvas-components/
|
|
34
|
+
"@canvas-components/chart": "0.3.9",
|
|
35
|
+
"@canvas-components/react-print-design": "0.1.7",
|
|
36
|
+
"@canvas-components/print-design": "0.1.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=16.8.0",
|