@veltra/desktop 1.1.3 → 1.1.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.
Files changed (163) hide show
  1. package/dist/components/action/action-group.js +3 -110
  2. package/dist/components/action/action-group.js.map +1 -1
  3. package/dist/components/action/action-group.vue.d.ts +5 -14
  4. package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js +105 -0
  5. package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js.map +1 -0
  6. package/dist/components/action/action.js +5 -1
  7. package/dist/components/action/action.js.map +1 -1
  8. package/dist/components/action/di.js.map +1 -1
  9. package/dist/components/action/style2.css +17 -14
  10. package/dist/components/auto-complete/auto-complete.js +1 -1
  11. package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
  12. package/dist/components/badge/badge.js +1 -1
  13. package/dist/components/batch-edit/batch-edit-form.js +94 -101
  14. package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
  15. package/dist/components/batch-edit/batch-edit-list.js +52 -68
  16. package/dist/components/batch-edit/batch-edit-list.js.map +1 -1
  17. package/dist/components/batch-edit/style2.css +13 -89
  18. package/dist/components/breadcrumb/breadcrumb.js +1 -1
  19. package/dist/components/button/button.js +1 -1
  20. package/dist/components/card/card.js +1 -1
  21. package/dist/components/cascade/cascade-panel-item.js +4 -4
  22. package/dist/components/cascade/cascade.js +2 -2
  23. package/dist/components/cascade/cascade.vue.d.ts +5 -5
  24. package/dist/components/checkbox/checkbox-button.js +1 -1
  25. package/dist/components/checkbox/checkbox.js +1 -1
  26. package/dist/components/checkbox-group/checkbox-group.js +1 -1
  27. package/dist/components/code-editor/code-editor.js +1 -1
  28. package/dist/components/collapse/collapse.js +1 -1
  29. package/dist/components/condition-editor/components/condition-group.js +152 -0
  30. package/dist/components/condition-editor/components/condition-group.js.map +1 -0
  31. package/dist/components/condition-editor/components/condition-row.js +217 -0
  32. package/dist/components/condition-editor/components/condition-row.js.map +1 -0
  33. package/dist/components/condition-editor/condition-editor.js +134 -5
  34. package/dist/components/condition-editor/condition-editor.js.map +1 -1
  35. package/dist/components/condition-editor/condition-editor.vue.d.ts +10 -2
  36. package/dist/components/condition-editor/core/evaluator.js +75 -0
  37. package/dist/components/condition-editor/core/evaluator.js.map +1 -0
  38. package/dist/components/condition-editor/core/operators.js +123 -0
  39. package/dist/components/condition-editor/core/operators.js.map +1 -0
  40. package/dist/components/condition-editor/style.js +7 -0
  41. package/dist/components/condition-editor/style2.css +186 -0
  42. package/dist/components/context-menu/context-menu.js +1 -1
  43. package/dist/components/date-picker/date-picker.js +2 -2
  44. package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
  45. package/dist/components/date-range-picker/date-range-picker.js +2 -2
  46. package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
  47. package/dist/components/dialog/dialog.js +7 -7
  48. package/dist/components/dialog/style2.css +8 -0
  49. package/dist/components/dialog/use-maximum.js +1 -1
  50. package/dist/components/drawer/style2.css +8 -0
  51. package/dist/components/dropdown/dropdown.js +1 -1
  52. package/dist/components/expression-editor/components/variable-picker.js +8 -8
  53. package/dist/components/expression-editor/expression-editor.js +1 -1
  54. package/dist/components/expression-editor/style2.css +1 -0
  55. package/dist/components/file-viewer/file-viewer.js +13 -13
  56. package/dist/components/form-item/form-item.js.map +1 -1
  57. package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js +6 -6
  58. package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
  59. package/dist/components/grid-input/grid-input.js +1 -1
  60. package/dist/components/group-input/group-input.js +2 -1
  61. package/dist/components/group-input/group-input.js.map +1 -1
  62. package/dist/components/group-input/style.js +1 -0
  63. package/dist/components/index.js +154 -154
  64. package/dist/components/input/input.vue.d.ts +4 -4
  65. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +1 -1
  66. package/dist/components/layout/layout-resizer.js +1 -1
  67. package/dist/components/layout/layout.js +1 -1
  68. package/dist/components/list/list.js +1 -1
  69. package/dist/components/loading/loading.js +1 -1
  70. package/dist/components/menu/menu-sub-collapsed.js +4 -4
  71. package/dist/components/menu/menu.js +1 -1
  72. package/dist/components/message/message.js +1 -1
  73. package/dist/components/message-confirm/message-confirm.js +1 -1
  74. package/dist/components/multi-select/multi-select-option.js +19 -14
  75. package/dist/components/multi-select/multi-select-option.js.map +1 -1
  76. package/dist/components/multi-select/multi-select.js +15 -15
  77. package/dist/components/multi-select/multi-select.vue.d.ts +4 -4
  78. package/dist/components/multi-tree-select/multi-tree-select.js +8 -8
  79. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +6 -6
  80. package/dist/components/notification/notification.js +1 -1
  81. package/dist/components/notification/notification.vue.d.ts +1 -1
  82. package/dist/components/number/number.vue.d.ts +1 -1
  83. package/dist/components/number-input/number-input.js +2 -2
  84. package/dist/components/number-input/number-input.vue.d.ts +4 -4
  85. package/dist/components/number-range-input/number-range-input.js +1 -1
  86. package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
  87. package/dist/components/number-range-input/style2.css +1 -0
  88. package/dist/components/paginator/paginator.js +6 -6
  89. package/dist/components/paginator/style.js +1 -1
  90. package/dist/components/palette/palette.js +1 -1
  91. package/dist/components/password-input/password-input.js +2 -2
  92. package/dist/components/password-input/password-input.vue.d.ts +1 -1
  93. package/dist/components/pop-confirm/pop-confirm.js +1 -1
  94. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  95. package/dist/components/progress-nodes/progress-nodes.js +1 -1
  96. package/dist/components/radio/radio.js +1 -1
  97. package/dist/components/radio-group/radio-group.js +1 -1
  98. package/dist/components/rich-text-editor/rich-text-editor.js +1 -1
  99. package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
  100. package/dist/components/scroll/scroll-bar.js +1 -1
  101. package/dist/components/scroll/scroll.js +1 -1
  102. package/dist/components/select/select.js +10 -10
  103. package/dist/components/select/select.vue.d.ts +2 -2
  104. package/dist/components/slider/slider.js +1 -1
  105. package/dist/components/steps/steps.js +2 -2
  106. package/dist/components/switch/switch.js +1 -1
  107. package/dist/components/table/style2.css +4 -1
  108. package/dist/components/table/table.js +2 -2
  109. package/dist/components/table/table.js.map +1 -1
  110. package/dist/components/table/use-columns.js +1 -1
  111. package/dist/components/table/use-fixed-columns.js +8 -31
  112. package/dist/components/table/use-fixed-columns.js.map +1 -1
  113. package/dist/components/table-editor/table-editor.js +1 -1
  114. package/dist/components/tabs/tabs-horizontal.js +1 -1
  115. package/dist/components/tabs/tabs-horizontal.vue.d.ts +4 -4
  116. package/dist/components/tabs/tabs-vertical.js +1 -1
  117. package/dist/components/tabs/tabs-vertical.vue.d.ts +3 -3
  118. package/dist/components/tabs/tabs.js +1 -1
  119. package/dist/components/tabs/tabs.vue.d.ts +4 -4
  120. package/dist/components/tag/tag.js +1 -1
  121. package/dist/components/textarea/textarea.js +1 -1
  122. package/dist/components/textarea/textarea.vue.d.ts +4 -4
  123. package/dist/components/theme/style.js +1 -1
  124. package/dist/components/theme/theme.js +11 -11
  125. package/dist/components/tip/tip.js +1 -1
  126. package/dist/components/tree/tree-node.js +1 -1
  127. package/dist/components/tree/tree.js +5 -5
  128. package/dist/components/tree-select/tree-select.js +6 -6
  129. package/dist/components/tree-select/tree-select.vue.d.ts +5 -5
  130. package/dist/index.d.ts +5 -5
  131. package/dist/index.js +83 -83
  132. package/dist/style.js +2 -2
  133. package/dist/types/action.d.ts +5 -11
  134. package/dist/types/condition-editor.d.ts +41 -8
  135. package/dist/types/index.d.ts +4 -4
  136. package/package.json +11 -11
  137. package/src/components/action/action-group.vue +68 -82
  138. package/src/components/action/action.vue +9 -1
  139. package/src/components/action/di.ts +2 -1
  140. package/src/components/action/style.scss +22 -27
  141. package/src/components/batch-edit/batch-edit-form.vue +65 -70
  142. package/src/components/batch-edit/batch-edit-list.vue +35 -41
  143. package/src/components/batch-edit/style.scss +19 -118
  144. package/src/components/condition-editor/components/condition-group.vue +131 -0
  145. package/src/components/condition-editor/components/condition-row.vue +208 -0
  146. package/src/components/condition-editor/condition-editor.vue +145 -6
  147. package/src/components/condition-editor/core/evaluator.ts +93 -0
  148. package/src/components/condition-editor/core/operators.ts +57 -0
  149. package/src/components/condition-editor/style.scss +239 -1
  150. package/src/components/condition-editor/style.ts +7 -0
  151. package/src/components/dialog/style.scss +13 -0
  152. package/src/components/drawer/style.scss +13 -0
  153. package/src/components/expression-editor/style.scss +1 -0
  154. package/src/components/form-item/form-item.vue +1 -1
  155. package/src/components/group-input/group-input.vue +8 -1
  156. package/src/components/group-input/style.ts +1 -0
  157. package/src/components/multi-select/multi-select-option.vue +19 -13
  158. package/src/components/number-range-input/style.scss +1 -0
  159. package/src/components/table/style.scss +9 -1
  160. package/src/components/table/table.vue +1 -3
  161. package/src/components/table/use-fixed-columns.ts +5 -49
  162. package/src/types/action.ts +6 -11
  163. package/src/types/condition-editor.ts +39 -7
