@sepveneto/dnde-core 0.5.1 → 0.6.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.
Files changed (40) hide show
  1. package/dist/{Widget-B-BAQlzv.d.cts → Node-BkpRtlvx.d.cts} +76 -2
  2. package/dist/{Widget-B-BAQlzv.d.ts → Node-BkpRtlvx.d.ts} +76 -2
  3. package/dist/{chunk-VRAKS4JU.js → chunk-3HT56K6Y.js} +2 -1
  4. package/dist/{chunk-LTDSWBOW.js → chunk-CI6CS5LG.js} +9 -0
  5. package/dist/{chunk-XDF4SBRY.js → chunk-VLEUQG7E.js} +1 -1
  6. package/dist/class/Container.cjs +19 -0
  7. package/dist/class/Container.d.cts +2 -2
  8. package/dist/class/Container.d.ts +2 -2
  9. package/dist/class/Container.js +2 -2
  10. package/dist/class/Node.d.cts +2 -52
  11. package/dist/class/Node.d.ts +2 -52
  12. package/dist/class/Widget.cjs +19 -0
  13. package/dist/class/Widget.d.cts +1 -1
  14. package/dist/class/Widget.d.ts +1 -1
  15. package/dist/class/Widget.js +1 -1
  16. package/dist/class/index.cjs +5 -0
  17. package/dist/class/index.d.cts +1 -2
  18. package/dist/class/index.d.ts +1 -2
  19. package/dist/class/index.js +2 -2
  20. package/dist/helper/index.cjs +2 -1
  21. package/dist/helper/index.d.cts +1 -1
  22. package/dist/helper/index.d.ts +1 -1
  23. package/dist/helper/index.js +1 -1
  24. package/dist/helper/schema.d.cts +1 -1
  25. package/dist/helper/schema.d.ts +1 -1
  26. package/dist/helper/widget.cjs +2 -1
  27. package/dist/helper/widget.d.cts +4 -1
  28. package/dist/helper/widget.d.ts +4 -1
  29. package/dist/helper/widget.js +1 -1
  30. package/dist/index.cjs +2 -1
  31. package/dist/index.d.cts +1 -2
  32. package/dist/index.d.ts +1 -2
  33. package/dist/index.js +1 -1
  34. package/dist/internal.d.cts +1 -2
  35. package/dist/internal.d.ts +1 -2
  36. package/dist/tokens.d.cts +9 -2
  37. package/dist/tokens.d.ts +9 -2
  38. package/dist/types.d.cts +1 -1
  39. package/dist/types.d.ts +1 -1
  40. package/package.json +4 -3
@@ -1,6 +1,6 @@
1
- import { FormItemRule, UploadRequestOptions, FormItemProps, InputProps, ElOption, SelectProps, InputNumberProps, SwitchProps, RadioGroupProps, ElRadio, ElRadioButton, DatePickerProps, ColorPickerProps, CheckboxProps } from 'element-plus';
2
1
  import * as vue from 'vue';
3
2
  import { CSSProperties } from 'vue';
3
+ import { FormItemRule, UploadRequestOptions, FormItemProps, InputProps, ElOption, SelectProps, InputNumberProps, SwitchProps, RadioGroupProps, ElRadio, ElRadioButton, DatePickerProps, ColorPickerProps, CheckboxProps } from 'element-plus';
4
4
  import Validator from 'async-validator';
5
5
 
