@seanyeh77/ui 0.43.1 → 0.44.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.
Files changed (129) hide show
  1. package/dist/bundle.js +14 -14
  2. package/dist/bundle.js.map +1 -1
  3. package/dist/components/Alert/Alert.d.ts +1 -1
  4. package/dist/components/Alert/Alert.js +2 -1
  5. package/dist/components/Alert/Alert.js.map +1 -1
  6. package/dist/components/DangerZone/DangerZone.d.ts +1 -1
  7. package/dist/components/DangerZone/DangerZone.js +2 -1
  8. package/dist/components/DangerZone/DangerZone.js.map +1 -1
  9. package/dist/components/DataTable/DataTable.d.ts +8 -3
  10. package/dist/components/DataTable/DataTable.js +155 -63
  11. package/dist/components/DataTable/DataTable.js.map +1 -1
  12. package/dist/components/DatePicker/DatePicker.d.ts +2 -2
  13. package/dist/components/DatePicker/DatePicker.js.map +1 -1
  14. package/dist/components/Dialog/Dialog.d.ts +1 -1
  15. package/dist/components/Dialog/Dialog.js +2 -1
  16. package/dist/components/Dialog/Dialog.js.map +1 -1
  17. package/dist/components/Drawer/Drawer.d.ts +1 -0
  18. package/dist/components/Drawer/Drawer.js +2 -1
  19. package/dist/components/Drawer/Drawer.js.map +1 -1
  20. package/dist/components/EmptyState/EmptyState.d.ts +2 -2
  21. package/dist/components/EmptyState/EmptyState.js +3 -2
  22. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  23. package/dist/components/ErrorPage/ErrorPage.d.ts +1 -0
  24. package/dist/components/ErrorPage/ErrorPage.js +2 -1
  25. package/dist/components/ErrorPage/ErrorPage.js.map +1 -1
  26. package/dist/components/EventTimeline/EventTimeline.d.ts +1 -1
  27. package/dist/components/EventTimeline/EventTimeline.js +2 -1
  28. package/dist/components/EventTimeline/EventTimeline.js.map +1 -1
  29. package/dist/components/FileUpload/FileUpload.d.ts +1 -1
  30. package/dist/components/FileUpload/FileUpload.js +2 -1
  31. package/dist/components/FileUpload/FileUpload.js.map +1 -1
  32. package/dist/components/InlineCode/InlineCode.js +10 -6
  33. package/dist/components/InlineCode/InlineCode.js.map +1 -1
  34. package/dist/components/KpiCard/KpiCard.d.ts +2 -2
  35. package/dist/components/KpiCard/KpiCard.js +5 -4
  36. package/dist/components/KpiCard/KpiCard.js.map +1 -1
  37. package/dist/components/LayerGraph/LayerGraph.js +19 -9
  38. package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
  39. package/dist/components/LoginCard/LoginCard.d.ts +1 -1
  40. package/dist/components/LoginCard/LoginCard.js.map +1 -1
  41. package/dist/components/Markdown/Markdown.js +19 -1
  42. package/dist/components/Markdown/Markdown.js.map +1 -1
  43. package/dist/components/MultiSelect/MultiSelect.d.ts +1 -1
  44. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  45. package/dist/components/NotificationBell/NotificationBell.d.ts +1 -0
  46. package/dist/components/NotificationBell/NotificationBell.js +2 -1
  47. package/dist/components/NotificationBell/NotificationBell.js.map +1 -1
  48. package/dist/components/Select/Select.d.ts +1 -1
  49. package/dist/components/Select/Select.js.map +1 -1
  50. package/dist/components/SettingsLayout/SettingsLayout.d.ts +1 -1
  51. package/dist/components/SettingsLayout/SettingsLayout.js +2 -1
  52. package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
  53. package/dist/components/Tabs/Tabs.d.ts +4 -1
  54. package/dist/components/Tabs/Tabs.js +5 -2
  55. package/dist/components/Tabs/Tabs.js.map +1 -1
  56. package/dist/components/TextArea/TextArea.d.ts +2 -1
  57. package/dist/components/TextArea/TextArea.js +3 -2
  58. package/dist/components/TextArea/TextArea.js.map +1 -1
  59. package/dist/components/TextField/TextField.d.ts +2 -2
  60. package/dist/components/TextField/TextField.js.map +1 -1
  61. package/dist/components/Toast/Toast.d.ts +1 -1
  62. package/dist/components/Toast/Toast.js +2 -1
  63. package/dist/components/Toast/Toast.js.map +1 -1
  64. package/dist/css/Alert.css +1 -0
  65. package/dist/css/Button.css +1 -0
  66. package/dist/css/Checkbox.css +1 -0
  67. package/dist/css/CodeView.css +1 -1
  68. package/dist/css/DangerZone.css +1 -0
  69. package/dist/css/DataTable.css +177 -38
  70. package/dist/css/DatePicker.css +1 -0
  71. package/dist/css/DateRangePicker.css +1 -0
  72. package/dist/css/Drawer.css +1 -0
  73. package/dist/css/EmptyState.css +1 -0
  74. package/dist/css/ErrorPage.css +1 -0
  75. package/dist/css/EventTimeline.css +1 -0
  76. package/dist/css/FileUpload.css +1 -0
  77. package/dist/css/KpiCard.css +1 -0
  78. package/dist/css/LoginCard.css +1 -0
  79. package/dist/css/Markdown.css +29 -1
  80. package/dist/css/MultiSelect.css +1 -0
  81. package/dist/css/NotificationBell.css +1 -0
  82. package/dist/css/ProjectSwitcher.css +6 -1
  83. package/dist/css/Select.css +1 -0
  84. package/dist/css/SettingsLayout.css +1 -0
  85. package/dist/css/Suggestion.css +1 -1
  86. package/dist/css/Tabs.css +6 -6
  87. package/dist/css/Term.css +1 -1
  88. package/dist/css/TextArea.css +1 -0
  89. package/dist/css/TextField.css +1 -0
  90. package/dist/css/Toast.css +1 -0
  91. package/dist/css/Tour.css +1 -1
  92. package/dist/css/TreeList.css +1 -0
  93. package/dist/css/Workbench.css +12 -0
  94. package/dist/format.js +3 -1
  95. package/dist/format.js.map +1 -1
  96. package/dist/index.js +2 -2
  97. package/dist/internal/Field.js +3 -2
  98. package/dist/internal/Field.js.map +1 -1
  99. package/dist/internal/codeSpans.js +20 -0
  100. package/dist/internal/codeSpans.js.map +1 -0
  101. package/dist/styles.css +316 -133
  102. package/docs/Alert.md +1 -0
  103. package/docs/Card.md +3 -3
  104. package/docs/DangerZone.md +1 -0
  105. package/docs/DataTable.md +29 -19
  106. package/docs/DatePicker.md +1 -0
  107. package/docs/Dialog.md +1 -0
  108. package/docs/Drawer.md +1 -0
  109. package/docs/EmptyState.md +1 -0
  110. package/docs/ErrorPage.md +1 -0
  111. package/docs/EventTimeline.md +1 -0
  112. package/docs/FileUpload.md +1 -0
  113. package/docs/Format.md +1 -1
  114. package/docs/KpiCard.md +1 -0
  115. package/docs/LoginCard.md +1 -0
  116. package/docs/Markdown.md +3 -0
  117. package/docs/MultiSelect.md +1 -0
  118. package/docs/NotificationBell.md +1 -0
  119. package/docs/Select.md +1 -0
  120. package/docs/SettingsLayout.md +1 -0
  121. package/docs/Tabs.md +2 -2
  122. package/docs/Term.md +1 -0
  123. package/docs/TextArea.md +1 -0
  124. package/docs/TextField.md +1 -0
  125. package/docs/Toast.md +1 -0
  126. package/docs/data.md +4 -3
  127. package/docs/guidelines.md +4 -4
  128. package/docs/layout.md +1 -1
  129. package/package.json +2 -2