@@ -20,17 +20,12 @@
20
20
  overflow: hidden;
21
21
  border-radius: var(--u-radius-default);
22
22
  }
23
+ .u-batch-edit:focus, .u-batch-edit:focus-visible {
24
+ outline: none;
25
+ }
23
26
  .u-batch-edit__table {
24
27
  flex-grow: 1;
25
28
  }
26
- .u-batch-edit .u-table__row:hover .u-action-group.is-hover,
27
- .u-batch-edit .u-table__row.is-current .u-action-group.is-hover {
28
- opacity: 1;
29
- background-color: color-mix(in srgb, var(--u-bg-color-top) 70%, transparent);
30
- backdrop-filter: var(--u-bg-filter);
31
- -webkit-backdrop-filter: var(--u-bg-filter);
32
- box-shadow: 0 1px 4px color-mix(in srgb, var(--u-shadow-color) 35%, transparent);
33
- }
34
29
  .u-batch-edit__add {
35
30
  position: sticky;
36
31
  left: 0;
@@ -40,58 +35,12 @@
40
35
  background-color: var(--u-bg-color-top);
41
36
  }
42
37
  .u-batch-edit__add-btn {
43
- --add-color: var(--u-color-primary);
44
- --add-border: color-mix(in srgb, var(--u-color-primary) 60%, transparent);
45
- --add-bg: color-mix(in srgb, var(--u-color-primary) 5%, transparent);
46
38
  position: sticky;
47
39
  left: 12px;
48
- height: 36px;
49
- min-width: 220px;
50
- max-width: 320px;
51
- display: inline-flex;
52
- align-items: center;
53
- justify-content: center;
54
- gap: 6px;
55
- padding: 0 20px;
56
- background: var(--add-bg);
57
- border: 1px dashed var(--add-border);
58
- border-radius: var(--u-radius-default);
59
- color: var(--add-color);
60
- font-size: var(--u-font-size-main-default);
61
- font-weight: 500;
62
- cursor: pointer;
63
- transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
64
- font-family: inherit;
65
- }
66
- .u-batch-edit__add-btn:hover:not(:disabled) {
67
- --add-border: var(--u-color-primary);
68
- --add-bg: var(--u-color-primary-light-9);
69
- border-style: solid;
70
- }
71
- .u-batch-edit__add-btn:active:not(:disabled) {
72
- transform: translateY(1px);
73
- }
74
- .u-batch-edit__add-btn:disabled {
75
- cursor: not-allowed;
76
- opacity: 0.55;
77
- }
78
- .u-batch-edit__add-btn.is-loading {
79
- pointer-events: none;
80
- }
81
- .u-batch-edit__add-icon {
82
- font-size: 16px;
83
- display: inline-flex;
84
- transition: transform 0.18s ease;
85
- }
86
- .u-batch-edit .u-batch-edit__add-btn:hover .u-batch-edit__add-icon {
87
- transform: rotate(90deg);
88
- }
89
- .u-batch-edit__add-label {
90
- line-height: 1;
91
40
  }
