@fbkworks/adapter-naive-ui 0.0.0-stage → 0.3.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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -2
  3. package/dist/dark.css +5 -0
  4. package/dist/feedback.d.ts +4 -0
  5. package/dist/feedback.mjs +61 -0
  6. package/dist/feedback.mjs.map +1 -0
  7. package/dist/index.d.ts +20 -0
  8. package/dist/index.mjs +80 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/locale-context.d.ts +9 -0
  11. package/dist/locale-context.mjs +7 -0
  12. package/dist/locale-context.mjs.map +1 -0
  13. package/dist/primitives/Button.d.ts +53 -0
  14. package/dist/primitives/Button.mjs +62 -0
  15. package/dist/primitives/Button.mjs.map +1 -0
  16. package/dist/primitives/Checkbox.d.ts +26 -0
  17. package/dist/primitives/Checkbox.mjs +43 -0
  18. package/dist/primitives/Checkbox.mjs.map +1 -0
  19. package/dist/primitives/DataGrid.d.ts +93 -0
  20. package/dist/primitives/DataGrid.mjs +125 -0
  21. package/dist/primitives/DataGrid.mjs.map +1 -0
  22. package/dist/primitives/DatePicker.d.ts +66 -0
  23. package/dist/primitives/DatePicker.mjs +90 -0
  24. package/dist/primitives/DatePicker.mjs.map +1 -0
  25. package/dist/primitives/Dialog.d.ts +57 -0
  26. package/dist/primitives/Dialog.mjs +64 -0
  27. package/dist/primitives/Dialog.mjs.map +1 -0
  28. package/dist/primitives/Drawer.d.ts +57 -0
  29. package/dist/primitives/Drawer.mjs +58 -0
  30. package/dist/primitives/Drawer.mjs.map +1 -0
  31. package/dist/primitives/Form.d.ts +95 -0
  32. package/dist/primitives/Form.mjs +124 -0
  33. package/dist/primitives/Form.mjs.map +1 -0
  34. package/dist/primitives/Input.d.ts +57 -0
  35. package/dist/primitives/Input.mjs +58 -0
  36. package/dist/primitives/Input.mjs.map +1 -0
  37. package/dist/primitives/Pagination.d.ts +63 -0
  38. package/dist/primitives/Pagination.mjs +66 -0
  39. package/dist/primitives/Pagination.mjs.map +1 -0
  40. package/dist/primitives/Radio.d.ts +40 -0
  41. package/dist/primitives/Radio.mjs +60 -0
  42. package/dist/primitives/Radio.mjs.map +1 -0
  43. package/dist/primitives/Select.d.ts +61 -0
  44. package/dist/primitives/Select.mjs +55 -0
  45. package/dist/primitives/Select.mjs.map +1 -0
  46. package/dist/primitives/Spin.d.ts +15 -0
  47. package/dist/primitives/Spin.mjs +28 -0
  48. package/dist/primitives/Spin.mjs.map +1 -0
  49. package/dist/primitives/Tag.d.ts +32 -0
  50. package/dist/primitives/Tag.mjs +48 -0
  51. package/dist/primitives/Tag.mjs.map +1 -0
  52. package/dist/root-provider.d.ts +58 -0
  53. package/dist/root-provider.mjs +103 -0
  54. package/dist/root-provider.mjs.map +1 -0
  55. package/dist/style.css +367 -0
  56. package/dist/theme.d.ts +103 -0
  57. package/dist/theme.mjs +133 -0
  58. package/dist/theme.mjs.map +1 -0
  59. package/package.json +56 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 54356
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @fbkworks/adapter-naive-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ FBK 业务组件库的 Naive UI 适配器(桌面端,DataGrid 渲染为表格)。
4
+
5
+ ```bash
6
+ pnpm add @fbkworks/components @fbkworks/adapter-naive-ui
7
+ pnpm add -D naive-ui
8
+ ```
9
+
10
+ ## 使用
11
+
12
+ ```ts
13
+ import { createBusinessKit } from '@fbkworks/adapter-core'
14
+ import { naiveUiAdapter } from '@fbkworks/adapter-naive-ui'
15
+
16
+ import '@fbkworks/tokens/css'
17
+ import '@fbkworks/adapter-naive-ui/style.css'
18
+ import '@fbkworks/components/style.css'
19
+
20
+ createApp(App).use(createBusinessKit({ adapter: naiveUiAdapter }))
21
+ ```
22
+
23
+ ::: warning 必须经过 FbkProvider
24
+ Naive UI 没有可覆盖的 CSS 变量体系,主题必须走 `NConfigProvider`。
25
+ 只调用 `theme.apply()` 而不包 `<FbkProvider>` 时,暗色不会生效。
26
+ `createBusinessKit` 与 `<FbkProvider>` 都会渲染 `adapter.RootProvider`。
27
+ :::
28
+
29
+ ## 能力
30
+
31
+ `theme.cssVariables: false`、`theme.provider: true`、`dataGrid.virtualScroll: true`。
32
+
33
+ ## License
34
+
35
+ MIT
package/dist/dark.css ADDED
@@ -0,0 +1,5 @@
1
+ /* naive-ui 暗色由 NConfigProvider 注入,这里只兜底页面背景 */
2
+ html[data-fbk-theme='dark'] body {
3
+ background: var(--fbk-color-bg);
4
+ color: var(--fbk-color-text);
5
+ }
@@ -0,0 +1,4 @@
1
+ import { FeedbackApi } from '@fbkworks/adapter-core';
2
+ /** 由 RootProvider 在 setup 中调用 */
3
+ export declare function installFeedback(): void;
4
+ export declare const feedback: FeedbackApi;
@@ -0,0 +1,61 @@
1
+ import { useMessage, useDialog } from "naive-ui";
2
+ let messageApi = null;
3
+ let dialogApi = null;
4
+ const fallbackWarned = { value: false };
5
+ function warnMissing() {
6
+ if (fallbackWarned.value) return;
7
+ fallbackWarned.value = true;
8
+ if (typeof console !== "undefined") {
9
+ console.warn(
10
+ "[fbk] naive-ui 的 feedback 需要 <FbkProvider> 包裹(内部会调用 useMessage/useDialog)。当前降级为 console 输出。"
11
+ );
12
+ }
13
+ }
14
+ function installFeedback() {
15
+ messageApi = useMessage();
16
+ dialogApi = useDialog();
17
+ }
18
+ const show = (type, content, options) => {
19
+ if (!messageApi) {
20
+ warnMissing();
21
+ if (typeof console !== "undefined") console.warn(`[fbk:${type}] ${content}`);
22
+ return () => {
23
+ };
24
+ }
25
+ const instance = messageApi[type](content, {
26
+ duration: options?.duration ?? 3e3,
27
+ closable: options?.closable ?? false
28
+ });
29
+ return () => instance.destroy();
30
+ };
31
+ const message = ((type, content, options) => show(type, content, options));
32
+ message.success = (content, options) => show("success", content, options);
33
+ message.warning = (content, options) => show("warning", content, options);
34
+ message.error = (content, options) => show("error", content, options);
35
+ message.info = (content, options) => show("info", content, options);
36
+ const confirm = (content, options = {}) => new Promise((resolve) => {
37
+ if (!dialogApi) {
38
+ warnMissing();
39
+ const ok = typeof window !== "undefined" ? window.confirm(content) : false;
40
+ resolve(ok);
41
+ return;
42
+ }
43
+ const type = options.danger ? "warning" : options.type ?? "warning";
44
+ dialogApi[type]({
45
+ title: options.title ?? "提示",
46
+ content,
47
+ positiveText: options.confirmText ?? "确定",
48
+ negativeText: options.cancelText ?? "取消",
49
+ positiveButtonProps: options.danger ? { type: "error" } : void 0,
50
+ onPositiveClick: () => resolve(true),
51
+ onNegativeClick: () => resolve(false),
52
+ onClose: () => resolve(false),
53
+ onMaskClick: () => resolve(false)
54
+ });
55
+ });
56
+ const feedback = { message, confirm };
57
+ export {
58
+ feedback,
59
+ installFeedback
60
+ };
61
+ //# sourceMappingURL=feedback.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.mjs","sources":["../src/feedback.ts"],"sourcesContent":["import { useMessage, useDialog } from 'naive-ui'\nimport type { ConfirmOptions, FeedbackApi, MessageApi, MessageOptions, MessageType } from '@fbkworks/adapter-core'\n\n/**\n * naive-ui 的命令式反馈。\n *\n * 关键差异:naive 的 useMessage / useDialog **必须在 setup 上下文里调用**,\n * 不能像 element-plus 那样直接 import 一个全局函数。\n * 所以这里暴露一个 `installFeedback()`,由 RootProvider 在 setup 中调用一次,\n * 把实例写进模块级变量,之后业务侧才能用 `feedback.message.success(...)`。\n *\n * 没有 RootProvider 包裹时,message 会降级为 console 并 warnOnce 提示 ——\n * 静默失败会让业务方以为提示弹出来了。\n */\nlet messageApi: ReturnType<typeof useMessage> | null = null\nlet dialogApi: ReturnType<typeof useDialog> | null = null\n\nconst fallbackWarned = { value: false }\n\nfunction warnMissing() {\n if (fallbackWarned.value) return\n fallbackWarned.value = true\n if (typeof console !== 'undefined') {\n console.warn(\n '[fbk] naive-ui 的 feedback 需要 <FbkProvider> 包裹(内部会调用 useMessage/useDialog)。' +\n '当前降级为 console 输出。',\n )\n }\n}\n\n/** 由 RootProvider 在 setup 中调用 */\nexport function installFeedback() {\n messageApi = useMessage()\n dialogApi = useDialog()\n}\n\nconst show = (type: MessageType, content: string, options?: MessageOptions) => {\n if (!messageApi) {\n warnMissing()\n // 用 warn 而不是 log:项目 ESLint 只允许 warn/error,\n // 且降级输出本质上是「本应弹窗但没弹」,属于告警而非普通日志\n if (typeof console !== 'undefined') console.warn(`[fbk:${type}] ${content}`)\n return () => {}\n }\n const instance = messageApi[type](content, {\n duration: options?.duration ?? 3000,\n closable: options?.closable ?? false,\n })\n return () => instance.destroy()\n}\n\nconst message = ((type: MessageType, content: string, options?: MessageOptions) =>\n show(type, content, options)) as MessageApi\n\nmessage.success = (content, options) => show('success', content, options)\nmessage.warning = (content, options) => show('warning', content, options)\nmessage.error = (content, options) => show('error', content, options)\nmessage.info = (content, options) => show('info', content, options)\n\nconst confirm = (content: string, options: ConfirmOptions = {}) =>\n new Promise<boolean>((resolve) => {\n if (!dialogApi) {\n warnMissing()\n // 没有 provider 时退化为原生 confirm,保证流程不中断\n const ok = typeof window !== 'undefined' ? window.confirm(content) : false\n resolve(ok)\n return\n }\n /* danger 只改确认按钮的配色(契约即「确认按钮用危险色」),图标语义不动 ——\n 与 element-plus 的 el-button--danger、vant 的 confirmButtonColor 对齐。\n naive 没有专门的 danger 开关,红按钮只能靠按钮的 type 传下去。\n dialog 的 type 由方法名决定(typedApi 里 type 是后写的),所以这里按 type 选方法。 */\n const type: MessageType = options.danger ? 'warning' : (options.type ?? 'warning')\n dialogApi[type]({\n title: options.title ?? '提示',\n content,\n positiveText: options.confirmText ?? '确定',\n negativeText: options.cancelText ?? '取消',\n positiveButtonProps: options.danger ? { type: 'error' } : undefined,\n onPositiveClick: () => resolve(true),\n onNegativeClick: () => resolve(false),\n onClose: () => resolve(false),\n onMaskClick: () => resolve(false),\n })\n })\n\nexport const feedback: FeedbackApi = { message, confirm }\n"],"names":[],"mappings":";AAcA,IAAI,aAAmD;AACvD,IAAI,YAAiD;AAErD,MAAM,iBAAiB,EAAE,OAAO,MAAA;AAEhC,SAAS,cAAc;AACrB,MAAI,eAAe,MAAO;AAC1B,iBAAe,QAAQ;AACvB,MAAI,OAAO,YAAY,aAAa;AAClC,YAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EAGJ;AACF;AAGO,SAAS,kBAAkB;AAChC,eAAa,WAAA;AACb,cAAY,UAAA;AACd;AAEA,MAAM,OAAO,CAAC,MAAmB,SAAiB,YAA6B;AAC7E,MAAI,CAAC,YAAY;AACf,gBAAA;AAGA,QAAI,OAAO,YAAY,YAAa,SAAQ,KAAK,QAAQ,IAAI,KAAK,OAAO,EAAE;AAC3E,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,QAAM,WAAW,WAAW,IAAI,EAAE,SAAS;AAAA,IACzC,UAAU,SAAS,YAAY;AAAA,IAC/B,UAAU,SAAS,YAAY;AAAA,EAAA,CAChC;AACD,SAAO,MAAM,SAAS,QAAA;AACxB;AAEA,MAAM,WAAW,CAAC,MAAmB,SAAiB,YACpD,KAAK,MAAM,SAAS,OAAO;AAE7B,QAAQ,UAAU,CAAC,SAAS,YAAY,KAAK,WAAW,SAAS,OAAO;AACxE,QAAQ,UAAU,CAAC,SAAS,YAAY,KAAK,WAAW,SAAS,OAAO;AACxE,QAAQ,QAAQ,CAAC,SAAS,YAAY,KAAK,SAAS,SAAS,OAAO;AACpE,QAAQ,OAAO,CAAC,SAAS,YAAY,KAAK,QAAQ,SAAS,OAAO;AAElE,MAAM,UAAU,CAAC,SAAiB,UAA0B,CAAA,MAC1D,IAAI,QAAiB,CAAC,YAAY;AAChC,MAAI,CAAC,WAAW;AACd,gBAAA;AAEA,UAAM,KAAK,OAAO,WAAW,cAAc,OAAO,QAAQ,OAAO,IAAI;AACrE,YAAQ,EAAE;AACV;AAAA,EACF;AAKA,QAAM,OAAoB,QAAQ,SAAS,YAAa,QAAQ,QAAQ;AACxE,YAAU,IAAI,EAAE;AAAA,IACd,OAAO,QAAQ,SAAS;AAAA,IACxB;AAAA,IACA,cAAc,QAAQ,eAAe;AAAA,IACrC,cAAc,QAAQ,cAAc;AAAA,IACpC,qBAAqB,QAAQ,SAAS,EAAE,MAAM,YAAY;AAAA,IAC1D,iBAAiB,MAAM,QAAQ,IAAI;AAAA,IACnC,iBAAiB,MAAM,QAAQ,KAAK;AAAA,IACpC,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,aAAa,MAAM,QAAQ,KAAK;AAAA,EAAA,CACjC;AACH,CAAC;AAEI,MAAM,WAAwB,EAAE,SAAS,QAAA;"}
@@ -0,0 +1,20 @@
1
+ import { Capabilities, UiAdapter } from '@fbkworks/adapter-core';
2
+ import { Button } from './primitives/Button.js';
3
+ import { Input } from './primitives/Input.js';
4
+ import { Select } from './primitives/Select.js';
5
+ import { Checkbox } from './primitives/Checkbox.js';
6
+ import { DatePicker } from './primitives/DatePicker.js';
7
+ import { Radio } from './primitives/Radio.js';
8
+ import { Form, FormItem } from './primitives/Form.js';
9
+ import { DataGrid } from './primitives/DataGrid.js';
10
+ import { Pagination } from './primitives/Pagination.js';
11
+ import { Dialog } from './primitives/Dialog.js';
12
+ import { Drawer } from './primitives/Drawer.js';
13
+ import { Tag } from './primitives/Tag.js';
14
+ import { Spin } from './primitives/Spin.js';
15
+ import { naiveTheme, naiveProviderProps } from './theme.js';
16
+ import { RootProvider } from './root-provider.js';
17
+ export declare const naiveCapabilities: Capabilities;
18
+ export declare const naiveUiAdapter: UiAdapter;
19
+ export { naiveTheme, naiveProviderProps, RootProvider };
20
+ export { Button, Input, Select, Checkbox, DatePicker, Radio, Form, FormItem, DataGrid, Pagination, Dialog, Drawer, Tag, Spin };
package/dist/index.mjs ADDED
@@ -0,0 +1,80 @@
1
+ import { Button } from "./primitives/Button.mjs";
2
+ import { Input } from "./primitives/Input.mjs";
3
+ import { Select } from "./primitives/Select.mjs";
4
+ import { Checkbox } from "./primitives/Checkbox.mjs";
5
+ import { DatePicker } from "./primitives/DatePicker.mjs";
6
+ import { Radio } from "./primitives/Radio.mjs";
7
+ import { feedback } from "./feedback.mjs";
8
+ import { FormItem, Form } from "./primitives/Form.mjs";
9
+ import { DataGrid } from "./primitives/DataGrid.mjs";
10
+ import { Pagination } from "./primitives/Pagination.mjs";
11
+ import { Dialog } from "./primitives/Dialog.mjs";
12
+ import { Drawer } from "./primitives/Drawer.mjs";
13
+ import { Tag } from "./primitives/Tag.mjs";
14
+ import { Spin } from "./primitives/Spin.mjs";
15
+ import { naiveTheme } from "./theme.mjs";
16
+ import { naiveProviderProps } from "./theme.mjs";
17
+ import { RootProvider } from "./root-provider.mjs";
18
+ const naiveCapabilities = {
19
+ dataGrid: {
20
+ presentation: "table",
21
+ selection: true,
22
+ sort: "custom",
23
+ /* 下面四个位此前声明为 true,但 DataGridProps 里根本没有对应 prop ——
24
+ 也就是说它们不只是没实现,而是连请求的入口都不存在。声明 true 会让
25
+ 调用方按能力位分支却拿到一条平铺的表。要真支持,需要先加 prop、
26
+ 三个适配器各实现、再补一致性用例,那是一轮独立设计。 */
27
+ expandable: false,
28
+ tree: false,
29
+ virtualScroll: false,
30
+ stickyHeader: false
31
+ },
32
+ form: {
33
+ layout: "horizontal",
34
+ labelWidth: true,
35
+ validateOn: ["change", "blur", "submit"],
36
+ asyncValidator: true
37
+ },
38
+ overlay: { kind: "dialog", supportsDrawer: true, supportsTeleport: true },
39
+ pagination: { mode: "pages", pageSizes: true, jumper: true },
40
+ // 只有契约里真实存在的两个 API;notification / loading 没有对应实现,不声明
41
+ feedback: { message: true, notification: false, confirm: true, loading: false },
42
+ theme: { darkMode: true, cssVariables: false, provider: true },
43
+ features: { "table.fixedColumns": true, "table.summary": true, "form.inline": true }
44
+ };
45
+ const naiveUiAdapter = {
46
+ meta: {
47
+ apiVersion: 3,
48
+ name: "naive-ui",
49
+ version: "0.1.0",
50
+ uiLibrary: { name: "naive-ui", version: "^2.40.0" },
51
+ platform: "desktop"
52
+ },
53
+ capabilities: naiveCapabilities,
54
+ primitives: { Button, Input, Select, Checkbox, DatePicker, Radio, Form, FormItem, DataGrid, Pagination, Dialog, Drawer, Tag, Spin },
55
+ feedback,
56
+ RootProvider,
57
+ theme: naiveTheme
58
+ };
59
+ export {
60
+ Button,
61
+ Checkbox,
62
+ DataGrid,
63
+ DatePicker,
64
+ Dialog,
65
+ Drawer,
66
+ Form,
67
+ FormItem,
68
+ Input,
69
+ Pagination,
70
+ Radio,
71
+ RootProvider,
72
+ Select,
73
+ Spin,
74
+ Tag,
75
+ naiveCapabilities,
76
+ naiveProviderProps,
77
+ naiveTheme,
78
+ naiveUiAdapter
79
+ };
80
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { Capabilities, UiAdapter } from '@fbkworks/adapter-core'\nimport { Button } from './primitives/Button'\nimport { Input } from './primitives/Input'\nimport { Select } from './primitives/Select'\nimport { Checkbox } from './primitives/Checkbox'\nimport { DatePicker } from './primitives/DatePicker'\nimport { Radio } from './primitives/Radio'\nimport { feedback } from './feedback'\nimport { Form, FormItem } from './primitives/Form'\nimport { DataGrid } from './primitives/DataGrid'\nimport { Pagination } from './primitives/Pagination'\nimport { Dialog } from './primitives/Dialog'\nimport { Drawer } from './primitives/Drawer'\nimport { Tag } from './primitives/Tag'\nimport { Spin } from './primitives/Spin'\nimport { naiveTheme, naiveProviderProps } from './theme'\nimport { RootProvider } from './root-provider'\n\nexport const naiveCapabilities: Capabilities = {\n dataGrid: {\n presentation: 'table',\n selection: true,\n sort: 'custom',\n /* 下面四个位此前声明为 true,但 DataGridProps 里根本没有对应 prop ——\n 也就是说它们不只是没实现,而是连请求的入口都不存在。声明 true 会让\n 调用方按能力位分支却拿到一条平铺的表。要真支持,需要先加 prop、\n 三个适配器各实现、再补一致性用例,那是一轮独立设计。 */\n expandable: false,\n tree: false,\n virtualScroll: false,\n stickyHeader: false,\n },\n form: {\n layout: 'horizontal',\n labelWidth: true,\n validateOn: ['change', 'blur', 'submit'],\n asyncValidator: true,\n },\n overlay: { kind: 'dialog', supportsDrawer: true, supportsTeleport: true },\n pagination: { mode: 'pages', pageSizes: true, jumper: true },\n // 只有契约里真实存在的两个 API;notification / loading 没有对应实现,不声明\n feedback: { message: true, notification: false, confirm: true, loading: false },\n theme: { darkMode: true, cssVariables: false, provider: true },\n features: { 'table.fixedColumns': true, 'table.summary': true, 'form.inline': true },\n}\n\nexport const naiveUiAdapter: UiAdapter = {\n meta: {\n apiVersion: 3,\n name: 'naive-ui',\n version: '0.1.0',\n uiLibrary: { name: 'naive-ui', version: '^2.40.0' },\n platform: 'desktop',\n },\n capabilities: naiveCapabilities,\n primitives: { Button, Input, Select, Checkbox, DatePicker, Radio, Form, FormItem, DataGrid, Pagination, Dialog, Drawer, Tag, Spin },\n feedback,\n RootProvider,\n theme: naiveTheme,\n}\n\nexport { naiveTheme, naiveProviderProps, RootProvider }\nexport { Button, Input, Select, Checkbox, DatePicker, Radio, Form, FormItem, DataGrid, Pagination, Dialog, Drawer, Tag, Spin }\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkBO,MAAM,oBAAkC;AAAA,EAC7C,UAAU;AAAA,IACR,cAAc;AAAA,IACd,WAAW;AAAA,IACX,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKN,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,eAAe;AAAA,IACf,cAAc;AAAA,EAAA;AAAA,EAEhB,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,YAAY,CAAC,UAAU,QAAQ,QAAQ;AAAA,IACvC,gBAAgB;AAAA,EAAA;AAAA,EAElB,SAAS,EAAE,MAAM,UAAU,gBAAgB,MAAM,kBAAkB,KAAA;AAAA,EACnE,YAAY,EAAE,MAAM,SAAS,WAAW,MAAM,QAAQ,KAAA;AAAA;AAAA,EAEtD,UAAU,EAAE,SAAS,MAAM,cAAc,OAAO,SAAS,MAAM,SAAS,MAAA;AAAA,EACxE,OAAO,EAAE,UAAU,MAAM,cAAc,OAAO,UAAU,KAAA;AAAA,EACxD,UAAU,EAAE,sBAAsB,MAAM,iBAAiB,MAAM,eAAe,KAAA;AAChF;AAEO,MAAM,iBAA4B;AAAA,EACvC,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,WAAW,EAAE,MAAM,YAAY,SAAS,UAAA;AAAA,IACxC,UAAU;AAAA,EAAA;AAAA,EAEZ,cAAc;AAAA,EACd,YAAY,EAAE,QAAQ,OAAO,QAAQ,UAAU,YAAY,OAAO,MAAM,UAAU,UAAU,YAAY,QAAQ,QAAQ,KAAK,KAAA;AAAA,EAC7H;AAAA,EACA;AAAA,EACA,OAAO;AACT;"}
@@ -0,0 +1,9 @@
1
+ import { ComputedRef, InjectionKey } from 'vue';
2
+ /**
3
+ * naive 的 NPagination 跳页组只渲染「跳至 [输入框]」,
4
+ * 而 element-plus 是「前往 [输入框] 页」—— 少一个尾部单位字。
5
+ *
6
+ * 这个字属于 locale(zh 是「页」、en 是「page」),不能写死在 CSS 里,
7
+ * 所以由 RootProvider 把当前语言包的 Pagination.selectionSuffix 传下来。
8
+ */
9
+ export declare const PAGINATION_SUFFIX: InjectionKey<ComputedRef<string>>;
@@ -0,0 +1,7 @@
1
+ const PAGINATION_SUFFIX = Symbol.for(
2
+ "fbk.naive.pagination-suffix"
3
+ );
4
+ export {
5
+ PAGINATION_SUFFIX
6
+ };
7
+ //# sourceMappingURL=locale-context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-context.mjs","sources":["../src/locale-context.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey } from 'vue'\n\n/**\n * naive 的 NPagination 跳页组只渲染「跳至 [输入框]」,\n * 而 element-plus 是「前往 [输入框] 页」—— 少一个尾部单位字。\n *\n * 这个字属于 locale(zh 是「页」、en 是「page」),不能写死在 CSS 里,\n * 所以由 RootProvider 把当前语言包的 Pagination.selectionSuffix 传下来。\n */\nexport const PAGINATION_SUFFIX: InjectionKey<ComputedRef<string>> = Symbol.for(\n 'fbk.naive.pagination-suffix',\n)\n"],"names":[],"mappings":"AASO,MAAM,oBAAuD,OAAO;AAAA,EACzE;AACF;"}
@@ -0,0 +1,53 @@
1
+ import { PropType } from 'vue';
2
+ import { ButtonProps, Size, Status } from '@fbkworks/adapter-core';
3
+ export declare const Button: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
+ variant: {
5
+ type: PropType<ButtonProps["variant"]>;
6
+ default: string;
7
+ };
8
+ status: {
9
+ type: PropType<Status>;
10
+ default: undefined;
11
+ };
12
+ size: {
13
+ type: PropType<Size>;
14
+ default: string;
15
+ };
16
+ disabled: BooleanConstructor;
17
+ loading: BooleanConstructor;
18
+ block: BooleanConstructor;
19
+ nativeType: {
20
+ type: PropType<ButtonProps["nativeType"]>;
21
+ default: string;
22
+ };
23
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "click"[], "click", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
24
+ variant: {
25
+ type: PropType<ButtonProps["variant"]>;
26
+ default: string;
27
+ };
28
+ status: {
29
+ type: PropType<Status>;
30
+ default: undefined;
31
+ };
32
+ size: {
33
+ type: PropType<Size>;
34
+ default: string;
35
+ };
36
+ disabled: BooleanConstructor;
37
+ loading: BooleanConstructor;
38
+ block: BooleanConstructor;
39
+ nativeType: {
40
+ type: PropType<ButtonProps["nativeType"]>;
41
+ default: string;
42
+ };
43
+ }>> & Readonly<{
44
+ onClick?: ((...args: any[]) => any) | undefined;
45
+ }>, {
46
+ size: Size;
47
+ variant: import('@fbkworks/adapter-core').ButtonVariant | undefined;
48
+ nativeType: "submit" | "button" | "reset" | undefined;
49
+ disabled: boolean;
50
+ loading: boolean;
51
+ block: boolean;
52
+ status: Status;
53
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,62 @@
1
+ import { defineComponent, computed, createVNode, mergeProps } from "vue";
2
+ import { NButton } from "naive-ui";
3
+ const statusType = {
4
+ primary: "primary",
5
+ success: "success",
6
+ warning: "warning",
7
+ danger: "error",
8
+ info: "info",
9
+ default: "default"
10
+ };
11
+ const Button = /* @__PURE__ */ defineComponent({
12
+ name: "FbkNaiveButton",
13
+ inheritAttrs: false,
14
+ props: {
15
+ variant: {
16
+ type: String,
17
+ default: "default"
18
+ },
19
+ status: {
20
+ type: String,
21
+ default: void 0
22
+ },
23
+ size: {
24
+ type: String,
25
+ default: "md"
26
+ },
27
+ disabled: Boolean,
28
+ loading: Boolean,
29
+ block: Boolean,
30
+ nativeType: {
31
+ type: String,
32
+ default: "button"
33
+ }
34
+ },
35
+ emits: ["click"],
36
+ setup(props, {
37
+ attrs,
38
+ emit,
39
+ slots
40
+ }) {
41
+ const type = computed(() => props.status ? statusType[props.status] : props.variant === "primary" ? "primary" : "default");
42
+ const size = computed(() => props.size === "sm" ? "small" : props.size === "lg" ? "large" : "medium");
43
+ const text = computed(() => props.variant === "text" || props.variant === "link");
44
+ const dashed = computed(() => props.variant === "dashed");
45
+ return () => createVNode(NButton, mergeProps(attrs, {
46
+ "class": [text.value ? "fbk-button--text" : null, attrs.class],
47
+ "type": type.value,
48
+ "size": size.value,
49
+ "disabled": props.disabled,
50
+ "loading": props.loading,
51
+ "block": props.block,
52
+ "attrType": props.nativeType,
53
+ "text": text.value,
54
+ "dashed": dashed.value,
55
+ "onClick": (event) => emit("click", event)
56
+ }), slots);
57
+ }
58
+ });
59
+ export {
60
+ Button
61
+ };
62
+ //# sourceMappingURL=Button.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.mjs","sources":["../../src/primitives/Button.tsx"],"sourcesContent":["import { computed, defineComponent, type PropType } from 'vue'\nimport { NButton } from 'naive-ui'\nimport type { ButtonProps, Size, Status } from '@fbkworks/adapter-core'\n\nconst statusType = {\n primary: 'primary',\n success: 'success',\n warning: 'warning',\n danger: 'error',\n info: 'info',\n default: 'default',\n} as const\n\nexport const Button = defineComponent({\n name: 'FbkNaiveButton',\n inheritAttrs: false,\n props: {\n variant: { type: String as PropType<ButtonProps['variant']>, default: 'default' },\n status: { type: String as PropType<Status>, default: undefined },\n size: { type: String as PropType<Size>, default: 'md' },\n disabled: Boolean,\n loading: Boolean,\n block: Boolean,\n nativeType: { type: String as PropType<ButtonProps['nativeType']>, default: 'button' },\n },\n emits: ['click'],\n setup(props, { attrs, emit, slots }) {\n const type = computed(() => (props.status ? statusType[props.status] : props.variant === 'primary' ? 'primary' : 'default'))\n const size = computed(() => (props.size === 'sm' ? 'small' : props.size === 'lg' ? 'large' : 'medium'))\n const text = computed(() => props.variant === 'text' || props.variant === 'link')\n const dashed = computed(() => props.variant === 'dashed')\n return () => (\n <NButton\n {...attrs}\n /* naive 的 text 模式**不产生任何 class**(Button.mjs 的 class 拼接里\n 只有 dashed / ghost / secondary 等会加类名,text 不加)。\n 样式层因此没法用 .n-button--text 选中它,文字按钮只剩行高\n (实测 12px vs element-plus 的 32px)。\n 这里补一个自己的标记类,由 style.css 补回控件高度。 */\n class={[text.value ? 'fbk-button--text' : null, attrs.class]}\n type={type.value}\n size={size.value}\n disabled={props.disabled}\n loading={props.loading}\n block={props.block}\n attrType={props.nativeType}\n text={text.value}\n dashed={dashed.value}\n onClick={(event: MouseEvent) => emit('click', event)}\n v-slots={slots}\n />\n )\n },\n})\n"],"names":["statusType","primary","success","warning","danger","info","default","Button","defineComponent","name","inheritAttrs","props","variant","type","String","status","undefined","size","disabled","Boolean","loading","block","nativeType","emits","setup","attrs","emit","slots","computed","text","dashed","_createVNode","NButton","_mergeProps","value","class","event"],"mappings":";;AAIA,MAAMA,aAAa;AAAA,EACjBC,SAAS;AAAA,EACTC,SAAS;AAAA,EACTC,SAAS;AAAA,EACTC,QAAQ;AAAA,EACRC,MAAM;AAAA,EACNC,SAAS;AACX;AAEO,MAAMC,SAASC,gCAAgB;AAAA,EACpCC,MAAM;AAAA,EACNC,cAAc;AAAA,EACdC,OAAO;AAAA,IACLC,SAAS;AAAA,MAAEC,MAAMC;AAAAA,MAA4CR,SAAS;AAAA;IACtES,QAAQ;AAAA,MAAEF,MAAMC;AAAAA,MAA4BR,SAASU;AAAAA;IACrDC,MAAM;AAAA,MAAEJ,MAAMC;AAAAA,MAA0BR,SAAS;AAAA;IACjDY,UAAUC;AAAAA,IACVC,SAASD;AAAAA,IACTE,OAAOF;AAAAA,IACPG,YAAY;AAAA,MAAET,MAAMC;AAAAA,MAA+CR,SAAS;AAAA,IAAS;AAAA;EAEvFiB,OAAO,CAAC,OAAO;AAAA,EACfC,MAAMb,OAAO;AAAA,IAAEc;AAAAA,IAAOC;AAAAA,IAAMC;AAAAA,EAAM,GAAG;AACnC,UAAMd,OAAOe,SAAS,MAAOjB,MAAMI,SAASf,WAAWW,MAAMI,MAAM,IAAIJ,MAAMC,YAAY,YAAY,YAAY,SAAU;AAC3H,UAAMK,OAAOW,SAAS,MAAOjB,MAAMM,SAAS,OAAO,UAAUN,MAAMM,SAAS,OAAO,UAAU,QAAS;AACtG,UAAMY,OAAOD,SAAS,MAAMjB,MAAMC,YAAY,UAAUD,MAAMC,YAAY,MAAM;AAChF,UAAMkB,SAASF,SAAS,MAAMjB,MAAMC,YAAY,QAAQ;AACxD,WAAO,MAAAmB,YAAAC,SAAAC,WAECR,OAAK;AAAA,MAAA,SAMF,CAACI,KAAKK,QAAQ,qBAAqB,MAAMT,MAAMU,KAAK;AAAA,MAAC,QACtDtB,KAAKqB;AAAAA,MAAK,QACVjB,KAAKiB;AAAAA,MAAK,YACNvB,MAAMO;AAAAA,MAAQ,WACfP,MAAMS;AAAAA,MAAO,SACfT,MAAMU;AAAAA,MAAK,YACRV,MAAMW;AAAAA,MAAU,QACpBO,KAAKK;AAAAA,MAAK,UACRJ,OAAOI;AAAAA,MAAK,WACVE,WAAsBV,KAAK,SAASU,KAAK;AAAA,IAAC,CAAA,GAC3CT,KAAK;AAAA,EAGpB;AACF,CAAC;"}
@@ -0,0 +1,26 @@
1
+ import { PropType } from 'vue';
2
+ import { Size } from '@fbkworks/adapter-core';
3
+ export declare const Checkbox: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
+ modelValue: BooleanConstructor;
5
+ label: StringConstructor;
6
+ disabled: BooleanConstructor;
7
+ size: {
8
+ type: PropType<Size>;
9
+ default: string;
10
+ };
11
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
12
+ modelValue: BooleanConstructor;
13
+ label: StringConstructor;
14
+ disabled: BooleanConstructor;
15
+ size: {
16
+ type: PropType<Size>;
17
+ default: string;
18
+ };
19
+ }>> & Readonly<{
20
+ onChange?: ((...args: any[]) => any) | undefined;
21
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
22
+ }>, {
23
+ size: Size;
24
+ disabled: boolean;
25
+ modelValue: boolean;
26
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,43 @@
1
+ import { defineComponent, createVNode, mergeProps } from "vue";
2
+ import { NCheckbox } from "naive-ui";
3
+ const sizeOf = {
4
+ sm: "small",
5
+ md: "medium",
6
+ lg: "large"
7
+ };
8
+ const Checkbox = /* @__PURE__ */ defineComponent({
9
+ name: "FbkNaiveCheckbox",
10
+ inheritAttrs: false,
11
+ props: {
12
+ modelValue: Boolean,
13
+ label: String,
14
+ disabled: Boolean,
15
+ size: {
16
+ type: String,
17
+ default: "md"
18
+ }
19
+ },
20
+ emits: ["update:modelValue", "change"],
21
+ setup(props, {
22
+ attrs,
23
+ emit,
24
+ slots
25
+ }) {
26
+ const forward = (value) => {
27
+ emit("update:modelValue", value);
28
+ emit("change", value);
29
+ };
30
+ return () => createVNode(NCheckbox, mergeProps(attrs, {
31
+ "checked": props.modelValue,
32
+ "disabled": props.disabled,
33
+ "size": sizeOf[props.size ?? "md"],
34
+ "onUpdate:checked": forward
35
+ }), {
36
+ default: () => [slots.default?.() ?? props.label]
37
+ });
38
+ }
39
+ });
40
+ export {
41
+ Checkbox
42
+ };
43
+ //# sourceMappingURL=Checkbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.mjs","sources":["../../src/primitives/Checkbox.tsx"],"sourcesContent":["import { defineComponent, type PropType } from 'vue'\nimport { NCheckbox } from 'naive-ui'\nimport type { Size } from '@fbkworks/adapter-core'\n\n/**\n * 布尔开关。\n *\n * 注意:naive 的 NCheckbox 单值模式用 `checked` 而不是 `modelValue`,\n * 事件名是 `update:checked`。直接用 v-model 会静默不生效 ——\n * 控件看起来在,但勾了没反应。\n *\n * 另外 naive 的 `size` 是 'small' | 'medium' | 'large' 这种档位名,\n * 不是像素值;字号对齐交给样式层,这里只映射档位。\n */\nconst sizeOf = { sm: 'small', md: 'medium', lg: 'large' } as const\n\nexport const Checkbox = defineComponent({\n name: 'FbkNaiveCheckbox',\n inheritAttrs: false,\n props: {\n modelValue: Boolean,\n label: String,\n disabled: Boolean,\n size: { type: String as PropType<Size>, default: 'md' },\n },\n emits: ['update:modelValue', 'change'],\n setup(props, { attrs, emit, slots }) {\n const forward = (value: boolean) => {\n emit('update:modelValue', value)\n emit('change', value)\n }\n\n return () => (\n <NCheckbox\n {...attrs}\n checked={props.modelValue}\n disabled={props.disabled}\n size={sizeOf[props.size ?? 'md']}\n onUpdate:checked={forward}\n >\n {slots.default?.() ?? props.label}\n </NCheckbox>\n )\n },\n})\n"],"names":["sizeOf","sm","md","lg","Checkbox","defineComponent","name","inheritAttrs","props","modelValue","Boolean","label","String","disabled","size","type","default","emits","setup","attrs","emit","slots","forward","value","_createVNode","NCheckbox","_mergeProps"],"mappings":";;AAcA,MAAMA,SAAS;AAAA,EAAEC,IAAI;AAAA,EAASC,IAAI;AAAA,EAAUC,IAAI;AAAQ;AAEjD,MAAMC,WAAWC,gCAAgB;AAAA,EACtCC,MAAM;AAAA,EACNC,cAAc;AAAA,EACdC,OAAO;AAAA,IACLC,YAAYC;AAAAA,IACZC,OAAOC;AAAAA,IACPC,UAAUH;AAAAA,IACVI,MAAM;AAAA,MAAEC,MAAMH;AAAAA,MAA0BI,SAAS;AAAA,IAAK;AAAA;EAExDC,OAAO,CAAC,qBAAqB,QAAQ;AAAA,EACrCC,MAAMV,OAAO;AAAA,IAAEW;AAAAA,IAAOC;AAAAA,IAAMC;AAAAA,EAAM,GAAG;AACnC,UAAMC,UAAWC,WAAmB;AAClCH,WAAK,qBAAqBG,KAAK;AAC/BH,WAAK,UAAUG,KAAK;AAAA,IACtB;AAEA,WAAO,MAAAC,YAAAC,WAAAC,WAECP,OAAK;AAAA,MAAA,WACAX,MAAMC;AAAAA,MAAU,YACfD,MAAMK;AAAAA,MAAQ,QAClBb,OAAOQ,MAAMM,QAAQ,IAAI;AAAA,MAAC,oBACdQ;AAAAA,IAAO,CAAA,GAAA;AAAA,MAAAN,SAAAA,MAAA,CAExBK,MAAML,UAAO,KAAQR,MAAMG,KAAK;AAAA,KAAA;AAAA,EAGvC;AACF,CAAC;"}
@@ -0,0 +1,93 @@
1
+ import { PropType } from 'vue';
2
+ import { DataGridColumn, DataGridProps, SortState } from '@fbkworks/adapter-core';
3
+ export declare const DataGrid: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
+ columns: {
5
+ type: PropType<DataGridColumn<any>[]>;
6
+ default: () => never[];
7
+ };
8
+ data: {
9
+ type: PropType<any[]>;
10
+ default: () => never[];
11
+ };
12
+ rowKey: {
13
+ type: PropType<DataGridProps["rowKey"]>;
14
+ default: string;
15
+ };
16
+ loading: BooleanConstructor;
17
+ presentation: {
18
+ type: PropType<DataGridProps["presentation"]>;
19
+ default: string;
20
+ };
21
+ selectionEnabled: BooleanConstructor;
22
+ selectionWidth: {
23
+ type: NumberConstructor;
24
+ default: number;
25
+ };
26
+ selectedKeys: {
27
+ type: PropType<Array<string | number>>;
28
+ default: () => never[];
29
+ };
30
+ sort: {
31
+ type: PropType<SortState | null>;
32
+ default: null;
33
+ };
34
+ emptyText: StringConstructor;
35
+ rowClickable: BooleanConstructor;
36
+ size: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("update:selectedKeys" | "update:sort" | "row-click")[], "update:selectedKeys" | "update:sort" | "row-click", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
41
+ columns: {
42
+ type: PropType<DataGridColumn<any>[]>;
43
+ default: () => never[];
44
+ };
45
+ data: {
46
+ type: PropType<any[]>;
47
+ default: () => never[];
48
+ };
49
+ rowKey: {
50
+ type: PropType<DataGridProps["rowKey"]>;
51
+ default: string;
52
+ };
53
+ loading: BooleanConstructor;
54
+ presentation: {
55
+ type: PropType<DataGridProps["presentation"]>;
56
+ default: string;
57
+ };
58
+ selectionEnabled: BooleanConstructor;
59
+ selectionWidth: {
60
+ type: NumberConstructor;
61
+ default: number;
62
+ };
63
+ selectedKeys: {
64
+ type: PropType<Array<string | number>>;
65
+ default: () => never[];
66
+ };
67
+ sort: {
68
+ type: PropType<SortState | null>;
69
+ default: null;
70
+ };
71
+ emptyText: StringConstructor;
72
+ rowClickable: BooleanConstructor;
73
+ size: {
74
+ type: StringConstructor;
75
+ default: string;
76
+ };
77
+ }>> & Readonly<{
78
+ "onUpdate:selectedKeys"?: ((...args: any[]) => any) | undefined;
79
+ "onUpdate:sort"?: ((...args: any[]) => any) | undefined;
80
+ "onRow-click"?: ((...args: any[]) => any) | undefined;
81
+ }>, {
82
+ size: string;
83
+ sort: SortState | null;
84
+ data: any[];
85
+ loading: boolean;
86
+ rowKey: string | ((row: any) => string | number) | undefined;
87
+ presentation: import('@fbkworks/adapter-core').DataGridPresentation | undefined;
88
+ selectionEnabled: boolean;
89
+ rowClickable: boolean;
90
+ columns: DataGridColumn<any>[];
91
+ selectionWidth: number;
92
+ selectedKeys: (string | number)[];
93
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;