@formily-design/formily-antd 1.0.0 → 1.0.2

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 (66) hide show
  1. package/package.json +8 -8
  2. package/.umirc.js +0 -44
  3. package/copy.ts +0 -6
  4. package/playground/components/AsyncSelect/AsyncSelect.tsx +0 -38
  5. package/playground/components/AsyncSelect/index.tsx +0 -1
  6. package/playground/components/AsyncSelect/preview.tsx +0 -36
  7. package/playground/components/ClickEventSetter/ActionConfigModal.tsx +0 -173
  8. package/playground/components/ClickEventSetter/ActionList.tsx +0 -67
  9. package/playground/components/ClickEventSetter/DownloadPanel.tsx +0 -24
  10. package/playground/components/ClickEventSetter/NavigationPanel.tsx +0 -42
  11. package/playground/components/ClickEventSetter/RequestPanel.tsx +0 -190
  12. package/playground/components/ClickEventSetter/index.tsx +0 -90
  13. package/playground/components/ClickEventSetter/styles.less +0 -89
  14. package/playground/components/ClickEventSetter/types.ts +0 -43
  15. package/playground/components/FormButton/FormButton.tsx +0 -189
  16. package/playground/components/FormButton/hooks/useEventActionExecutor.ts +0 -65
  17. package/playground/components/FormButton/index.ts +0 -1
  18. package/playground/components/FormButton/preview.tsx +0 -60
  19. package/playground/components/FormButton/utils/actionExecutors.ts +0 -96
  20. package/playground/components/FormButtonGroup/FormButtonGroup.tsx +0 -21
  21. package/playground/components/FormButtonGroup/index.ts +0 -1
  22. package/playground/components/FormButtonGroup/preview.tsx +0 -66
  23. package/playground/components/FormList/FormList.tsx +0 -164
  24. package/playground/components/FormList/index.tsx +0 -1
  25. package/playground/components/FormList/preview.tsx +0 -429
  26. package/playground/components/LocationPicker/LocationModal.tsx +0 -328
  27. package/playground/components/LocationPicker/LocationPicker.tsx +0 -163
  28. package/playground/components/LocationPicker/SearchBox.tsx +0 -122
  29. package/playground/components/LocationPicker/api.ts +0 -77
  30. package/playground/components/LocationPicker/constants.ts +0 -2
  31. package/playground/components/LocationPicker/index.tsx +0 -44
  32. package/playground/components/LocationPicker/types.ts +0 -160
  33. package/playground/components/LocationPicker/utils.ts +0 -46
  34. package/playground/components/ResourceIcon/index.module.less +0 -10
  35. package/playground/components/ResourceIcon/index.tsx +0 -10
  36. package/playground/designerLocales/en-US.ts +0 -38
  37. package/playground/designerLocales/index.ts +0 -6
  38. package/playground/designerLocales/ko-KR.ts +0 -10
  39. package/playground/designerLocales/zh-CN.ts +0 -38
  40. package/playground/locales/FormButton.ts +0 -38
  41. package/playground/locales/FormButtonGroup.ts +0 -29
  42. package/playground/locales/LocationPicker.ts +0 -30
  43. package/playground/locales/all.ts +0 -3
  44. package/playground/locales/index.ts +0 -3
  45. package/playground/main.tsx +0 -222
  46. package/playground/react-app-env.d.ts +0 -4
  47. package/playground/request.ts +0 -123
  48. package/playground/schemas/FormButton.ts +0 -42
  49. package/playground/schemas/FormButtonGroup.ts +0 -24
  50. package/playground/schemas/LocationPicker.ts +0 -14
  51. package/playground/schemas/all.ts +0 -3
  52. package/playground/schemas/index.ts +0 -3
  53. package/playground/service/index.ts +0 -1
  54. package/playground/service/schema.ts +0 -22
  55. package/playground/template.ejs +0 -20
  56. package/playground/utils.ts +0 -744
  57. package/playground/webpack.base.ts +0 -123
  58. package/playground/webpack.dev.ts +0 -64
  59. package/playground/webpack.prod.ts +0 -46
  60. package/playground/widgets/ActionsWidget.tsx +0 -58
  61. package/playground/widgets/LogoWidget.tsx +0 -20
  62. package/playground/widgets/MarkupSchemaWidget.tsx +0 -164
  63. package/playground/widgets/PreviewWidget.tsx +0 -188
  64. package/playground/widgets/SchemaEditorWidget.tsx +0 -27
  65. package/playground/widgets/index.ts +0 -5
  66. package/tsconfig.build.json +0 -12