92
41
  .u-batch-edit__form {
93
42
  --u-batch-edit-form-radius: var(--u-radius-large);
94
- --u-batch-edit-form-padding: 16px;
43
+ --u-batch-edit-form-padding: 18px;
95
44
  display: flex;
96
45
  flex-direction: column;
97
46
  background-color: var(--u-bg-color-top);
@@ -101,23 +50,13 @@
101
50
  isolation: isolate;
102
51
  min-height: 0;
103
52
  }
104
- .u-batch-edit__form::before {
105
- content: "";
106
- position: absolute;
107
- top: 0;
108
- left: 0;
109
- right: 0;
110
- height: 3px;
111
- background: linear-gradient(90deg, var(--u-color-primary) 0%, color-mix(in srgb, var(--u-color-primary) 50%, transparent) 100%);
112
- opacity: 0.7;
113
- z-index: 1;
114
- }
115
53
  .u-batch-edit__form-header {
116
54
  display: flex;
117
55
  align-items: center;
118
- gap: 10px;
119
- padding: 8px 14px;
56
+ gap: 12px;
57
+ padding: 10px 14px;
120
58
  border-bottom: 1px solid var(--u-border-color);
59
+ background-color: color-mix(in srgb, var(--u-bg-color-top) 96%, var(--u-bg-color-hover));
121
60
  flex-shrink: 0;
122
61
  }
