@akinon/akitable 1.7.0-260909-0 → 1.7.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/cjs/common/navigation.d.ts +59 -0
- package/dist/cjs/common/navigation.d.ts.map +1 -0
- package/dist/cjs/common/navigation.js +112 -0
- package/dist/cjs/components/datatable.css +8 -0
- package/dist/cjs/components/datatable.d.ts.map +1 -1
- package/dist/cjs/components/datatable.js +176 -8
- package/dist/cjs/components/pagination.d.ts.map +1 -1
- package/dist/cjs/components/pagination.js +15 -2
- package/dist/cjs/constants.d.ts +3 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +4 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/types.d.ts +99 -3
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/common/navigation.d.ts +59 -0
- package/dist/esm/common/navigation.d.ts.map +1 -0
- package/dist/esm/common/navigation.js +107 -0
- package/dist/esm/components/datatable.css +8 -0
- package/dist/esm/components/datatable.d.ts.map +1 -1
- package/dist/esm/components/datatable.js +176 -8
- package/dist/esm/components/pagination.d.ts.map +1 -1
- package/dist/esm/components/pagination.js +15 -2
- package/dist/esm/constants.d.ts +3 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +99 -3
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/cjs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,E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ACrE,qBAAqB,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC;IAC7E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,UAAU,CAAC,EAAE,CACX,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,KAAK,CAAC,SAAS,KACxB,KAAK,CAAC,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChC,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,QAAQ,CAAC,EAAE,CACT,eAAe,EAAE,KAAK,CAAC,GAAG,EAAE,EAC5B,YAAY,EAAE,YAAY,EAAE,EAC5B,IAAI,EAAE;QAAE,IAAI,EAAE,uBAAuB,CAAA;KAAE,KACpC,IAAI,CAAC;IACV,QAAQ,CAAC,EAAE,CACT,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,YAAY,EAAE,EAC5B,WAAW,EAAE,KAAK,KACf,IAAI,CAAC;CACX;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,EAAE,CAAC,eAAe,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC;CAClD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation helpers behind this package's new-tab support.
|
|
3
|
+
*
|
|
4
|
+
* DUPLICATE — an identical copy lives in `@akinon/ui-breadcrumb` as
|
|
5
|
+
* `src/navigation.ts`. The two are kept apart on purpose: neither package
|
|
6
|
+
* should depend on the other, and a shared package would have to put them in
|
|
7
|
+
* its public API. `isSafeHref` is a security check, so any change here — a
|
|
8
|
+
* newly discovered bypass shape, a scheme added to the allow list — MUST be
|
|
9
|
+
* applied to the other copy as well.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Returns `true` when a mouse event expresses the user's intent to open the
|
|
13
|
+
* target in a new tab or window: middle click, `Cmd` + click (macOS) / `Ctrl` +
|
|
14
|
+
* click (Windows, Linux), or `Shift` + click.
|
|
15
|
+
*
|
|
16
|
+
* `Alt` + click is deliberately **not** included: it is a download gesture
|
|
17
|
+
* rather than a new-tab one, and it does nothing at all for in-app routes, so
|
|
18
|
+
* treating it as browser-handled would swallow the navigation entirely.
|
|
19
|
+
*
|
|
20
|
+
* Call sites must return early **without** calling `preventDefault()` when this
|
|
21
|
+
* returns `true`, so the browser's native anchor behavior takes over. This only
|
|
22
|
+
* works on elements that render as a real `<a href="...">`.
|
|
23
|
+
*
|
|
24
|
+
* The `button` check only matters for a call site that listens to
|
|
25
|
+
* `mousedown`/`auxclick`: a middle click dispatches `auxclick`, not `click`, so
|
|
26
|
+
* React's `onClick` never sees it.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isNewTabRequest: (event: Pick<MouseEvent, "button" | "metaKey" | "ctrlKey" | "shiftKey">) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Returns `true` when `href` is safe to render as a real `<a href="...">`
|
|
31
|
+
* attribute.
|
|
32
|
+
*
|
|
33
|
+
* Relative URLs (`/products/1`, `products/1`, `#/products/1`, `?page=2`) and
|
|
34
|
+
* the `http`, `https`, `mailto` and `tel` schemes are allowed. Any other scheme
|
|
35
|
+
* — `javascript:` above all — is rejected, since following such a link executes
|
|
36
|
+
* script in the page's own origin. Note that an internal routing key shaped
|
|
37
|
+
* like `catalog:detail` parses as the scheme `catalog:` and is rejected as
|
|
38
|
+
* well.
|
|
39
|
+
*
|
|
40
|
+
* This matters because navigation targets are typically derived from server
|
|
41
|
+
* data: an `href` built from a record field is untrusted input, and a real
|
|
42
|
+
* anchor is followed natively on middle click, `Cmd`/`Ctrl` + click and through
|
|
43
|
+
* the right-click context menu, where no click handler runs to intercept it.
|
|
44
|
+
*
|
|
45
|
+
* An empty or whitespace-only value is rejected as well: `<a href="">` points at
|
|
46
|
+
* the current document and reloads the page.
|
|
47
|
+
*
|
|
48
|
+
* Protocol-relative URLs (`//evil.com`) are rejected too. They carry no scheme,
|
|
49
|
+
* so they read as relative, but the browser resolves them against the current
|
|
50
|
+
* one and navigates off-origin — and no in-app route ever needs that shape.
|
|
51
|
+
* Absolute `http`/`https` URLs stay allowed on purpose: a cross-origin target
|
|
52
|
+
* can be legitimate, so the caller owns that decision — including whether it
|
|
53
|
+
* can carry `rel="noopener"`, which is a per-call-site matter.
|
|
54
|
+
*
|
|
55
|
+
* A rejected value is dropped silently: nothing is logged, and the element
|
|
56
|
+
* renders without an anchor.
|
|
57
|
+
*/
|
|
58
|
+
export declare const isSafeHref: (href: string | undefined | null) => boolean;
|
|
59
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/common/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoCH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC,KACrE,OAIa,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,OAkB5D,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation helpers behind this package's new-tab support.
|
|
3
|
+
*
|
|
4
|
+
* DUPLICATE — an identical copy lives in `@akinon/ui-breadcrumb` as
|
|
5
|
+
* `src/navigation.ts`. The two are kept apart on purpose: neither package
|
|
6
|
+
* should depend on the other, and a shared package would have to put them in
|
|
7
|
+
* its public API. `isSafeHref` is a security check, so any change here — a
|
|
8
|
+
* newly discovered bypass shape, a scheme added to the allow list — MUST be
|
|
9
|
+
* applied to the other copy as well.
|
|
10
|
+
*/
|
|
11
|
+
/** Mouse button number for the middle (wheel) button in `MouseEvent.button`. */
|
|
12
|
+
const MIDDLE_MOUSE_BUTTON = 1;
|
|
13
|
+
/**
|
|
14
|
+
* Control characters (tab and newline included) are stripped by browsers while
|
|
15
|
+
* parsing a URL, so `java\nscript:alert(1)` is a working `javascript:` URL and
|
|
16
|
+
* must not slip through the scheme check below.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately wider than the browser, which strips tab/CR/LF anywhere but
|
|
19
|
+
* whitespace only from the ends. Widening can never let an unsupported scheme
|
|
20
|
+
* through — the stripped characters cannot spell one out — so it errs in the
|
|
21
|
+
* safe direction. The range covers whitespace as well, so no separate `trim()`
|
|
22
|
+
* is needed.
|
|
23
|
+
*/
|
|
24
|
+
// eslint-disable-next-line no-control-regex
|
|
25
|
+
const CONTROL_CHARACTERS = /[\x00-\x20\x7f]/g;
|
|
26
|
+
/**
|
|
27
|
+
* Schemes that are safe to put into an `href` attribute. Everything else —
|
|
28
|
+
* most importantly `javascript:`, but also `data:` and `vbscript:` — can run
|
|
29
|
+
* script in the page's own origin when the link is followed.
|
|
30
|
+
*/
|
|
31
|
+
const SAFE_SCHEMES = ['http:', 'https:', 'mailto:', 'tel:'];
|
|
32
|
+
/** Matches a leading URL scheme, e.g. `https:` or `javascript:`. */
|
|
33
|
+
const SCHEME_PATTERN = /^([a-z][a-z0-9+.-]*):/;
|
|
34
|
+
/**
|
|
35
|
+
* Matches the leading slashes of a protocol-relative URL. Backslashes are
|
|
36
|
+
* folded in because browsers treat `\` as `/` while parsing a URL, which makes
|
|
37
|
+
* `\\evil.com` and `/\evil.com` protocol-relative just like `//evil.com`.
|
|
38
|
+
*/
|
|
39
|
+
const PROTOCOL_RELATIVE_PATTERN = /^[/\\]{2,}/;
|
|
40
|
+
/**
|
|
41
|
+
* Returns `true` when a mouse event expresses the user's intent to open the
|
|
42
|
+
* target in a new tab or window: middle click, `Cmd` + click (macOS) / `Ctrl` +
|
|
43
|
+
* click (Windows, Linux), or `Shift` + click.
|
|
44
|
+
*
|
|
45
|
+
* `Alt` + click is deliberately **not** included: it is a download gesture
|
|
46
|
+
* rather than a new-tab one, and it does nothing at all for in-app routes, so
|
|
47
|
+
* treating it as browser-handled would swallow the navigation entirely.
|
|
48
|
+
*
|
|
49
|
+
* Call sites must return early **without** calling `preventDefault()` when this
|
|
50
|
+
* returns `true`, so the browser's native anchor behavior takes over. This only
|
|
51
|
+
* works on elements that render as a real `<a href="...">`.
|
|
52
|
+
*
|
|
53
|
+
* The `button` check only matters for a call site that listens to
|
|
54
|
+
* `mousedown`/`auxclick`: a middle click dispatches `auxclick`, not `click`, so
|
|
55
|
+
* React's `onClick` never sees it.
|
|
56
|
+
*/
|
|
57
|
+
export const isNewTabRequest = (event) => event.button === MIDDLE_MOUSE_BUTTON ||
|
|
58
|
+
event.metaKey ||
|
|
59
|
+
event.ctrlKey ||
|
|
60
|
+
event.shiftKey;
|
|
61
|
+
/**
|
|
62
|
+
* Returns `true` when `href` is safe to render as a real `<a href="...">`
|
|
63
|
+
* attribute.
|
|
64
|
+
*
|
|
65
|
+
* Relative URLs (`/products/1`, `products/1`, `#/products/1`, `?page=2`) and
|
|
66
|
+
* the `http`, `https`, `mailto` and `tel` schemes are allowed. Any other scheme
|
|
67
|
+
* — `javascript:` above all — is rejected, since following such a link executes
|
|
68
|
+
* script in the page's own origin. Note that an internal routing key shaped
|
|
69
|
+
* like `catalog:detail` parses as the scheme `catalog:` and is rejected as
|
|
70
|
+
* well.
|
|
71
|
+
*
|
|
72
|
+
* This matters because navigation targets are typically derived from server
|
|
73
|
+
* data: an `href` built from a record field is untrusted input, and a real
|
|
74
|
+
* anchor is followed natively on middle click, `Cmd`/`Ctrl` + click and through
|
|
75
|
+
* the right-click context menu, where no click handler runs to intercept it.
|
|
76
|
+
*
|
|
77
|
+
* An empty or whitespace-only value is rejected as well: `<a href="">` points at
|
|
78
|
+
* the current document and reloads the page.
|
|
79
|
+
*
|
|
80
|
+
* Protocol-relative URLs (`//evil.com`) are rejected too. They carry no scheme,
|
|
81
|
+
* so they read as relative, but the browser resolves them against the current
|
|
82
|
+
* one and navigates off-origin — and no in-app route ever needs that shape.
|
|
83
|
+
* Absolute `http`/`https` URLs stay allowed on purpose: a cross-origin target
|
|
84
|
+
* can be legitimate, so the caller owns that decision — including whether it
|
|
85
|
+
* can carry `rel="noopener"`, which is a per-call-site matter.
|
|
86
|
+
*
|
|
87
|
+
* A rejected value is dropped silently: nothing is logged, and the element
|
|
88
|
+
* renders without an anchor.
|
|
89
|
+
*/
|
|
90
|
+
export const isSafeHref = (href) => {
|
|
91
|
+
var _a;
|
|
92
|
+
if (!href)
|
|
93
|
+
return false;
|
|
94
|
+
// Normalized the way the browser would parse it, so a value that only looks
|
|
95
|
+
// safe before the noise is stripped cannot get through.
|
|
96
|
+
const normalized = href.replace(CONTROL_CHARACTERS, '').toLowerCase();
|
|
97
|
+
if (!normalized)
|
|
98
|
+
return false;
|
|
99
|
+
// Checked before the scheme, since a protocol-relative URL carries none.
|
|
100
|
+
if (PROTOCOL_RELATIVE_PATTERN.test(normalized))
|
|
101
|
+
return false;
|
|
102
|
+
const scheme = (_a = SCHEME_PATTERN.exec(normalized)) === null || _a === void 0 ? void 0 : _a[1];
|
|
103
|
+
// No scheme at all — a relative URL, resolved against the current document.
|
|
104
|
+
if (!scheme)
|
|
105
|
+
return true;
|
|
106
|
+
return SAFE_SCHEMES.includes(`${scheme}:`);
|
|
107
|
+
};
|
|
@@ -167,3 +167,11 @@
|
|
|
167
167
|
opacity: 1 !important;
|
|
168
168
|
cursor: not-allowed;
|
|
169
169
|
}
|
|
170
|
+
|
|
171
|
+
/* Declarative action column items (`actionColumn.items`). Keeps the buttons on
|
|
172
|
+
one line instead of letting them wrap in a narrow action column. */
|
|
173
|
+
.akitable-action-items {
|
|
174
|
+
display: inline-flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: 0.25rem;
|
|
177
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datatable.d.ts","sourceRoot":"","sources":["../../../src/components/datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAQzB,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"datatable.d.ts","sourceRoot":"","sources":["../../../src/components/datatable.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AAQzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAOL,sBAAsB,EAIvB,MAAM,UAAU,CAAC;AAKlB,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,sBA2hB9D,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import './datatable.css';
|
|
2
13
|
import { Akiform } from '@akinon/akiform';
|
|
3
14
|
import { Button } from '@akinon/ui-button';
|
|
@@ -7,6 +18,7 @@ import { Empty } from 'antd';
|
|
|
7
18
|
import clsx from 'clsx';
|
|
8
19
|
import React from 'react';
|
|
9
20
|
import { useAkitableContext } from '../akitable-context';
|
|
21
|
+
import { isNewTabRequest, isSafeHref } from '../common/navigation';
|
|
10
22
|
import { i18n } from '../i18n';
|
|
11
23
|
import { AkitableRowStatus } from '../types';
|
|
12
24
|
import EditableCell from './EditableCell';
|
|
@@ -23,12 +35,46 @@ export const AkitableDataTable = (props) => {
|
|
|
23
35
|
if (!editingKey)
|
|
24
36
|
setHasFormErrors(false);
|
|
25
37
|
}, [editingKey]);
|
|
38
|
+
/** Keys of the misconfiguration reports already made by this instance. */
|
|
39
|
+
const warnedConfigKeysRef = React.useRef(new Set());
|
|
40
|
+
// Developer-facing misconfiguration reports, stripped from production builds
|
|
41
|
+
// the way antd's own `devUseWarning` is: the messages help nobody in a
|
|
42
|
+
// shipped app, and the guard lets a bundler drop the whole block.
|
|
43
|
+
//
|
|
44
|
+
// Re-checked when the props change rather than only on mount: an
|
|
45
|
+
// `actionColumn` is commonly built from data (permissions, an async config),
|
|
46
|
+
// so it can arrive after the first render. Each report is deduplicated per
|
|
47
|
+
// instance instead, since `actionColumn` is typically an inline object
|
|
48
|
+
// literal whose identity changes on every render.
|
|
26
49
|
React.useEffect(() => {
|
|
50
|
+
var _a;
|
|
51
|
+
if (process.env.NODE_ENV === 'production')
|
|
52
|
+
return;
|
|
53
|
+
const warnOnce = (key, message) => {
|
|
54
|
+
if (warnedConfigKeysRef.current.has(key))
|
|
55
|
+
return;
|
|
56
|
+
warnedConfigKeysRef.current.add(key);
|
|
57
|
+
console.warn(message);
|
|
58
|
+
};
|
|
27
59
|
if (onRowEdit && !actionColumn) {
|
|
28
|
-
|
|
60
|
+
warnOnce('onRowEdit-without-actionColumn', '[Akitable] onRowEdit is provided without actionColumn. ' +
|
|
29
61
|
'Please migrate to the actionColumn prop to customize the action column.');
|
|
30
62
|
}
|
|
31
|
-
|
|
63
|
+
if ((actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.render) && (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.items)) {
|
|
64
|
+
warnOnce('render-and-items', '[Akitable] actionColumn.render and actionColumn.items are both provided. ' +
|
|
65
|
+
'render takes precedence and items is ignored.');
|
|
66
|
+
}
|
|
67
|
+
if (actionColumn && !actionColumn.render && !actionColumn.items) {
|
|
68
|
+
warnOnce('actionColumn-without-actions', '[Akitable] actionColumn is provided without render or items. ' +
|
|
69
|
+
'The column renders no actions — and it replaces the built-in edit ' +
|
|
70
|
+
'column, so there is no way to enter edit mode either. Provide one ' +
|
|
71
|
+
'of them.');
|
|
72
|
+
}
|
|
73
|
+
if (!onRowEdit && ((_a = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.items) === null || _a === void 0 ? void 0 : _a.some(item => item.startEdit))) {
|
|
74
|
+
warnOnce('startEdit-without-onRowEdit', '[Akitable] actionColumn.items contains a startEdit item but onRowEdit ' +
|
|
75
|
+
'is not provided. Saving the edited row would fail.');
|
|
76
|
+
}
|
|
77
|
+
}, [actionColumn, onRowEdit]);
|
|
32
78
|
const [isOverflowing, setIsOverflowing] = React.useState(false);
|
|
33
79
|
const wrapperRef = React.useRef(null);
|
|
34
80
|
const hasActions = actions && actions.length > 0;
|
|
@@ -58,6 +104,15 @@ export const AkitableDataTable = (props) => {
|
|
|
58
104
|
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
59
105
|
},
|
|
60
106
|
handleSaveEditingItem: async () => {
|
|
107
|
+
// Without `onRowEdit` there is nowhere to save to. Keep the row editable
|
|
108
|
+
// rather than throwing and discarding what was typed, and report the
|
|
109
|
+
// misconfiguration outside production builds.
|
|
110
|
+
if (!onRowEdit) {
|
|
111
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
112
|
+
console.error('[Akitable] Cannot save the edited row because onRowEdit is not provided.');
|
|
113
|
+
}
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
61
116
|
try {
|
|
62
117
|
setIsLoadingSaveButton(true);
|
|
63
118
|
await onRowEdit(record, form.getFieldsValue());
|
|
@@ -70,7 +125,121 @@ export const AkitableDataTable = (props) => {
|
|
|
70
125
|
},
|
|
71
126
|
handleCancelEditingItem: () => setEditingKey(null)
|
|
72
127
|
});
|
|
73
|
-
|
|
128
|
+
/**
|
|
129
|
+
* The save/cancel pair shown while a row is being edited. Shared by the
|
|
130
|
+
* default edit column and the declarative `items` action column so both
|
|
131
|
+
* render an identical editing state.
|
|
132
|
+
*/
|
|
133
|
+
const renderEditingActions = ({ handleSaveEditingItem, handleCancelEditingItem }) => (React.createElement("span", null,
|
|
134
|
+
React.createElement(Button, { size: "small", onClick: handleSaveEditingItem, loading: isLoadingSaveButton, disabled: hasFormErrors, className: clsx({
|
|
135
|
+
'akitable-save-button--has-errors': hasFormErrors
|
|
136
|
+
}) }, t('save')),
|
|
137
|
+
React.createElement(Text, Object.assign({ type: "danger", disabled: isLoadingSaveButton, className: "cursor-pointer ml-2" }, (!isLoadingSaveButton && { onClick: handleCancelEditingItem })), t('cancel'))));
|
|
138
|
+
const resolveActionItemValue = (value, record) => typeof value === 'function'
|
|
139
|
+
? value(record)
|
|
140
|
+
: value;
|
|
141
|
+
const renderActionItem = (item, index, onNavigate, params) => {
|
|
142
|
+
const { record } = params;
|
|
143
|
+
const { key, label, startEdit, href: hrefValue, hidden, disabled: disabledValue, onClick: onItemClick } = item, buttonProps = __rest(item, ["key", "label", "startEdit", "href", "hidden", "disabled", "onClick"]);
|
|
144
|
+
if (resolveActionItemValue(hidden, record))
|
|
145
|
+
return null;
|
|
146
|
+
const resolvedHref = resolveActionItemValue(hrefValue, record);
|
|
147
|
+
const disabled = resolveActionItemValue(disabledValue, record);
|
|
148
|
+
// An `href` is usually derived from record data, so it is validated rather
|
|
149
|
+
// than trusted — see `isSafeHref` for which values are accepted and why
|
|
150
|
+
// rendering a real anchor makes that necessary.
|
|
151
|
+
//
|
|
152
|
+
// A rejected value is dropped silently: it never reaches the anchor, the
|
|
153
|
+
// item degrades to a plain button and nothing is logged. A builder slip
|
|
154
|
+
// like `record => record.detailUrl ?? ''` therefore shows up as a button
|
|
155
|
+
// where a link was expected, not as a console message.
|
|
156
|
+
const href = isSafeHref(resolvedHref) ? resolvedHref : undefined;
|
|
157
|
+
const handleClick = (event) => {
|
|
158
|
+
// Action buttons live inside a row that may have its own `onRowClick`.
|
|
159
|
+
// The wrapper in `renderActionItems` stops the same propagation for the
|
|
160
|
+
// clicks antd swallows before this handler ever runs; this one covers the
|
|
161
|
+
// ordinary path.
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
if (startEdit) {
|
|
164
|
+
// A `startEdit` item never becomes an anchor (see the `href` prop
|
|
165
|
+
// below), so there is no default navigation to prevent here.
|
|
166
|
+
params.handleStartEdit(event);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (!href) {
|
|
170
|
+
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(record, event);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// New tab request (middle click, Cmd/Ctrl/Shift + click) — hand over to
|
|
174
|
+
// the browser. Never `preventDefault()` here, otherwise the native
|
|
175
|
+
// anchor behavior is destroyed.
|
|
176
|
+
if (isNewTabRequest(event) || event.defaultPrevented)
|
|
177
|
+
return;
|
|
178
|
+
// A per-item `onClick` wins over the column level `onNavigate` so a
|
|
179
|
+
// single item can route itself.
|
|
180
|
+
const navigate = onItemClick
|
|
181
|
+
? () => onItemClick(record, event)
|
|
182
|
+
: onNavigate
|
|
183
|
+
? () => onNavigate(href, record, event)
|
|
184
|
+
: undefined;
|
|
185
|
+
// With no handler there is nothing to intercept: let the browser follow
|
|
186
|
+
// the `href` instead of leaving a dead link behind.
|
|
187
|
+
if (!navigate)
|
|
188
|
+
return;
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
navigate();
|
|
191
|
+
};
|
|
192
|
+
return (React.createElement(Button, Object.assign({}, buttonProps, { key: key !== null && key !== void 0 ? key : index,
|
|
193
|
+
// An `href` makes `@akinon/ui-button` render a real <a href>, which is
|
|
194
|
+
// what enables the browser's native new-tab gestures.
|
|
195
|
+
//
|
|
196
|
+
// Neither a disabled, a loading nor a `startEdit` item may become an
|
|
197
|
+
// anchor. antd swallows the click handler of a disabled Button, so
|
|
198
|
+
// `stopPropagation` would never run and the click would bubble up to
|
|
199
|
+
// `onRowClick`; a real <button disabled> dispatches no click at all.
|
|
200
|
+
//
|
|
201
|
+
// A loading Button is swallowed the same way but is *not* marked
|
|
202
|
+
// disabled in the DOM, so an anchor left in place would take a click
|
|
203
|
+
// that reaches neither the item nor `preventDefault` — antd calls that
|
|
204
|
+
// itself — leaving a dead left click whose event still bubbles to
|
|
205
|
+
// `onRowClick`, while a middle click would keep opening a new tab. That
|
|
206
|
+
// is exactly the "two gestures, two targets" split this API exists to
|
|
207
|
+
// avoid. `loading` is read as truthy, so the `{ delay }` form drops the
|
|
208
|
+
// anchor from the start rather than once the delay elapses.
|
|
209
|
+
//
|
|
210
|
+
// And a `startEdit` item is not a navigation target, so an anchor would
|
|
211
|
+
// be followed by the browser on a middle click or through the context
|
|
212
|
+
// menu — gestures that dispatch `auxclick` or no event at all, leaving
|
|
213
|
+
// no handler to stop.
|
|
214
|
+
href: disabled || startEdit || item.loading ? undefined : href, disabled: disabled, size: "small", onClick: handleClick }), label));
|
|
215
|
+
};
|
|
216
|
+
const renderActionItems = (items, onNavigate, params) => {
|
|
217
|
+
if (params.isEditing)
|
|
218
|
+
return renderEditingActions(params);
|
|
219
|
+
return (React.createElement("span", { className: "akitable-action-items",
|
|
220
|
+
// Safety net for the row's own `onRowClick`: antd never calls a
|
|
221
|
+
// Button's `onClick` while it is loading or disabled, so an item's own
|
|
222
|
+
// `stopPropagation` cannot be relied on to keep the click from bubbling
|
|
223
|
+
// up to the row.
|
|
224
|
+
onClick: event => event.stopPropagation() }, items.map((item, index) => renderActionItem(item, index, onNavigate, params))));
|
|
225
|
+
};
|
|
226
|
+
const buildActionColumn = (col) => {
|
|
227
|
+
// `items`/`onNavigate` are Akinon-only fields; keep them out of the object
|
|
228
|
+
// that is handed to antd's `Table` as a column definition.
|
|
229
|
+
const { items, onNavigate, render } = col, columnProps = __rest(col, ["items", "onNavigate", "render"]);
|
|
230
|
+
return Object.assign(Object.assign({}, columnProps), { key: '__akitable_action__',
|
|
231
|
+
// rc-table passes the whole record as the first argument when the column
|
|
232
|
+
// has no `dataIndex`.
|
|
233
|
+
render: (record) => {
|
|
234
|
+
const params = Object.assign({ record, isEditing: checkIsEditingRow(getRowKeyData(record)), isEditLoading: isLoadingSaveButton, hasEditFormError: hasFormErrors }, buildActionHandlers(record));
|
|
235
|
+
// `render` wins over `items` so existing consumers are untouched.
|
|
236
|
+
if (render)
|
|
237
|
+
return render(params);
|
|
238
|
+
if (items)
|
|
239
|
+
return renderActionItems(items, onNavigate, params);
|
|
240
|
+
return null;
|
|
241
|
+
} });
|
|
242
|
+
};
|
|
74
243
|
const handleFormFieldsChange = (_, allFields) => {
|
|
75
244
|
setHasFormErrors(allFields.some(f => { var _a, _b; return ((_b = (_a = f.errors) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0; }));
|
|
76
245
|
};
|
|
@@ -81,11 +250,10 @@ export const AkitableDataTable = (props) => {
|
|
|
81
250
|
render: (record) => {
|
|
82
251
|
const isRowEditing = checkIsEditingRow(getRowKeyData(record));
|
|
83
252
|
const { handleStartEdit, handleSaveEditingItem, handleCancelEditingItem } = buildActionHandlers(record);
|
|
84
|
-
return isRowEditing ? (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
React.createElement(Text, Object.assign({ type: "danger", disabled: isLoadingSaveButton, className: "cursor-pointer ml-2" }, (!isLoadingSaveButton && { onClick: handleCancelEditingItem })), t('cancel')))) : (React.createElement(Button, { type: "primary", size: "small", onClick: handleStartEdit, className: clsx({
|
|
253
|
+
return isRowEditing ? (renderEditingActions({
|
|
254
|
+
handleSaveEditingItem,
|
|
255
|
+
handleCancelEditingItem
|
|
256
|
+
})) : (React.createElement(Button, { type: "primary", size: "small", onClick: handleStartEdit, className: clsx({
|
|
89
257
|
'akinon-table-edit-button--disable': isLoadingSaveButton
|
|
90
258
|
}) }, t('edit')));
|
|
91
259
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AA6B1B,eAAO,MAAM,kBAAkB,yBA8C9B,CAAC"}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import { Pagination } from '@akinon/ui-pagination';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useAkitableContext } from '../akitable-context';
|
|
4
|
+
import { AKITABLE_DEFAULT_PAGE_SIZE_OPTIONS } from '../constants';
|
|
4
5
|
import { i18n } from '../i18n';
|
|
5
|
-
const
|
|
6
|
+
const resolvePageSizeOptions = (requestedOptions) => [
|
|
7
|
+
...new Set((requestedOptions === null || requestedOptions === void 0 ? void 0 : requestedOptions.length)
|
|
8
|
+
? requestedOptions
|
|
9
|
+
: AKITABLE_DEFAULT_PAGE_SIZE_OPTIONS)
|
|
10
|
+
];
|
|
11
|
+
const resolvePageSize = (requestedSize, pageSizeOptions) => {
|
|
12
|
+
const isPositiveInteger = typeof requestedSize === 'number' &&
|
|
13
|
+
Number.isInteger(requestedSize) &&
|
|
14
|
+
requestedSize > 0;
|
|
15
|
+
return isPositiveInteger ? requestedSize : pageSizeOptions[0];
|
|
16
|
+
};
|
|
6
17
|
export const AkitablePagination = () => {
|
|
7
18
|
const { isLoading, pagination, onPaginationChanged, paginationShowTotal } = useAkitableContext();
|
|
8
19
|
const { t } = i18n;
|
|
9
20
|
const totalPagination = (pagination === null || pagination === void 0 ? void 0 : pagination.total) || 0;
|
|
21
|
+
const pageSizeOptions = resolvePageSizeOptions(pagination === null || pagination === void 0 ? void 0 : pagination.pageSizeOptions);
|
|
22
|
+
const pageSize = resolvePageSize(pagination === null || pagination === void 0 ? void 0 : pagination.size, pageSizeOptions);
|
|
10
23
|
const hasItems = totalPagination > 0;
|
|
11
24
|
const locale = {
|
|
12
25
|
items_per_page: t('itemsPerPage')
|
|
@@ -26,5 +39,5 @@ export const AkitablePagination = () => {
|
|
|
26
39
|
return null;
|
|
27
40
|
};
|
|
28
41
|
return (React.createElement("div", { className: "akitable-pagination" },
|
|
29
|
-
React.createElement(Pagination, { disabled: isLoading || !hasItems, current: pagination === null || pagination === void 0 ? void 0 : pagination.page, pageSize:
|
|
42
|
+
React.createElement(Pagination, { disabled: isLoading || !hasItems, current: pagination === null || pagination === void 0 ? void 0 : pagination.page, pageSize: pageSize, pageSizeOptions: pageSizeOptions, total: totalPagination, showTotal: handleShowTotal, showSizeChanger: true, onChange: handleOnChange, locale: locale, theme: "light" })));
|
|
30
43
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,eAAO,MAAM,kCAAkC,EAAE,SAAS,iBAAiB,EACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const AKITABLE_DEFAULT_PAGE_SIZE_OPTIONS = Object.freeze([20, 50, 100, 250]);
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
package/dist/esm/index.js
CHANGED