@@ -1,44 +0,0 @@
1
- import React from 'react'
2
- import { createBehavior, createResource } from '@formily-design/core'
3
- import { DnFC } from '@formily-design/react'
4
- import { LocationPicker as LocationPickerComponent } from './LocationPicker'
5
- import { createFieldSchema } from '@formily-design/formily-antd'
6
- import { CustomLocales } from '../../locales'
7
- import { CustomSchemas } from '../../schemas'
8
- import { EnvironmentOutlined } from '@ant-design/icons'
9
- import { ResourceIcon } from '../ResourceIcon'
10
-
11
- export const LocationPicker: DnFC<
12
- React.ComponentProps<typeof LocationPickerComponent>
13
- > = LocationPickerComponent
14
-
15
- LocationPicker.Behavior = createBehavior({
16
- name: 'LocationPicker',
17
- extends: ['Field'],
18
- selector: (node) => node.props?.['x-component'] === 'LocationPicker',
19
- designerProps: {
20
- propsSchema: createFieldSchema(CustomSchemas.LocationPicker),
21
- },
22
- designerLocales: CustomLocales.LocationPicker,
23
- })
24
-
25
- LocationPicker.Resource = createResource({
26
- icon: (
27
- <ResourceIcon>
28
- <EnvironmentOutlined />
29
- </ResourceIcon>
30
- ),
31
- elements: [
32
- {
33
- componentName: 'Field',
34
- props: {
35
- title: 'LocationPicker',
36
- 'x-decorator': 'FormItem',
37
- 'x-component': 'LocationPicker',
38
- 'x-component-props': {
39
- placeholder: '请选择位置',
40
- },
41
- },
42
- },
43
- ],
44
- })
@@ -1,160 +0,0 @@
1
- import { InputProps } from 'antd'
2
-
3
- /**
4
- * 位置值类型
5
- */
6
- export interface LocationValue {
7
- /** 完整地址 */
8
- address: string
9
- /** 纬度 */
10
- lat: number
11
- /** 经度 */
12
- lng: number
13
- /** 地名(可选) */
14
- name?: string
15
- /** 省级编码(可选) */
16
- provinceCode: string
17
- /** 省级名称(可选) */
18
- provinceName: string
19
- /** 市级编码(可选) */
20
- cityCode: string
21
- /** 市级名称(可选) */
22
- cityName: string
23
- /** 区级编码(可选) */
24
- districtCode: string
25
- /** 区级名称(可选) */
26
- districtName: string
27
- }
28
-
29
- /**
30
- * 位置选择器属性类型
31
- */
32
- export interface LocationPickerProps
33
- extends Omit<InputProps, 'value' | 'onChange'> {
34
- /** 值-具体数据类型会根据 fieldNames 进行转换 */
35
- value?: Record<string, any>
36
- /** 值变化回调-具体数据类型会根据 fieldNames 进行转换 */
37
- onChange?: (value: Record<string, any>) => void
38
- /** 地图容器 ID 前缀(用于支持多个地图实例) */
39
- mapId?: string
40
- /** 是否只读 */
41
- readOnly?: boolean
42
- /** 业务字段和组件值的映射 */
43
- fieldNames?: {
44
- address?: string
45
- lat?: string
46
- lng?: string
47
- provinceCode?: string
48
- provinceName?: string
49
- cityCode?: string
50
- cityName?: string
51
- districtCode?: string
52
- districtName?: string
53
- name?: string
54
- }
55
- /** 地图 API Key */
56
- mapApiKey: string
57
- }
58
-
59
- /**
60
- * 搜索结果类型
61
- */
62
- export interface SearchResult {
63
- /** 标题 */
64
- title: string
65
- /** 地址 */
66
- address: string
67
- /** 纬度 */
68
- lat: number
69
- /** 经度 */
70
- lng: number
71
- /** 类别 */
72
- category?: string
73
- /** 行政区划编码 */
74
- adcode: number
75
- /** 省份名称 */
76
- province: string
77
- /** 城市名称 */
78
- city: string
79
- /** 区县名称 */
80
- district: string
81
- }
82
-
83
- /**
84
- * 地图实例类型(腾讯地图)
85
- */
86
- export interface TencentMap {
87
- center: new (point: { lat: number; lng: number }) => void
88
- setCenter: (point: { lat: number; lng: number }) => void
89
- addEventListener: (event: string, callback: (e: any) => void) => void
90
- removeEventListener: (event: string, callback: (e: any) => void) => void
91
- clearOverlays: () => void
92
- addOverlay: (overlay: any) => void
93
- getCenter: () => { lat: number; lng: number }
94
- }
95
-
96
- /**
97
- * 标记点类型
98
- */
99
- export interface MapMarker {
100
- setPosition: (point: { lat: number; lng: number }) => void
101
- setTitle: (title: string) => void
102
- addEventListener: (event: string, callback: (e: any) => void) => void
103
- remove: () => void
104
- }
105
-
106
- /** 地图服务响应类型 */
107
- export interface MapServiceResponse {
108
- status: number
109
- message?: string
110
- request_id?: string
111
- }
112
-
113
- /** 地址解析结果 */
114
- export interface GeocoderResponse extends MapServiceResponse {
115
- result: {
116
- location: Record<string, any>
117
- address: string
118
- address_component: Record<string, any>
119
- ad_info: Record<string, any>
120
- address_reference: Record<string, any>
121
- }
122
- }
123
-
124
- /** 地图定位结果 */
125
- export interface MapLocationResponse extends MapServiceResponse {
126
- result: {
127
- ip: string
128
- location: {
129
- lat: number
130
- lng: number
131
- }
132
- ad_info: {
133
- province: string
134
- city: string
135
- district: string
136
- adcode: number
137
- nation: string
138
- nation_code: number
139
- }
140
- }
141
- }
142
-
143
- /** 关键词输入提示结果数据 */
144
- export interface SuggestionResponse {
145
- count: number
146
- request_id: string
147
- data: {
148
- adcode: number
149
- address: string
150
- category: string
151
- city: string
152
- district: string
153
- id: string
154
- location: { lat: number; lng: number }
155
- province: string
156
- title: string
157
- type: number
158
- }[]
159
- status: number
160
- }
@@ -1,46 +0,0 @@
1
- import jsonp from 'jsonp'
2
- import { MapServiceResponse } from './types'
3
-
4
- /** 地图服务请求方法 */
5
- export function fetchMapService<T extends MapServiceResponse>(
6
- url: string
7
- ): Promise<T> {
8
- return new Promise<T>((resolve, reject) => {
9
- try {
10
- // 使用jsonp请求
11
- jsonp(url, {}, (err, data: T) => {
12
- if (err) {
13
- console.error('获取地址失败:', err)
14
- reject(err)
15
- }
16
- if (data.status === 0) {
17
- resolve(data)
18
- }
19
- })
20
- } catch (error) {
21
- reject(error)
22
- console.error('获取地址失败:', error)
23
- }
24
- })
25
- }
26
-
27
- /**
28
- * 通过 adcode 解析省市区编码
29
- * adcode 编码结构:
30
- * 省代码:前两位。
31
- * 市/地区代码:前4位。
32
- * 区县代码:6位全有值
33
- */
34
- export function parseAdcode(adcode: string): {
35
- provinceCode: string
36
- cityCode: string
37
- districtCode: string
38
- } {
39
- if (!adcode || adcode.length !== 6) {
40
- return { provinceCode: '', cityCode: '', districtCode: '' }
41
- }
42
- const province = adcode.slice(0, 2) + '0000'
43
- const city = adcode.slice(0, 4) + '00'
44
- const district = adcode
45
- return { provinceCode: province, cityCode: city, districtCode: district }
46
- }
@@ -1,10 +0,0 @@
1
- .resourceIcon {
2
- display: flex;
3
- justify-content: center;
4
- width: 150px;
5
- height: 40px;
6
- margin: 12px 0;
7
- font-size: 32px;
8
- // color: var(--dn-brand-color);
9
- color: rgb(153, 153, 153);
10
- }
@@ -1,10 +0,0 @@
1
- import React from 'react'
2
- import styles from './index.module.less'
3
- interface ResourceIconProps {
4
- children: React.ReactNode
5
- }
6
-
7
- /** 资源图标容器组件 */
8
- export function ResourceIcon({ children }: ResourceIconProps) {
9
- return <div className={styles.resourceIcon}>{children}</div>
10
- }
@@ -1,38 +0,0 @@
1
- export default {
2
- 'en-US': {
3
- sources: {
4
- Inputs: 'Inputs',
5
- Layouts: 'Layouts',
6
- Arrays: 'Arrays',
7
- Displays: 'Displays',
8
- },
9
- SettingComponents: {
10
- ClickEventSetter: {
11
- configureEvents: 'Configure Click Event',
12
- edit: 'Edit',
13
- delete: 'Delete',
14
- basicConfig: 'Basic Config',
15
- actionType: 'Action Type',
16
- description: 'Description',
17
- descriptionPlaceholder: 'Please enter action description (optional)',
18
- actionConfig: 'Action Config',
19
- request: 'Request',
20
- navigation: 'Navigation',
21
- download: 'Download',
22
- cancel: 'Cancel',
23
- confirm: 'Confirm',
24
- url: 'URL',
25
- openMode: 'Open Mode',
26
- currentWindow: 'Current Window',
27
- newWindow: 'New Window',
28
- downloadUrl: 'Download URL',
29
- successMessage: 'Success Message',
30
- successMessagePlaceholder: 'Please enter success message (optional)',
31
- fieldMapping: 'Field Mapping',
32
- paramKey: 'Parameter Key',
33
- formField: 'Form Field',
34
- addMapping: 'Add Mapping',
35
- },
36
- },
37
- },
38
- }
@@ -1,6 +0,0 @@
1
- import { GlobalRegistry } from '@formily-design/core'
2
- import zhCN from './zh-CN'
3
- import enUS from './en-US'
4
- import koKR from './ko-KR'
5
-
6
- GlobalRegistry.registerDesignerLocales(zhCN, enUS, koKR)
@@ -1,10 +0,0 @@
1
- export default {
2
- 'ko-KR': {
3
- sources: {
4
- Inputs: '입력',
5
- Layouts: '레이아웃',
6
- Arrays: '배열',
7
- Displays: '디스플레이',
8
- },
9
- },
10
- }
@@ -1,38 +0,0 @@
1
- export default {
2
- 'zh-CN': {
3
- sources: {
4
- Inputs: '输入控件',
5
- Layouts: '布局组件',
6
- Arrays: '自增组件',
7
- Displays: '展示组件',
8
- },
9
- SettingComponents: {
10
- ClickEventSetter: {
11
- configureEvents: '配置点击事件',
12
- edit: '编辑',
13
- delete: '删除',
14
- basicConfig: '基本配置',
15
- actionType: '动作类型',
16
- description: '动作描述',
17
- descriptionPlaceholder: '请输入动作描述(可选)',
18
- actionConfig: '动作配置',
19
- request: '服务请求',
20
- navigation: '页面跳转',
21
- download: '下载文件',
22
- cancel: '取消',
23
- confirm: '确定',
24
- url: '跳转地址',
25
- openMode: '打开方式',
26
- currentWindow: '当前窗口',
27
- newWindow: '新窗口',
28
- downloadUrl: '下载地址',
29
- successMessage: '成功提示',
30
- successMessagePlaceholder: '请输入成功提示文案(可选)',
31
- fieldMapping: '字段映射',
32
- paramKey: '参数名',
33
- formField: '表单字段',
34
- addMapping: '添加映射',
35
- },
36
- },
37
- },
38
- }
@@ -1,38 +0,0 @@
1
- export const FormButton = {
2
- 'zh-CN': {
3
- title: '表单按钮',
4
- settings: {
5
- 'x-component-props': {
6
- title: '按钮标题',
7
- type: '按钮类型',
8
- htmlType: '原生类型',
9
- noValidate: '不校验',
10
- },
11
- 'event-group': '事件',
12
- },
13
- },
14
- 'en-US': {
15
- title: 'Form Button',
16
- settings: {
17
- 'x-component-props': {
18
- title: 'Button Title',
19
- type: 'Button Type',
20
- htmlType: 'Native Type',
21
- noValidate: 'No Validate',
22
- },
23
- 'event-group': 'Event',
24
- },
25
- },
26
- 'ko-KR': {
27
- title: '폼 버튼',
28
- settings: {
29
- 'x-component-props': {
30
- title: '버튼 제목',
31
- type: '버튼 타입',
32
- htmlType: '기본 타입',
33
- noValidate: '불 검사',
34
- },
35
- 'event-group': '이벤트',
36
- },
37
- },
38
- }
@@ -1,29 +0,0 @@
1
- export const FormButtonGroup = {
2
- 'zh-CN': {
3
- title: '表单按钮组',
4
- settings: {
5
- 'x-component-props': {
6
- gutter: '间距大小',
7
- align: '对齐方式',
8
- },
9
- },
10
- },
11
- 'en-US': {
12
- title: 'Form Button Group',
13
- settings: {
14
- 'x-component-props': {
15
- gutter: 'Gutter',
16
- align: 'Align',
17
- },
18
- },
19
- },
20
- 'ko-KR': {
21
- title: '폼 버튼 그룹',
22
- settings: {
23
- 'x-component-props': {
24
- gutter: '간격',
25
- align: '정렬',
26
- },
27
- },
28
- },
29
- }
@@ -1,30 +0,0 @@
1
- import { createLocales } from '@formily-design/core'
2
- import { AllLocales } from '@formily-design/formily-antd'
3
-
4
- export const LocationPicker = createLocales(AllLocales.Input, {
5
- 'zh-CN': {
6
- title: '位置选择器',
7
- settings: {
8
- 'x-component-props': {
9
- mapApiKey: '地图API Key',
10
- },
11
- },
12
- },
13
- 'en-US': {
14
- title: 'Location Picker',
15
- settings: {
16
- 'x-component-props': {
17
- mapApiKey: 'Map API Key',
18
- },
19
- },
20
- },
21
-
22
- 'ko-KR': {
23
- title: '위치 선택기',
24
- settings: {
25
- 'x-component-props': {
26
- mapApiKey: 'Map API Key',
27
- },
28
- },
29
- },
30
- })
@@ -1,3 +0,0 @@
1
- export * from './FormButtonGroup'
2
- export * from './FormButton'
3
- export * from './LocationPicker'
@@ -1,3 +0,0 @@
1
- import * as CustomLocales from './all'
2
-
3
- export { CustomLocales }