6
6
  interface WidgetPos {
@@ -9,6 +9,30 @@ interface WidgetPos {
9
9
  width?: number;
10
10
  height?: number;
11
11
  }
12
+ /** 布局子 Agent 的输出项:选中的组件 + 要放进去的元素 */
13
+ interface WidgetLayoutItem {
14
+ widget: string;
15
+ items: Array<{
16
+ category: string;
17
+ id: any;
18
+ }>;
19
+ }
20
+ interface WidgetAgent {
21
+ description: string;
22
+ layout?: {
23
+ direction: 'row' | 'column';
24
+ density: 'low' | 'medium' | 'high';
25
+ priority: 'large';
26
+ };
27
+ /**
28
+ * 布局子 Agent 结束、组件创建完成后,由业务侧决定数据如何更新到组件里。
29
+ *
30
+ * @param node 已创建的组件节点
31
+ * @param item 布局结果项(选中的组件 + 元素引用)
32
+ * @param data 生成布局用到的业务数据
33
+ */
34
+ update?: (node: Node, item: WidgetLayoutItem, data: Record<string, any>) => void;
35
+ }
12
36
  interface Base {
13
37
  _uuid?: string;
14
38
  _name: string;
@@ -27,6 +51,7 @@ interface Base {
27
51
  };
28
52
  style?: CSSProperties & WidgetPos;
29
53
  data?: Record<string, any> | any[];
54
+ agent?: WidgetAgent;
30
55
  }
31
56
  type BaseKey = '_inContainer' | '_custom' | '_disableDel' | '_name' | '_schema' | '_uuid' | '_view';
32
57
  type IWidget = Base;
@@ -204,6 +229,7 @@ declare class Widget {
204
229
  get style(): SchemaItem[];
205
230
  get defaultStyle(): (vue.CSSProperties & WidgetPos) | undefined;
206
231
  get defaultData(): any[] | Record<string, any> | undefined;
232
+ get agent(): WidgetAgent | undefined;
207
233
  get draggable(): boolean;
208
234
  get isFixed(): false | "header" | "footer" | undefined;
209
235
  get visible(): boolean;
@@ -211,4 +237,52 @@ declare class Widget {
211
237
  get validatorStyle(): Validator;
212
238
  }
213
239
 
214
- 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 };
240
+ declare class Node {
241
+ level: number;
242
+ wid: string;
243
+ widget: Readonly<Widget>;
244
+ parent?: Node;
245
+ list: Node[];
246
+ data: Record<string, any>;
247
+ style: CSSProperties;
248
+ hovering: boolean;
249
+ dragging: boolean;
250
+ constructor(widget: Widget, info?: {
251
+ uuid?: string;
252
+ props?: Node['data'];
253
+ style?: Node['style'];
254
+ list?: Node['list'];
255
+ });
256
+ get info(): {
257
+ style: CSSProperties;
258
+ };
259
+ get isContainer(): boolean;
260
+ get hasList(): boolean;
261
+ get mouseover(): boolean;
262
+ get type(): string;
263
+ get name(): string;
264
+ get visible(): boolean | undefined;
265
+ validate(only?: boolean): Promise<string | undefined>;
266
+ triggerHover(hover: boolean): void;
267
+ setList(list: Node[]): void;
268
+ copy(): Node;
269
+ parse(): Record<string, any>;
270
+ }
271
+ declare class RootNode {
272
+ level: number;
273
+ wid: string;
274
+ widget: Readonly<Widget>;
275
+ parent?: Node;
276
+ list: any[];
277
+ data: Record<string, any>;
278
+ style: CSSProperties;
279
+ hovering: boolean;
280
+ dragging: boolean;
281
+ constructor(widget: Widget, info?: {
282
+ props?: Node['data'];
283
+ style?: Node['style'];
284
+ list?: Node['list'];
285
+ });
286
+ }
287
+
288
+ export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, Node as N, type Option as O, type RadioOption as R, type SchemaOther as S, type WidgetPos as W, type WidgetLayoutItem as a, type WidgetAgent as b, type SchemaBox as c, type ISchema as d, type EditorSchema as e, type EditorWidget as f, type EditorRoute as g, type EditorWidgets as h, isBox as i, type EditorSettings as j, type EditorData as k, type SchemaItem as l, type RadioButtonOption as m, Widget as n, RootNode as o, type SchemaItemCustom as p };
@@ -1,6 +1,6 @@
1
- import { FormItemRule, UploadRequestOptions, FormItemProps, InputProps, ElOption, SelectProps, InputNumberProps, SwitchProps, RadioGroupProps, ElRadio, ElRadioButton, DatePickerProps, ColorPickerProps, CheckboxProps } from 'element-plus';
2
1
  import * as vue from 'vue';
3
2
  import { CSSProperties } from 'vue';
3
+ import { FormItemRule, UploadRequestOptions, FormItemProps, InputProps, ElOption, SelectProps, InputNumberProps, SwitchProps, RadioGroupProps, ElRadio, ElRadioButton, DatePickerProps, ColorPickerProps, CheckboxProps } from 'element-plus';
4
4
  import Validator from 'async-validator';
5
5
 