123
62
  .u-batch-edit__form-icon {
@@ -151,8 +90,8 @@
151
90
  flex: 1 1 auto;
152
91
  min-width: 0;
153
92
  display: flex;
154
- flex-direction: column;
155
- gap: 2px;
93
+ align-items: center;
94
+ gap: 8px;
156
95
  }
157
96
  .u-batch-edit__form-title-text {
158
97
  margin: 0;
@@ -163,28 +102,24 @@
163
102
  }
164
103
  .u-batch-edit__form-chip {
165
104
  display: inline-block;
166
- align-self: flex-start;
167
105
  padding: 1px 8px;
168
106
  font-size: 12px;
169
107
  line-height: 18px;
170
- border-radius: 999px;
171
- background-color: var(--u-bg-color-hover);
108
+ border-radius: var(--u-radius-default);
109
+ background-color: var(--u-bg-color-default);
172
110
  color: var(--u-text-color-second);
173
111
  white-space: nowrap;
174
112
  overflow: hidden;
175
113
  text-overflow: ellipsis;
176
- max-width: 100%;
114
+ max-width: 60%;
177
115
  }
178
116
  .u-batch-edit__form-close {
179
117
  flex-shrink: 0;
180
- align-self: flex-start;
181
118
  }
182
119
  .u-batch-edit__form-body {
183
120
  flex: 1 1 auto;
184
121
  min-height: 0;
185
- }
186
- .u-batch-edit__form-body .u-form__body {
187
- padding: 10px var(--u-batch-edit-form-padding) 4px;
122
+ padding: 6px 8px 0;
188
123
  }
189
124
  .u-batch-edit__form-footer {
190
125
  display: flex;
@@ -224,14 +159,3 @@
224
159
  gap: 8px;
225
160
  flex-shrink: 0;
226
161
  }
227
-
228
- .batch-edit-panel-enter-active,
229
- .batch-edit-panel-leave-active {
230
- transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.24s ease;
231
- }
232
-
233
- .batch-edit-panel-enter-from,
234
- .batch-edit-panel-leave-to {
235
- transform: translateX(16px) scale(0.985);
236
- opacity: 0;
237
- }
@@ -1,6 +1,6 @@
1
1
  import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, toDisplayString, unref } from "vue";
2
- import { bem } from "@veltra/utils";
3
2
  import { useFallbackProps } from "@veltra/compositions";
3
+ import { bem } from "@veltra/utils";
4
4
  //#region src/components/breadcrumb/breadcrumb.vue
5
5
  const _hoisted_1 = [
6
6
  "href",
@@ -1,7 +1,7 @@
1
1
  import _sfc_main$1 from "../icon/icon.js";
2
2
  import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, shallowRef, unref, withCtx, withDirectives } from "vue";
3
- import { bem } from "@veltra/utils";
4
3
  import { useFallbackProps } from "@veltra/compositions";
4
+ import { bem } from "@veltra/utils";
5
5
  import { vRipple } from "@veltra/directives";
6
6
  import { Loading } from "@veltra/icons";
7
7
  //#region src/components/button/button.vue
@@ -1,7 +1,7 @@
1
1
  import { CardDIKey } from "./di.js";
2
2
  import { computed, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, provide, renderSlot } from "vue";
3
- import { bem, withUnit } from "@veltra/utils";
4
3
  import { useFormFallbackProps } from "@veltra/compositions";
