@sepveneto/dnde-core 0.4.4 → 0.4.6

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 (45) hide show
  1. package/dist/{Widget-Dfw3PnBq.d.cts → Widget-xF5X82JJ.d.cts} +3 -2
  2. package/dist/{Widget-Dfw3PnBq.d.ts → Widget-xF5X82JJ.d.ts} +3 -2
  3. package/dist/chunk-2KTF7TW7.js +77 -0
  4. package/dist/{chunk-HJO26HIQ.js → chunk-6FNC3XMI.js} +4 -0
  5. package/dist/{chunk-77RZWUI5.js → chunk-CETJOSM3.js} +1 -1
  6. package/dist/class/Container.d.cts +1 -1
  7. package/dist/class/Container.d.ts +1 -1
  8. package/dist/class/Container.js +1 -1
  9. package/dist/class/Node.d.cts +1 -1
  10. package/dist/class/Node.d.ts +1 -1
  11. package/dist/class/Node.js +2 -2
  12. package/dist/class/Widget.d.cts +1 -1
  13. package/dist/class/Widget.d.ts +1 -1
  14. package/dist/class/Widget.js +1 -1
  15. package/dist/class/index.d.cts +1 -1
  16. package/dist/class/index.d.ts +1 -1
  17. package/dist/class/index.js +2 -2
  18. package/dist/helper/EventEmitter.js +1 -1
  19. package/dist/helper/index.cjs +35 -78
  20. package/dist/helper/index.d.cts +1 -1
  21. package/dist/helper/index.d.ts +1 -1
  22. package/dist/helper/index.js +2 -2
  23. package/dist/helper/schema.cjs +35 -78
  24. package/dist/helper/schema.d.cts +6 -2
  25. package/dist/helper/schema.d.ts +6 -2
  26. package/dist/helper/schema.js +2 -2
  27. package/dist/helper/widget.d.cts +1 -1
  28. package/dist/helper/widget.d.ts +1 -1
  29. package/dist/helper/widget.js +1 -1
  30. package/dist/index.cjs +35 -78
  31. package/dist/index.d.cts +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +2 -2
  34. package/dist/internal.d.cts +1 -1
  35. package/dist/internal.d.ts +1 -1
  36. package/dist/internal.js +1 -1
  37. package/dist/tokens.d.cts +1 -1
  38. package/dist/tokens.d.ts +1 -1
  39. package/dist/tokens.js +1 -1
  40. package/dist/types.d.cts +1 -1
  41. package/dist/types.d.ts +1 -1
  42. package/dist/types.js +1 -1
  43. package/dist/utils.js +1 -1
  44. package/package.json +1 -1
  45. package/dist/chunk-ZYXSKUF4.js +0 -133