@@ -4,7 +4,7 @@ export interface AlertProps {
4
4
  /** Default 'info'. danger is announced at once (role alert). */
5
5
  tone?: AlertTone;
6
6
  title?: string;
7
- /** The cause and the fix, at most 2 short sentences. */
7
+ /** The cause and the fix, at most 2 short sentences; in a string, `backticks` are code. */
8
8
  children?: React.ReactNode;
9
9
  /** A verb, such as 重試. */
10
10
  actionLabel?: string;
@@ -4,6 +4,7 @@ import { Icon } from "../../icons/Icon.js";
4
4
  import { cx } from "../../internal/util.js";
5
5
  import { includeIcons } from "../../icons/store.js";
6
6
  import x_default from "../../icons/ph/x.js";
7
+ import { codeText } from "../InlineCode/InlineCode.js";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  // src/components/Alert/Alert.tsx
9
10
  includeIcons(x_default);
@@ -32,7 +33,7 @@ function Alert({ tone = "info", title, children, actionLabel, onAction, onDismis
32
33
  children: title
33
34
  }) : null, children ? /* @__PURE__ */ jsx("div", {
34
35
  className: "ui-alert-body",
35
- children
36
+ children: codeText(children)
36
37
  }) : null]
37
38
  }),
38
39
  actionLabel ? /* @__PURE__ */ jsx("button", {
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","names":["phX"],"sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon, type CustomIcon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { includeIcons } from '../../icons/store';\nimport phX from '../../icons/ph/x';\n\nincludeIcons(phX);\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\nconst ALERT_ICONS: Record<AlertTone, CustomIcon> = {\n info: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 11v5M12 7.5v.5',\n success: 'M5 12.5l4.5 4.5L19 7',\n warning: 'M12 4l9 16H3zM12 10v4M12 17v.5',\n danger: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 8v5M12 16.5v.5',\n};\n\nexport interface AlertProps {\n /** Default 'info'. danger is announced at once (role alert). */\n tone?: AlertTone;\n title?: string;\n /** The cause and the fix, at most 2 short sentences. */\n children?: React.ReactNode;\n /** A verb, such as 重試. */\n actionLabel?: string;\n onAction?: () => void;\n /** Adds × for info and success; warning and danger stay until the problem is solved. */\n onDismiss?: () => void;\n className?: string;\n}\n\n/** A message inside the page with a colored bar and icon. */\nexport function Alert({ tone = 'info', title, children, actionLabel, onAction, onDismiss, className }: AlertProps) {\n const t = ALERT_ICONS[tone] ? tone : 'info';\n const canClose = (t === 'info' || t === 'success') && onDismiss;\n return (\n <div className={cx('ui-alert', 'ui-alert-' + t, className)} role={t === 'danger' ? 'alert' : 'status'}>\n <Icon d={ALERT_ICONS[t]} className=\"ui-alert-icon\" />\n <div className=\"ui-alert-content\">\n {title ? <div className=\"ui-alert-title\">{title}</div> : null}\n {children ? <div className=\"ui-alert-body\">{children}</div> : null}\n </div>\n {actionLabel ? (\n <button type=\"button\" className=\"ui-btn ui-btn-secondary ui-alert-action\" onClick={onAction}>\n {actionLabel}\n </button>\n ) : null}\n {canClose ? (\n <button type=\"button\" className=\"ui-alert-close\" aria-label={tr('關閉提示')} onClick={onDismiss}>\n <Icon name=\"x\" size={16} />\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAOA,aAAaA,SAAG;AAIhB,MAAM,cAA6C;CACjD,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;AACV;;AAiBA,SAAgB,MAAM,EAAE,OAAO,QAAQ,OAAO,UAAU,aAAa,UAAU,WAAW,aAAyB;CACjH,MAAM,IAAI,YAAY,QAAQ,OAAO;CACrC,MAAM,YAAY,MAAM,UAAU,MAAM,cAAc;CACtD,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,cAAc,GAAG,SAAS;EAAG,MAAM,MAAM,WAAW,UAAU;EAA7F,UAAA;GACE,oBAAC,MAAD;IAAM,GAAG,YAAY;IAAI,WAAU;GAAiB,CAAA;GACpD,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,QAAQ,oBAAC,OAAD;KAAK,WAAU;KAAkB,UAAA;IAAW,CAAA,IAAI,MACxD,WAAW,oBAAC,OAAD;KAAK,WAAU;KAAiB;IAAc,CAAA,IAAI,IAC3D;;GACJ,cACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAA0C,SAAS;IAChF,UAAA;GACK,CAAA,IACN;GACH,WACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAiB,cAAY,GAAG,MAAM;IAAG,SAAS;IAChF,UAAA,oBAAC,MAAD;KAAM,MAAK;KAAI,MAAM;IAAK,CAAA;GACpB,CAAA,IACN;EACD;;AAET"}
1
+ {"version":3,"file":"Alert.js","names":["phX"],"sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { tr } from '../../i18n';\nimport { Icon, type CustomIcon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { includeIcons } from '../../icons/store';\nimport phX from '../../icons/ph/x';\nimport { codeText } from '../InlineCode/InlineCode';\n\nincludeIcons(phX);\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\nconst ALERT_ICONS: Record<AlertTone, CustomIcon> = {\n info: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 11v5M12 7.5v.5',\n success: 'M5 12.5l4.5 4.5L19 7',\n warning: 'M12 4l9 16H3zM12 10v4M12 17v.5',\n danger: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18zM12 8v5M12 16.5v.5',\n};\n\nexport interface AlertProps {\n /** Default 'info'. danger is announced at once (role alert). */\n tone?: AlertTone;\n title?: string;\n /** The cause and the fix, at most 2 short sentences; in a string, `backticks` are code. */\n children?: React.ReactNode;\n /** A verb, such as 重試. */\n actionLabel?: string;\n onAction?: () => void;\n /** Adds × for info and success; warning and danger stay until the problem is solved. */\n onDismiss?: () => void;\n className?: string;\n}\n\n/** A message inside the page with a colored bar and icon. */\nexport function Alert({ tone = 'info', title, children, actionLabel, onAction, onDismiss, className }: AlertProps) {\n const t = ALERT_ICONS[tone] ? tone : 'info';\n const canClose = (t === 'info' || t === 'success') && onDismiss;\n return (\n <div className={cx('ui-alert', 'ui-alert-' + t, className)} role={t === 'danger' ? 'alert' : 'status'}>\n <Icon d={ALERT_ICONS[t]} className=\"ui-alert-icon\" />\n <div className=\"ui-alert-content\">\n {title ? <div className=\"ui-alert-title\">{title}</div> : null}\n {children ? <div className=\"ui-alert-body\">{codeText(children)}</div> : null}\n </div>\n {actionLabel ? (\n <button type=\"button\" className=\"ui-btn ui-btn-secondary ui-alert-action\" onClick={onAction}>\n {actionLabel}\n </button>\n ) : null}\n {canClose ? (\n <button type=\"button\" className=\"ui-alert-close\" aria-label={tr('關閉提示')} onClick={onDismiss}>\n <Icon name=\"x\" size={16} />\n </button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAQA,aAAaA,SAAG;AAIhB,MAAM,cAA6C;CACjD,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;AACV;;AAiBA,SAAgB,MAAM,EAAE,OAAO,QAAQ,OAAO,UAAU,aAAa,UAAU,WAAW,aAAyB;CACjH,MAAM,IAAI,YAAY,QAAQ,OAAO;CACrC,MAAM,YAAY,MAAM,UAAU,MAAM,cAAc;CACtD,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,cAAc,GAAG,SAAS;EAAG,MAAM,MAAM,WAAW,UAAU;EAA7F,UAAA;GACE,oBAAC,MAAD;IAAM,GAAG,YAAY;IAAI,WAAU;GAAiB,CAAA;GACpD,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,QAAQ,oBAAC,OAAD;KAAK,WAAU;KAAkB,UAAA;IAAW,CAAA,IAAI,MACxD,WAAW,oBAAC,OAAD;KAAK,WAAU;KAAiB,UAAA,SAAS,QAAQ;IAAO,CAAA,IAAI,IACrE;;GACJ,cACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAA0C,SAAS;IAChF,UAAA;GACK,CAAA,IACN;GACH,WACC,oBAAC,UAAD;IAAQ,MAAK;IAAS,WAAU;IAAiB,cAAY,GAAG,MAAM;IAAG,SAAS;IAChF,UAAA,oBAAC,MAAD;KAAM,MAAK;KAAI,MAAM;IAAK,CAAA;GACpB,CAAA,IACN;EACD;;AAET"}
@@ -2,7 +2,7 @@ import { DangerConfirm } from "../Button/Button.js";
2
2
  export interface DangerZoneProps {
3
3
  /** Default 「危險操作」. */
4
4
  title?: string;
5
- /** What the action destroys. */
5
+ /** What the action destroys; `backticks` are code. */
6
6
  description: string;
7
7
  /** Default 「刪除」. */
8
8
  actionLabel?: string;
@@ -2,6 +2,7 @@
2
2
  import { tr } from "../../i18n.js";
3
3
  import { cx } from "../../internal/util.js";
4
4
  import { Button } from "../Button/Button.js";
5
+ import { codeText } from "../InlineCode/InlineCode.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  // src/components/DangerZone/DangerZone.tsx
7
8
  /** A red-bordered block at the bottom of a settings page for delete-type actions; the button asks to confirm. */
@@ -14,7 +15,7 @@ function DangerZone({ title, description, actionLabel, onAction, confirm, classN
14
15
  children: title || tr("危險操作")
15
16
  }), /* @__PURE__ */ jsxs("div", {
16
17
  className: "ui-danger-row",
17
- children: [/* @__PURE__ */ jsx("p", { children: description }), /* @__PURE__ */ jsx(Button, {
18
+ children: [/* @__PURE__ */ jsx("p", { children: codeText(description) }), /* @__PURE__ */ jsx(Button, {
18
19
  variant: "danger",
19
20
  confirm: confirm ?? { title: tr("{label}?", { label }) },
20
21
  onClick: onAction,
@@ -1 +1 @@
1
- {"version":3,"file":"DangerZone.js","names":[],"sources":["../../../src/components/DangerZone/DangerZone.tsx"],"sourcesContent":["import { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\nimport { Button, type DangerConfirm } from '../Button/Button';\n\nexport interface DangerZoneProps {\n /** Default 「危險操作」. */\n title?: string;\n /** What the action destroys. */\n description: string;\n /** Default 「刪除」. */\n actionLabel?: string;\n /** Runs after the person confirms. */\n onAction: () => void;\n /** The confirm dialog: name the object in the title. */\n confirm: DangerConfirm;\n className?: string;\n}\n\n/** A red-bordered block at the bottom of a settings page for delete-type actions; the button asks to confirm. */\nexport function DangerZone({ title, description, actionLabel, onAction, confirm, className }: DangerZoneProps) {\n const label = actionLabel || tr('刪除');\n return (\n <section className={cx('ui-danger', className)}>\n <h2 className=\"ui-danger-title\">{title || tr('危險操作')}</h2>\n <div className=\"ui-danger-row\">\n <p>{description}</p>\n {/* Without a build step nothing enforces confirm: ask anyway. */}\n <Button variant=\"danger\" confirm={confirm ?? { title: tr('{label}?', { label }) }} onClick={onAction}>\n {label}\n </Button>\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,WAAW,EAAE,OAAO,aAAa,aAAa,UAAU,SAAS,aAA8B;CAC7G,MAAM,QAAQ,eAAe,GAAG,IAAI;CACpC,OACE,qBAAC,WAAD;EAAS,WAAW,GAAG,aAAa,SAAS;EAA7C,UAAA,CACE,oBAAC,MAAD;GAAI,WAAU;GAAmB,UAAA,SAAS,GAAG,MAAM;EAAM,CAAA,GACzD,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,KAAD,EAAA,UAAI,YAAe,CAAA,GAEnB,oBAAC,QAAD;IAAQ,SAAQ;IAAS,SAAS,WAAW,EAAE,OAAO,GAAG,YAAY,EAAE,MAAM,CAAC,EAAE;IAAG,SAAS;IACzF,UAAA;GACK,CAAA,CACL;EACE,CAAA,CAAA;;AAEb"}
1
+ {"version":3,"file":"DangerZone.js","names":[],"sources":["../../../src/components/DangerZone/DangerZone.tsx"],"sourcesContent":["import { tr } from '../../i18n';\nimport { cx } from '../../internal/util';\nimport { Button, type DangerConfirm } from '../Button/Button';\nimport { codeText } from '../InlineCode/InlineCode';\n\nexport interface DangerZoneProps {\n /** Default 「危險操作」. */\n title?: string;\n /** What the action destroys; `backticks` are code. */\n description: string;\n /** Default 「刪除」. */\n actionLabel?: string;\n /** Runs after the person confirms. */\n onAction: () => void;\n /** The confirm dialog: name the object in the title. */\n confirm: DangerConfirm;\n className?: string;\n}\n\n/** A red-bordered block at the bottom of a settings page for delete-type actions; the button asks to confirm. */\nexport function DangerZone({ title, description, actionLabel, onAction, confirm, className }: DangerZoneProps) {\n const label = actionLabel || tr('刪除');\n return (\n <section className={cx('ui-danger', className)}>\n <h2 className=\"ui-danger-title\">{title || tr('危險操作')}</h2>\n <div className=\"ui-danger-row\">\n <p>{codeText(description)}</p>\n {/* Without a build step nothing enforces confirm: ask anyway. */}\n <Button variant=\"danger\" confirm={confirm ?? { title: tr('{label}?', { label }) }} onClick={onAction}>\n {label}\n </Button>\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,WAAW,EAAE,OAAO,aAAa,aAAa,UAAU,SAAS,aAA8B;CAC7G,MAAM,QAAQ,eAAe,GAAG,IAAI;CACpC,OACE,qBAAC,WAAD;EAAS,WAAW,GAAG,aAAa,SAAS;EAA7C,UAAA,CACE,oBAAC,MAAD;GAAI,WAAU;GAAmB,UAAA,SAAS,GAAG,MAAM;EAAM,CAAA,GACzD,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,KAAD,EAAA,UAAI,SAAS,WAAW,EAAK,CAAA,GAE7B,oBAAC,QAAD;IAAQ,SAAQ;IAAS,SAAS,WAAW,EAAE,OAAO,GAAG,YAAY,EAAE,MAAM,CAAC,EAAE;IAAG,SAAS;IACzF,UAAA;GACK,CAAA,CACL;EACE,CAAA,CAAA;;AAEb"}
@@ -24,13 +24,18 @@ export interface DataTableProps<R extends Row = Record<string, unknown>> {
24
24
  pageSize?: number;
25
25
  /** Change it when the rows become a different data set: search, filters, sort, page, selection and summary reset. */
26
26
  resetKey?: string | number;
27
- /** Checkboxes appear when a row is hovered, and on every row once any row is selected. */
27
+ /** The page's primary action, one primary Button (「新增」): at the right end of the toolbar, on one row with the
28
+ * summary tabs and the search field when they fit. Use it instead of a Card head that holds only this button. */
29
+ action?: React.ReactNode;
30
+ /** Checkboxes appear when a row is hovered, and on every row once any row is selected; the header's is always shown. */
28
31
  selectable?: boolean;
29
32
  /** Buttons for the bar that replaces the header while rows are selected. */
30
33
  bulkActions?: (ids: string[], clear: () => void) => React.ReactNode;
31
- /** IconButtons at the row's right end, shown when the row is hovered. */
34
+ /** IconButtons over the row's right end, shown while the row is hovered or has keyboard focus (always on touch
35
+ * screens and phone cards). They take no column of their own. */
32
36
  rowActions?: (row: R) => React.ReactNode;
33
- /** px. Default 88. */
37
+ /** px kept free at the end of each row's last cell for the row actions, so they never cover its content. Default:
38
+ * the width the actions take, measured. */
34
39
  actionsWidth?: number;
35
40
  /** Search box (default on; false hides it). Searches every column unless keys is given. */
36
41
  search?: false | {
@@ -5,7 +5,7 @@ import { Tabs } from "../Tabs/Tabs.js";
5
5
  import { format } from "../../format.js";
6
6
  import { tr, unitFor } from "../../i18n.js";
7
7
  import { Icon } from "../../icons/Icon.js";
8
- import { TOUCH_ONLY, copyText, cx, idPart, monoNums, reduced, seenOnly, useMedia, useNarrow } from "../../internal/util.js";
8
+ import { TOUCH_ONLY, copyText, cx, idPart, monoNums, reduced, resizeObserver, seenOnly, useMedia, useNarrow } from "../../internal/util.js";
9
9
  import { Tooltip } from "../Tooltip/Tooltip.js";
10
10
  import { devWarn } from "../../internal/dev.js";
11
11
  import { CheckMark } from "../../internal/Field.js";
@@ -24,6 +24,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
24
24
  import { createPortal } from "react-dom";
25
25
  // src/components/DataTable/DataTable.tsx
26
26
  includeIcons(caret_right_default, check_default, x_default);
27
+ const SEL = 40;
27
28
  const MOVE = {
28
29
  dur: 320,
29
30
  stagger: 25,
@@ -39,7 +40,10 @@ const isNum = (c) => c.numeric || c.format === "money" || c.format === "percent"
39
40
  const isShort = (c) => isNum(c) || !!c.unit || isDateCol(c) || c.mobile === "status";
40
41
  const TEXT_HUG_MAX = 280;
41
42
  const HUG_START = 96;
42
- const CELL_PAD = 25;
43
+ const TEXT_HUG_MIN = 128;
44
+ const MAIN_WANT_MAX = 320;
45
+ const LONG_WANT_MAX = 512;
46
+ const TOOL_GAP = 8;
43
47
  const isoOf = (d, dateOnly) => dateOnly ? `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}` : d.toISOString();
44
48
  /** The width of what an element holds (its text and children, not absolutely placed parts such as the column border).
45
49
  * Null where text cannot be measured (jsdom has no Range#getBoundingClientRect): the column keeps its default width. */
@@ -190,6 +194,12 @@ function DataTable(p) {
190
194
  const [sel, setSel] = React.useState({});
191
195
  const [sumVal, setSumVal] = React.useState("all");
192
196
  const [fit, setFit] = React.useState({});
197
+ const [clipped, setClipped] = React.useState(null);
198
+ const [want, setWant] = React.useState({});
199
+ const wantRef = React.useRef(want);
200
+ const [roomy, setRoomy] = React.useState(false);
201
+ const [actsW, setActsW] = React.useState(null);
202
+ const [onerowState, setOnerow] = React.useState(false);
193
203
  const [widths, setWidthsState] = React.useState(() => {
194
204
  if (!p.widthKey) return null;
195
205
  try {
@@ -216,6 +226,10 @@ function DataTable(p) {
216
226
  const prev = noSearch ? rootRef.current?.previousElementSibling : null;
217
227
  setHeadSlot(prev instanceof HTMLElement && prev.classList.contains("ui-card-head") && prev.parentElement?.classList.contains("ui-card") ? prev : null);
218
228
  }, [noSearch]);
229
+ React.useEffect(() => {
230
+ const prev = rootRef.current?.previousElementSibling;
231
+ devWarn(prev?.classList.contains("ui-card-head") && !prev.querySelector(".ui-card-title") && prev.querySelector(".ui-card-actions"), "DataTable", "the Card around this table has actions but no title, so its one button takes a row of its own above the table. Pass the page's primary action to DataTable's action instead: it goes at the right end of the toolbar.");
232
+ }, []);
219
233
  const [resetKey, setResetKey] = React.useState(p.resetKey);
220
234
  const resetting = resetKey !== p.resetKey;
221
235
  if (resetting) {
@@ -229,6 +243,8 @@ function DataTable(p) {
229
243
  if (!colsKey) setToggledState({});
230
244
  setOpened({});
231
245
  setFit({});
246
+ setWant({});
247
+ setClipped(null);
232
248
  }
233
249
  const valuesKey = JSON.stringify(values);
234
250
  const sortKey = JSON.stringify(sort);
@@ -483,32 +499,32 @@ function DataTable(p) {
483
499
  setPage(0);
484
500
  };
485
501
  const hasAct = !!p.rowActions;
486
- const actW = p.actionsWidth || 88;
502
+ const onerow = onerowState && !narrow;
487
503
  const hasTitle = shownCols.some((c) => c.mobile === "title");
488
504
  const mobileClass = (c, ci) => {
489
505
  const m = c.mobile || (!hasTitle && ci === 0 ? "title" : null);
490
506
  return m ? "is-m-" + m : null;
491
507
  };
492
508
  const longCols = shownCols.filter((c) => c.long || c.fullText);
493
- const expander = longCols.length > 0 && !narrow;
509
+ const expander = longCols.length > 0 && !narrow && (clipped !== false || longCols.some((c) => c.fullText) || visIds.some((id) => opened[id]));
494
510
  const EXP = 40;
495
511
  const mainKey = (shownCols.find((c) => !isShort(c) && !c.long && c.grow !== 0) ?? shownCols[0])?.key;
496
512
  const grows = (c) => c.grow != null ? c.grow > 0 : c.long || c.key === mainKey;
497
513
  const minOf = (c) => {
498
- if (grows(c)) return Math.max(c.width || (isNum(c) ? 96 : 120), fit[c.key] || 0);
499
- const cap = c.width == null && !isShort(c) ? TEXT_HUG_MAX : Infinity;
500
- return Math.max(c.width || 0, 48, Math.min(fit[c.key] ?? c.width ?? HUG_START, cap));
514
+ if (grows(c)) return Math.max(c.width || (isNum(c) ? 96 : 120), fit[c.key] || 0, roomy ? want[c.key] || 0 : 0);
515
+ const text = c.width == null && !isShort(c);
516
+ const cap = text ? TEXT_HUG_MAX : Infinity;
517
+ return Math.max(c.width || 0, 48, text ? TEXT_HUG_MIN : 0, Math.min(fit[c.key] ?? c.width ?? HUG_START, cap));
501
518
  };
502
519
  const layout = (w) => {
503
520
  const colW = (c) => w ? `${w[c.key] ?? minOf(c)}px` : grows(c) ? `minmax(${minOf(c)}px, ${c.grow || 1}fr)` : `${minOf(c)}px`;
504
521
  return {
505
522
  gridTemplateColumns: [
506
523
  expander ? "40px" : null,
507
- selectable ? "46px" : null,
508
- ...shownCols.map(colW),
509
- hasAct ? actW + "px" : null
524
+ selectable ? "40px" : null,
525
+ ...shownCols.map(colW)
510
526
  ].filter(Boolean).join(" "),
511
- minWidth: (expander ? EXP : 0) + (selectable ? 46 : 0) + shownCols.reduce((a, c) => a + (w ? w[c.key] ?? minOf(c) : minOf(c)), 0) + (hasAct ? actW : 0)
527
+ minWidth: (expander ? EXP : 0) + (selectable ? SEL : 0) + shownCols.reduce((a, c) => a + (w ? w[c.key] ?? minOf(c) : minOf(c)), 0)
512
528
  };
513
529
  };
514
530
  const pageGrid = layout(widths);
@@ -529,6 +545,7 @@ function DataTable(p) {
529
545
  React.useLayoutEffect(() => {
530
546
  const root = rootRef.current;
531
547
  if (!root || narrow) return;
548
+ wantRef.current = {};
532
549
  const measure = () => {
533
550
  const need = {};
534
551
  for (const el of root.querySelectorAll(":scope > .ui-dt-scroller .ui-dt-body .ui-dt-cell[data-col]:not(.is-long):not(.is-hug)")) {
@@ -536,13 +553,27 @@ function DataTable(p) {
536
553
  const key = el.dataset.col;
537
554
  if (over > 1 && key) need[key] = Math.max(need[key] ?? 0, Math.ceil(el.getBoundingClientRect().width + over));
538
555
  }
556
+ const pad = (el) => {
557
+ const st = getComputedStyle(el);
558
+ return (parseFloat(st.paddingLeft) || 0) + (parseFloat(st.paddingRight) || 0) + (parseFloat(st.borderRightWidth) || 0);
559
+ };
539
560
  const hugs = root.querySelectorAll(":scope > .ui-dt-scroller .ui-dt-cell.is-hug[data-col]");
540
- if (hugs.length) {
561
+ const growCells = root.querySelectorAll(":scope > .ui-dt-scroller .ui-dt-cell.is-grow[data-col]");
562
+ const asks = {};
563
+ if (hugs.length || growCells.length) {
541
564
  root.classList.add("is-measuring");
542
565
  for (const el of hugs) {
543
566
  const key = el.dataset.col;
544
567
  const w = contentWidth(el.querySelector(":scope > .ui-dt-stack > .ui-dt-main") ?? el);
545
- if (key && w !== null) need[key] = Math.max(need[key] ?? 0, Math.ceil(w + CELL_PAD));
568
+ if (key && w !== null) need[key] = Math.max(need[key] ?? 0, Math.ceil(w + pad(el)));
569
+ }
570
+ for (const el of growCells) {
571
+ const key = el.dataset.col;
572
+ const long = el.querySelector(".ui-dt-long-text");
573
+ const w = long ? long.getBoundingClientRect().width : contentWidth(el.querySelector(":scope > .ui-dt-stack > .ui-dt-main") ?? el);
574
+ if (!key || w === null || !w) continue;
575
+ const max = el.classList.contains("is-long") ? LONG_WANT_MAX : MAIN_WANT_MAX;
576
+ asks[key] = Math.max(asks[key] ?? 0, Math.min(max, Math.ceil(w + pad(el))));
546
577
  }
547
578
  root.classList.remove("is-measuring");
548
579
  }
@@ -553,6 +584,46 @@ function DataTable(p) {
553
584
  ...Object.fromEntries(grow)
554
585
  } : f;
555
586
  });
587
+ const head = root.querySelector(":scope > .ui-dt-scroller .ui-dt-head");
588
+ const scroll = root.querySelector(":scope > .ui-dt-scroller .ui-dt-scroll");
589
+ if (head && scroll && scroll.clientWidth > 0) {
590
+ const before = wantRef.current;
591
+ const more = Object.entries(asks).filter(([k, w]) => w > (before[k] ?? 0));
592
+ const merged = more.length ? {
593
+ ...before,
594
+ ...Object.fromEntries(more)
595
+ } : before;
596
+ wantRef.current = merged;
597
+ if (more.length) setWant(merged);
598
+ let used = 0;
599
+ for (const el of head.children) {
600
+ if (el.classList.contains("ui-dt-exp")) continue;
601
+ const key = el.dataset.col;
602
+ used += key && el.classList.contains("is-grow") ? Math.max(asks[key] ?? 0, merged[key] ?? 0, 48) : el.getBoundingClientRect().width;
603
+ }
604
+ setRoomy(used <= scroll.clientWidth);
605
+ }
606
+ let aw = 0;
607
+ for (const el of root.querySelectorAll(":scope > .ui-dt-scroller .ui-dt-body .ui-dt-acts")) if (el.childElementCount) aw = Math.max(aw, Math.ceil(el.getBoundingClientRect().width));
608
+ if (root.querySelector(":scope > .ui-dt-scroller .ui-dt-body .ui-dt-acts")) setActsW((v) => v !== null && Math.abs(v - aw) <= 1 ? v : aw);
609
+ const tools = root.querySelector(":scope > .ui-dt-tools.has-summary");
610
+ if (tools && tools.clientWidth > 0) {
611
+ const tabs = tools.querySelector(".ui-dt-summary");
612
+ const actions = tools.querySelector(":scope > .ui-dt-actions");
613
+ let need2 = (tabs?.scrollWidth ?? 0) + (tools.querySelector(":scope > .ui-dt-search") ? 256 : TOOL_GAP);
614
+ const parts = actions ? [...actions.children].filter((e) => getComputedStyle(e).position !== "absolute") : [];
615
+ for (const e of parts) {
616
+ const text = e.querySelector(".ui-dt-sortbtn-text");
617
+ need2 += e.getBoundingClientRect().width + (text ? Math.max(0, text.scrollWidth - text.clientWidth) : 0);
618
+ }
619
+ need2 += Math.max(0, parts.length - 1) * TOOL_GAP;
620
+ setOnerow(need2 <= tools.clientWidth);
621
+ }
622
+ const scroller = root.querySelector(":scope > .ui-dt-scroller .ui-dt-scroll");
623
+ if (scroller && scroller.clientWidth > 0) {
624
+ const cut = [...root.querySelectorAll(":scope > .ui-dt-scroller .ui-dt-body .ui-dt-long")].some((el) => el.scrollWidth > el.clientWidth + 1);
625
+ setClipped(cut);
626
+ }
556
627
  };
557
628
  let frame = 0;
558
629
  const later = () => {
@@ -567,18 +638,29 @@ function DataTable(p) {
567
638
  const mo = new MutationObserver(later);
568
639
  for (const el of root.querySelectorAll(":scope > .ui-dt-scroller .ui-dt-table, :scope > .ui-dt-scroller .ui-dt-body")) mo.observe(el, { childList: true });
569
640
  document.fonts?.ready.then(later).catch(() => {});
641
+ let lastW = -1;
642
+ const ro = resizeObserver((entries) => {
643
+ const w = Math.round(entries[0]?.contentRect.width ?? 0);
644
+ if (w !== lastW && lastW >= 0) later();
645
+ lastW = w;
646
+ });
647
+ ro?.observe(root);
570
648
  return () => {
571
649
  mo.disconnect();
650
+ ro?.disconnect();
572
651
  cancelAnimationFrame(frame);
573
652
  measureRef.current = () => {};
574
653
  };
575
654
  }, [narrow, resetKey]);
655
+ React.useLayoutEffect(() => {
656
+ measureRef.current();
657
+ }, [actsW]);
576
658
  const contentKey = `${visIds.join("")}|${shownCols.map((c) => c.key).join(",")}|${list.length}|${q}|${!!p.totals}`;
577
659
  React.useLayoutEffect(() => {
578
660
  measureRef.current();
579
661
  }, [contentKey, rows]);
580
- const stickyStyle = (ci) => ci === 0 && sticky ? { left: (expander ? EXP : 0) + (selectable ? 46 : 0) } : void 0;
581
- const cellClass = (c, ci, ...more) => cx("ui-dt-cell", isNum(c) && "is-num", !grows(c) && "is-hug", ci === 0 && sticky && "is-sticky is-sticky-end", ...more);
662
+ const stickyStyle = (ci) => ci === 0 && sticky ? { left: (expander ? EXP : 0) + (selectable ? SEL : 0) } : void 0;
663
+ const cellClass = (c, ci, ...more) => cx("ui-dt-cell", isNum(c) && "is-num", grows(c) ? "is-grow" : "is-hug", ci === 0 && sticky && "is-sticky is-sticky-end", ci === shownCols.length - 1 && "is-lastcol", ...more);
582
664
  const lead = (what) => sticky ? {
583
665
  className: "is-sticky",
584
666
  style: { left: what === "sel" && expander ? EXP : 0 }
@@ -696,12 +778,7 @@ function DataTable(p) {
696
778
  onReset: () => setW(null)
697
779
  })]
698
780
  }, c.key);
699
- }),
700
- hasAct ? /* @__PURE__ */ jsx("div", {
701
- className: "ui-dt-cell",
702
- role: "columnheader",
703
- "aria-label": tr("操作")
704
- }) : null
781
+ })
705
782
  ]
706
783
  });
707
784
  };
@@ -744,6 +821,10 @@ function DataTable(p) {
744
821
  })
745
822
  ]
746
823
  });
824
+ else if (raw === null || raw === void 0 || raw === "") v = /* @__PURE__ */ jsx("span", {
825
+ className: "ui-dt-none",
826
+ children: cellText(c, raw)
827
+ });
747
828
  else v = markMatch(cellText(c, raw), mark);
748
829
  return v;
749
830
  };
@@ -892,9 +973,35 @@ function DataTable(p) {
892
973
  },
893
974
  filterButton: () => (inZoom ? zoomRef : rootRef).current?.querySelector(".ui-dt-filterbtn") ?? null
894
975
  });
976
+ const summaryView = summary ? /* @__PURE__ */ jsx(Tabs, {
977
+ className: "ui-dt-summary",
978
+ label: summary.label || tr("依狀態篩選"),
979
+ unit: summary.unit || "筆",
980
+ value: sumVal,
981
+ onChange: (v) => {
982
+ capture("sort");
983
+ setSumVal(v);
984
+ setPage(0);
985
+ },
986
+ items: [{
987
+ id: "all",
988
+ label: tr("全部"),
989
+ count: sumAll.length
990
+ }, ...summary.items.map((it) => ({
991
+ id: String(it.value),
992
+ label: it.label,
993
+ count: sumAll.filter((x) => String(get(x.r, summary.key)) === String(it.value)).length
994
+ }))],
995
+ hideUnit: true
996
+ }) : null;
997
+ const showCount = !summary || list.length !== baseCount;
895
998
  const toolsView = (inZoom, inHead = false) => /* @__PURE__ */ jsxs("div", {
896
- className: cx("ui-dt-tools", inHead && "is-inhead"),
999
+ className: cx("ui-dt-tools", inHead && "is-inhead", summaryView && !inZoom && !inHead && "has-summary", onerow && !inZoom && !inHead && "is-onerow"),
897
1000
  children: [
1001
+ summaryView && !inZoom && !inHead ? /* @__PURE__ */ jsx("div", {
1002
+ className: "ui-dt-sumwrap",
1003
+ children: summaryView
1004
+ }) : null,
898
1005
  search === false && p.caption && !inZoom && !inHead ? /* @__PURE__ */ jsx("div", {
899
1006
  className: "ui-dt-caption",
900
1007
  children: p.caption
@@ -935,7 +1042,7 @@ function DataTable(p) {
935
1042
  }
936
1043
  }) : null,
937
1044
  /* @__PURE__ */ jsxs("span", {
938
- className: "ui-dt-result",
1045
+ className: cx("ui-dt-result", !showCount && "ui-visually-hidden"),
939
1046
  children: [/* @__PURE__ */ jsx("span", {
940
1047
  "aria-hidden": "true",
941
1048
  children: seenOnly(tr("{n} / {total} 筆", {
@@ -972,6 +1079,10 @@ function DataTable(p) {
972
1079
  onCopy: p.copy !== false ? doCopy : void 0,
973
1080
  onZoom: p.zoom !== false && !inZoom ? () => setZoomed(true) : void 0
974
1081
  }),
1082
+ p.action && !inZoom ? /* @__PURE__ */ jsx("div", {
1083
+ className: "ui-dt-primary",
1084
+ children: p.action
1085
+ }) : null,
975
1086
  copied && !narrow ? /* @__PURE__ */ jsxs("span", {
976
1087
  className: "ui-dt-copied",
977
1088
  "aria-hidden": "true",
@@ -1016,7 +1127,7 @@ function DataTable(p) {
1016
1127
  },
1017
1128
  role: "row",
1018
1129
  "aria-labelledby": shownCols.length ? `${pfx}-n-${start + i}` : void 0,
1019
- className: cx("ui-dt-row", i % 2 && "is-even", on && "is-selected", selectable && "has-sel", expander && !p.rowHref && "has-exp", p.rowHref && "has-href"),
1130
+ className: cx("ui-dt-row", i % 2 && "is-even", hasAct && "has-acts", on && "is-selected", selectable && "has-sel", expander && !p.rowHref && "has-exp", p.rowHref && "has-href"),
1020
1131
  style: grid,
1021
1132
  onClick: expander || p.rowHref ? (e) => {
1022
1133
  if (!rowClick(e)) return;
@@ -1087,7 +1198,7 @@ function DataTable(p) {
1087
1198
  children: /* @__PURE__ */ jsx("div", {
1088
1199
  role: "cell",
1089
1200
  className: "ui-dt-detail-cell",
1090
- style: { paddingLeft: EXP + (selectable ? 46 : 0) + 12 },
1201
+ style: { paddingLeft: EXP + (selectable ? SEL : 0) + 12 },
1091
1202
  children: longCols.map((c) => /* @__PURE__ */ jsxs("div", {
1092
1203
  className: "ui-dt-detail-item",
1093
1204
  children: [/* @__PURE__ */ jsx("div", {
@@ -1114,12 +1225,12 @@ function DataTable(p) {
1114
1225
  style: grid,
1115
1226
  children: [
1116
1227
  expander ? /* @__PURE__ */ jsx("div", {
1117
- className: cx("ui-dt-cell", lead("exp").className),
1228
+ className: cx("ui-dt-cell ui-dt-exp", lead("exp").className),
1118
1229
  style: lead("exp").style,
1119
1230
  role: "cell"
1120
1231
  }) : null,
1121
1232
  selectable ? /* @__PURE__ */ jsx("div", {
1122
- className: cx("ui-dt-cell", lead("sel").className),
1233
+ className: cx("ui-dt-cell ui-dt-sel", lead("sel").className),
1123
1234
  style: lead("sel").style,
1124
1235
  role: "cell"
1125
1236
  }) : null,
@@ -1130,11 +1241,7 @@ function DataTable(p) {
1130
1241
  "data-col": c.key,
1131
1242
  "data-label": ci > 0 && p.totals?.[c.key] ? c.label : void 0,
1132
1243
  children: total(c, ci)
1133
- }, c.key)),
1134
- hasAct ? /* @__PURE__ */ jsx("div", {
1135
- className: "ui-dt-cell",
1136
- role: "cell"
1137
- }) : null
1244
+ }, c.key))
1138
1245
  ]
1139
1246
  }) : null
1140
1247
  ]
@@ -1187,7 +1294,8 @@ function DataTable(p) {
1187
1294
  }) : null });
1188
1295
  return /* @__PURE__ */ jsxs("div", {
1189
1296
  ref: rootRef,
1190
- className: cx("ui-dt", search === false && "is-nosearch", selIds.length && "has-sel", p.className),
1297
+ className: cx("ui-dt", search === false && "is-nosearch", selIds.length && "has-sel", hasAct && "has-acts", p.className),
1298
+ style: hasAct ? { "--dt-acts-w": (p.actionsWidth ?? actsW ?? 72) + "px" } : void 0,
1191
1299
  children: [
1192
1300
  p.caption && search !== false ? /* @__PURE__ */ jsx("div", {
1193
1301
  className: "ui-dt-caption",
@@ -1209,39 +1317,23 @@ function DataTable(p) {
1209
1317
  setView(v.id);
1210
1318
  setPage(0);
1211
1319
  },
1212
- children: [v.label, /* @__PURE__ */ jsxs("span", {
1213
- className: "ui-dt-view-n",
1214
- children: [
1215
- format.number(vn),
1216
- " ",
1217
- /* @__PURE__ */ jsx("span", {
1218
- className: "ui-unit",
1219
- children: unitFor("筆", vn)
1220
- })
1221
- ]
1222
- })]
1320
+ children: [
1321
+ v.label,
1322
+ " ",
1323
+ /* @__PURE__ */ jsxs("span", {
1324
+ className: "ui-dt-view-n",
1325
+ children: [format.number(vn), /* @__PURE__ */ jsxs("span", {
1326
+ className: "ui-visually-hidden",
1327
+ children: [" ", unitFor("筆", vn)]
1328
+ })]
1329
+ })
1330
+ ]
1223
1331
  }, v.id);
1224
1332
  })
1225
1333
  }) : null,
1226
- summary ? /* @__PURE__ */ jsx(Tabs, {
1227
- className: "ui-dt-summary",
1228
- label: summary.label || tr("依狀態篩選"),
1229
- unit: summary.unit || "筆",
1230
- value: sumVal,
1231
- onChange: (v) => {
1232
- capture("sort");
1233
- setSumVal(v);
1234
- setPage(0);
1235
- },
1236
- items: [{
1237
- id: "all",
1238
- label: tr("全部"),
1239
- count: sumAll.length
1240
- }, ...summary.items.map((it) => ({
1241
- id: String(it.value),
1242
- label: it.label,
1243
- count: sumAll.filter((x) => String(get(x.r, summary.key)) === String(it.value)).length
1244
- }))]
1334
+ summaryView && headSlot ? /* @__PURE__ */ jsx("div", {
1335
+ className: "ui-dt-top",
1336
+ children: summaryView
1245
1337
  }) : null,
1246
1338
  headSlot ? createPortal(toolsView(false, true), headSlot) : toolsView(false),
1247
1339
  chipsView(false),