@otlab/form-generator 0.0.0-stage → 0.1.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 (56) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +160 -2
  3. package/dist/api/index.d.ts +23 -0
  4. package/dist/api/paths.d.ts +47 -0
  5. package/dist/api/request.d.ts +3 -0
  6. package/dist/components/BizProjectForm/index.vue.d.ts +137 -0
  7. package/dist/components/FormDesign/CenterCanvas.vue.d.ts +31 -0
  8. package/dist/components/FormDesign/DefaultValueModal.vue.d.ts +36 -0
  9. package/dist/components/FormDesign/ExamConfigSection.vue.d.ts +2 -0
  10. package/dist/components/FormDesign/FormItem.vue.d.ts +53 -0
  11. package/dist/components/FormDesign/FormItemLayout.vue.d.ts +26 -0
  12. package/dist/components/FormDesign/ImportFormItem.vue.d.ts +23 -0
  13. package/dist/components/FormDesign/LeftPanel.vue.d.ts +21 -0
  14. package/dist/components/FormDesign/RightPanel.vue.d.ts +2 -0
  15. package/dist/components/FormDesign/default-value.d.ts +21 -0
  16. package/dist/components/FormDesign/index.vue.d.ts +15 -0
  17. package/dist/components/FormItem/autoRegister.d.ts +4 -0
  18. package/dist/components/FormItemConfig/autoRegister.d.ts +3 -0
  19. package/dist/components/GenerateForm/GenerateForm.vue.d.ts +88 -0
  20. package/dist/components/GenerateForm/GenerateFormItem.vue.d.ts +92 -0
  21. package/dist/components/GenerateFormContainer/index.vue.d.ts +52 -0
  22. package/dist/components/InlineEditor/index.vue.d.ts +40 -0
  23. package/dist/composables/useDesigner.d.ts +216 -0
  24. package/dist/composables/useDynamicOptions.d.ts +19 -0
  25. package/dist/composables/useFormLogic.d.ts +11 -0
  26. package/dist/composables/useFormPagination.d.ts +11 -0
  27. package/dist/composables/useFormTheme.d.ts +9 -0
  28. package/dist/composables/useFormValidate.d.ts +22 -0
  29. package/dist/composables/useMetadataSave.d.ts +27 -0
  30. package/dist/composables/useOptionQuota.d.ts +48 -0
  31. package/dist/composables/useReadOnly.d.ts +12 -0
  32. package/dist/composables/useUploadScene.d.ts +17 -0
  33. package/dist/config/index.d.ts +7856 -0
  34. package/dist/configure.d.ts +21 -0
  35. package/dist/designer.d.ts +2 -0
  36. package/dist/designer.js +4445 -0
  37. package/dist/field-default-BtCnB3aH.js +1282 -0
  38. package/dist/index.d.ts +18 -0
  39. package/dist/index.js +3560 -0
  40. package/dist/style.css +1 -0
  41. package/dist/types/adapter.d.ts +33 -0
  42. package/dist/types/form.d.ts +130 -0
  43. package/dist/utils/batch-edit.d.ts +9 -0
  44. package/dist/utils/convert.d.ts +41 -0
  45. package/dist/utils/dataTypeRules.d.ts +29 -0
  46. package/dist/utils/db.d.ts +6 -0
  47. package/dist/utils/exam.d.ts +40 -0
  48. package/dist/utils/expression.d.ts +16 -0
  49. package/dist/utils/field-default.d.ts +57 -0
  50. package/dist/utils/http.d.ts +8 -0
  51. package/dist/utils/import-parse.d.ts +36 -0
  52. package/dist/utils/index.d.ts +7 -0
  53. package/dist/utils/item-contract.d.ts +22 -0
  54. package/dist/utils/upload.d.ts +12 -0
  55. package/dist/utils/url.d.ts +9 -0
  56. package/package.json +119 -4
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OTLOG
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.
22
+
23
+ ---
24
+
25
+ ## Third-party notices
26
+
27
+ 本包的问卷表单引擎源自 tduck-platform(https://gitee.com/TDuckApp/tduck-platform),
28
+ 该项目以 MIT 协议发布。其原始版权声明与许可条款同样适用于本包中源自该项目的部分。
29
+ 上游代码已按 otlab 后端契约做过适配改造,且不再跟随上游同步。
package/README.md CHANGED
@@ -1,3 +1,161 @@
1
- # Temporary Holding Version
1
+ # @otlab/form-generator
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
+ otlab 问卷表单引擎:表单设计器 + 渲染层。从 `ot-admin` 前端仓库抽出的独立包。
4
+
5
+ - **渲染层**(`@otlab/form-generator`):`GenerateForm` / `GenerateFormContainer` / `BizProjectForm`,27 种题型、逻辑规则、分页、主题、选项名额、上传场景。
6
+ - **设计器**(`@otlab/form-generator/designer`):`FormDesign` / `InlineEditor`,含拖拽画布、右面板配置、富文本。
7
+
8
+ 两个入口分开是为了避免把 tinymce(富文本)与 vuedraggable(拖拽)打进只做填写/预览的消费方产物——SFC 带副作用,单桶无法树摇。
9
+
10
+ ## 安装(npmjs)
11
+
12
+ 已发布到 npmjs 公共 registry,直接安装,**无需配置 registry 或 token**:
13
+
14
+ ```bash
15
+ pnpm add @otlab/form-generator
16
+ ```
17
+
18
+ ```json
19
+ { "dependencies": { "@otlab/form-generator": "^0.1.0" } }
20
+ ```
21
+
22
+ 用设计器时把可选依赖一并装上(渲染层不需要):
23
+
24
+ ```bash
25
+ pnpm add tinymce tinymce-i18n vuedraggable
26
+ ```
27
+
28
+ ### 本地联调(改包时用)
29
+
30
+ 改包要即时生效时,临时把依赖换成链接(**提交前还原成版本号**,否则 CI 装不上):
31
+
32
+ ```json
33
+ { "dependencies": { "@otlab/form-generator": "link:../form-generator" } }
34
+ ```
35
+
36
+ `link:` 直接指向本仓库目录,改完只需 `pnpm build` 产出 `dist`,无需重新发布。
37
+
38
+ ## 消费方必须提供
39
+
40
+ peerDependencies(**不要**让包自带副本,否则 antd 双实例、主题令牌失效):
41
+
42
+ | 包 | 说明 |
43
+ |---|---|
44
+ | `vue` | ^3.4 |
45
+ | `ant-design-vue` | ^4.2,且需在应用内**全局注册**组件(包内模板使用 `<a-xxx>`) |
46
+ | `@ant-design/icons-vue` | ^7 |
47
+ | `dayjs` / `lodash` | 工具依赖 |
48
+ | `vuedraggable` | 仅设计器需要(optional peer) |
49
+ | `tinymce` / `tinymce-i18n` | 仅设计器富文本需要(optional peer) |
50
+
51
+ 包内**零运行时 HTTP 依赖**:请求走宿主注入的适配器,公开数据源走原生 `fetch`。
52
+
53
+ ## 接入
54
+
55
+ ```ts
56
+ // main.ts
57
+ import { configure } from '@otlab/form-generator';
58
+ import '@otlab/form-generator/style.css';
59
+ import adapter from './form-generator-adapter'; // 参考 examples/adapter.ts
60
+
61
+ configure({
62
+ apiBase: import.meta.env.VITE_APP_API_URL, // 静态资源/文件地址前缀
63
+ request: adapter, // 宿主请求适配器
64
+ });
65
+ ```
66
+
67
+ ```vue
68
+ <!-- 填写/预览 -->
69
+ <script setup lang="ts">
70
+ import { BizProjectForm } from '@otlab/form-generator';
71
+ </script>
72
+ <template>
73
+ <BizProjectForm :form-config="{ formKey }" @submit="onSubmit" />
74
+ </template>
75
+ ```
76
+
77
+ ```vue
78
+ <!-- 设计器:建议配合路由懒加载 -->
79
+ <script setup lang="ts">
80
+ import { provide } from 'vue';
81
+ import { FORM_DESIGN_READONLY_KEY } from '@otlab/form-generator';
82
+ import { FormDesign } from '@otlab/form-generator/designer';
83
+
84
+ const props = defineProps<{ formKey: string }>();
85
+ // 只读态由宿主工作台决定(编辑占用租约等),包只消费这一个布尔量
86
+ provide(FORM_DESIGN_READONLY_KEY, { isReadOnly });
87
+ </script>
88
+ <template>
89
+ <FormDesign :form-key="formKey" />
90
+ </template>
91
+ ```
92
+
93
+ ## 配置项
94
+
95
+ | 字段 | 默认 | 说明 |
96
+ |---|---|---|
97
+ | `apiBase` | `''` | 静态资源/文件地址前缀(原 `VITE_APP_API_URL`) |
98
+ | `request` | `null` | 请求适配器,未配置时调用接口会抛错 |
99
+ | `paths` | `/survey/**` | 后端端点表,局部覆盖即可换后端 |
100
+ | `documentTitle` | `true` | 是否允许改写 `document.title` |
101
+
102
+ 端点表覆盖示例(默认值见 `src/api/paths.ts`):
103
+
104
+ ```ts
105
+ configure({
106
+ paths: {
107
+ formDetail: '/api-v2/form/{key}',
108
+ fileUpload: '/api-v2/file/upload',
109
+ },
110
+ });
111
+ ```
112
+
113
+ 占位符 `{key}` 由 `resolvePath` 填充并 encode。
114
+
115
+ ## 开发
116
+
117
+ ```bash
118
+ pnpm install
119
+ pnpm check # lint + typecheck + test + build
120
+ pnpm build # 产出 dist/index.js、dist/designer.js、dist/style.css、d.ts
121
+ pnpm pack:local # 本地打 tarball,供 npm pack 安装验证
122
+ ```
123
+
124
+ ## 发布(npmjs)
125
+
126
+ ### 首选:GitHub Actions(Trusted Publishing,无需 token)
127
+
128
+ 打 tag 推送即触发 `.github/workflows/publish.yml`:
129
+
130
+ ```bash
131
+ pnpm version patch # 或 minor / major,同时打 vX.Y.Z tag
132
+ git push --follow-tags
133
+ ```
134
+
135
+ 一次性配置:在 npmjs 包的 Trusted Publisher 页面填 GitHub 仓库信息(`dowei` / `form-generator` / `publish.yml`),
136
+ 之后 CI 用 OIDC 换临时凭据发布,不涉及任何长期 token。
137
+
138
+ ### 本机发布(2FA 账号需要 OTP)
139
+
140
+ ```bash
141
+ npm login
142
+ pnpm version patch
143
+ pnpm release --otp=<6位验证码>
144
+ ```
145
+
146
+ > 账号开启 2FA 后,`pnpm release` 不带 `--otp` 会返回 403;且 npm 正在弃用
147
+ > 「bypass 2FA 的 granular token」用于直接发布,所以长期建议走上面的 CI 通道。
148
+
149
+ `prepublishOnly` 会先跑 `pnpm check`(lint + typecheck + test + build),门禁不过不发版。
150
+ 发布内容只有 `dist` + `README.md` + `LICENSE`(`files` 白名单),`npm pack --dry-run` 可先核对。
151
+
152
+ 版本语义(0.x 阶段):`^0.1.0` 只接受 `0.1.x`,破坏性改动请升 minor(`0.2.0`)——
153
+ 下游 fork 后升级依赖是显式动作,不会被动跟到不兼容版本。
154
+
155
+ 发布后若消费方装了 pnpm 的「最小发布年龄」策略,`pnpm install` 会把新版本追加进
156
+ `pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude`,属正常现象,随 lockfile 一起提交即可。
157
+
158
+ ## 约束
159
+
160
+ - 题型白名单(`src/utils/item-contract.ts`、`src/config/index.ts`)必须与后端 `SurveyFormItemValidator` 保持一致;它是包的核心语义,**不做成配置项**。
161
+ - 包内不得出现宿主路径别名(`/@/`)或宿主专属环境变量。
@@ -0,0 +1,23 @@
1
+ import { ApiResponse } from '../types/adapter';
2
+ export declare function getProject(formKey: string): Promise<ApiResponse>;
3
+ export declare function getFormDetails(formKey: string): Promise<ApiResponse>;
4
+ export declare function getTemplateFormDetails(formKey: string): Promise<ApiResponse>;
5
+ export declare function queryProjectItems(formKey: string): Promise<ApiResponse>;
6
+ export declare function listFormFields(formKey: string): Promise<ApiResponse>;
7
+ export declare function createProjectItem(data: Record<string, unknown>): Promise<ApiResponse>;
8
+ export declare function updateProjectItem(data: Record<string, unknown>): Promise<ApiResponse>;
9
+ export declare function deleteProjectItem(formKey: string, id: number | string): Promise<ApiResponse>;
10
+ export declare function sortProjectItem(formKey: string, itemIds: Array<number | string>): Promise<ApiResponse>;
11
+ export declare function updateProject(data: Record<string, unknown>, options?: {
12
+ silentError?: boolean;
13
+ }): Promise<ApiResponse>;
14
+ export declare function batchCreateProjectItem(data: Array<Record<string, unknown>>): Promise<ApiResponse>;
15
+ export declare function createFormResult(data: Record<string, unknown>): Promise<ApiResponse>;
16
+ export declare function publicCreateFormResult(data: Record<string, unknown>): Promise<ApiResponse>;
17
+ export declare function getFormLogic(params: Record<string, unknown>): Promise<ApiResponse>;
18
+ export declare function getUserTheme(projectKey: string): Promise<ApiResponse>;
19
+ export declare function getOptionUsedQuotaRequest(projectKey: string): Promise<ApiResponse>;
20
+ export declare function stopPublishForm(formKey: string): Promise<ApiResponse>;
21
+ export declare function fileUpload(data: FormData): Promise<ApiResponse>;
22
+ export declare function fileUploadAnonymous(data: FormData, formKey?: string): Promise<ApiResponse>;
23
+ export declare function getPhoneCode(phoneNumber: string, formKey?: string): Promise<ApiResponse>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * 后端端点表。
3
+ *
4
+ * 包内所有 URL 集中在此,`{key}` 为占位符(由 config.resolvePath 填充并 encode)。
5
+ * 换后端前缀 / 换路径时用 configure({ paths: {...} }) 局部覆盖,无需改包内代码。
6
+ */
7
+ export interface EndpointPaths {
8
+ /** 表单项目详情(设计器/管理端) */
9
+ formDetail: string;
10
+ /** 表单详情(填写/预览) */
11
+ formDetails: string;
12
+ /** 模板表单详情 */
13
+ templateDetails: string;
14
+ /** 表单项列表(query: key) */
15
+ itemList: string;
16
+ /** 创建表单项 */
17
+ itemCreate: string;
18
+ /** 更新表单项(PUT,body 含后端 id) */
19
+ itemUpdate: string;
20
+ /** 删除表单项(query: id + key) */
21
+ itemDelete: string;
22
+ /** 表单项排序(query: key,body 为 id 数组) */
23
+ itemSort: string;
24
+ /** 批量创建表单项 */
25
+ itemBatchCreate: string;
26
+ /** 更新表单项目(PUT,body 含问卷 id) */
27
+ formUpdate: string;
28
+ /** 保存表单结果 */
29
+ resultCreate: string;
30
+ /** 保存公开表单结果(@Anonymous) */
31
+ resultPublicCreate: string;
32
+ /** 表单逻辑(query: key) */
33
+ formLogic: string;
34
+ /** 表单主题 */
35
+ formTheme: string;
36
+ /** 选项名额已用数(query: key,@Anonymous) */
37
+ optionUsedQuota: string;
38
+ /** 停止发布(query: key) */
39
+ formStop: string;
40
+ /** 登录态文件上传 */
41
+ fileUpload: string;
42
+ /** 匿名文件上传(@Anonymous) */
43
+ fileUploadAnonymous: string;
44
+ /** 手机验证码(@Anonymous) */
45
+ phoneCode: string;
46
+ }
47
+ export declare const defaultPaths: EndpointPaths;
@@ -0,0 +1,3 @@
1
+ import { ApiAdapter } from '../types/adapter';
2
+ export declare function setApiInstance(instance: unknown): void;
3
+ export declare function getApiInstance(): ApiAdapter | null;
@@ -0,0 +1,137 @@
1
+ import { FormConf } from '../../types/form';
2
+ declare const _default: import('vue').DefineComponent<{
3
+ formConfig: {
4
+ type: ObjectConstructor;
5
+ default: () => {
6
+ formKey: string;
7
+ showBtns: boolean;
8
+ formKind: number;
9
+ supportText: string;
10
+ setting: null;
11
+ preview: boolean;
12
+ };
13
+ };
14
+ /** 运行时预填值(键=config.defaultValueSource),透传给 GenerateFormContainer(TASK-0115) */
15
+ prefillValues: {
16
+ type: ObjectConstructor;
17
+ default: () => {};
18
+ };
19
+ }, {
20
+ containerRef: import('vue').Ref<import('vue').CreateComponentPublicInstance<Readonly<import('vue').ExtractPropTypes<{
21
+ formConf: {
22
+ type: import('vue').PropType<FormConf>;
23
+ required: true;
24
+ };
25
+ supportText: {
26
+ type: StringConstructor;
27
+ default: string;
28
+ };
29
+ prefillValues: {
30
+ type: ObjectConstructor;
31
+ default: () => {};
32
+ };
33
+ }>> & {
34
+ onChange?: ((...args: any[]) => any) | undefined;
35
+ onSubmit?: ((...args: any[]) => any) | undefined;
36
+ onCompleted?: ((...args: any[]) => any) | undefined;
37
+ }, {
38
+ generateFormRef: import('vue').Ref<{
39
+ getFormModel: () => Record<string, unknown>;
40
+ validate: () => Promise<unknown>;
41
+ } | null>;
42
+ getFormModel: () => Record<string, unknown> | undefined;
43
+ validate: () => Promise<unknown> | undefined;
44
+ restoreFormModel: (models: Record<string, unknown>) => void;
45
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
46
+ change: (...args: any[]) => void;
47
+ submit: (...args: any[]) => void;
48
+ completed: (...args: any[]) => void;
49
+ }, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{
50
+ formConf: {
51
+ type: import('vue').PropType<FormConf>;
52
+ required: true;
53
+ };
54
+ supportText: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ };
58
+ prefillValues: {
59
+ type: ObjectConstructor;
60
+ default: () => {};
61
+ };
62
+ }>> & {
63
+ onChange?: ((...args: any[]) => any) | undefined;
64
+ onSubmit?: ((...args: any[]) => any) | undefined;
65
+ onCompleted?: ((...args: any[]) => any) | undefined;
66
+ }, {
67
+ prefillValues: Record<string, any>;
68
+ supportText: string;
69
+ }, true, {}, {}, {
70
+ P: {};
71
+ B: {};
72
+ D: {};
73
+ C: {};
74
+ M: {};
75
+ Defaults: {};
76
+ }, Readonly<import('vue').ExtractPropTypes<{
77
+ formConf: {
78
+ type: import('vue').PropType<FormConf>;
79
+ required: true;
80
+ };
81
+ supportText: {
82
+ type: StringConstructor;
83
+ default: string;
84
+ };
85
+ prefillValues: {
86
+ type: ObjectConstructor;
87
+ default: () => {};
88
+ };
89
+ }>> & {
90
+ onChange?: ((...args: any[]) => any) | undefined;
91
+ onSubmit?: ((...args: any[]) => any) | undefined;
92
+ onCompleted?: ((...args: any[]) => any) | undefined;
93
+ }, {
94
+ generateFormRef: import('vue').Ref<{
95
+ getFormModel: () => Record<string, unknown>;
96
+ validate: () => Promise<unknown>;
97
+ } | null>;
98
+ getFormModel: () => Record<string, unknown> | undefined;
99
+ validate: () => Promise<unknown> | undefined;
100
+ restoreFormModel: (models: Record<string, unknown>) => void;
101
+ }, {}, {}, {}, {
102
+ prefillValues: Record<string, any>;
103
+ supportText: string;
104
+ }> | null>;
105
+ getFormModel: () => Record<string, unknown> | undefined;
106
+ validate: () => Promise<unknown> | undefined;
107
+ restoreFormModel: (models: Record<string, unknown>) => void | undefined;
108
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
109
+ change: (...args: any[]) => void;
110
+ submit: (...args: any[]) => void;
111
+ completed: (...args: any[]) => void;
112
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
113
+ formConfig: {
114
+ type: ObjectConstructor;
115
+ default: () => {
116
+ formKey: string;
117
+ showBtns: boolean;
118
+ formKind: number;
119
+ supportText: string;
120
+ setting: null;
121
+ preview: boolean;
122
+ };
123
+ };
124
+ /** 运行时预填值(键=config.defaultValueSource),透传给 GenerateFormContainer(TASK-0115) */
125
+ prefillValues: {
126
+ type: ObjectConstructor;
127
+ default: () => {};
128
+ };
129
+ }>> & {
130
+ onChange?: ((...args: any[]) => any) | undefined;
131
+ onSubmit?: ((...args: any[]) => any) | undefined;
132
+ onCompleted?: ((...args: any[]) => any) | undefined;
133
+ }, {
134
+ prefillValues: Record<string, any>;
135
+ formConfig: Record<string, any>;
136
+ }, {}>;
137
+ export default _default;
@@ -0,0 +1,31 @@
1
+ /** Sortable.js 排序信息(sort-change 载荷,vuedraggable 无事件类型导出) */
2
+ interface DragMovedInfo {
3
+ newIndex?: number;
4
+ oldIndex?: number;
5
+ element?: unknown;
6
+ }
7
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
8
+ /** 是否处于设计器全屏态(由父组件经 Fullscreen API 同步) */
9
+ fullscreen?: boolean;
10
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
+ "sort-change": (value: DragMovedInfo) => void;
12
+ "toggle-fullscreen": () => void;
13
+ clear: () => void;
14
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
15
+ /** 是否处于设计器全屏态(由父组件经 Fullscreen API 同步) */
16
+ fullscreen?: boolean;
17
+ }>>> & {
18
+ onClear?: (() => any) | undefined;
19
+ "onSort-change"?: ((value: DragMovedInfo) => any) | undefined;
20
+ "onToggle-fullscreen"?: (() => any) | undefined;
21
+ }, {}, {}>;
22
+ export default _default;
23
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
24
+ type __VLS_TypePropsToOption<T> = {
25
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
26
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
27
+ } : {
28
+ type: import('vue').PropType<T[K]>;
29
+ required: true;
30
+ };
31
+ };
@@ -0,0 +1,36 @@
1
+ interface OptionItem {
2
+ label: string;
3
+ value: string | number;
4
+ }
5
+ interface FormField {
6
+ type?: string;
7
+ config: {
8
+ tag?: string;
9
+ defaultValue?: unknown;
10
+ defaultNowTime?: boolean;
11
+ options?: OptionItem[];
12
+ [key: string]: unknown;
13
+ };
14
+ [key: string]: unknown;
15
+ }
16
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
17
+ open: boolean;
18
+ field: FormField | null;
19
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
+ "update:open": (value: boolean) => void;
21
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
22
+ open: boolean;
23
+ field: FormField | null;
24
+ }>>> & {
25
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
26
+ }, {}, {}>;
27
+ export default _default;
28
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
29
+ type __VLS_TypePropsToOption<T> = {
30
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
31
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
32
+ } : {
33
+ type: import('vue').PropType<T[K]>;
34
+ required: true;
35
+ };
36
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{}>>, {}, {}>;
2
+ export default _default;
@@ -0,0 +1,53 @@
1
+ import { FormFieldConfig, MatrixTable, SelectOption } from '../../types/form';
2
+ /** 预览消费的 config:在 FormFieldConfig 基础上显式声明面板写入的额外开关 */
3
+ interface PreviewFieldConfig extends FormFieldConfig {
4
+ showWordLimit?: boolean;
5
+ showOther?: boolean;
6
+ inline?: boolean;
7
+ buttonText?: string;
8
+ }
9
+ /** 画布预览消费的字段形状(FormField 顶层扩展属性为 unknown,此处按实际消费声明) */
10
+ interface PreviewField {
11
+ placeholder?: string;
12
+ style?: Record<string, string>;
13
+ clearable?: boolean;
14
+ maxlength?: number;
15
+ showWordLimit?: boolean;
16
+ min?: number;
17
+ max?: number;
18
+ step?: number;
19
+ precision?: number;
20
+ autosize?: boolean | {
21
+ minRows: number;
22
+ maxRows: number;
23
+ };
24
+ format?: string;
25
+ allowHalf?: boolean;
26
+ multiple?: boolean;
27
+ orientation?: 'left' | 'right' | 'center';
28
+ content?: string;
29
+ sortList?: SelectOption[];
30
+ table?: MatrixTable;
31
+ textConfig?: {
32
+ prevBtnText?: string;
33
+ nextBtnText?: string;
34
+ };
35
+ tag?: string;
36
+ type?: string;
37
+ config?: PreviewFieldConfig;
38
+ }
39
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
40
+ field: PreviewField;
41
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
42
+ field: PreviewField;
43
+ }>>>, {}, {}>;
44
+ export default _default;
45
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
46
+ type __VLS_TypePropsToOption<T> = {
47
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
48
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
49
+ } : {
50
+ type: import('vue').PropType<T[K]>;
51
+ required: true;
52
+ };
53
+ };
@@ -0,0 +1,26 @@
1
+ import { FormField } from '../../types/form';
2
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
3
+ field: FormField;
4
+ active?: boolean;
5
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
+ delete: () => void;
7
+ select: () => void;
8
+ copy: () => void;
9
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
10
+ field: FormField;
11
+ active?: boolean;
12
+ }>>> & {
13
+ onCopy?: (() => any) | undefined;
14
+ onSelect?: (() => any) | undefined;
15
+ onDelete?: (() => any) | undefined;
16
+ }, {}, {}>;
17
+ export default _default;
18
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
19
+ type __VLS_TypePropsToOption<T> = {
20
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
21
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
22
+ } : {
23
+ type: import('vue').PropType<T[K]>;
24
+ required: true;
25
+ };
26
+ };
@@ -0,0 +1,23 @@
1
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
2
+ open: boolean;
3
+ formKey: string;
4
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
5
+ "update:open": (value: boolean) => void;
6
+ success: () => void;
7
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
8
+ open: boolean;
9
+ formKey: string;
10
+ }>>> & {
11
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
12
+ onSuccess?: (() => any) | undefined;
13
+ }, {}, {}>;
14
+ export default _default;
15
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
16
+ type __VLS_TypePropsToOption<T> = {
17
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
18
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
19
+ } : {
20
+ type: import('vue').PropType<T[K]>;
21
+ required: true;
22
+ };
23
+ };
@@ -0,0 +1,21 @@
1
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
2
+ /** 当前问卷 key,导入题目批量创建时使用 */
3
+ formKey: string;
4
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
5
+ "import-success": () => void;
6
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
7
+ /** 当前问卷 key,导入题目批量创建时使用 */
8
+ formKey: string;
9
+ }>>> & {
10
+ "onImport-success"?: (() => any) | undefined;
11
+ }, {}, {}>;
12
+ export default _default;
13
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
+ type __VLS_TypePropsToOption<T> = {
15
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
16
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
+ } : {
18
+ type: import('vue').PropType<T[K]>;
19
+ required: true;
20
+ };
21
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{}>>, {}, {}>;
2
+ export default _default;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 默认值设置弹窗的题型分派与预览格式化(task-0032/feat-0047)。
3
+ * 渲染侧 GenerateForm initFormData 已消费 config.defaultValue,无需改动。
4
+ */
5
+ export type DefaultValueMode = 'text' | 'number' | 'date' | 'choice';
6
+ /** 支持设置默认值的题型(tag → 分派模式);未列出的题型不支持 */
7
+ export declare const tagModeMap: Record<string, DefaultValueMode>;
8
+ export declare function isDefaultValueSupported(tag?: string): boolean;
9
+ /** 选项节点(含级联 children,宽松取字段) */
10
+ interface OptionNode {
11
+ label?: unknown;
12
+ value?: unknown;
13
+ children?: OptionNode[];
14
+ }
15
+ /**
16
+ * 默认值在面板按钮旁的预览文案(数组顿号连接,空值返回空串)。
17
+ * choice 类题型按选项表把 value 映射为选项名显示(bug-0054),查不到回落原值;
18
+ * 其余模式(text/number/date)原样显示。
19
+ */
20
+ export declare function formatDefaultValuePreview(value: unknown, tag?: string, options?: OptionNode[]): string;
21
+ export {};
@@ -0,0 +1,15 @@
1
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<{
2
+ formKey?: string;
3
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<{
4
+ formKey?: string;
5
+ }>>>, {}, {}>;
6
+ export default _default;
7
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
+ type __VLS_TypePropsToOption<T> = {
9
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
10
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
+ } : {
12
+ type: import('vue').PropType<T[K]>;
13
+ required: true;
14
+ };
15
+ };
@@ -0,0 +1,4 @@
1
+ import { Component } from 'vue';
2
+ declare const components: Record<string, Component>;
3
+ export declare function getComponents(): Record<string, Component>;
4
+ export default components;
@@ -0,0 +1,3 @@
1
+ declare const components: Record<string, unknown>;
2
+ export declare function getConfigComponents(): Record<string, unknown>;
3
+ export default components;