@formily-djd/component 0.0.1

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/dist/index.css ADDED
@@ -0,0 +1,178 @@
1
+ .custom-comp.grid,.custom-comp .grid{display:grid}.custom-comp.inline,.custom-comp .inline{display:inline}.custom-comp.inline-block,.custom-comp .inline-block{display:inline-block}.custom-comp.flex,.custom-comp .flex{display:flex}.custom-comp.inline-flex,.custom-comp .inline-flex{display:inline-flex}.custom-comp.flex-shrink,.custom-comp .flex-shrink{flex-shrink:1}.custom-comp.border,.custom-comp .border{border-width:1px}.custom-comp.px,.custom-comp .px{padding-left:1rem;padding-right:1rem}.custom-comp.transition,.custom-comp .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}
2
+
3
+ .formily-array[data-v-199a477c] {
4
+ box-sizing: border-box;
5
+ width: 100%;
6
+ border: 1px solid #dcdfe6;
7
+ border-radius: 4px;
8
+ padding: 16px;
9
+ background: #fafafa;
10
+ }
11
+ .array-header[data-v-199a477c] {
12
+ display: flex;
13
+ justify-content: space-between;
14
+ align-items: center;
15
+ margin-bottom: 12px;
16
+ }
17
+ .array-title[data-v-199a477c] {
18
+ font-size: 14px;
19
+ font-weight: 600;
20
+ color: #303133;
21
+ }
22
+ .array-actions[data-v-199a477c] {
23
+ display: flex;
24
+ gap: 8px;
25
+ }
26
+ .array-content[data-v-199a477c] {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 12px;
30
+ }
31
+
32
+
33
+ .formily-array-item[data-v-189fa67a] {
34
+ width: 100%;
35
+ border: 1px solid #e4e7ed;
36
+ border-radius: 4px;
37
+ background: #ffffff;
38
+ transition: all 0.2s;
39
+ }
40
+ .formily-array-item[data-v-189fa67a]:hover {
41
+ border-color: #409eff;
42
+ box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1);
43
+ }
44
+ .array-item-header[data-v-189fa67a] {
45
+ display: flex;
46
+ justify-content: space-between;
47
+ align-items: center;
48
+ padding: 8px 12px;
49
+ background: #f5f7fa;
50
+ border-bottom: 1px solid #e4e7ed;
51
+ border-radius: 4px 4px 0 0;
52
+ }
53
+ .array-item-index[data-v-189fa67a] {
54
+ font-size: 13px;
55
+ font-weight: 600;
56
+ color: #606266;
57
+ }
58
+ .array-item-actions[data-v-189fa67a] {
59
+ display: flex;
60
+ gap: 4px;
61
+ }
62
+ .array-item-content[data-v-189fa67a] {
63
+ padding: 12px;
64
+ }
65
+
66
+
67
+ .formily-form-item[data-v-9b086206] {
68
+ display: flex;
69
+ width: 100%;
70
+ box-sizing: border-box;
71
+ }
72
+
73
+ /* Inline 布局 */
74
+ .formily-form-item--inline[data-v-9b086206] {
75
+ flex-direction: row;
76
+ align-items: center;
77
+ gap: 12px;
78
+ }
79
+
80
+ /* Vertical 布局 */
81
+ .formily-form-item--vertical[data-v-9b086206] {
82
+ flex-direction: column;
83
+ align-items: flex-start;
84
+ gap: 8px;
85
+ }
86
+
87
+ /* Label 样式 */
88
+ .formily-form-item__label[data-v-9b086206] {
89
+ display: inline-flex;
90
+ align-items: center;
91
+ gap: 4px;
92
+ color: var(--el-text-color-regular);
93
+ font-size: 14px;
94
+ line-height: 32px;
95
+ white-space: nowrap;
96
+ flex-shrink: 0;
97
+ }
98
+ .formily-form-item--inline .formily-form-item__label[data-v-9b086206] {
99
+ min-width: 80px;
100
+ }
101
+ .formily-form-item--vertical .formily-form-item__label[data-v-9b086206] {
102
+ text-align: left;
103
+ line-height: 24px;
104
+ }
105
+
106
+ /* 必填标记 */
107
+ .formily-form-item__required[data-v-9b086206] {
108
+ color: var(--el-color-danger);
109
+ margin-right: 4px;
110
+ }
111
+
112
+ /* Label 文本 */
113
+ .formily-form-item__label-text[data-v-9b086206] {
114
+ flex-shrink: 0;
115
+ }
116
+
117
+ /* Tooltip 图标 */
118
+ .formily-form-item__tooltip[data-v-9b086206] {
119
+ color: var(--el-text-color-secondary);
120
+ cursor: help;
121
+ font-size: 14px;
122
+ flex-shrink: 0;
123
+ }
124
+ .formily-form-item__tooltip[data-v-9b086206]:hover {
125
+ color: var(--el-color-primary);
126
+ }
127
+
128
+ /* Content 区域 */
129
+ .formily-form-item__content[data-v-9b086206] {
130
+ flex: 1;
131
+ min-width: 0;
132
+ }
133
+ .formily-form-item--vertical .formily-form-item__content[data-v-9b086206] {
134
+ width: 100%;
135
+ }
136
+
137
+ /* 响应式:小屏幕自动切换为 vertical */
138
+ @media (max-width: 768px) {
139
+ .formily-form-item--inline[data-v-9b086206] {
140
+ flex-direction: column;
141
+ align-items: flex-start;
142
+ gap: 8px;
143
+ }
144
+ .formily-form-item--inline .formily-form-item__label[data-v-9b086206] {
145
+ text-align: left;
146
+ }
147
+ }
148
+
149
+
150
+ .formily-divider[data-v-d0d9b7c7] {
151
+ border: 0;
152
+ border-top: 1px solid #e5e7eb;
153
+ margin: 16px 0;
154
+ }
155
+ .divider-horizontal[data-v-d0d9b7c7] {
156
+ width: 100%;
157
+ height: 0;
158
+ }
159
+ .divider-vertical[data-v-d0d9b7c7] {
160
+ width: 0;
161
+ height: 100%;
162
+ border-top: 0;
163
+ border-left: 1px solid #e5e7eb;
164
+ margin: 0 16px;
165
+ display: inline-block;
166
+ }
167
+ .divider-dashed[data-v-d0d9b7c7] {
168
+ border-style: dashed;
169
+ }
170
+
171
+
172
+ .formily-grid[data-v-3e87dffd] {
173
+ width: 100%;
174
+ }
175
+
176
+
177
+ /* 组件特定样式可以在这里添加 */
178
+
@@ -0,0 +1,34 @@
1
+ import { Component } from "vue";
2
+ import { ISchema } from "@formily/vue";
3
+
4
+ //#region src/types.d.ts
5
+ interface ComponentConfig {
6
+ name: string;
7
+ icon?: string;
8
+ category?: string;
9
+ description?: string;
10
+ hidden?: boolean;
11
+ }
12
+ interface FormilyComponent {
13
+ component: Component;
14
+ setterSchema: ISchema;
15
+ config: ComponentConfig;
16
+ defaultSchema: ISchema;
17
+ }
18
+ //#endregion
19
+ //#region src/components/index.d.ts
20
+ declare const Input: FormilyComponent;
21
+ declare const Array: FormilyComponent;
22
+ declare const ArrayItem: FormilyComponent;
23
+ declare const Select: FormilyComponent;
24
+ declare const Checkbox: FormilyComponent;
25
+ declare const Radio: FormilyComponent;
26
+ declare const DatePicker: FormilyComponent;
27
+ declare const TextArea: FormilyComponent;
28
+ declare const Switch: FormilyComponent;
29
+ declare const InputNumber: FormilyComponent;
30
+ declare const Grid: FormilyComponent;
31
+ declare const Space: FormilyComponent;
32
+ declare const Divider: FormilyComponent;
33
+ //#endregion
34
+ export { Array, ArrayItem, Checkbox, DatePicker, Divider, type FormilyComponent, Grid, Input, InputNumber, Radio, Select, Space, Switch, TextArea };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{Fragment as e,computed as t,createBlock as n,createCommentVNode as r,createElementBlock as i,createElementVNode as a,createTextVNode as o,createVNode as s,defineComponent as c,normalizeClass as l,normalizeStyle as u,openBlock as d,renderList as f,renderSlot as p,resolveComponent as m,toDisplayString as h,unref as g,withCtx as _}from"vue";import{ElTooltip as v}from"element-plus";import{QuestionFilled as y}from"@element-plus/icons-vue";var b={type:`object`,properties:{minItems:{type:`number`,title:`最少项数`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`minItems`,"x-component-props":{min:0}},maxItems:{type:`number`,title:`最多项数`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`maxItems`,"x-component-props":{min:0}}}},x=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};const ee={class:`formily-array`},S={class:`array-header`},C={key:0,class:`array-title`},w={class:`array-actions`},T={class:`array-content`};var E={component:x(c({name:`Array`,inheritAttrs:!1,__name:`ui`,props:{title:{},onAdd:{type:Function},onPush:{type:Function},onUnshift:{type:Function}},setup(e){let t=e;return(e,n)=>{let c=m(`ElButton`);return d(),i(`div`,ee,[a(`div`,S,[t.title?(d(),i(`div`,C,h(t.title),1)):r(``,!0),a(`div`,w,[s(c,{type:`primary`,size:`small`,onClick:t.onAdd},{default:_(()=>[...n[0]||=[o(` 添加到末尾 `,-1)]]),_:1},8,[`onClick`]),s(c,{size:`small`,onClick:t.onUnshift},{default:_(()=>[...n[1]||=[o(` 添加到开头 `,-1)]]),_:1},8,[`onClick`])])]),a(`div`,T,[p(e.$slots,`default`,{},void 0,!0)])])}}}),[[`__scopeId`,`data-v-199a477c`]]),setterSchema:b,config:{name:`数组容器`,icon:`Grid`,category:`容器`,description:`数组字段容器`},defaultSchema:{type:`array`,title:`数组容器`,"x-component":`Array`,"x-decorator":`FormItem`,items:{type:`object`,"x-component":`ArrayItem`,properties:{}}}},D={type:`object`,properties:{}};const O={class:`formily-array-item`},k={class:`array-item-header`},A={class:`array-item-index`},j={class:`array-item-actions`},M={class:`array-item-content`};var N={component:x(c({name:`ArrayItem`,inheritAttrs:!1,__name:`ui`,props:{arrayIndex:{},onAdd:{type:Function},onRemove:{type:Function},onMoveUp:{type:Function},onMoveDown:{type:Function}},setup(e){let t=e;return(e,n)=>{let r=m(`ElButton`);return d(),i(`div`,O,[a(`div`,k,[a(`div`,A,` # `+h((t.arrayIndex??0)+1),1),a(`div`,j,[s(r,{text:``,type:`primary`,size:`small`,onClick:t.onAdd},{default:_(()=>[...n[3]||=[o(` 添加 `,-1)]]),_:1},8,[`onClick`]),s(r,{text:``,size:`small`,onClick:n[0]||=()=>t.onMoveUp?.(t.arrayIndex)},{default:_(()=>[...n[4]||=[o(` 上移 `,-1)]]),_:1}),s(r,{text:``,size:`small`,onClick:n[1]||=()=>t.onMoveDown?.(t.arrayIndex)},{default:_(()=>[...n[5]||=[o(` 下移 `,-1)]]),_:1}),s(r,{text:``,type:`danger`,size:`small`,onClick:n[2]||=()=>t.onRemove?.(t.arrayIndex)},{default:_(()=>[...n[6]||=[o(` 删除 `,-1)]]),_:1})])]),a(`div`,M,[p(e.$slots,`default`,{},void 0,!0)])])}}}),[[`__scopeId`,`data-v-189fa67a`]]),setterSchema:D,config:{name:`数组项`,icon:`List`,category:`容器`,description:`数组项容器`,hidden:!0},defaultSchema:{type:`object`,"x-component":`ArrayItem`,"x-decorator":`FormItem`,properties:{}}};function P(){return{title:{type:`string`,title:`标题`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`title`},required:{type:`boolean`,title:`必填标记`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`required`,"x-component-props":{activeText:`显示`,inactiveText:`隐藏`}},tooltip:{type:`string`,title:`提示信息`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.tooltip`,"x-component-props":{placeholder:`鼠标悬停时显示的提示`}},labelWidth:{type:`string`,title:`标签宽度`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.labelWidth`,"x-component-props":{placeholder:`如: 100px, auto`}},layout:{type:`string`,title:`布局方式`,"x-component":`Radio.Group`,"x-decorator":`FormItem`,"x-path":`x-component-props.layout`,enum:[{label:`行内`,value:`inline`},{label:`垂直`,value:`vertical`}]},labelAlign:{type:`string`,title:`标签对齐`,"x-component":`Radio.Group`,"x-decorator":`FormItem`,"x-path":`x-component-props.labelAlign`,enum:[{label:`左对齐`,value:`left`},{label:`右对齐`,value:`right`}]}}}function F(e){let{placeholder:t=!0,clearable:n=!0,disabled:r=!0,readonly:i=!0}=e||{},a={};return t&&(a.placeholder={type:`string`,title:`占位符`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.placeholder`}),n&&(a.clearable={type:`boolean`,title:`可清空`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.clearable`}),r&&(a.disabled={type:`boolean`,title:`禁用`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.disabled`}),i&&(a.readonly={type:`boolean`,title:`只读`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.readonly`}),a}function I(){return{size:{type:`string`,title:`尺寸`,"x-component":`Radio.Group`,"x-decorator":`FormItem`,"x-path":`x-component-props.size`,enum:[{label:`大`,value:`large`},{label:`默认`,value:`default`},{label:`小`,value:`small`}]}}}function L(e,t){let{includeTitle:n=!0,includeInput:r=!0,includeSize:i=!1}=t||{},a={};if(n&&Object.assign(a,P()),r){let e=typeof r==`object`?r:void 0;Object.assign(a,F(e))}return i&&Object.assign(a,I()),Object.assign(a,e),{type:`object`,properties:a}}var R=L({min:{type:`number`,title:`最少选择数`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.min`,"x-component-props":{min:0}},max:{type:`number`,title:`最多选择数`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.max`,"x-component-props":{min:0}},options:{type:`array`,title:`选项列表`,"x-component":`ArrayItems`,"x-decorator":`FormItem`,"x-path":`enum`,items:{type:`object`,properties:{space:{type:`void`,"x-component":`Space`,properties:{sort:{type:`void`,"x-decorator":`FormItem`,"x-component":`ArrayItems.SortHandle`},label:{type:`string`,title:`标签`,"x-decorator":`FormItem`,"x-component":`Input`,"x-component-props":{placeholder:`显示文本`}},value:{type:`string`,title:`值`,"x-decorator":`FormItem`,"x-component":`Input`,"x-component-props":{placeholder:`选项值`}},remove:{type:`void`,"x-decorator":`FormItem`,"x-component":`ArrayItems.Remove`}}}}},properties:{add:{type:`void`,title:`添加选项`,"x-component":`ArrayItems.Addition`}}}},{includeTitle:!0,includeInput:{placeholder:!1,clearable:!1,disabled:!0,readonly:!1},includeSize:!1});const z={key:0,class:`formily-form-item__required`},B={class:`formily-form-item__label-text`},V={class:`formily-form-item__content`};var H=x(c({name:`FormItemLayout`,inheritAttrs:!1,__name:`FormItemLayout`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{default:`auto`},layout:{default:`inline`},labelAlign:{default:`right`}},setup(e){let o=e,c=t(()=>`formily-form-item--${o.layout}`),f=t(()=>({width:o.labelWidth,textAlign:o.labelAlign}));return(e,t)=>{let b=m(`el-icon`);return d(),i(`div`,{class:l([`formily-form-item`,c.value])},[o.title?(d(),i(`div`,{key:0,class:`formily-form-item__label`,style:u(f.value)},[o.required?(d(),i(`span`,z,`*`)):r(``,!0),a(`span`,B,h(o.title),1),o.tooltip?(d(),n(g(v),{key:1,content:o.tooltip,placement:`top`,effect:`dark`},{default:_(()=>[s(b,{class:`formily-form-item__tooltip`},{default:_(()=>[s(g(y))]),_:1})]),_:1},8,[`content`])):r(``,!0)],4)):r(``,!0),a(`div`,V,[p(e.$slots,`default`,{},void 0,!0)])],2)}}}),[[`__scopeId`,`data-v-9b086206`]]),U={component:c({name:`CheckboxComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{},onChange:{type:Function},options:{},min:{},max:{},disabled:{type:Boolean}},setup(e){let t=e;return(e,r)=>{let i=m(`ElCheckboxGroup`);return d(),n(H,{title:t.title,required:t.required,tooltip:t.tooltip,"label-width":t.labelWidth,layout:t.layout,"label-align":t.labelAlign},{default:_(()=>[s(i,{"model-value":t.value,options:t.options,min:t.min,max:t.max,disabled:t.disabled,"onUpdate:modelValue":t.onChange},null,8,[`model-value`,`options`,`min`,`max`,`disabled`,`onUpdate:modelValue`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),setterSchema:R,config:{name:`复选框`,icon:`Select`,category:`选择`,description:`多选控件`},defaultSchema:{type:`array`,title:`复选框`,"x-component":`Checkbox`,"x-decorator":`FormItem`,enum:[{label:`选项1`,value:`1`},{label:`选项2`,value:`2`},{label:`选项3`,value:`3`}]}},W=L({type:{type:`string`,title:`类型`,"x-component":`Select`,"x-decorator":`FormItem`,"x-path":`x-component-props.type`,enum:[{label:`日期`,value:`date`},{label:`日期时间`,value:`datetime`},{label:`日期范围`,value:`daterange`},{label:`日期时间范围`,value:`datetimerange`},{label:`年`,value:`year`},{label:`月`,value:`month`},{label:`周`,value:`week`}]},format:{type:`string`,title:`显示格式`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.format`,"x-component-props":{placeholder:`如: YYYY-MM-DD`}},valueFormat:{type:`string`,title:`值格式`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.valueFormat`,"x-component-props":{placeholder:`如: YYYY-MM-DD`}},editable:{type:`boolean`,title:`可输入`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.editable`}},{includeTitle:!0,includeInput:{placeholder:!0,clearable:!0,disabled:!0,readonly:!0},includeSize:!1}),G={component:c({name:`DatePickerComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{},onChange:{type:Function},placeholder:{},format:{},valueFormat:{},type:{},clearable:{type:Boolean},editable:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean}},setup(e){let t=e;return(e,r)=>{let i=m(`ElDatePicker`);return d(),n(H,{title:t.title,required:t.required,tooltip:t.tooltip,"label-width":t.labelWidth,layout:t.layout,"label-align":t.labelAlign},{default:_(()=>[s(i,{placeholder:t.placeholder,"model-value":t.value,format:t.format,"value-format":t.valueFormat,type:t.type||`date`,clearable:t.clearable,editable:t.editable,disabled:t.disabled,readonly:t.readonly,"onUpdate:modelValue":t.onChange},null,8,[`placeholder`,`model-value`,`format`,`value-format`,`type`,`clearable`,`editable`,`disabled`,`readonly`,`onUpdate:modelValue`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),setterSchema:W,config:{name:`日期选择器`,icon:`Calendar`,category:`基础`,description:`日期选择控件`},defaultSchema:{type:`string`,title:`日期选择器`,"x-component":`DatePicker`,"x-decorator":`FormItem`,"x-component-props":{placeholder:`请选择日期`}}},te={component:x(c({name:`Divider`,inheritAttrs:!1,__name:`ui`,props:{orientation:{},dashed:{type:Boolean}},setup(e){let t=e;return(e,n)=>(d(),i(`div`,{class:l([`formily-divider`,{"divider-horizontal":t.orientation===`horizontal`,"divider-vertical":t.orientation===`vertical`,"divider-dashed":t.dashed}])},null,2))}}),[[`__scopeId`,`data-v-d0d9b7c7`]]),setterSchema:{type:`object`,properties:{orientation:{type:`string`,title:`方向`,"x-component":`Radio.Group`,"x-decorator":`FormItem`,"x-path":`x-component-props.orientation`,enum:[{label:`水平`,value:`horizontal`},{label:`垂直`,value:`vertical`}]},dashed:{type:`boolean`,title:`虚线`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.dashed`}}},config:{name:`分割线`,icon:`Minus`,category:`布局`,description:`内容分割线`},defaultSchema:{type:`void`,title:`分割线`,"x-component":`Divider`,"x-droppable":!1,"x-component-props":{orientation:`horizontal`,dashed:!1}}},K={component:x(c({name:`Grid`,inheritAttrs:!1,__name:`ui`,props:{columns:{},rows:{},columnGap:{},rowGap:{}},setup(e){let t=e;return(e,n)=>(d(),i(`div`,{class:`formily-grid`,style:u({display:`grid`,gridTemplateColumns:`repeat(${t.columns||3}, 1fr)`,gridTemplateRows:t.rows===`auto`?`auto`:`repeat(${t.rows||`auto`}, 1fr)`,columnGap:`${t.columnGap||16}px`,rowGap:`${t.rowGap||16}px`})},[p(e.$slots,`default`,{},void 0,!0)],4))}}),[[`__scopeId`,`data-v-3e87dffd`]]),setterSchema:{type:`object`,properties:{columns:{type:`number`,title:`列数`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.columns`,"x-component-props":{min:1,max:12}},columnGap:{type:`number`,title:`列间距 (px)`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.columnGap`,"x-component-props":{min:0,max:100}},rowGap:{type:`number`,title:`行间距 (px)`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.rowGap`,"x-component-props":{min:0,max:100}}}},config:{name:`Grid 布局`,icon:`Grid`,category:`布局`,description:`Grid 网格布局容器`},defaultSchema:{type:`void`,title:`Grid 容器`,"x-component":`Grid`,"x-component-props":{columns:3,rows:`auto`,columnGap:16,rowGap:16},properties:{}}},q=L({maxlength:{type:`number`,title:`最大长度`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.maxlength`,"x-component-props":{min:0}},showWordLimit:{type:`boolean`,title:`显示字数`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.showWordLimit`},prefixIcon:{type:`string`,title:`前缀图标`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.prefixIcon`},suffixIcon:{type:`string`,title:`后缀图标`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.suffixIcon`}},{includeTitle:!0,includeInput:!0,includeSize:!1}),J={component:x(c({name:`InputComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{},onChange:{type:Function},placeholder:{},maxlength:{},showWordLimit:{type:Boolean},clearable:{type:Boolean},prefixIcon:{},suffixIcon:{},disabled:{type:Boolean},readonly:{type:Boolean}},setup(e){let t=e;return(e,r)=>{let i=m(`ElInput`);return d(),n(H,{title:t.title,required:t.required,tooltip:t.tooltip,"label-width":t.labelWidth,layout:t.layout,"label-align":t.labelAlign},{default:_(()=>[s(i,{placeholder:t.placeholder,maxlength:t.maxlength,"show-word-limit":t.showWordLimit,clearable:t.clearable,"prefix-icon":t.prefixIcon,"suffix-icon":t.suffixIcon,disabled:t.disabled,readonly:t.readonly,"model-value":t.value,"onUpdate:modelValue":t.onChange},null,8,[`placeholder`,`maxlength`,`show-word-limit`,`clearable`,`prefix-icon`,`suffix-icon`,`disabled`,`readonly`,`model-value`,`onUpdate:modelValue`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),[[`__scopeId`,`data-v-707d64a6`]]),setterSchema:q,config:{name:`输入框`,icon:`EditPen`,category:`基础`,description:`单行文本输入框`},defaultSchema:{type:`string`,title:`输入框`,"x-component":`Input`,"x-decorator":`FormItem`,"x-component-props":{placeholder:`请输入`}}},Y=L({min:{type:`number`,title:`最小值`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.min`},max:{type:`number`,title:`最大值`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.max`},step:{type:`number`,title:`步长`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.step`,"x-component-props":{min:0}},precision:{type:`number`,title:`精度`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.precision`,"x-component-props":{min:0,max:10}},controls:{type:`boolean`,title:`显示控制按钮`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.controls`},controlsPosition:{type:`string`,title:`控制按钮位置`,"x-component":`Select`,"x-decorator":`FormItem`,"x-path":`x-component-props.controlsPosition`,enum:[{label:`默认`,value:``},{label:`右侧`,value:`right`}]}},{includeTitle:!0,includeInput:{placeholder:!0,clearable:!1,disabled:!0,readonly:!0},includeSize:!1}),X={component:c({name:`InputNumberComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{},onChange:{type:Function},min:{},max:{},step:{},precision:{},placeholder:{},controls:{type:Boolean},controlsPosition:{},disabled:{type:Boolean},readonly:{type:Boolean}},setup(e){let t=e;return(e,r)=>{let i=m(`ElInputNumber`);return d(),n(H,{title:t.title,required:t.required,tooltip:t.tooltip,"label-width":t.labelWidth,layout:t.layout,"label-align":t.labelAlign},{default:_(()=>[s(i,{placeholder:t.placeholder,"model-value":t.value,min:t.min,max:t.max,step:t.step,precision:t.precision,controls:t.controls,"controls-position":t.controlsPosition||void 0,disabled:t.disabled,readonly:t.readonly,"onUpdate:modelValue":t.onChange},null,8,[`placeholder`,`model-value`,`min`,`max`,`step`,`precision`,`controls`,`controls-position`,`disabled`,`readonly`,`onUpdate:modelValue`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),setterSchema:Y,config:{name:`数字输入框`,icon:`Histogram`,category:`基础`,description:`数字输入控件`},defaultSchema:{type:`number`,title:`数字输入框`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-component-props":{placeholder:`请输入数字`}}},Z=L({options:{type:`array`,title:`选项列表`,"x-component":`ArrayItems`,"x-decorator":`FormItem`,"x-path":`enum`,items:{type:`object`,properties:{space:{type:`void`,"x-component":`Space`,properties:{sort:{type:`void`,"x-decorator":`FormItem`,"x-component":`ArrayItems.SortHandle`},label:{type:`string`,title:`标签`,"x-decorator":`FormItem`,"x-component":`Input`,"x-component-props":{placeholder:`显示文本`}},value:{type:`string`,title:`值`,"x-decorator":`FormItem`,"x-component":`Input`,"x-component-props":{placeholder:`选项值`}},remove:{type:`void`,"x-decorator":`FormItem`,"x-component":`ArrayItems.Remove`}}}}},properties:{add:{type:`void`,title:`添加选项`,"x-component":`ArrayItems.Addition`}}}},{includeTitle:!0,includeInput:{placeholder:!1,clearable:!1,disabled:!0,readonly:!1},includeSize:!1}),Q={component:c({name:`RadioComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{},onChange:{type:Function},options:{},disabled:{type:Boolean}},setup(t){let r=t;return(t,a)=>{let c=m(`ElRadio`),l=m(`ElRadioGroup`);return d(),n(H,{title:r.title,required:r.required,tooltip:r.tooltip,"label-width":r.labelWidth,layout:r.layout,"label-align":r.labelAlign},{default:_(()=>[s(l,{"model-value":r.value,disabled:r.disabled,"onUpdate:modelValue":a[0]||=e=>r.onChange?.(e)},{default:_(()=>[(d(!0),i(e,null,f(r.options,e=>(d(),n(c,{key:e.value,value:e.value},{default:_(()=>[o(h(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`,`disabled`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),setterSchema:Z,config:{name:`单选框`,icon:`CircleCheck`,category:`选择`,description:`单选控件`},defaultSchema:{type:`string`,title:`单选框`,"x-component":`Radio.Group`,"x-decorator":`FormItem`,enum:[{label:`选项1`,value:`1`},{label:`选项2`,value:`2`},{label:`选项3`,value:`3`}]}},ne=L({multiple:{title:`多选`,type:`boolean`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.multiple`},filterable:{title:`可搜索`,type:`boolean`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.filterable`},allowCreate:{title:`允许创建`,type:`boolean`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.allowCreate`},options:{type:`array`,title:`选项列表`,"x-component":`ArrayItems`,"x-decorator":`FormItem`,"x-path":`enum`,items:{type:`object`,properties:{space:{type:`void`,"x-component":`Space`,properties:{sort:{type:`void`,"x-decorator":`FormItem`,"x-component":`ArrayItems.SortHandle`},label:{type:`string`,title:`标签`,"x-decorator":`FormItem`,"x-component":`Input`,"x-component-props":{placeholder:`显示文本`}},value:{type:`string`,title:`值`,"x-decorator":`FormItem`,"x-component":`Input`,"x-component-props":{placeholder:`选项值`}},remove:{type:`void`,"x-decorator":`FormItem`,"x-component":`ArrayItems.Remove`}}}}},properties:{add:{type:`void`,title:`添加选项`,"x-component":`ArrayItems.Addition`}}}},{includeTitle:!0,includeInput:{placeholder:!0,clearable:!0,disabled:!0,readonly:!1},includeSize:!1}),re={component:c({name:`SelectComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{},onChange:{type:Function},placeholder:{},options:{},multiple:{type:Boolean},clearable:{type:Boolean},filterable:{type:Boolean},allowCreate:{type:Boolean},disabled:{type:Boolean}},setup(t){let r=t;return(t,a)=>{let o=m(`ElOption`),c=m(`ElSelect`);return d(),n(H,{title:r.title,required:r.required,tooltip:r.tooltip,"label-width":r.labelWidth,layout:r.layout,"label-align":r.labelAlign},{default:_(()=>[s(c,{placeholder:r.placeholder,"model-value":r.value,multiple:r.multiple,clearable:r.clearable,filterable:r.filterable,"allow-create":r.allowCreate,disabled:r.disabled,"onUpdate:modelValue":r.onChange},{default:_(()=>[(d(!0),i(e,null,f(r.options,e=>(d(),n(o,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`placeholder`,`model-value`,`multiple`,`clearable`,`filterable`,`allow-create`,`disabled`,`onUpdate:modelValue`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),setterSchema:ne,config:{name:`下拉选择`,icon:`ArrowDown`,category:`选择`,description:`下拉选择器`},defaultSchema:{type:`string`,title:`下拉选择`,"x-component":`Select`,"x-decorator":`FormItem`,"x-component-props":{placeholder:`请选择`},enum:[{label:`选项1`,value:`1`},{label:`选项2`,value:`2`},{label:`选项3`,value:`3`}]}},ie={component:c({name:`Space`,inheritAttrs:!1,__name:`ui`,props:{direction:{},size:{}},setup(e){let n=e,r=t(()=>{let{direction:e,size:t}=n;return e===`vertical`?{width:`100%`,height:`${t||8}px`}:{width:`${t||8}px`,height:`100%`}});return(e,t)=>(d(),i(`div`,{style:u(r.value)},null,4))}}),setterSchema:{type:`object`,properties:{direction:{type:`string`,title:`方向`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.direction`,"x-component-props":{activeText:`水平`,inactiveText:`垂直`,activeValue:`horizontal`,inactiveValue:`vertical`}},size:{type:`number`,title:`间距 (px)`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.size`,"x-component-props":{min:0,max:100}}}},config:{name:`Space 间距`,icon:`Grid`,category:`布局`,description:`快捷间距容器`},defaultSchema:{type:`void`,title:`Space 间距`,"x-component":`Space`,"x-droppable":!1,"x-component-props":{direction:`horizontal`,size:8,align:`center`}}},ae=L({activeText:{type:`string`,title:`激活文字`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.activeText`},inactiveText:{type:`string`,title:`未激活文字`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.inactiveText`},activeValue:{type:`string`,title:`激活值`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.activeValue`,"x-component-props":{placeholder:`默认为 true`}},inactiveValue:{type:`string`,title:`未激活值`,"x-component":`Input`,"x-decorator":`FormItem`,"x-path":`x-component-props.inactiveValue`,"x-component-props":{placeholder:`默认为 false`}},inlinePrompt:{type:`boolean`,title:`内联文字`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.inlinePrompt`}},{includeTitle:!0,includeInput:{placeholder:!1,clearable:!1,disabled:!0,readonly:!1},includeSize:!1}),oe={component:c({name:`SwitchComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{type:Boolean},onChange:{type:Function},activeText:{},inactiveText:{},activeValue:{},inactiveValue:{},inlinePrompt:{type:Boolean},disabled:{type:Boolean}},setup(e){let t=e;return(e,r)=>{let i=m(`ElSwitch`);return d(),n(H,{title:t.title,required:t.required,tooltip:t.tooltip,"label-width":t.labelWidth,layout:t.layout,"label-align":t.labelAlign},{default:_(()=>[s(i,{"model-value":t.value,"active-text":t.activeText,"inactive-text":t.inactiveText,"active-value":t.activeValue,"inactive-value":t.inactiveValue,"inline-prompt":t.inlinePrompt,disabled:t.disabled,"onUpdate:modelValue":t.onChange},null,8,[`model-value`,`active-text`,`inactive-text`,`active-value`,`inactive-value`,`inline-prompt`,`disabled`,`onUpdate:modelValue`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),setterSchema:ae,config:{name:`开关`,icon:`Switch`,category:`基础`,description:`开关控件`},defaultSchema:{type:`boolean`,title:`开关`,"x-component":`Switch`,"x-decorator":`FormItem`}},se=L({rows:{type:`number`,title:`行数`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.rows`,"x-component-props":{min:1,max:20,step:1}},maxlength:{type:`number`,title:`最大长度`,"x-component":`InputNumber`,"x-decorator":`FormItem`,"x-path":`x-component-props.maxlength`,"x-component-props":{min:0}},showWordLimit:{type:`boolean`,title:`显示字数限制`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.showWordLimit`},autosize:{type:`boolean`,title:`自适应高度`,"x-component":`Switch`,"x-decorator":`FormItem`,"x-path":`x-component-props.autosize`},resize:{type:`string`,title:`缩放`,"x-component":`Select`,"x-decorator":`FormItem`,"x-path":`x-component-props.resize`,enum:[{label:`无`,value:`none`},{label:`垂直`,value:`vertical`},{label:`水平`,value:`horizontal`},{label:`全部`,value:`both`}]}},{includeTitle:!0,includeInput:!0,includeSize:!1}),ce={component:c({name:`TextAreaComponent`,inheritAttrs:!1,__name:`ui`,props:{title:{},required:{type:Boolean},tooltip:{},labelWidth:{},layout:{},labelAlign:{},value:{},onChange:{type:Function},placeholder:{},rows:{},maxlength:{},showWordLimit:{type:Boolean},autosize:{type:[Boolean,Object]},resize:{},disabled:{type:Boolean},readonly:{type:Boolean}},setup(e){let t=e;return(e,r)=>{let i=m(`ElInput`);return d(),n(H,{title:t.title,required:t.required,tooltip:t.tooltip,"label-width":t.labelWidth,layout:t.layout,"label-align":t.labelAlign},{default:_(()=>[s(i,{type:`textarea`,placeholder:t.placeholder,rows:t.rows,maxlength:t.maxlength,"show-word-limit":t.showWordLimit,autosize:t.autosize,resize:t.resize,disabled:t.disabled,readonly:t.readonly,"model-value":t.value,"onUpdate:modelValue":t.onChange},null,8,[`placeholder`,`rows`,`maxlength`,`show-word-limit`,`autosize`,`resize`,`disabled`,`readonly`,`model-value`,`onUpdate:modelValue`])]),_:1},8,[`title`,`required`,`tooltip`,`label-width`,`layout`,`label-align`])}}}),setterSchema:se,config:{name:`文本域`,icon:`Document`,category:`基础`,description:`多行文本输入框`},defaultSchema:{type:`string`,title:`文本域`,"x-component":`Textarea`,"x-decorator":`FormItem`,"x-component-props":{placeholder:`请输入`,rows:4}}};const le=J,ue=E,de=N,fe=re,pe=U,$=Q,me=G,he=ce,ge=oe,_e=X,ve=K,ye=ie,be=te;export{ue as Array,de as ArrayItem,pe as Checkbox,me as DatePicker,be as Divider,ve as Grid,le as Input,_e as InputNumber,$ as Radio,fe as Select,ye as Space,ge as Switch,he as TextArea};
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@formily-djd/component",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "packageManager": "pnpm@10.17.1",
6
+ "description": "djd formily component",
7
+ "author": "gaojinsong2010@gmail.com",
8
+ "license": "MIT",
9
+ "keywords": [],
10
+ "sideEffects": false,
11
+ "exports": {
12
+ ".": "./dist/index.mjs",
13
+ "./package.json": "./package.json",
14
+ "./css": "./dist/index.css"
15
+ },
16
+ "main": "./dist/index.mjs",
17
+ "module": "./dist/index.mjs",
18
+ "types": "./dist/index.d.mts",
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "build": "export NODE_ENV=production && tsdown --config-loader=tsx",
24
+ "dev": "export NODE_ENV=development && tsdown --watch --config-loader=tsx",
25
+ "lint": "eslint",
26
+ "lint:fix": "eslint --fix",
27
+ "prepublishOnly": "nr build",
28
+ "release": "bumpp",
29
+ "test": "vitest",
30
+ "typecheck": "tsc --noEmit",
31
+ "prepare": "simple-git-hooks"
32
+ },
33
+ "dependencies": {
34
+ "@element-plus/icons-vue": "^2.3.2",
35
+ "@formily-djd/utils": "workspace:*",
36
+ "@formily/core": "^2.3.7",
37
+ "@formily/vue": "^2.3.7",
38
+ "element-plus": "^2.11.7",
39
+ "vue": "^3.5.22"
40
+ },
41
+ "devDependencies": {
42
+ "@antfu/eslint-config": "^5.4.1",
43
+ "@antfu/ni": "^26.0.1",
44
+ "@antfu/utils": "^9.2.1",
45
+ "@types/node": "^24.5.2",
46
+ "@unocss/reset": "^66.5.2",
47
+ "ansis": "^4.2.0",
48
+ "bumpp": "^10.2.3",
49
+ "chokidar": "^4.0.3",
50
+ "eslint": "^9.36.0",
51
+ "exsolve": "^1.0.7",
52
+ "lightningcss": "^1.30.1",
53
+ "lint-staged": "^16.2.3",
54
+ "magic-string": "^0.30.19",
55
+ "simple-git-hooks": "^2.13.1",
56
+ "tinyexec": "^1.0.1",
57
+ "tinyglobby": "0.2.15",
58
+ "tsdown": "^0.15.5",
59
+ "tsx": "4.20.6",
60
+ "typescript": "^5.9.2",
61
+ "unocss": "^66.5.2",
62
+ "unplugin-vue": "^7.0.1",
63
+ "vite": "^7.1.7",
64
+ "vitest": "^3.2.4",
65
+ "vitest-package-exports": "^0.1.1",
66
+ "yaml": "^2.8.1"
67
+ },
68
+ "simple-git-hooks": {
69
+ "pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
70
+ },
71
+ "publishConfig": {
72
+ "access": "public",
73
+ "registry": "https://registry.npmjs.org"
74
+ },
75
+ "lint-staged": {
76
+ "*": "eslint --fix"
77
+ }
78
+ }