@@ -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 {
@@ -205,4 +206,4 @@ declare class Widget {
205
206
  get validatorStyle(): Validator;
206
207
  }
207
208
 
208
- export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, type Option as O, type RadioOption as R, type SchemaOther as S, type WidgetPos as W, type SchemaBox as a, type ISchema as b, type EditorSchema as c, type EditorWidget as d, type EditorRoute as e, type EditorWidgets as f, type EditorSettings as g, type EditorData as h, isBox as i, type RadioButtonOption as j, type SchemaItem as k, Widget as l };
209
+ export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, type Option as O, type RadioOption as R, type SchemaOther as S, type WidgetPos as W, type SchemaBox as a, type ISchema as b, type EditorSchema as c, type EditorWidget as d, type EditorRoute as e, type EditorWidgets as f, type EditorSettings as g, type EditorData as h, isBox as i, type RadioButtonOption as j, type SchemaItemCustom as k, type SchemaItem as l, Widget as m };
@@ -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 {
@@ -205,4 +206,4 @@ declare class Widget {
205
206
  get validatorStyle(): Validator;
206
207
  }
207
208
 
208
- export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, type Option as O, type RadioOption as R, type SchemaOther as S, type WidgetPos as W, type SchemaBox as a, type ISchema as b, type EditorSchema as c, type EditorWidget as d, type EditorRoute as e, type EditorWidgets as f, type EditorSettings as g, type EditorData as h, isBox as i, type RadioButtonOption as j, type SchemaItem as k, Widget as l };
209
+ export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, type Option as O, type RadioOption as R, type SchemaOther as S, type WidgetPos as W, type SchemaBox as a, type ISchema as b, type EditorSchema as c, type EditorWidget as d, type EditorRoute as e, type EditorWidgets as f, type EditorSettings as g, type EditorData as h, isBox as i, type RadioButtonOption as j, type SchemaItemCustom as k, type SchemaItem as l, Widget as m };
@@ -0,0 +1,77 @@
1
+ import {
2
+ likeArray
3
+ } from "./chunk-XJ2IJHKH.js";
4
+ import {
5
+ __spreadProps,
6
+ __spreadValues
7
+ } from "./chunk-6FNC3XMI.js";
8
+
9
+ // src/helper/schema.ts
10
+ var schema = {
11
+ _create(type, config) {
12
+ const base = {
13
+ label: config.label,
14
+ key: config.key,
15
+ type,
16
+ formItem: config.formItem,
17
+ rules: normalizeRules(config),
18
+ attrs: config.attrs
19
+ };
20
+ return base;
21
+ },
22
+ input(config) {
23
+ return this._create("input", config);
24
+ },
25
+ number(config) {
26
+ return this._create("number", config);
27
+ },
28
+ select(config) {
29
+ return this._create("select", config);
30
+ },
31
+ radio(config) {
32
+ return this._create("radio", config);
33
+ },
34
+ radioButton(config) {
35
+ return this._create("radioButton", config);
36
+ },
37
+ switch(config) {
38
+ return this._create("switch", config);
39
+ },
40
+ time(config) {
41
+ return this._create("datetimePicker", config);
42
+ },
43
+ color(config) {
44
+ return this._create("colorPicker", config);
45
+ },
46
+ custom(config) {
47
+ const res = __spreadProps(__spreadValues({}, this._create("custom", config)), {
48
+ type: "custom",
49
+ name: config.type
50
+ });
51
+ return res;
52
+ },
53
+ styleNumber(config) {
54
+ return this._create("styleNumber", config);
55
+ }
56
+ };
57
+ function normalizeRules(config) {
58
+ const rules = likeArray(config.rules || []);
59
+ if (config.required) {
60
+ if (typeof config.required === "string") {
61
+ rules.push({
62
+ required: true,
63
+ message: config.required
64
+ });
65
+ } else if (config.required) {
66
+ rules.push({
67
+ required: true,
68
+ message: `\u8BF7\u586B\u5199${config.label}`
69
+ });
70
+ }
71
+ }
72
+ return rules;
73
+ }
74
+
75
+ export {
76
+ schema
77
+ };
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
14
16
  }
15
17
  return a;
16
18
  };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17
