@borurio-print/print-designer 1.0.10 → 1.0.12
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/README.md +4 -40
- package/dist-lib/PrintTemplateRenderer.vue.d.ts +24 -0
- package/dist-lib/components/{ElDatePicker.vue.d.ts → BpdDatePicker.vue.d.ts} +11 -0
- package/dist-lib/components/{ElDropdown.vue.d.ts → BpdDropdown.vue.d.ts} +2 -2
- package/dist-lib/components/{ElSelect.vue.d.ts → BpdSelect.vue.d.ts} +9 -0
- package/dist-lib/components/{ElSlider.vue.d.ts → BpdSlider.vue.d.ts} +2 -0
- package/dist-lib/components/uiFloating.d.ts +13 -0
- package/dist-lib/components/uiSelectContext.d.ts +13 -0
- package/dist-lib/core/componentRegistry.d.ts +1 -1
- package/dist-lib/{index-BSUORujY.js → index-QusGcdhY.js} +5892 -5742
- package/dist-lib/index.d.ts +14 -2
- package/dist-lib/{index.es-CImGQms4.js → index.es-lpNcrrOw.js} +2 -2
- package/dist-lib/index.js +4 -5
- package/dist-lib/{pdfGenerator-BlIFWfaN.js → pdfGenerator-CyRlnABp.js} +40 -15
- package/dist-lib/style.css +1 -1
- package/package.json +2 -4
- package/dist-lib/locales/en-US.d.ts +0 -216
- package/dist-lib/locales/zh-CN.d.ts +0 -216
- package/dist-lib/components/{ElButton.vue.d.ts → BpdButton.vue.d.ts} +0 -0
- package/dist-lib/components/{ElButtonGroup.vue.d.ts → BpdButtonGroup.vue.d.ts} +0 -0
- package/dist-lib/components/{ElCheckbox.vue.d.ts → BpdCheckbox.vue.d.ts} +0 -0
- package/dist-lib/components/{ElDialog.vue.d.ts → BpdDialog.vue.d.ts} +0 -0
- package/dist-lib/components/{ElDivider.vue.d.ts → BpdDivider.vue.d.ts} +0 -0
- package/dist-lib/components/{ElDropdownItem.vue.d.ts → BpdDropdownItem.vue.d.ts} +0 -0
- package/dist-lib/components/{ElDropdownMenu.vue.d.ts → BpdDropdownMenu.vue.d.ts} +0 -0
- package/dist-lib/components/{ElEmpty.vue.d.ts → BpdEmpty.vue.d.ts} +0 -0
- package/dist-lib/components/{ElForm.vue.d.ts → BpdForm.vue.d.ts} +0 -0
- package/dist-lib/components/{ElFormItem.vue.d.ts → BpdFormItem.vue.d.ts} +0 -0
- package/dist-lib/components/{ElInput.vue.d.ts → BpdInput.vue.d.ts} +1 -1
- /package/dist-lib/components/{ElInputNumber.vue.d.ts → BpdInputNumber.vue.d.ts} +0 -0
- /package/dist-lib/components/{ElOption.vue.d.ts → BpdOption.vue.d.ts} +0 -0
- /package/dist-lib/components/{ElRadio.vue.d.ts → BpdRadio.vue.d.ts} +0 -0
- /package/dist-lib/components/{ElRadioGroup.vue.d.ts → BpdRadioGroup.vue.d.ts} +0 -0
- /package/dist-lib/components/{ElTooltip.vue.d.ts → BpdTooltip.vue.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
## 入口说明
|
|
6
6
|
|
|
7
7
|
- `src/main.ts`:独立 Web/iframe 入口,创建 Vue 应用并挂载到 `#app`。
|
|
8
|
-
- `src/index.ts`:npm
|
|
8
|
+
- `src/index.ts`:npm 包入口,只导出组件和类型,不创建应用。
|
|
9
9
|
- `src/PrintDesigner.vue`:设计器根组件,持有模板、网格和缩放状态。
|
|
10
10
|
|
|
11
11
|
## 目录职责
|
|
12
12
|
|
|
13
13
|
- `src/components`:可跨业务模块复用的基础组件,目前包含 Symbol 图标组件。
|
|
14
14
|
- `src/core`:与界面无关的领域类型。
|
|
15
|
-
- `src/locales`:中英文语言包及独立 Web 模式的 i18n 实例。
|
|
16
15
|
- `src/views/print-designer/components`:打印设计器内部使用的界面组件。
|
|
17
16
|
- `src/assets/iconfont`:Iconfont 平台生成的本地 Symbol 脚本,不建议手动修改。
|
|
18
17
|
|
|
@@ -36,15 +35,14 @@
|
|
|
36
35
|
当前包名为 `@borurio-print/print-designer`。业务项目需要已安装下列 peer dependencies:
|
|
37
36
|
|
|
38
37
|
- Vue `>=3.2.45 <4.0.0`
|
|
39
|
-
- vue-i18n `>=9.2.2 <12.0.0`
|
|
40
38
|
|
|
41
|
-
设计器使用内置原生 UI
|
|
39
|
+
设计器使用内置原生 UI 控件和固定中文文案,不依赖业务系统的 Element Plus 或多语言配置。
|
|
42
40
|
|
|
43
41
|
```bash
|
|
44
42
|
npm install @borurio-print/print-designer
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
如果业务项目尚未安装 Vue,再按 npm 提示补充安装。
|
|
48
46
|
二维码、条形码和 PDF 生成库已包含在设计器产物中,业务项目无需另行安装。
|
|
49
47
|
|
|
50
48
|
在 Vue 页面中引入组件和独立样式文件:
|
|
@@ -69,41 +67,7 @@ import '@borurio-print/print-designer/style.css'
|
|
|
69
67
|
</style>
|
|
70
68
|
```
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
对应语言中:
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
import { createI18n } from 'vue-i18n'
|
|
77
|
-
import {
|
|
78
|
-
enUS as printDesignerEnUS,
|
|
79
|
-
zhCN as printDesignerZhCN,
|
|
80
|
-
} from '@borurio-print/print-designer'
|
|
81
|
-
|
|
82
|
-
const i18n = createI18n({
|
|
83
|
-
legacy: false,
|
|
84
|
-
locale: 'zh-CN',
|
|
85
|
-
messages: {
|
|
86
|
-
'zh-CN': printDesignerZhCN,
|
|
87
|
-
'en-US': printDesignerEnUS,
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
app.use(i18n)
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
如果业务应用已经存在语言包,可以使用 `mergeLocaleMessage` 合并,避免覆盖原有文案:
|
|
95
|
-
|
|
96
|
-
```ts
|
|
97
|
-
i18n.global.mergeLocaleMessage('zh-CN', printDesignerZhCN)
|
|
98
|
-
i18n.global.mergeLocaleMessage('en-US', printDesignerEnUS)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
如果业务系统使用 `zh-cn` 和 `en` 作为语言代码,则按实际代码合并:
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
i18n.global.mergeLocaleMessage('zh-cn', printDesignerZhCN)
|
|
105
|
-
i18n.global.mergeLocaleMessage('en', printDesignerEnUS)
|
|
106
|
-
```
|
|
70
|
+
设计器界面直接使用中文文案,业务应用无需注册 `vue-i18n`、合并语言包或传入语言代码。
|
|
107
71
|
|
|
108
72
|
## npm 发布
|
|
109
73
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PrintDesignerTheme, PrintRequest, PrintResult, PrintTemplate } from '@/core/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
template: PrintTemplate;
|
|
4
|
+
data?: unknown;
|
|
5
|
+
showPreview?: boolean;
|
|
6
|
+
previewPageIndex?: number;
|
|
7
|
+
theme?: PrintDesignerTheme;
|
|
8
|
+
};
|
|
9
|
+
declare function generatePdf(request: PrintRequest): Promise<void>;
|
|
10
|
+
declare function previewPdf(request: PrintRequest): Promise<void>;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
12
|
+
generatePdf: typeof generatePdf;
|
|
13
|
+
previewPdf: typeof previewPdf;
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"print-result": (result: PrintResult) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onPrint-result"?: (result: PrintResult) => any;
|
|
18
|
+
}>, {
|
|
19
|
+
data: {};
|
|
20
|
+
showPreview: boolean;
|
|
21
|
+
previewPageIndex: number;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { type CSSProperties } from 'vue';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
modelValue?: string;
|
|
3
4
|
disabled?: boolean;
|
|
4
5
|
placeholder?: string;
|
|
6
|
+
type?: 'date' | 'datetime';
|
|
7
|
+
format?: string;
|
|
8
|
+
valueFormat?: string;
|
|
9
|
+
popperClass?: string;
|
|
10
|
+
popperStyle?: CSSProperties | string;
|
|
5
11
|
};
|
|
6
12
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
13
|
change: (value: string) => any;
|
|
@@ -10,9 +16,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
10
16
|
onChange?: (value: string) => any;
|
|
11
17
|
"onUpdate:modelValue"?: (value: string) => any;
|
|
12
18
|
}>, {
|
|
19
|
+
type: "date" | "datetime";
|
|
13
20
|
disabled: boolean;
|
|
14
21
|
modelValue: string;
|
|
15
22
|
placeholder: string;
|
|
23
|
+
format: string;
|
|
24
|
+
valueFormat: string;
|
|
25
|
+
popperClass: string;
|
|
26
|
+
popperStyle: CSSProperties | string;
|
|
16
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
28
|
declare const _default: typeof __VLS_export;
|
|
18
29
|
export default _default;
|
|
@@ -6,11 +6,11 @@ type __VLS_Props = {
|
|
|
6
6
|
popperClass?: string;
|
|
7
7
|
popperStyle?: CSSProperties | string;
|
|
8
8
|
};
|
|
9
|
-
declare var __VLS_1: {},
|
|
9
|
+
declare var __VLS_1: {}, __VLS_9: {};
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
11
11
|
default?: (props: typeof __VLS_1) => any;
|
|
12
12
|
} & {
|
|
13
|
-
dropdown?: (props: typeof
|
|
13
|
+
dropdown?: (props: typeof __VLS_9) => any;
|
|
14
14
|
};
|
|
15
15
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
16
|
command: (value: unknown) => any;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { type CSSProperties } from 'vue';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
modelValue?: string | number | boolean;
|
|
3
4
|
disabled?: boolean;
|
|
4
5
|
placeholder?: string;
|
|
6
|
+
filterable?: boolean;
|
|
7
|
+
clearable?: boolean;
|
|
8
|
+
popperClass?: string;
|
|
9
|
+
popperStyle?: CSSProperties | string;
|
|
5
10
|
};
|
|
6
11
|
declare var __VLS_1: {};
|
|
7
12
|
type __VLS_Slots = {} & {
|
|
@@ -17,6 +22,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
17
22
|
disabled: boolean;
|
|
18
23
|
modelValue: string | number | boolean;
|
|
19
24
|
placeholder: string;
|
|
25
|
+
clearable: boolean;
|
|
26
|
+
popperClass: string;
|
|
27
|
+
popperStyle: CSSProperties | string;
|
|
28
|
+
filterable: boolean;
|
|
20
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
30
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
31
|
declare const _default: typeof __VLS_export;
|
|
@@ -5,6 +5,7 @@ type __VLS_Props = {
|
|
|
5
5
|
step?: number;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
showTooltip?: boolean;
|
|
8
|
+
tooltipClass?: string;
|
|
8
9
|
};
|
|
9
10
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
11
|
change: (value: number) => any;
|
|
@@ -19,6 +20,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
19
20
|
max: number;
|
|
20
21
|
step: number;
|
|
21
22
|
showTooltip: boolean;
|
|
23
|
+
tooltipClass: string;
|
|
22
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
25
|
declare const _default: typeof __VLS_export;
|
|
24
26
|
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CSSProperties, type Ref } from 'vue';
|
|
2
|
+
export interface FloatingPanelOptions {
|
|
3
|
+
offset?: number;
|
|
4
|
+
align?: 'start' | 'end';
|
|
5
|
+
matchWidth?: boolean;
|
|
6
|
+
minWidth?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface FloatingPanelState {
|
|
9
|
+
direction: Ref<'top' | 'bottom'>;
|
|
10
|
+
style: Ref<CSSProperties>;
|
|
11
|
+
updatePosition: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function useFloatingPanel(open: Ref<boolean>, trigger: Ref<HTMLElement | null>, panel: Ref<HTMLElement | null>, options?: FloatingPanelOptions): FloatingPanelState;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
export interface SelectOptionRecord {
|
|
3
|
+
id: symbol;
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectContext {
|
|
9
|
+
register: (option: SelectOptionRecord) => void;
|
|
10
|
+
unregister: (id: symbol) => void;
|
|
11
|
+
update: (option: SelectOptionRecord) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const selectContextKey: InjectionKey<SelectContext>;
|