6
6
  interface WidgetPos {
@@ -9,6 +9,30 @@ interface WidgetPos {
9
9
  width?: number;
10
10
  height?: number;
11
11
  }
12
+ /** 布局子 Agent 的输出项:选中的组件 + 要放进去的元素 */
13
+ interface WidgetLayoutItem {
14
+ widget: string;
15
+ items: Array<{
16
+ category: string;
17
+ id: any;
18
+ }>;
19
+ }
20
+ interface WidgetAgent {
21
+ description: string;
22
+ layout?: {
23
+ direction: 'row' | 'column';
24
+ density: 'low' | 'medium' | 'high';
25
+ priority: 'large';
26
+ };
27
+ /**
28
+ * 布局子 Agent 结束、组件创建完成后,由业务侧决定数据如何更新到组件里。
29
+ *
30
+ * @param node 已创建的组件节点
31
+ * @param item 布局结果项(选中的组件 + 元素引用)
32
+ * @param data 生成布局用到的业务数据
33
+ */
34
+ update?: (node: Node, item: WidgetLayoutItem, data: Record<string, any>) => void;
35
+ }
12
36
  interface Base {
13
37
  _uuid?: string;
14
38
  _name: string;
@@ -27,6 +51,7 @@ interface Base {
27
51
  };
28
52
  style?: CSSProperties & WidgetPos;
29
53
  data?: Record<string, any> | any[];
54
+ agent?: WidgetAgent;
30
55
  }
31
56
  type BaseKey = '_inContainer' | '_custom' | '_disableDel' | '_name' | '_schema' | '_uuid' | '_view';
32
57
  type IWidget = Base;
@@ -204,6 +229,7 @@ declare class Widget {
204
229
  get style(): SchemaItem[];
205
230
  get defaultStyle(): (vue.CSSProperties & WidgetPos) | undefined;
206
231
  get defaultData(): any[] | Record<string, any> | undefined;
232
+ get agent(): WidgetAgent | undefined;
207
233
  get draggable(): boolean;
208
234
  get isFixed(): false | "header" | "footer" | undefined;
209
235
  get visible(): boolean;
@@ -211,4 +237,52 @@ declare class Widget {
211
237
  get validatorStyle(): Validator;
212
238
  }
213
239
 
214
- 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 };
240
+ declare class Node {
241
+ level: number;
242
+ wid: string;
243
+ widget: Readonly<Widget>;
244
+ parent?: Node;
245
+ list: Node[];
246
+ data: Record<string, any>;
247
+ style: CSSProperties;
248
+ hovering: boolean;
249
+ dragging: boolean;
250
+ constructor(widget: Widget, info?: {
251
+ uuid?: string;
252
+ props?: Node['data'];
253
+ style?: Node['style'];
254
+ list?: Node['list'];
255
+ });
256
+ get info(): {
257
+ style: CSSProperties;
258
+ };
259
+ get isContainer(): boolean;
260
+ get hasList(): boolean;
261
+ get mouseover(): boolean;
262
+ get type(): string;
263
+ get name(): string;
264
+ get visible(): boolean | undefined;
265
+ validate(only?: boolean): Promise<string | undefined>;
266
+ triggerHover(hover: boolean): void;
267
+ setList(list: Node[]): void;
268
+ copy(): Node;
269
+ parse(): Record<string, any>;
270
+ }
271
+ declare class RootNode {
272
+ level: number;
273
+ wid: string;
274
+ widget: Readonly<Widget>;
275
+ parent?: Node;
276
+ list: any[];
277
+ data: Record<string, any>;
278
+ style: CSSProperties;
279
+ hovering: boolean;
280
+ dragging: boolean;
281
+ constructor(widget: Widget, info?: {
282
+ props?: Node['data'];
283
+ style?: Node['style'];
284
+ list?: Node['list'];
285
+ });
286
+ }
287
+
288
+ export { type Base as B, type DisabledItemFn as D, type EditorConfig as E, type IWidget as I, Node as N, type Option as O, type RadioOption as R, type SchemaOther as S, type WidgetPos as W, type WidgetLayoutItem as a, type WidgetAgent as b, type SchemaBox as c, type ISchema as d, type EditorSchema as e, type EditorWidget as f, type EditorRoute as g, type EditorWidgets as h, isBox as i, type EditorSettings as j, type EditorData as k, type SchemaItem as l, type RadioButtonOption as m, Widget as n, RootNode as o, type SchemaItemCustom as p };
@@ -31,7 +31,8 @@ var widget = {
31
31
  style: config.stylesheet
32
32
  },
33
33
  style: config.defaultStyle,
34
- data: config.defaultData
34
+ data: config.defaultData,
35
+ agent: config.agent
35
36
  };
36
37
  },