20
  var __async = (__this, __arguments, generator) => {
18
21
  return new Promise((resolve, reject) => {
19
22
  var fulfilled = (value) => {
@@ -37,5 +40,6 @@ var __async = (__this, __arguments, generator) => {
37
40
 
38
41
  export {
39
42
  __spreadValues,
43
+ __spreadProps,
40
44
  __async
41
45
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __async,
3
3
  __spreadValues
4
- } from "./chunk-HJO26HIQ.js";
4
+ } from "./chunk-6FNC3XMI.js";
5
5
 
6
6
  // src/class/Node.ts
7
7
  import { v4 } from "uuid";
@@ -1,4 +1,4 @@
1
- import { l as Widget, I as IWidget } from '../Widget-Dfw3PnBq.cjs';
1
+ import { m as Widget, I as IWidget } from '../Widget-xF5X82JJ.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 { m as Widget, I as IWidget } from '../Widget-xF5X82JJ.js';
2
2
  import 'element-plus';
3
3
  import 'vue';
4
4
  import 'async-validator';
@@ -2,7 +2,7 @@ import {
2
2
  Container
3
3
  } from "../chunk-ZNYRMDSU.js";
4
4
  import "../chunk-KHPFRVKB.js";
5
- import "../chunk-HJO26HIQ.js";
5
+ import "../chunk-6FNC3XMI.js";
6
6
  export {
7
7
  Container
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from 'vue';
2
- import { l as Widget } from '../Widget-Dfw3PnBq.cjs';
2
+ import { m as Widget } from '../Widget-xF5X82JJ.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 { m as Widget } from '../Widget-xF5X82JJ.js';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
5
5
 
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Node,
3
3
  RootNode
4
- } from "../chunk-77RZWUI5.js";
5
- import "../chunk-HJO26HIQ.js";
4
+ } from "../chunk-CETJOSM3.js";
5
+ import "../chunk-6FNC3XMI.js";
6
6
  export {
7
7
  Node,
8
8
  RootNode
@@ -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, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-xF5X82JJ.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, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-xF5X82JJ.js';
2
2
  import 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Widget
3
3
  } from "../chunk-KHPFRVKB.js";
4
- import "../chunk-HJO26HIQ.js";
4
+ import "../chunk-6FNC3XMI.js";
5
5
  export {
6
6
  Widget
7
7
  };
@@ -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, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-xF5X82JJ.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, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-xF5X82JJ.js';
4
4
  import 'vue';
5
5
  import 'element-plus';
6
6
  import 'async-validator';
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  Node,
6
6
  RootNode
7
- } from "../chunk-77RZWUI5.js";
7
+ } from "../chunk-CETJOSM3.js";
8
8
  import {
9
9
  Widget
10
10
  } from "../chunk-KHPFRVKB.js";
11
- import "../chunk-HJO26HIQ.js";
11
+ import "../chunk-6FNC3XMI.js";
12
12
  export {
13
13
  Container,
14
14
  Node,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EventEmitter
3
3
  } from "../chunk-W776G2UQ.js";
4
- import "../chunk-HJO26HIQ.js";
4
+ import "../chunk-6FNC3XMI.js";
5
5
  export {
6
6
  EventEmitter
7
7
  };
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
23
  var __export = (target, all) => {
7
24
  for (var name in all)
8
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -67,110 +84,50 @@ function likeArray(val) {
67
84
 
68
85
  // src/helper/schema.ts
69
86
  var schema = {
70
- input(config) {
87
+ _create(type, config) {
71
88
  const base = {
72
89
  label: config.label,
73
90
  key: config.key,
74
- type: "input",
91
+ type,
92
+ formItem: config.formItem,
75
93
  rules: normalizeRules(config),
76
94
  attrs: config.attrs
77
95
  };
78
96
  return base;
79
97
  },
98
+ input(config) {
99
+ return this._create("input", config);
100
+ },
80
101
  number(config) {
81
- return {
82
- label: config.label,
83
- key: config.key,
84
- type: "number",
85
- rules: normalizeRules(config),
86
- attrs: config.attrs
87
- };
102
+ return this._create("number", config);
88
103
  },
89
104
  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
- };
105
+ return this._create("select", config);
98
106
  },
99
107
  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;
108
+ return this._create("radio", config);
109
109
  },
110
110
  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;
111
+ return this._create("radioButton", config);
120
112
  },
121
113
  switch(config) {
122
- return {
123
- label: config.label,
124
- key: config.key,
125
- type: "switch",
126
- attrs: config.attrs,
127
- rules: normalizeRules(config)
128
- };
114
+ return this._create("switch", config);
129
115
  },
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
116
  time(config) {
140
- return {
141
- label: config.label,
142
- key: config.key,
143
- type: "datetimePicker",
144
- attrs: config.attrs,
145
- rules: normalizeRules(config)
146
- };
117
+ return this._create("datetimePicker", config);
147
118
  },
148
119
  color(config) {
149
- return {
150
- label: config.label,
151
- key: config.key,
152
- type: "colorPicker",
153
- attrs: config.attrs,
154
- rules: normalizeRules(config)
155
- };
120
+ return this._create("colorPicker", config);
156
121
  },
157
122
  custom(config) {
158
- return {
159
- label: config.label,
160
- key: config.key,
161
- name: config.type,
123
+ const res = __spreadProps(__spreadValues({}, this._create("custom", config)), {
162
124
  type: "custom",
163
- attrs: config.attrs,
164
- rules: normalizeRules(config)
165
- };
125
+ name: config.type
126
+ });
127
+ return res;
166
128
  },
167
129
  styleNumber(config) {
168
- return {
169
- label: config.label,
170
- key: config.key,
171
- type: "styleNumber",
172
- rules: normalizeRules(config)
173
- };
130
+ return this._create("styleNumber", config);
174
131
  }
175
132
  };
176
133
  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-xF5X82JJ.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-xF5X82JJ.js';
6
6
  import 'vue';
7
7
  import 'async-validator';
@@ -4,13 +4,13 @@ import {
4
4
  } from "../chunk-W776G2UQ.js";
5
5
  import {
6
6
  schema
7
- } from "../chunk-ZYXSKUF4.js";
7
+ } from "../chunk-2KTF7TW7.js";
8
8
  import {
9
9
  widget,
10
10
  widgetType
11
11
  } from "../chunk-VRAKS4JU.js";
12
12
  import "../chunk-XJ2IJHKH.js";