4
+ import { bem, withUnit } from "@veltra/utils";
5
5
  //#region src/components/card/card.vue
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  name: "Card",
@@ -1,5 +1,5 @@
1
- import _sfc_main$1 from "../scroll/scroll.js";
2
- import _sfc_main$2 from "../icon/icon.js";
1
+ import _sfc_main$1 from "../icon/icon.js";
2
+ import _sfc_main$2 from "../scroll/scroll.js";
3
3
  import _sfc_main$3 from "../checkbox/checkbox.js";
4
4
  import { CascadeDIKey } from "./di.js";
5
5
  import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, normalizeClass, onMounted, openBlock, renderList, shallowRef, toDisplayString, unref, useTemplateRef, withCtx } from "vue";
@@ -39,7 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
39
  });
40
40
  });
41
41
  return (_ctx, _cache) => {
42
- return openBlock(), createBlock(unref(_sfc_main$1), {
42
+ return openBlock(), createBlock(unref(_sfc_main$2), {
43
43
  tag: "ul",
44
44
  class: normalizeClass(unref(panelCls).b),
45
45
  ref: "scroll-container",
@@ -65,7 +65,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
65
  "onUpdate:modelValue"
66
66
  ])) : createCommentVNode("v-if", true),
67
67
  createElementVNode("span", { class: normalizeClass(unref(panelCls).e("option-label")) }, toDisplayString(node.label), 3),
68
- node.children?.length ? (openBlock(), createBlock(unref(_sfc_main$2), {
68
+ node.children?.length ? (openBlock(), createBlock(unref(_sfc_main$1), {
69
69
  key: 1,
70
70
  class: normalizeClass(unref(panelCls).e("option-expand"))
71
71
  }, {
@@ -10,10 +10,10 @@ import { useCheck } from "./use-check.js";
10
10
  import { useDataMap } from "./use-data-map.js";
11
11
  import { useSelect } from "./use-select.js";
12
12
  import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, provide, renderList, shallowRef, toDisplayString, triggerRef, unref, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
13
- import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
14
13
  import { useFormFallbackProps, useUserAction } from "@veltra/compositions";
15
- import { Forest, o } from "@cat-kit/core";
14
+ import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
16
15
  import { ArrowDown, Close, Search } from "@veltra/icons/normal";
16
+ import { Forest, o } from "@cat-kit/core";
17
17
  //#region src/components/cascade/cascade.vue
18
18
  const _sfc_main = /* @__PURE__ */ defineComponent({
19
19
  name: "Cascade",
@@ -4,23 +4,23 @@ import * as _$vue from "vue";
4
4
  //#region src/components/cascade/cascade.vue.d.ts
5
5
  declare const __VLS_export: _$vue.DefineComponent<CascadeProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {} & {
6
6
  "update:modelValue": (value?: string | string[] | undefined) => any;
7
- change: (...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any;
8
7
  clear: () => any;
8
+ change: (...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any;
9
9
  }, string, _$vue.PublicProps, Readonly<CascadeProps> & Readonly<{
10
10
  "onUpdate:modelValue"?: ((value?: string | string[] | undefined) => any) | undefined;
11
- onChange?: ((...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any) | undefined;
12
11
  onClear?: (() => any) | undefined;
12
+ onChange?: ((...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any) | undefined;
13
13
  }>, {
14
14
  labelKey: string;
15
15
  valueKey: string;
16
16
  childrenKey: string;
17
17
  data: Record<string, any>[];
18
- clearable: boolean;
18
+ disabled: boolean;
19
+ readonly: boolean;
19
20
  placeholder: string;
21
+ clearable: boolean;
20
22
  filterable: boolean;
21
23
  visibilityLimit: number;
22
- disabled: boolean;
23
- readonly: boolean;
24
24
  separator: string;
25
25
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: typeof __VLS_export;
@@ -1,7 +1,7 @@
1
1
  import _sfc_main$1 from "../tag/tag.js";
2
2
  import { Fragment, computed, createBlock, createElementBlock, createTextVNode, defineComponent, mergeModels, normalizeClass, openBlock, renderSlot, toDisplayString, unref, useModel, useSlots, withCtx } from "vue";
3
- import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
4
3
  import { useFormFallbackProps } from "@veltra/compositions";
4
+ import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
5
5
  //#region src/components/checkbox/checkbox-button.vue
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  name: "CheckboxButton",
@@ -1,6 +1,6 @@
1
1
  import { Transition, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, normalizeClass, openBlock, renderSlot, unref, useModel, withCtx } from "vue";
2
- import { bem, injectFormContext } from "@veltra/utils";
3
2
  import { useFormFallbackProps } from "@veltra/compositions";
3
+ import { bem, injectFormContext } from "@veltra/utils";
4
4
  //#region src/components/checkbox/checkbox.vue
5
5
  const _hoisted_1 = {
6
6
  key: 0,
@@ -1,8 +1,8 @@
1
1
  import _sfc_main$1 from "../checkbox/checkbox.js";
2
2
  import _sfc_main$2 from "../tag/tag.js";
3
3
  import { Fragment, createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeModels, normalizeClass, openBlock, renderList, toDisplayString, unref, useModel, withCtx } from "vue";
4
- import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
5
4
  import { useFormFallbackProps } from "@veltra/compositions";
5
+ import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
6
6
  //#region src/components/checkbox-group/checkbox-group.vue
7
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
8
  name: "CheckboxGroup",
@@ -1,7 +1,7 @@
1
1
  import _sfc_main$1 from "../scroll/scroll.js";
2
2
  import { computed, createBlock, createElementVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, shallowRef, unref, useModel, useTemplateRef, watch, withCtx, withKeys, withModifiers } from "vue";
3
- import { bem, injectFormContext, zIndex } from "@veltra/utils";
4
3
  import { useFormFallbackProps } from "@veltra/compositions";
4
+ import { bem, injectFormContext, zIndex } from "@veltra/utils";
5
5
  import { Compartment, EditorState } from "@codemirror/state";
6
6
  import { oneDark } from "@codemirror/theme-one-dark";
7
7
  import { ViewPlugin, tooltips } from "@codemirror/view";
@@ -1,7 +1,7 @@
1
1
  import { CollapseDIKey } from "./di.js";
2
2
  import { computed, createElementBlock, defineComponent, normalizeClass, openBlock, provide, renderSlot } from "vue";
3
- import { ExpandTransition, bem } from "@veltra/utils";
4
3
  import { useFormFallbackProps, useModel as useModel$1 } from "@veltra/compositions";
4
+ import { ExpandTransition, bem } from "@veltra/utils";
5
5
  //#region src/components/collapse/collapse.vue
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  name: "Collapse",
@@ -0,0 +1,152 @@
1
+ import { createEmptyGroup, createEmptyItem } from "../core/evaluator.js";
2
+ import _sfc_main$1 from "./condition-row.js";
3
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, renderList, resolveComponent, toDisplayString, unref } from "vue";
4
+ import { bem } from "@veltra/utils";
5
+ //#region src/components/condition-editor/components/condition-group.vue
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ name: "ConditionGroup",
8
+ __name: "condition-group",
9
+ props: {
10
+ group: {},
11
+ fields: {},
12
+ size: { default: "default" },
13
+ disabled: { type: Boolean },
14
+ readonly: { type: Boolean }
15
+ },
16
+ emits: [
17
+ "update:group",
18
+ "remove",
19
+ "mention"
20
+ ],
21
+ setup(__props, { emit: __emit }) {
22
+ const props = __props;
23
+ const emit = __emit;
24
+ const cls = bem("condition-editor");
25
+ const hasResult = computed(() => props.group._result !== void 0);
26
+ function toggleLogic() {
27
+ if (props.disabled || props.readonly) return;
28
+ emit("update:group", {
29
+ ...props.group,
30
+ logic: props.group.logic === "and" ? "or" : "and"
31
+ });
32
+ }
33
+ function addCondition() {
34
+ emit("update:group", {
35
+ ...props.group,
36
+ conditions: [...props.group.conditions, createEmptyItem()]
37
+ });
38
+ }
39
+ function removeCondition(idx) {
40
+ const conditions = [...props.group.conditions];
41
+ conditions.splice(idx, 1);
42
+ emit("update:group", {
43
+ ...props.group,
44
+ conditions
45
+ });
46
+ }
47
+ function updateCondition(idx, item) {
48
+ const conditions = [...props.group.conditions];
49
+ conditions[idx] = item;
50
+ emit("update:group", {
51
+ ...props.group,
52
+ conditions
53
+ });
54
+ }
55
+ function addGroup() {
56
+ emit("update:group", {
57
+ ...props.group,
58
+ groups: [...props.group.groups, createEmptyGroup()]
59
+ });
60
+ }
61
+ function removeSubGroup(idx) {
62
+ const groups = [...props.group.groups];
63
+ groups.splice(idx, 1);
64
+ emit("update:group", {
65
+ ...props.group,
66
+ groups
67
+ });
68
+ }
69
+ function updateSubGroup(idx, g) {
70
+ const groups = [...props.group.groups];
71
+ groups[idx] = g;
72
+ emit("update:group", {
73
+ ...props.group,
74
+ groups
75
+ });
76
+ }
77
+ return (_ctx, _cache) => {
78
+ const _component_ConditionGroup = resolveComponent("ConditionGroup", true);
79
+ return openBlock(), createElementBlock("div", { class: normalizeClass(unref(cls).e("group")) }, [
80
+ createCommentVNode(" AND/OR 标签 + 汇总结果 "),
81
+ createElementVNode("div", { class: normalizeClass(unref(cls).e("group-header")) }, [createElementVNode("span", {
82
+ class: normalizeClass([unref(cls).e("logic-tag"), unref(cls).em("logic-tag", __props.group.logic)]),
83
+ onClick: toggleLogic
84
+ }, toDisplayString(__props.group.logic.toUpperCase()) + " ▾ ", 3), hasResult.value ? (openBlock(), createElementBlock("span", {
85
+ key: 0,
86
+ class: normalizeClass([unref(cls).e("group-result"), unref(cls).em("group-result", __props.group._result ? "pass" : "fail")])
87
+ }, toDisplayString(__props.group._result ? "✓ 通过" : "✗ 不通过"), 3)) : createCommentVNode("v-if", true)], 2),
88
+ createCommentVNode(" 嵌套组容器 "),
89
+ createElementVNode("div", { class: normalizeClass(unref(cls).e("group-body")) }, [
90
+ createCommentVNode(" 子条件 "),
91
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.group.conditions, (cond, idx) => {
92
+ return openBlock(), createBlock(_sfc_main$1, {
93
+ key: idx,
94
+ item: cond,
95
+ fields: __props.fields,
96
+ size: __props.size,
97
+ disabled: __props.disabled,
98
+ readonly: __props.readonly,
99
+ "onUpdate:item": (item) => updateCondition(idx, item),
100
+ onDelete: ($event) => removeCondition(idx),
101
+ onMention: _cache[0] || (_cache[0] = (p) => emit("mention", p))
102
+ }, null, 8, [
103
+ "item",
104
+ "fields",
105
+ "size",
106
+ "disabled",
107
+ "readonly",
108
+ "onUpdate:item",
109
+ "onDelete"
110
+ ]);
111
+ }), 128)),
112
+ createCommentVNode(" 子分组(递归) "),
113
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.group.groups, (sub, idx) => {
114
+ return openBlock(), createBlock(_component_ConditionGroup, {
115
+ key: idx,
116
+ group: sub,
117
+ fields: __props.fields,
118
+ size: __props.size,
119
+ disabled: __props.disabled,
120
+ readonly: __props.readonly,
121
+ "onUpdate:group": (g) => updateSubGroup(idx, g),
122
+ onRemove: () => removeSubGroup(idx),
123
+ onMention: _cache[1] || (_cache[1] = (p) => emit("mention", p))
124
+ }, null, 8, [
125
+ "group",
126
+ "fields",
127
+ "size",
128
+ "disabled",
129
+ "readonly",
130
+ "onUpdate:group",
131
+ "onRemove"
132
+ ]);
133
+ }), 128)),
134
+ createCommentVNode(" 空状态 + 添加按钮 "),
135
+ createElementVNode("div", { class: normalizeClass(unref(cls).e("group-actions")) }, [!__props.readonly ? (openBlock(), createElementBlock("span", {
136
+ key: 0,
137
+ class: normalizeClass(unref(cls).e("add-btn")),
138
+ onClick: addCondition
139
+ }, "+ 添加条件", 2)) : createCommentVNode("v-if", true), !__props.readonly ? (openBlock(), createElementBlock("span", {
140
+ key: 1,
141
+ class: normalizeClass(unref(cls).e("add-btn")),
142
+ onClick: addGroup
143
+ }, "+ 添加条件组", 2)) : createCommentVNode("v-if", true)], 2)
144
+ ], 2)
145
+ ], 2);
146
+ };
147
+ }
148
+ });
149
+ //#endregion
150
+ export { _sfc_main as default };
151
+
152
+ //# sourceMappingURL=condition-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-group.js","names":[],"sources":["../../../../src/components/condition-editor/components/condition-group.vue"],"sourcesContent":["<template>\n <div :class=\"cls.e('group')\">\n <!-- AND/OR 标签 + 汇总结果 -->\n <div :class=\"cls.e('group-header')\">\n <span :class=\"[cls.e('logic-tag'), cls.em('logic-tag', group.logic)]\" @click=\"toggleLogic\">\n {{ group.logic.toUpperCase() }} ▾\n </span>\n <span\n v-if=\"hasResult\"\n :class=\"[cls.e('group-result'), cls.em('group-result', group._result ? 'pass' : 'fail')]\"\n >\n {{ group._result ? '✓ 通过' : '✗ 不通过' }}\n </span>\n </div>\n\n <!-- 嵌套组容器 -->\n <div :class=\"cls.e('group-body')\">\n <!-- 子条件 -->\n <ConditionRow\n v-for=\"(cond, idx) in group.conditions\"\n :key=\"idx\"\n :item=\"cond\"\n :fields=\"fields\"\n :size=\"size\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n @update:item=\"(item) => updateCondition(idx, item)\"\n @delete=\"removeCondition(idx)\"\n @mention=\"(p) => emit('mention', p)\"\n />\n\n <!-- 子分组(递归) -->\n <ConditionGroup\n v-for=\"(sub, idx) in group.groups\"\n :key=\"idx\"\n :group=\"sub\"\n :fields=\"fields\"\n :size=\"size\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n @update:group=\"(g) => updateSubGroup(idx, g)\"\n @remove=\"() => removeSubGroup(idx)\"\n @mention=\"(p) => emit('mention', p)\"\n />\n\n <!-- 空状态 + 添加按钮 -->\n <div :class=\"cls.e('group-actions')\">\n <span v-if=\"!readonly\" :class=\"cls.e('add-btn')\" @click=\"addCondition\">+ 添加条件</span>\n <span v-if=\"!readonly\" :class=\"cls.e('add-btn')\" @click=\"addGroup\">+ 添加条件组</span>\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed } from 'vue'\n\nimport type { ConditionField, ConditionGroup, ConditionItem } from '../../../types'\nimport { createEmptyGroup, createEmptyItem } from '../core/evaluator'\nimport ConditionRow, { type MentionPayload } from './condition-row.vue'\n\ndefineOptions({ name: 'ConditionGroup' })\n\nconst props = withDefaults(\n defineProps<{\n group: ConditionGroup\n fields?: ConditionField[]\n size?: 'small' | 'default' | 'large'\n disabled?: boolean\n readonly?: boolean\n }>(),\n { size: 'default' }\n)\n\nconst emit = defineEmits<{\n (e: 'update:group', group: ConditionGroup): void\n (e: 'remove'): void\n (e: 'mention', payload: MentionPayload): void\n}>()\n\nconst cls = bem('condition-editor')\n\nconst hasResult = computed(() => props.group._result !== undefined)\n\nfunction toggleLogic() {\n if (props.disabled || props.readonly) return\n emit('update:group', {\n ...props.group,\n logic: props.group.logic === 'and' ? 'or' : 'and'\n })\n}\n\nfunction addCondition() {\n emit('update:group', {\n ...props.group,\n conditions: [...props.group.conditions, createEmptyItem()]\n })\n}\n\nfunction removeCondition(idx: number) {\n const conditions = [...props.group.conditions]\n conditions.splice(idx, 1)\n emit('update:group', { ...props.group, conditions })\n}\n\nfunction updateCondition(idx: number, item: ConditionItem) {\n const conditions = [...props.group.conditions]\n conditions[idx] = item\n emit('update:group', { ...props.group, conditions })\n}\n\nfunction addGroup() {\n emit('update:group', {\n ...props.group,\n groups: [...props.group.groups, createEmptyGroup()]\n })\n}\n\nfunction removeSubGroup(idx: number) {\n const groups = [...props.group.groups]\n groups.splice(idx, 1)\n emit('update:group', { ...props.group, groups })\n}\n\nfunction updateSubGroup(idx: number, g: ConditionGroup) {\n const groups = [...props.group.groups]\n groups[idx] = g\n emit('update:group', { ...props.group, groups })\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAgEA,MAAM,QAAQ;EAWd,MAAM,OAAO;EAMb,MAAM,MAAM,IAAI,mBAAkB;EAElC,MAAM,YAAY,eAAe,MAAM,MAAM,YAAY,KAAA,EAAS;EAElE,SAAS,cAAc;AACrB,OAAI,MAAM,YAAY,MAAM,SAAU;AACtC,QAAK,gBAAgB;IACnB,GAAG,MAAM;IACT,OAAO,MAAM,MAAM,UAAU,Q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