37
38
  group(name, list) {
@@ -1,8 +1,14 @@
1
+ import {
2
+ __spreadValues
3
+ } from "./chunk-6FNC3XMI.js";
4
+
1
5
  // src/class/Widget.ts
2
6
  import Validator from "async-validator";
3
7
  var Widget = class _Widget {
4
8
  constructor(widget) {
5
9
  this._data = JSON.parse(JSON.stringify(widget));
10
+ if (widget.agent)
11
+ this._data.agent = __spreadValues({}, widget.agent);
6
12
  this.name = widget._name;
7
13
  this.view = widget._view;
8
14
  this.container = widget.container;
@@ -27,6 +33,9 @@ var Widget = class _Widget {
27
33
  get defaultData() {
28
34
  return this._data.data;
29
35
  }
36
+ get agent() {
37
+ return this._data.agent;
38
+ }
30
39
  get draggable() {
31
40
  var _a, _b;
32
41
  return (_b = (_a = this._data.meta) == null ? void 0 : _a.draggable) != null ? _b : true;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Widget
3
- } from "./chunk-LTDSWBOW.js";
3
+ } from "./chunk-CI6CS5LG.js";
4
4
 
5
5
  // src/class/Container.ts
6
6
  var Container = class extends Widget {
@@ -3,8 +3,22 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
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
+ };
8
22
  var __export = (target, all) => {
9
23
  for (var name in all)
10
24
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -39,6 +53,8 @@ var import_async_validator = __toESM(require("async-validator"), 1);
39
53
  var Widget = class _Widget {
40
54
  constructor(widget) {
41
55
  this._data = JSON.parse(JSON.stringify(widget));
56
+ if (widget.agent)
57
+ this._data.agent = __spreadValues({}, widget.agent);
42
58
  this.name = widget._name;
43
59
  this.view = widget._view;
44
60
  this.container = widget.container;
@@ -63,6 +79,9 @@ var Widget = class _Widget {
63
79
  get defaultData() {
64
80
  return this._data.data;
65
81
  }
82
+ get agent() {
83
+ return this._data.agent;
84
+ }
66
85
  get draggable() {
67
86
  var _a, _b;
68
87
  return (_b = (_a = this._data.meta) == null ? void 0 : _a.draggable) != null ? _b : true;
@@ -1,6 +1,6 @@
1
- import { m as Widget, I as IWidget } from '../Widget-B-BAQlzv.cjs';
2
- import 'element-plus';
1
+ import { n as Widget, I as IWidget } from '../Node-BkpRtlvx.cjs';
3
2
  import 'vue';
3
+ import 'element-plus';
4
4
  import 'async-validator';
5
5
 
6
6
  declare class Container extends Widget {
@@ -1,6 +1,6 @@
1
- import { m as Widget, I as IWidget } from '../Widget-B-BAQlzv.js';
2
- import 'element-plus';
1
+ import { n as Widget, I as IWidget } from '../Node-BkpRtlvx.js';
3
2
  import 'vue';
3
+ import 'element-plus';
4
4
  import 'async-validator';
5
5
 
6
6
  declare class Container extends Widget {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Container
3
- } from "../chunk-XDF4SBRY.js";
4
- import "../chunk-LTDSWBOW.js";
3
+ } from "../chunk-VLEUQG7E.js";
4
+ import "../chunk-CI6CS5LG.js";
5
5
  import "../chunk-6FNC3XMI.js";
6
6
  export {
7
7
  Container
@@ -1,54 +1,4 @@
1
- import { CSSProperties } from 'vue';
2
- import { m as Widget } from '../Widget-B-BAQlzv.cjs';
1
+ import 'vue';
2
+ export { N as Node, o as RootNode } from '../Node-BkpRtlvx.cjs';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
5
-
6
- declare class Node {
7
- level: number;
8
- wid: string;
9
- widget: Readonly<Widget>;
10
- parent?: Node;
11
- list: Node[];
12
- data: Record<string, any>;
13
- style: CSSProperties;
14
- hovering: boolean;
15
- dragging: boolean;
16
- constructor(widget: Widget, info?: {
17
- uuid?: string;
18
- props?: Node['data'];
19
- style?: Node['style'];
20
- list?: Node['list'];
21
- });
22
- get info(): {
23
- style: CSSProperties;
24
- };
25
- get isContainer(): boolean;
26
- get hasList(): boolean;
27
- get mouseover(): boolean;
28
- get type(): string;
29
- get name(): string;
30
- get visible(): boolean | undefined;
31
- validate(only?: boolean): Promise<string | undefined>;
32
- triggerHover(hover: boolean): void;
33
- setList(list: Node[]): void;
34
- copy(): Node;
35
- parse(): Record<string, any>;
36
- }
37
- declare class RootNode {
38
- level: number;
39
- wid: string;
40
- widget: Readonly<Widget>;
41
- parent?: Node;
42
- list: any[];
43
- data: Record<string, any>;
44
- style: CSSProperties;
45
- hovering: boolean;
46
- dragging: boolean;
47
- constructor(widget: Widget, info?: {
48
- props?: Node['data'];
49
- style?: Node['style'];
50
- list?: Node['list'];
51
- });
52
- }
53
-
54
- export { Node, RootNode };
@@ -1,54 +1,4 @@
1
- import { CSSProperties } from 'vue';
2
- import { m as Widget } from '../Widget-B-BAQlzv.js';
1
+ import 'vue';
2
+ export { N as Node, o as RootNode } from '../Node-BkpRtlvx.js';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
5
-
6
- declare class Node {
7
- level: number;
8
- wid: string;
9
- widget: Readonly<Widget>;
10
- parent?: Node;
11
- list: Node[];
12
- data: Record<string, any>;
13
- style: CSSProperties;
14
- hovering: boolean;
15
- dragging: boolean;
16
- constructor(widget: Widget, info?: {
17
- uuid?: string;
18
- props?: Node['data'];
19
- style?: Node['style'];
20
- list?: Node['list'];
21
- });
22
- get info(): {
23
- style: CSSProperties;
24
- };
25
- get isContainer(): boolean;
26
- get hasList(): boolean;
27
- get mouseover(): boolean;
28
- get type(): string;
29
- get name(): string;
30
- get visible(): boolean | undefined;
31
- validate(only?: boolean): Promise<string | undefined>;
32
- triggerHover(hover: boolean): void;
33
- setList(list: Node[]): void;
34
- copy(): Node;
35
- parse(): Record<string, any>;
36
- }
37
- declare class RootNode {
38
- level: number;
39
- wid: string;
40
- widget: Readonly<Widget>;
41
- parent?: Node;
42
- list: any[];
43
- data: Record<string, any>;
44
- style: CSSProperties;
45
- hovering: boolean;
46
- dragging: boolean;
47
- constructor(widget: Widget, info?: {
48
- props?: Node['data'];
49
- style?: Node['style'];
50
- list?: Node['list'];
51
- });
52
- }
53
-
54
- export { Node, RootNode };
@@ -3,8 +3,22 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
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
+ };
8
22
  var __export = (target, all) => {
9
23
  for (var name in all)
10
24
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -37,6 +51,8 @@ var import_async_validator = __toESM(require("async-validator"), 1);
37
51
  var Widget = class _Widget {
38
52
  constructor(widget) {
39
53
  this._data = JSON.parse(JSON.stringify(widget));
54
+ if (widget.agent)
55
+ this._data.agent = __spreadValues({}, widget.agent);
40
56
  this.name = widget._name;
41
57
  this.view = widget._view;
42
58
  this.container = widget.container;
@@ -61,6 +77,9 @@ var Widget = class _Widget {
61
77
  get defaultData() {
62
78
  return this._data.data;
63
79
  }
80
+ get agent() {
81
+ return this._data.agent;
82
+ }
64
83
  get draggable() {
65
84
  var _a, _b;
66
85
  return (_b = (_a = this._data.meta) == null ? void 0 : _a.draggable) != null ? _b : true;
@@ -1,4 +1,4 @@
1
- export { O as Option, j as RadioButtonOption, R as RadioOption, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-B-BAQlzv.cjs';
1
+ export { O as Option, m as RadioButtonOption, R as RadioOption, l as SchemaItem, p as SchemaItemCustom, n as Widget } from '../Node-BkpRtlvx.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, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-B-BAQlzv.js';
1
+ export { O as Option, m as RadioButtonOption, R as RadioOption, l as SchemaItem, p as SchemaItemCustom, n as Widget } from '../Node-BkpRtlvx.js';
2
2
  import 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Widget
3
- } from "../chunk-LTDSWBOW.js";
3
+ } from "../chunk-CI6CS5LG.js";
4
4
  import "../chunk-6FNC3XMI.js";
5
5
  export {
6
6
  Widget
@@ -76,6 +76,8 @@ var import_async_validator = __toESM(require("async-validator"), 1);
76
76
  var Widget = class _Widget {
77
77
  constructor(widget) {
78
78
  this._data = JSON.parse(JSON.stringify(widget));
79
+ if (widget.agent)
80
+ this._data.agent = __spreadValues({}, widget.agent);
79
81
  this.name = widget._name;
80
82
  this.view = widget._view;
81
83
  this.container = widget.container;
@@ -100,6 +102,9 @@ var Widget = class _Widget {
100
102
  get defaultData() {
101
103
  return this._data.data;
102
104
  }
105
+ get agent() {
106
+ return this._data.agent;
107
+ }
103
108
  get draggable() {
104
109
  var _a, _b;
105
110
  return (_b = (_a = this._data.meta) == null ? void 0 : _a.draggable) != null ? _b : true;
@@ -1,6 +1,5 @@
1
1
  export { Container } from './Container.cjs';
2
- export { Node, RootNode } from './Node.cjs';
3
- export { O as Option, j as RadioButtonOption, R as RadioOption, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-B-BAQlzv.cjs';
2
+ export { N as Node, O as Option, m as RadioButtonOption, R as RadioOption, o as RootNode, l as SchemaItem, p as SchemaItemCustom, n as Widget } from '../Node-BkpRtlvx.cjs';
4
3
  import 'vue';
5
4
  import 'element-plus';
6
5
  import 'async-validator';
@@ -1,6 +1,5 @@
1
1
  export { Container } from './Container.js';
2
- export { Node, RootNode } from './Node.js';
3
- export { O as Option, j as RadioButtonOption, R as RadioOption, l as SchemaItem, k as SchemaItemCustom, m as Widget } from '../Widget-B-BAQlzv.js';
2
+ export { N as Node, O as Option, m as RadioButtonOption, R as RadioOption, o as RootNode, l as SchemaItem, p as SchemaItemCustom, n as Widget } from '../Node-BkpRtlvx.js';
4
3
  import 'vue';
5
4
  import 'element-plus';
6
5
  import 'async-validator';
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Container
3
- } from "../chunk-XDF4SBRY.js";
3
+ } from "../chunk-VLEUQG7E.js";
4
4
  import {
5
5
  Node,
6
6
  RootNode
7
7
  } from "../chunk-KJZSF66T.js";
8
8
  import {
9
9
  Widget
10
- } from "../chunk-LTDSWBOW.js";
10
+ } from "../chunk-CI6CS5LG.js";
11
11
  import "../chunk-6FNC3XMI.js";
12
12
  export {
13
13
  Container,
@@ -195,7 +195,8 @@ var widget = {
195
195
  style: config.stylesheet
196
196
  },
197
197
  style: config.defaultStyle,
198
- data: config.defaultData
198
+ data: config.defaultData,
199
+ agent: config.agent
199
200
  };
200
201
  },
201
202
  group(name, list) {
@@ -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-B-BAQlzv.cjs';
5
+ import '../Node-BkpRtlvx.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-B-BAQlzv.js';
5
+ import '../Node-BkpRtlvx.js';
6
6
  import 'vue';
7
7
  import 'async-validator';
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  widget,
10
10
  widgetType
11
- } from "../chunk-VRAKS4JU.js";
11
+ } from "../chunk-3HT56K6Y.js";
12
12
  import "../chunk-XJ2IJHKH.js";
13
13
  import "../chunk-6FNC3XMI.js";
14
14
  export {
@@ -1,5 +1,5 @@
1
1
  import { FormItemProps, InputProps, InputNumberProps, CheckboxProps, SelectProps, RadioProps, RadioButtonProps, SwitchProps, DatePickerProps, ColorPickerProps } from 'element-plus';
2
- import { l as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-B-BAQlzv.cjs';
2
+ import { l as SchemaItem, O as Option, R as RadioOption, m as RadioButtonOption } from '../Node-BkpRtlvx.cjs';
3
3
  import 'vue';
4
4
  import 'async-validator';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { FormItemProps, InputProps, InputNumberProps, CheckboxProps, SelectProps, RadioProps, RadioButtonProps, SwitchProps, DatePickerProps, ColorPickerProps } from 'element-plus';
2
- import { l as SchemaItem, O as Option, R as RadioOption, j as RadioButtonOption } from '../Widget-B-BAQlzv.js';
2
+ import { l as SchemaItem, O as Option, R as RadioOption, m as RadioButtonOption } from '../Node-BkpRtlvx.js';
3
3
  import 'vue';
4
4
  import 'async-validator';
5
5
 
@@ -56,7 +56,8 @@ var widget = {
56
56
  style: config.stylesheet
57
57
  },
58
58
  style: config.defaultStyle,
59
- data: config.defaultData
59
+ data: config.defaultData,
60
+ agent: config.agent
60
61
  };
61
62
  },
62
63
  group(name, list) {
@@ -1,4 +1,4 @@
1
- import { I as IWidget, l as SchemaItem, W as WidgetPos, B as Base } from '../Widget-B-BAQlzv.cjs';
1
+ import { I as IWidget, l as SchemaItem, W as WidgetPos, b as WidgetAgent, B as Base } from '../Node-BkpRtlvx.cjs';
2
2
  import * as vue from 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -17,6 +17,7 @@ interface CWidget {
17
17
  defaultData?: Record<string, any>;
18
18
  attributes?: SchemaItem[];
19
19
  stylesheet?: SchemaItem[];
20
+ agent?: IWidget['agent'];
20
21
  }
21
22
  interface RootWidget {
22
23
  name?: IWidget['_name'];
@@ -51,6 +52,7 @@ declare const widget: {
51
52
  };
52
53
  style: (vue.CSSProperties & WidgetPos) | undefined;
53
54
  data: Record<string, any> | undefined;
55
+ agent: WidgetAgent | undefined;
54
56
  };
55
57
  group(name: string, list: IWidget[]): {
56
58
  type: widgetType;
@@ -78,6 +80,7 @@ declare const widget: {
78
80
  };
79
81
  style: (vue.CSSProperties & WidgetPos) | undefined;
80
82
  data: Record<string, any> | undefined;
83
+ agent: WidgetAgent | undefined;
81
84
  };
82
85
  };
83
86
 
@@ -1,4 +1,4 @@
1
- import { I as IWidget, l as SchemaItem, W as WidgetPos, B as Base } from '../Widget-B-BAQlzv.js';
1
+ import { I as IWidget, l as SchemaItem, W as WidgetPos, b as WidgetAgent, B as Base } from '../Node-BkpRtlvx.js';
2
2
  import * as vue from 'vue';
3
3
  import 'element-plus';
4
4
  import 'async-validator';
@@ -17,6 +17,7 @@ interface CWidget {
17
17
  defaultData?: Record<string, any>;
18
18
  attributes?: SchemaItem[];
19
19
  stylesheet?: SchemaItem[];
20
+ agent?: IWidget['agent'];
20
21
  }
21
22
  interface RootWidget {
22
23
  name?: IWidget['_name'];
@@ -51,6 +52,7 @@ declare const widget: {
51
52
  };
52
53
  style: (vue.CSSProperties & WidgetPos) | undefined;
53
54
  data: Record<string, any> | undefined;
55
+ agent: WidgetAgent | undefined;
54
56
  };
55
57
  group(name: string, list: IWidget[]): {
56
58
  type: widgetType;
@@ -78,6 +80,7 @@ declare const widget: {
78
80
  };
79
81
  style: (vue.CSSProperties & WidgetPos) | undefined;
80
82
  data: Record<string, any> | undefined;
83
+ agent: WidgetAgent | undefined;
81
84
  };
82
85
  };
83
86
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  widget,
3
3
  widgetType
4
- } from "../chunk-VRAKS4JU.js";
4
+ } from "../chunk-3HT56K6Y.js";
5
5
  import "../chunk-6FNC3XMI.js";
6
6
  export {
7
7
  widget,
package/dist/index.cjs CHANGED
@@ -199,7 +199,8 @@ var widget = {
199
199
  style: config.stylesheet
200
200
  },
201
201
  style: config.defaultStyle,
202
- data: config.defaultData
202
+ data: config.defaultData,
203
+ agent: config.agent
203
204
  };
204
205
  },
205
206
  group(name, list) {
package/dist/index.d.cts CHANGED
@@ -3,8 +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-B-BAQlzv.cjs';
6
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, k as EditorData, g as EditorRoute, e as EditorSchema, j as EditorSettings, f as EditorWidget, h as EditorWidgets, d as ISchema, I as IWidget, c as SchemaBox, S as SchemaOther, b as WidgetAgent, a as WidgetLayoutItem, W as WidgetPos, i as isBox } from './Node-BkpRtlvx.cjs';
7
7
  import 'element-plus';
8
8
  import 'vue';
9
- import './class/Node.cjs';
10
9
  import 'async-validator';
package/dist/index.d.ts CHANGED
@@ -3,8 +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-B-BAQlzv.js';
6
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, k as EditorData, g as EditorRoute, e as EditorSchema, j as EditorSettings, f as EditorWidget, h as EditorWidgets, d as ISchema, I as IWidget, c as SchemaBox, S as SchemaOther, b as WidgetAgent, a as WidgetLayoutItem, W as WidgetPos, i as isBox } from './Node-BkpRtlvx.js';
7
7
  import 'element-plus';
8
8
  import 'vue';
9
- import './class/Node.js';
10
9
  import 'async-validator';
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  widget,
10
10
  widgetType
11
- } from "./chunk-VRAKS4JU.js";
11
+ } from "./chunk-3HT56K6Y.js";
12
12
  import {
13
13
  createCopy,
14
14
  createDelete
@@ -1,6 +1,5 @@
1
- import { Node } from './class/Node.cjs';
1
+ import { N as Node } from './Node-BkpRtlvx.cjs';
2
2
  import 'vue';
3
- import './Widget-B-BAQlzv.cjs';
4
3
  import 'element-plus';
5
4
  import 'async-validator';
6
5
 
@@ -1,6 +1,5 @@
1
- import { Node } from './class/Node.js';
1
+ import { N as Node } from './Node-BkpRtlvx.js';
2
2
  import 'vue';
3
- import './Widget-B-BAQlzv.js';
4
3
  import 'element-plus';
5
4
  import 'async-validator';
6
5
 
package/dist/tokens.d.cts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { InjectionKey } from 'vue';
2
2
  import { EventEmitter } from './helper/EventEmitter.cjs';
3
- import { Node } from './class/Node.cjs';
4
- import './Widget-B-BAQlzv.cjs';
3
+ import { N as Node } from './Node-BkpRtlvx.cjs';
5
4
  import 'element-plus';
6
5
  import 'async-validator';
7
6
 
@@ -10,6 +9,14 @@ interface EditorContext {
10
9
  plugins?: any;
11
10
  bus: EventEmitter;
12
11
  extra: Record<string, any>;
12
+ /**
13
+ * 是否处于预览态,预览态下业务组件应禁用拖拽、缩放等编辑交互
14
+ */
15
+ preview?: boolean;
16
+ /**
17
+ * 业务组件在运行时修改自身配置后,通知编辑器同步数据 / 触发变更
18
+ */
19
+ updateConfig?: (data: any) => void;
13
20
  }
14
21
  declare const editorContextKey: InjectionKey<EditorContext>;
15
22
 
package/dist/tokens.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { InjectionKey } from 'vue';
2
2
  import { EventEmitter } from './helper/EventEmitter.js';
3
- import { Node } from './class/Node.js';
4
- import './Widget-B-BAQlzv.js';
3
+ import { N as Node } from './Node-BkpRtlvx.js';
5
4
  import 'element-plus';
6
5
  import 'async-validator';
7
6
 
@@ -10,6 +9,14 @@ interface EditorContext {
10
9
  plugins?: any;
11
10
  bus: EventEmitter;
12
11
  extra: Record<string, any>;
12
+ /**
13
+ * 是否处于预览态,预览态下业务组件应禁用拖拽、缩放等编辑交互
14
+ */
15
+ preview?: boolean;
16
+ /**
17
+ * 业务组件在运行时修改自身配置后,通知编辑器同步数据 / 触发变更
18
+ */
19
+ updateConfig?: (data: any) => void;
13
20
  }
14
21
  declare const editorContextKey: InjectionKey<EditorContext>;
15
22
 
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-B-BAQlzv.cjs';
3
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, k as EditorData, g as EditorRoute, e as EditorSchema, j as EditorSettings, f as EditorWidget, h as EditorWidgets, d as ISchema, I as IWidget, c as SchemaBox, S as SchemaOther, b as WidgetAgent, a as WidgetLayoutItem, W as WidgetPos, i as isBox } from './Node-BkpRtlvx.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-B-BAQlzv.js';
3
+ export { B as Base, D as DisabledItemFn, E as EditorConfig, k as EditorData, g as EditorRoute, e as EditorSchema, j as EditorSettings, f as EditorWidget, h as EditorWidgets, d as ISchema, I as IWidget, c as SchemaBox, S as SchemaOther, b as WidgetAgent, a as WidgetLayoutItem, W as WidgetPos, i as isBox } from './Node-BkpRtlvx.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.5.1",
4
+ "version": "0.6.1",
5
5
  "description": "",
6
6
  "author": "sepveneto",
7
7
  "license": "MIT",
@@ -36,11 +36,11 @@
36
36
  ],
37
37
  "changelog": "https://github.com/SepVeneto/miniprogram-design/blob/master/packages/core/CHANGELOG.md",
38
38
  "dependencies": {
39
- "element-plus": "^2.14.1",
40
39
  "async-validator": "^4.2.5",
41
40
  "uuid": "^11.1.0"
42
41
  },
43
42
  "devDependencies": {
43
+ "element-plus": "^2.14.1",
44
44
  "tsup": "^8.4.0",
45
45
  "vite": "^4.5.5",
46
46
  "vitest": "^0.28.5",
@@ -48,7 +48,8 @@
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsup",
51
- "test": "vitest",
51
+ "test": "vitest run",
52
+ "test:watch": "vitest",
52
53
  "version": " pnpm changelog && git add CHANGELOG.md",
53
54
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package core -t core@"
54
55
  }