13
- import "../chunk-HJO26HIQ.js";
13
+ import "../chunk-6FNC3XMI.js";
14
14
  export {
15
15
  EventEmitter,
16
16
  schema,
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
23
  var __export = (target, all) => {
7
24
  for (var name in all)
8
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -31,110 +48,50 @@ function likeArray(val) {
31
48
 
32
49
  // src/helper/schema.ts
33
50
  var schema = {
34
- input(config) {
51
+ _create(type, config) {
35
52
  const base = {
36
53
  label: config.label,
37
54
  key: config.key,
38
- type: "input",
55
+ type,
56
+ formItem: config.formItem,
39
57
  rules: normalizeRules(config),
40
58
  attrs: config.attrs
41
59
  };
42
60
  return base;
43
61
  },
62
+ input(config) {
63
+ return this._create("input", config);
64
+ },
44
65
  number(config) {
45
- return {
46
- label: config.label,
47
- key: config.key,
48
- type: "number",
49
- rules: normalizeRules(config),
50
- attrs: config.attrs
51
- };
66
+ return this._create("number", config);
52
67
  },
53
68
  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
- };
69
+ return this._create("select", config);
62
70
  },
63
71
  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;
72
+ return this._create("radio", config);
73
73
  },
74
74
  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;
75
+ return this._create("radioButton", config);
84
76
  },
85
77
  switch(config) {
86
- return {
87
- label: config.label,
88
- key: config.key,
89
- type: "switch",
90
- attrs: config.attrs,
91
- rules: normalizeRules(config)
92
- };
78
+ return this._create("switch", config);
93
79
  },
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
80
  time(config) {
104
- return {
105
- label: config.label,
106
- key: config.key,
107
- type: "datetimePicker",
108
- attrs: config.attrs,
109
- rules: normalizeRules(config)
110
- };
81
+ return this._create("datetimePicker", config);
111
82
  },
112
83
  color(config) {
113
- return {
114
- label: config.label,
115
- key: config.key,
116
- type: "colorPicker",
117
- attrs: config.attrs,
118
- rules: normalizeRules(config)
119
- };
84
+ return this._create("colorPicker", config);
120
85
  },
121
86
  custom(config) {
122
- return {
123
- label: config.label,
124
- key: config.key,
125
- name: config.type,
87
+ const res = __spreadProps(__spreadValues({}, this._create("custom", config)), {
126
88
  type: "custom",
127
- attrs: config.attrs,
128
- rules: normalizeRules(config)
129
- };
89
+ name: config.type
90
+ });
91
+ return res;
130
92
  },
131
93
  styleNumber(config) {
132
- return {
133
- label: config.label,
134
- key: config.key,
135
- type: "styleNumber",
136
- rules: normalizeRules(config)
137
- };
94
+ return this._create("styleNumber", config);
138
95
  }
139
96
  };
140
97
  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 { l as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-xF5X82JJ.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 { l as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-xF5X82JJ.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,8 +1,8 @@
1
1
  import {
2
2
  schema
3
- } from "../chunk-ZYXSKUF4.js";
3
+ } from "../chunk-2KTF7TW7.js";
4
4
  import "../chunk-XJ2IJHKH.js";
5
- import "../chunk-HJO26HIQ.js";
5
+ import "../chunk-6FNC3XMI.js";
6
6
  export {
7
7
  schema
8
8
  };
@@ -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, l as SchemaItem, W as WidgetPos, B as Base } from '../Widget-xF5X82JJ.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, l as SchemaItem, W as WidgetPos, B as Base } from '../Widget-xF5X82JJ.js';
2
2
  import * as vue from 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -2,7 +2,7 @@ import {
2
2
  widget,
3
3
  widgetType
4
4
  } from "../chunk-VRAKS4JU.js";
