@sepveneto/dnde-core 0.4.4 → 0.4.5

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.
@@ -1,4 +1,4 @@
1
- import { FormItemRule, UploadRequestOptions, InputInstance, ElOption, SelectInstance, InputNumberInstance, SwitchInstance, ImageInstance, RadioGroupInstance, ElRadio, ElRadioButton, DatePickerInstance, ColorPickerInstance } from 'element-plus';
1
+ import { FormItemRule, UploadRequestOptions, FormItemProps, InputInstance, ElOption, SelectInstance, InputNumberInstance, SwitchInstance, ImageInstance, RadioGroupInstance, ElRadio, ElRadioButton, DatePickerInstance, ColorPickerInstance } from 'element-plus';
2
2
  import * as vue from 'vue';
3
3
  import { CSSProperties } from 'vue';
4
4
  import Validator from 'async-validator';
@@ -136,6 +136,7 @@ type RadioButtonOption = InstanceType<typeof ElRadioButton>;
136
136
  interface SchemaItemBase {
137
137
  label: string;
138
138
  key: string;
139
+ formItem?: Partial<FormItemProps>;
139
140
  rules?: FormItemRule | FormItemRule[];
140
141
  }
141
142
  interface SchemaItemInput extends SchemaItemBase {
@@ -1,4 +1,4 @@
1
- import { FormItemRule, UploadRequestOptions, InputInstance, ElOption, SelectInstance, InputNumberInstance, SwitchInstance, ImageInstance, RadioGroupInstance, ElRadio, ElRadioButton, DatePickerInstance, ColorPickerInstance } from 'element-plus';
1
+ import { FormItemRule, UploadRequestOptions, FormItemProps, InputInstance, ElOption, SelectInstance, InputNumberInstance, SwitchInstance, ImageInstance, RadioGroupInstance, ElRadio, ElRadioButton, DatePickerInstance, ColorPickerInstance } from 'element-plus';
2
2
  import * as vue from 'vue';
3
3
  import { CSSProperties } from 'vue';
4
4
  import Validator from 'async-validator';
@@ -136,6 +136,7 @@ type RadioButtonOption = InstanceType<typeof ElRadioButton>;
136
136
  interface SchemaItemBase {
137
137
  label: string;
138
138
  key: string;
139
+ formItem?: Partial<FormItemProps>;
139
140
  rules?: FormItemRule | FormItemRule[];
140
141
  }
141
142
  interface SchemaItemInput extends SchemaItemBase {
@@ -0,0 +1,69 @@
1
+ import {
2
+ likeArray
3
+ } from "./chunk-XJ2IJHKH.js";
4
+
5
+ // src/helper/schema.ts
6
+ var schema = {
7
+ _create(type, config) {
8
+ const base = {
9
+ label: config.label,
10
+ key: config.key,
11
+ type,
12
+ formItem: config.formItem,
13
+ rules: normalizeRules(config),
14
+ attrs: config.attrs
15
+ };
16
+ return base;
17
+ },
18
+ input(config) {
19
+ return this._create("input", config);
20
+ },
21
+ number(config) {
22
+ return this._create("number", config);
23
+ },
24
+ select(config) {
25
+ return this._create("select", config);
26
+ },
27
+ radio(config) {
28
+ return this._create("radio", config);
29
+ },
30
+ radioButton(config) {
31
+ return this._create("radioButton", config);
32
+ },
33
+ switch(config) {
34
+ return this._create("switch", config);
35
+ },
36
+ time(config) {
37
+ return this._create("datetimePicker", config);
38
+ },
39
+ color(config) {
40
+ return this._create("colorPicker", config);
41
+ },
42
+ custom(config) {
43
+ return this._create("custom", config);
44
+ },
45
+ styleNumber(config) {
46
+ return this._create("styleNumber", config);
47
+ }
48
+ };
49
+ function normalizeRules(config) {
50
+ const rules = likeArray(config.rules || []);
51
+ if (config.required) {
52
+ if (typeof config.required === "string") {
53
+ rules.push({
54
+ required: true,
55
+ message: config.required
56
+ });
57
+ } else if (config.required) {
58
+ rules.push({
59
+ required: true,
60
+ message: `\u8BF7\u586B\u5199${config.label}`
61
+ });
62
+ }
63
+ }
64
+ return rules;
65
+ }
66
+
67
+ export {
68
+ schema
69
+ };
@@ -1,4 +1,4 @@
1
- import { l as Widget, I as IWidget } from '../Widget-Dfw3PnBq.cjs';
1
+ import { l as Widget, I as IWidget } from '../Widget-DndvEdEX.cjs';
2
2
  import 'element-plus';
3
3
  import 'vue';
4
4
  import 'async-validator';
@@ -1,4 +1,4 @@
1
- import { l as Widget, I as IWidget } from '../Widget-Dfw3PnBq.js';
1
+ import { l as Widget, I as IWidget } from '../Widget-DndvEdEX.js';
2
2
  import 'element-plus';
3
3
  import 'vue';
4
4
  import 'async-validator';
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from 'vue';
2
- import { l as Widget } from '../Widget-Dfw3PnBq.cjs';
2
+ import { l as Widget } from '../Widget-DndvEdEX.cjs';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from 'vue';
2
- import { l as Widget } from '../Widget-Dfw3PnBq.js';
2
+ import { l as Widget } from '../Widget-DndvEdEX.js';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
5
5
 
@@ -1,4 +1,4 @@
1
- export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-Dfw3PnBq.cjs';
1
+ export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-DndvEdEX.cjs';
2
2
  import 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -1,4 +1,4 @@
1
- export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-Dfw3PnBq.js';
1
+ export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-DndvEdEX.js';
2
2
  import 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -1,6 +1,6 @@
1
1
  export { Container } from './Container.cjs';
2
2
  export { Node, RootNode } from './Node.cjs';
3
- export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-Dfw3PnBq.cjs';
3
+ export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-DndvEdEX.cjs';
4
4
  import 'vue';
5
5
  import 'element-plus';
6
6
  import 'async-validator';
@@ -1,6 +1,6 @@
1
1
  export { Container } from './Container.js';
2
2
  export { Node, RootNode } from './Node.js';
3
- export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-Dfw3PnBq.js';
3
+ export { O as Option, j as RadioButtonOption, R as RadioOption, k as SchemaItem, l as Widget } from '../Widget-DndvEdEX.js';
4
4
  import 'vue';
5
5
  import 'element-plus';
6
6
  import 'async-validator';
@@ -67,110 +67,46 @@ function likeArray(val) {
67
67
 
68
68
  // src/helper/schema.ts
69
69
  var schema = {
70
- input(config) {
70
+ _create(type, config) {
71
71
  const base = {
72
72
  label: config.label,
73
73
  key: config.key,
74
- type: "input",
74
+ type,
75
+ formItem: config.formItem,
75
76
  rules: normalizeRules(config),
76
77
  attrs: config.attrs
77
78
  };
78
79
  return base;
79
80
  },
81
+ input(config) {
82
+ return this._create("input", config);
83
+ },
80
84
  number(config) {
81
- return {
82
- label: config.label,
83
- key: config.key,
84
- type: "number",
85
- rules: normalizeRules(config),
86
- attrs: config.attrs
87
- };
85
+ return this._create("number", config);
88
86
  },
89
87
  select(config) {
90
- return {
91
- label: config.label,
92
- key: config.key,
93
- type: "select",
94
- attrs: config.attrs,
95
- rules: normalizeRules(config),
96
- options: config.options
97
- };
88
+ return this._create("select", config);
98
89
  },
99
90
  radio(config) {
100
- const base = {
101
- label: config.label,
102
- key: config.key,
103
- type: "radio",
104
- rules: normalizeRules(config),
105
- attrs: config.attrs,
106
- options: config.options
107
- };
108
- return base;
91
+ return this._create("radio", config);
109
92
  },
110
93
  radioButton(config) {
111
- const base = {
112
- label: config.label,
113
- key: config.key,
114
- type: "radioButton",
115
- rules: normalizeRules(config),
116
- attrs: config.attrs,
117
- options: config.options
118
- };
119
- return base;
94
+ return this._create("radioButton", config);
120
95
  },
121
96
  switch(config) {
122
- return {
123
- label: config.label,
124
- key: config.key,
125
- type: "switch",
126
- attrs: config.attrs,
127
- rules: normalizeRules(config)
128
- };
97
+ return this._create("switch", config);
129
98
  },
130
- // image(config: BaseConfig & { attrs?: ImageInstance['$props'] }): SchemaItem {
131
- // return {
132
- // label: config.label,
133
- // key: config.key,
134
- // type: 'image',
135
- // attrs: config.attrs,
136
- // rules: normalizeRules(config),
137
- // }
138
- // },
139
99
  time(config) {
140
- return {
141
- label: config.label,
142
- key: config.key,
143
- type: "datetimePicker",
144
- attrs: config.attrs,
145
- rules: normalizeRules(config)
146
- };
100
+ return this._create("datetimePicker", config);
147
101
  },
148
102
  color(config) {
149
- return {
150
- label: config.label,
151
- key: config.key,
152
- type: "colorPicker",
153
- attrs: config.attrs,
154
- rules: normalizeRules(config)
155
- };
103
+ return this._create("colorPicker", config);
156
104
  },
157
105
  custom(config) {
158
- return {
159
- label: config.label,
160
- key: config.key,
161
- name: config.type,
162
- type: "custom",
163
- attrs: config.attrs,
164
- rules: normalizeRules(config)
165
- };
106
+ return this._create("custom", config);
166
107
  },
167
108
  styleNumber(config) {
168
- return {
169
- label: config.label,
170
- key: config.key,
171
- type: "styleNumber",
172
- rules: normalizeRules(config)
173
- };
109
+ return this._create("styleNumber", config);
174
110
  }
175
111
  };
176
112
  function normalizeRules(config) {
@@ -2,6 +2,6 @@ export { EventEmitter } from './EventEmitter.cjs';
2
2
  export { schema } from './schema.cjs';
3
3
  export { widget, widgetType } from './widget.cjs';
4
4
  import 'element-plus';
5
- import '../Widget-Dfw3PnBq.cjs';
5
+ import '../Widget-DndvEdEX.cjs';
6
6
  import 'vue';
7
7
  import 'async-validator';
@@ -2,6 +2,6 @@ export { EventEmitter } from './EventEmitter.js';
2
2
  export { schema } from './schema.js';
3
3
  export { widget, widgetType } from './widget.js';
4
4
  import 'element-plus';
5
- import '../Widget-Dfw3PnBq.js';
5
+ import '../Widget-DndvEdEX.js';
6
6
  import 'vue';
7
7
  import 'async-validator';
@@ -4,7 +4,7 @@ import {
4
4
  } from "../chunk-W776G2UQ.js";
5
5
  import {
6
6
  schema
7
- } from "../chunk-ZYXSKUF4.js";
7
+ } from "../chunk-MWZZYXEL.js";
8
8
  import {
9
9
  widget,
10
10
  widgetType
@@ -31,110 +31,46 @@ function likeArray(val) {
31
31
 
32
32
  // src/helper/schema.ts
33
33
  var schema = {
34
- input(config) {
34
+ _create(type, config) {
35
35
  const base = {
36
36
  label: config.label,
37
37
  key: config.key,
38
- type: "input",
38
+ type,
39
+ formItem: config.formItem,
39
40
  rules: normalizeRules(config),
40
41
  attrs: config.attrs
41
42
  };
42
43
  return base;
43
44
  },
45
+ input(config) {
46
+ return this._create("input", config);
47
+ },
44
48
  number(config) {
45
- return {
46
- label: config.label,
47
- key: config.key,
48
- type: "number",
49
- rules: normalizeRules(config),
50
- attrs: config.attrs
51
- };
49
+ return this._create("number", config);
52
50
  },
53
51
  select(config) {
54
- return {
55
- label: config.label,
56
- key: config.key,
57
- type: "select",
58
- attrs: config.attrs,
59
- rules: normalizeRules(config),
60
- options: config.options
61
- };
52
+ return this._create("select", config);
62
53
  },
63
54
  radio(config) {
64
- const base = {
65
- label: config.label,
66
- key: config.key,
67
- type: "radio",
68
- rules: normalizeRules(config),
69
- attrs: config.attrs,
70
- options: config.options
71
- };
72
- return base;
55
+ return this._create("radio", config);
73
56
  },
74
57
  radioButton(config) {
75
- const base = {
76
- label: config.label,
77
- key: config.key,
78
- type: "radioButton",
79
- rules: normalizeRules(config),
80
- attrs: config.attrs,
81
- options: config.options
82
- };
83
- return base;
58
+ return this._create("radioButton", config);
84
59
  },
85
60
  switch(config) {
86
- return {
87
- label: config.label,
88
- key: config.key,
89
- type: "switch",
90
- attrs: config.attrs,
91
- rules: normalizeRules(config)
92
- };
61
+ return this._create("switch", config);
93
62
  },
94
- // image(config: BaseConfig & { attrs?: ImageInstance['$props'] }): SchemaItem {
95
- // return {
96
- // label: config.label,
97
- // key: config.key,
98
- // type: 'image',
99
- // attrs: config.attrs,
100
- // rules: normalizeRules(config),
101
- // }
102
- // },
103
63
  time(config) {
104
- return {
105
- label: config.label,
106
- key: config.key,
107
- type: "datetimePicker",
108
- attrs: config.attrs,
109
- rules: normalizeRules(config)
110
- };
64
+ return this._create("datetimePicker", config);
111
65
  },
112
66
  color(config) {
113
- return {
114
- label: config.label,
115
- key: config.key,
116
- type: "colorPicker",
117
- attrs: config.attrs,
118
- rules: normalizeRules(config)
119
- };
67
+ return this._create("colorPicker", config);
120
68
  },
121
69
  custom(config) {
122
- return {
123
- label: config.label,
124
- key: config.key,
125
- name: config.type,
126
- type: "custom",
127
- attrs: config.attrs,
128
- rules: normalizeRules(config)
129
- };
70
+ return this._create("custom", config);
130
71
  },
131
72
  styleNumber(config) {
132
- return {
133
- label: config.label,
134
- key: config.key,
135
- type: "styleNumber",
136
- rules: normalizeRules(config)
137
- };
73
+ return this._create("styleNumber", config);
138
74
  }
139
75
  };
140
76
  function normalizeRules(config) {
@@ -1,5 +1,5 @@
1
- import { InputInstance, InputNumberInstance, SelectInstance, RadioInstance, SwitchInstance, DatePickerInstance, ColorPickerInstance } from 'element-plus';
2
- import { k as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-Dfw3PnBq.cjs';
1
+ import { FormItemProps, InputInstance, InputNumberInstance, SelectInstance, RadioInstance, SwitchInstance, DatePickerInstance, ColorPickerInstance } from 'element-plus';
2
+ import { k as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-DndvEdEX.cjs';
3
3
  import 'vue';
4
4
  import 'async-validator';
5
5
 
@@ -7,10 +7,14 @@ interface BaseConfig {
7
7
  label: SchemaItem['label'];
8
8
  key: SchemaItem['key'];
9
9
  tips?: string;
10
+ formItem?: Partial<FormItemProps>;
10
11
  required?: boolean | string;
11
12
  rules?: SchemaItem['rules'];
12
13
  }
13
14
  declare const schema: {
15
+ _create(type: any, config: BaseConfig & {
16
+ attrs?: any;
17
+ }): SchemaItem;
14
18
  input(config: BaseConfig & {
15
19
  attrs?: InputInstance["$props"];
16
20
  }): SchemaItem;
@@ -1,5 +1,5 @@
1
- import { InputInstance, InputNumberInstance, SelectInstance, RadioInstance, SwitchInstance, DatePickerInstance, ColorPickerInstance } from 'element-plus';
2
- import { k as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-Dfw3PnBq.js';
1
+ import { FormItemProps, InputInstance, InputNumberInstance, SelectInstance, RadioInstance, SwitchInstance, DatePickerInstance, ColorPickerInstance } from 'element-plus';
2
+ import { k as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-DndvEdEX.js';
3
3
  import 'vue';
4
4
  import 'async-validator';
5
5
 
@@ -7,10 +7,14 @@ interface BaseConfig {
7
7
  label: SchemaItem['label'];
8
8
  key: SchemaItem['key'];
9
9
  tips?: string;
10
+ formItem?: Partial<FormItemProps>;
10
11
  required?: boolean | string;
11
12
  rules?: SchemaItem['rules'];
12
13
  }
13
14
  declare const schema: {
15
+ _create(type: any, config: BaseConfig & {
16
+ attrs?: any;
17
+ }): SchemaItem;
14
18
  input(config: BaseConfig & {
15
19
  attrs?: InputInstance["$props"];
16
20
  }): SchemaItem;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  schema
3
- } from "../chunk-ZYXSKUF4.js";
3
+ } from "../chunk-MWZZYXEL.js";
4
4
  import "../chunk-XJ2IJHKH.js";
5
5
  import "../chunk-HJO26HIQ.js";
6
6
  export {
@@ -1,4 +1,4 @@
1
- import { I as IWidget, k as SchemaItem, W as WidgetPos, B as Base } from '../Widget-Dfw3PnBq.cjs';
1
+ import { I as IWidget, k as SchemaItem, W as WidgetPos, B as Base } from '../Widget-DndvEdEX.cjs';
2
2
  import * as vue from 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -1,4 +1,4 @@
1
- import { I as IWidget, k as SchemaItem, W as WidgetPos, B as Base } from '../Widget-Dfw3PnBq.js';
1
+ import { I as IWidget, k as SchemaItem, W as WidgetPos, B as Base } from '../Widget-DndvEdEX.js';
2
2
  import * as vue from 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
package/dist/index.cjs CHANGED
@@ -71,110 +71,46 @@ function likeArray(val) {
71
71
 
72
72
  // src/helper/schema.ts
73
73
  var schema = {
74
- input(config) {
74
+ _create(type, config) {
75
75
  const base = {
76
76
  label: config.label,
77
77
  key: config.key,
78
- type: "input",
78
+ type,
79
+ formItem: config.formItem,
79
80
  rules: normalizeRules(config),
80
81
  attrs: config.attrs
81
82
  };
82
83
  return base;
83
84
  },
85
+ input(config) {
86
+ return this._create("input", config);
87
+ },
84
88
  number(config) {
85
- return {
86
- label: config.label,
87
- key: config.key,
88
- type: "number",
89
- rules: normalizeRules(config),
90
- attrs: config.attrs
91
- };
89
+ return this._create("number", config);
92
90
  },
93
91
  select(config) {
94
- return {
95
- label: config.label,
96
- key: config.key,
97
- type: "select",
98
- attrs: config.attrs,
99
- rules: normalizeRules(config),
100
- options: config.options
101
- };
92
+ return this._create("select", config);
102
93
  },
103
94
  radio(config) {
104
- const base = {
105
- label: config.label,
106
- key: config.key,
107
- type: "radio",
108
- rules: normalizeRules(config),
109
- attrs: config.attrs,
110
- options: config.options
111
- };
112
- return base;
95
+ return this._create("radio", config);
113
96
  },
114
97
  radioButton(config) {
115
- const base = {
116
- label: config.label,
117
- key: config.key,
118
- type: "radioButton",
119
- rules: normalizeRules(config),
120
- attrs: config.attrs,
121
- options: config.options
122
- };
123
- return base;
98
+ return this._create("radioButton", config);
124
99
  },
125
100
  switch(config) {
126
- return {
127
- label: config.label,
128
- key: config.key,
129
- type: "switch",
130
- attrs: config.attrs,
131
- rules: normalizeRules(config)
132
- };
101
+ return this._create("switch", config);
133
102
  },
134
- // image(config: BaseConfig & { attrs?: ImageInstance['$props'] }): SchemaItem {
135
- // return {
136
- // label: config.label,
137
- // key: config.key,
138
- // type: 'image',
139
- // attrs: config.attrs,
140
- // rules: normalizeRules(config),
141
- // }
142
- // },
143
103
  time(config) {
144
- return {
145
- label: config.label,
146
- key: config.key,
147
- type: "datetimePicker",
148
- attrs: config.attrs,
149
- rules: normalizeRules(config)
150
- };
104
+ return this._create("datetimePicker", config);
151
105
  },
152
106
  color(config) {
153
- return {
154
- label: config.label,
155
- key: config.key,
156
- type: "colorPicker",
157
- attrs: config.attrs,
158
- rules: normalizeRules(config)
159
- };
107
+ return this._create("colorPicker", config);
160
108
  },
161
109
  custom(config) {
162
- return {
163
- label: config.label,
164
- key: config.key,
165
- name: config.type,
166
- type: "custom",
167
- attrs: config.attrs,
168
- rules: normalizeRules(config)
169
- };
110
+ return this._create("custom", config);
170
111
  },
171
112
  styleNumber(config) {
172
- return {
173
- label: config.label,
174
- key: config.key,
175
- type: "styleNumber",
176
- rules: normalizeRules(config)
177
- };
113
+ return this._create("styleNumber", config);
178
114
  }
179
115
  };
180
116
  function normalizeRules(config) {
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ export { schema } from './helper/schema.cjs';
3
3
  export { widget, widgetType } from './helper/widget.cjs';
4
4
  export { createCopy, createDelete } from './internal.cjs';
5
5
  export { EditorContext, editorContextKey } from './tokens.cjs';
6
- export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-Dfw3PnBq.cjs';
6
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-DndvEdEX.cjs';
7
7
  import 'element-plus';
8
8
  import 'vue';
9
9
  import './class/Node.cjs';
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { schema } from './helper/schema.js';
3
3
  export { widget, widgetType } from './helper/widget.js';
4
4
  export { createCopy, createDelete } from './internal.js';
5
5
  export { EditorContext, editorContextKey } from './tokens.js';
6
- export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-Dfw3PnBq.js';
6
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-DndvEdEX.js';
7
7
  import 'element-plus';
8
8
  import 'vue';
9
9
  import './class/Node.js';
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-W776G2UQ.js";
5
5
  import {
6
6
  schema
7
- } from "./chunk-ZYXSKUF4.js";
7
+ } from "./chunk-MWZZYXEL.js";
8
8
  import {
9
9
  widget,
10
10
  widgetType
@@ -1,6 +1,6 @@
1
1
  import { Node } from './class/Node.cjs';
2
2
  import 'vue';
3
- import './Widget-Dfw3PnBq.cjs';
3
+ import './Widget-DndvEdEX.cjs';
4
4
  import 'element-plus';
5
5
  import 'async-validator';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { Node } from './class/Node.js';
2
2
  import 'vue';
3
- import './Widget-Dfw3PnBq.js';
3
+ import './Widget-DndvEdEX.js';
4
4
  import 'element-plus';
5
5
  import 'async-validator';
6
6
 
package/dist/tokens.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { InjectionKey } from 'vue';
2
2
  import { EventEmitter } from './helper/EventEmitter.cjs';
3
3
  import { Node } from './class/Node.cjs';
4
- import './Widget-Dfw3PnBq.cjs';
4
+ import './Widget-DndvEdEX.cjs';
5
5
  import 'element-plus';
6
6
  import 'async-validator';
7
7
 
package/dist/tokens.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { InjectionKey } from 'vue';
2
2
  import { EventEmitter } from './helper/EventEmitter.js';
3
3
  import { Node } from './class/Node.js';
4
- import './Widget-Dfw3PnBq.js';
4
+ import './Widget-DndvEdEX.js';
5
5
  import 'element-plus';
6
6
  import 'async-validator';
7
7
 
package/dist/types.d.cts CHANGED
@@ -1,4 +1,4 @@
1
1
  import 'element-plus';
2
2
  import 'vue';
3
- export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-Dfw3PnBq.cjs';
3
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-DndvEdEX.cjs';
4
4
  import 'async-validator';
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import 'element-plus';
2
2
  import 'vue';
3
- export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-Dfw3PnBq.js';
3
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, h as EditorData, e as EditorRoute, c as EditorSchema, g as EditorSettings, d as EditorWidget, f as EditorWidgets, b as ISchema, I as IWidget, a as SchemaBox, S as SchemaOther, W as WidgetPos, i as isBox } from './Widget-DndvEdEX.js';
4
4
  import 'async-validator';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sepveneto/dnde-core",
3
3
  "type": "module",
4
- "version": "0.4.4",
4
+ "version": "0.4.5",
5
5
  "description": "",
6
6
  "author": "sepveneto",
7
7
  "license": "MIT",
@@ -1,133 +0,0 @@
1
- import {
2
- likeArray
3
- } from "./chunk-XJ2IJHKH.js";
4
-
5
- // src/helper/schema.ts
6
- var schema = {
7
- input(config) {
8
- const base = {
9
- label: config.label,
10
- key: config.key,
11
- type: "input",
12
- rules: normalizeRules(config),
13
- attrs: config.attrs
14
- };
15
- return base;
16
- },
17
- number(config) {
18
- return {
19
- label: config.label,
20
- key: config.key,
21
- type: "number",
22
- rules: normalizeRules(config),
23
- attrs: config.attrs
24
- };
25
- },
26
- select(config) {
27
- return {
28
- label: config.label,
29
- key: config.key,
30
- type: "select",
31
- attrs: config.attrs,
32
- rules: normalizeRules(config),
33
- options: config.options
34
- };
35
- },
36
- radio(config) {
37
- const base = {
38
- label: config.label,
39
- key: config.key,
40
- type: "radio",
41
- rules: normalizeRules(config),
42
- attrs: config.attrs,
43
- options: config.options
44
- };
45
- return base;
46
- },
47
- radioButton(config) {
48
- const base = {
49
- label: config.label,
50
- key: config.key,
51
- type: "radioButton",
52
- rules: normalizeRules(config),
53
- attrs: config.attrs,
54
- options: config.options
55
- };
56
- return base;
57
- },
58
- switch(config) {
59
- return {
60
- label: config.label,
61
- key: config.key,
62
- type: "switch",
63
- attrs: config.attrs,
64
- rules: normalizeRules(config)
65
- };
66
- },
67
- // image(config: BaseConfig & { attrs?: ImageInstance['$props'] }): SchemaItem {
68
- // return {
69
- // label: config.label,
70
- // key: config.key,
71
- // type: 'image',
72
- // attrs: config.attrs,
73
- // rules: normalizeRules(config),
74
- // }
75
- // },
76
- time(config) {
77
- return {
78
- label: config.label,
79
- key: config.key,
80
- type: "datetimePicker",
81
- attrs: config.attrs,
82
- rules: normalizeRules(config)
83
- };
84
- },
85
- color(config) {
86
- return {
87
- label: config.label,
88
- key: config.key,
89
- type: "colorPicker",
90
- attrs: config.attrs,
91
- rules: normalizeRules(config)
92
- };
93
- },
94
- custom(config) {
95
- return {
96
- label: config.label,
97
- key: config.key,
98
- name: config.type,
99
- type: "custom",
100
- attrs: config.attrs,
101
- rules: normalizeRules(config)
102
- };
103
- },
104
- styleNumber(config) {
105
- return {
106
- label: config.label,
107
- key: config.key,
108
- type: "styleNumber",
109
- rules: normalizeRules(config)
110
- };
111
- }
112
- };
113
- function normalizeRules(config) {
114
- const rules = likeArray(config.rules || []);
115
- if (config.required) {
116
- if (typeof config.required === "string") {
117
- rules.push({
118
- required: true,
119
- message: config.required
120
- });
121
- } else if (config.required) {
122
- rules.push({
123
- required: true,
124
- message: `\u8BF7\u586B\u5199${config.label}`
125
- });
126
- }
127
- }
128
- return rules;
129
- }
130
-
131
- export {
132
- schema
133
- };