5
- import "../chunk-HJO26HIQ.js";
5
+ import "../chunk-6FNC3XMI.js";
6
6
  export {
7
7
  widget,
8
8
  widgetType
package/dist/index.cjs CHANGED
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
23
  var __export = (target, all) => {
7
24
  for (var name in all)
8
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -71,110 +88,50 @@ function likeArray(val) {
71
88
 
72
89
  // src/helper/schema.ts
73
90
  var schema = {
74
- input(config) {
91
+ _create(type, config) {
75
92
  const base = {
76
93
  label: config.label,
77
94
  key: config.key,
78
- type: "input",
95
+ type,
96
+ formItem: config.formItem,
79
97
  rules: normalizeRules(config),
80
98
  attrs: config.attrs
81
99
  };
82
100
  return base;
83
101
  },
102
+ input(config) {
103
+ return this._create("input", config);
104
+ },
84
105
  number(config) {
85
- return {
86
- label: config.label,
87
- key: config.key,
88
- type: "number",
89
- rules: normalizeRules(config),
90
- attrs: config.attrs
91
- };
106
+ return this._create("number", config);
92
107
  },
93
108
  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
- };
109
+ return this._create("select", config);
102
110
  },
103
111
  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;
112
+ return this._create("radio", config);
113
113
  },
114
114
  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;
115
+ return this._create("radioButton", config);
124
116
  },
125
117
  switch(config) {
126
- return {
127
- label: config.label,
128
- key: config.key,
129
- type: "switch",
130
- attrs: config.attrs,
131
- rules: normalizeRules(config)
132
- };
118
+ return this._create("switch", config);
133
119
  },
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
120
  time(config) {
144
- return {
145
- label: config.label,
146
- key: config.key,
147
- type: "datetimePicker",
148
- attrs: config.attrs,
149
- rules: normalizeRules(config)
150
- };
121
+ return this._create("datetimePicker", config);
151
122
  },
152
123
  color(config) {
153
- return {
154
- label: config.label,
155
- key: config.key,
156
- type: "colorPicker",
157
- attrs: config.attrs,
158
- rules: normalizeRules(config)
159
- };
124
+ return this._create("colorPicker", config);
160
125
  },
161
126
  custom(config) {
162
- return {
163
- label: config.label,
164
- key: config.key,
165
- name: config.type,
127
+ const res = __spreadProps(__spreadValues({}, this._create("custom", config)), {
166
128
  type: "custom",
167
- attrs: config.attrs,
168
- rules: normalizeRules(config)
169
- };
129
+ name: config.type
130
+ });
131
+ return res;
170
132
  },
171
133
  styleNumber(config) {
172
- return {
173
- label: config.label,
174
- key: config.key,
175
- type: "styleNumber",
176
- rules: normalizeRules(config)
177
- };
134
+ return this._create("styleNumber", config);
178
135
  }
179
136
  };
180
137
  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-xF5X82JJ.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-xF5X82JJ.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-2KTF7TW7.js";
8
8
  import {
9
9
  widget,
10
10
  widgetType
@@ -20,7 +20,7 @@ import {
20
20
  isBox
21
21
  } from "./chunk-4QIIKQ6B.js";
22
22
  import "./chunk-XJ2IJHKH.js";
23
- import "./chunk-HJO26HIQ.js";
23
+ import "./chunk-6FNC3XMI.js";
24
24
  export {
25
25
  EventEmitter,
26
26
  createCopy,
@@ -1,6 +1,6 @@
1
1
  import { Node } from './class/Node.cjs';
2
2
  import 'vue';
3
- import './Widget-Dfw3PnBq.cjs';
3
+ import './Widget-xF5X82JJ.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-xF5X82JJ.js';
4
4
  import 'element-plus';
5
5
  import 'async-validator';
6
6
 
package/dist/internal.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  createCopy,
3
3
  createDelete
4
4
  } from "./chunk-TM53N6AZ.js";
5
- import "./chunk-HJO26HIQ.js";
5
+ import "./chunk-6FNC3XMI.js";
6
6
  export {
7
7
  createCopy,
8
8
  createDelete
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-xF5X82JJ.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-xF5X82JJ.js';
5
5
  import 'element-plus';
6
6
  import 'async-validator';
7
7
 
package/dist/tokens.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  editorContextKey
3
3
  } from "./chunk-D2MSIUE2.js";
4
- import "./chunk-HJO26HIQ.js";
4
+ import "./chunk-6FNC3XMI.js";
5
5
  export {
6
6
  editorContextKey
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-xF5X82JJ.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-xF5X82JJ.js';
4
4
  import 'async-validator';
package/dist/types.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isBox
3
3
  } from "./chunk-4QIIKQ6B.js";
4
- import "./chunk-HJO26HIQ.js";
4
+ import "./chunk-6FNC3XMI.js";
5
5
  export {
6
6
  isBox
7
7
  };
package/dist/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  likeArray
3
3
  } from "./chunk-XJ2IJHKH.js";
4
- import "./chunk-HJO26HIQ.js";
4
+ import "./chunk-6FNC3XMI.js";
5
5
  export {
6
6
  likeArray
7
7
  };
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.6",
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
- };