@ctzy-web-client/plugin-component-vue 1.0.25 → 1.0.27

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 (228) hide show
  1. package/es/_virtual/_plugin-vue_export-helper.mjs +11 -0
  2. package/es/advance-select/advance-operation.mjs +48 -51
  3. package/es/advance-select/advance-option.mjs +128 -163
  4. package/es/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.mjs +11 -5
  5. package/es/advance-select/advance-select.mjs +323 -370
  6. package/es/advance-select/events-helpers.mjs +9 -0
  7. package/es/advance-select/index.mjs +9 -0
  8. package/es/advance-select/use-advance-option.mjs +9 -0
  9. package/es/advance-select/use-advance-select.mjs +9 -0
  10. package/es/application-slot/application-slot.mjs +9 -0
  11. package/es/application-slot/breadcrumb-item.mjs +26 -20
  12. package/es/application-slot/header-tools-item.mjs +26 -20
  13. package/es/application-slot/index.mjs +9 -0
  14. package/es/breadcrumb-select/breadcrumb-select.mjs +123 -137
  15. package/es/breadcrumb-select/index.mjs +9 -0
  16. package/es/components.mjs +9 -0
  17. package/es/contextmenu/contextmenu-item.mjs +24 -19
  18. package/es/contextmenu/contextmenu.mjs +68 -73
  19. package/es/contextmenu/index.mjs +9 -0
  20. package/es/contextmenu/use-contextmenu.mjs +10 -1
  21. package/es/data-form/data-form-item.mjs +41 -49
  22. package/es/data-form/data-form.mjs +176 -213
  23. package/es/data-form/dynamic-component.mjs +9 -0
  24. package/es/data-form/form-components/Blots/AtBlot.mjs +9 -0
  25. package/es/data-form/form-components/bwa-date-picker.mjs +50 -51
  26. package/es/data-form/form-components/bwa-date-time-picker.mjs +55 -56
  27. package/es/data-form/form-components/bwa-input-float.mjs +48 -48
  28. package/es/data-form/form-components/bwa-input-integer.mjs +61 -68
  29. package/es/data-form/form-components/bwa-input.mjs +43 -43
  30. package/es/data-form/form-components/bwa-multi-select.mjs +40 -40
  31. package/es/data-form/form-components/bwa-rich-text-tinymce.mjs +230 -555
  32. package/es/data-form/form-components/bwa-rich-text.mjs +326 -404
  33. package/es/data-form/form-components/bwa-select.mjs +81 -84
  34. package/es/data-form/form-components/bwa-textarea.mjs +38 -38
  35. package/es/data-form/form-components/bwa-upload.mjs +160 -173
  36. package/es/data-form/form-components/bwa-user-multi-select.mjs +35 -35
  37. package/es/data-form/form-components/bwa-user-select.mjs +72 -86
  38. package/es/data-form/index.mjs +9 -0
  39. package/es/data-table/data-column-view.mjs +124 -146
  40. package/es/data-table/data-table-card.mjs +49 -48
  41. package/es/data-table/data-table-column.mjs +55 -58
  42. package/es/data-table/data-table.mjs +328 -404
  43. package/es/data-table/dynamic-component.mjs +9 -0
  44. package/es/data-table/index.mjs +9 -0
  45. package/es/data-table/use-datatable-drag.mjs +9 -0
  46. package/es/datatable-settings/datatable-settings.mjs +286 -328
  47. package/es/datatable-settings/index.mjs +9 -0
  48. package/es/date-range/date-picker.mjs +125 -131
  49. package/es/date-range/date-range.mjs +173 -216
  50. package/es/date-range/index.mjs +9 -0
  51. package/es/drag-list/constants.mjs +10 -0
  52. package/es/drag-list/drag-item.mjs +51 -56
  53. package/es/drag-list/drag-list.mjs +58 -60
  54. package/es/drag-list/index.mjs +9 -0
  55. package/es/drag-list/use-drag-list.mjs +10 -1
  56. package/es/dragable/constants.mjs +10 -0
  57. package/es/dragable/dragable-item.mjs +27 -23
  58. package/es/dragable/dragable-operation.mjs +33 -32
  59. package/es/dragable/dragable.mjs +33 -32
  60. package/es/dragable/index.mjs +9 -0
  61. package/es/dragable/use-dragable.mjs +9 -0
  62. package/es/filter-panel/conditions/condition.mjs +9 -0
  63. package/es/filter-panel/conditions/date-range-condition.mjs +51 -50
  64. package/es/filter-panel/conditions/department-condition/department-condition.mjs +82 -99
  65. package/es/filter-panel/conditions/department-condition/department-node.mjs +69 -73
  66. package/es/filter-panel/conditions/index.mjs +9 -0
  67. package/es/filter-panel/conditions/input-condition.mjs +88 -91
  68. package/es/filter-panel/conditions/multi-user-condition.mjs +66 -67
  69. package/es/filter-panel/conditions/multiple-menu-condition.mjs +44 -54
  70. package/es/filter-panel/conditions/single-menu-condition.mjs +71 -65
  71. package/es/filter-panel/conditions/single-user-condition.mjs +66 -67
  72. package/es/filter-panel/filter-panel-item.mjs +51 -55
  73. package/es/filter-panel/filter-panel.mjs +147 -156
  74. package/es/filter-panel/index.mjs +9 -0
  75. package/es/filter-panel/use-filter-panel-item.mjs +9 -0
  76. package/es/filter-panel/use-filter-panel.mjs +9 -0
  77. package/es/hooks/use-data/index.mjs +9 -0
  78. package/es/index.mjs +9 -0
  79. package/es/layout/index.mjs +9 -0
  80. package/es/layout/layout.mjs +87 -85
  81. package/es/make-installer.mjs +9 -0
  82. package/es/math/Rectangle.mjs +10 -0
  83. package/es/menu/index.mjs +9 -0
  84. package/es/menu/menu-item.mjs +65 -70
  85. package/es/menu/menu.mjs +64 -70
  86. package/es/node_modules/.pnpm/{@vueuse_core@9.6.0_vue@3.2.41 → @vueuse_core@9.13.0_vue@3.5.29_typescript@4.9.5_}/node_modules/@vueuse/core/index.mjs +680 -454
  87. package/es/node_modules/.pnpm/{@vueuse_shared@9.6.0_vue@3.2.41 → @vueuse_shared@9.13.0_vue@3.5.29_typescript@4.9.5_}/node_modules/@vueuse/shared/index.mjs +108 -46
  88. package/es/panel/index.mjs +9 -0
  89. package/es/panel/panel.mjs +49 -53
  90. package/es/panel-tabs/index.mjs +9 -0
  91. package/es/panel-tabs/panel-tabs.mjs +9 -0
  92. package/es/pct-filter-panel/index.mjs +9 -0
  93. package/es/pct-filter-panel/pct-compents/index.mjs +9 -0
  94. package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +73 -75
  95. package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +77 -77
  96. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +345 -374
  97. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +149 -154
  98. package/es/pct-filter-panel/pct-filter-panel-item.mjs +52 -56
  99. package/es/pct-filter-panel/pct-filter-panel.mjs +235 -248
  100. package/es/pct-filter-panel/use-filter-panel-item.mjs +9 -0
  101. package/es/pct-filter-panel/use-filter-panel.mjs +9 -0
  102. package/es/plugins.mjs +9 -0
  103. package/es/progress/index.mjs +9 -0
  104. package/es/progress/progress-item.mjs +71 -81
  105. package/es/progress/progress.mjs +74 -78
  106. package/es/progress/use-progress.mjs +9 -0
  107. package/es/utils/db.mjs +9 -0
  108. package/es/utils.css +1 -0
  109. package/es/utils.mjs +9 -0
  110. package/es/where-filter-panel/index.mjs +9 -1
  111. package/es/where-filter-panel/use-where-filter-panel.mjs +9 -0
  112. package/es/where-filter-panel/where-filter-panel.mjs +21 -15
  113. package/lib/_virtual/_plugin-vue_export-helper.js +11 -0
  114. package/lib/advance-select/advance-operation.js +47 -50
  115. package/lib/advance-select/advance-option.js +127 -162
  116. package/lib/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.js +11 -6
  117. package/lib/advance-select/advance-select.js +322 -369
  118. package/lib/advance-select/events-helpers.js +9 -0
  119. package/lib/advance-select/index.js +9 -0
  120. package/lib/advance-select/use-advance-option.js +9 -0
  121. package/lib/advance-select/use-advance-select.js +9 -0
  122. package/lib/application-slot/application-slot.js +9 -0
  123. package/lib/application-slot/breadcrumb-item.js +25 -19
  124. package/lib/application-slot/header-tools-item.js +25 -19
  125. package/lib/application-slot/index.js +9 -0
  126. package/lib/breadcrumb-select/breadcrumb-select.js +122 -136
  127. package/lib/breadcrumb-select/index.js +9 -0
  128. package/lib/components.js +9 -0
  129. package/lib/contextmenu/contextmenu-item.js +23 -18
  130. package/lib/contextmenu/contextmenu.js +67 -72
  131. package/lib/contextmenu/index.js +9 -0
  132. package/lib/contextmenu/use-contextmenu.js +10 -1
  133. package/lib/data-form/data-form-item.js +40 -48
  134. package/lib/data-form/data-form.js +175 -212
  135. package/lib/data-form/dynamic-component.js +9 -0
  136. package/lib/data-form/form-components/Blots/AtBlot.js +9 -0
  137. package/lib/data-form/form-components/bwa-date-picker.js +49 -50
  138. package/lib/data-form/form-components/bwa-date-time-picker.js +54 -55
  139. package/lib/data-form/form-components/bwa-input-float.js +47 -47
  140. package/lib/data-form/form-components/bwa-input-integer.js +60 -67
  141. package/lib/data-form/form-components/bwa-input.js +42 -42
  142. package/lib/data-form/form-components/bwa-multi-select.js +39 -39
  143. package/lib/data-form/form-components/bwa-rich-text-tinymce.js +229 -554
  144. package/lib/data-form/form-components/bwa-rich-text.js +325 -403
  145. package/lib/data-form/form-components/bwa-select.js +80 -83
  146. package/lib/data-form/form-components/bwa-textarea.js +37 -37
  147. package/lib/data-form/form-components/bwa-upload.js +159 -172
  148. package/lib/data-form/form-components/bwa-user-multi-select.js +34 -34
  149. package/lib/data-form/form-components/bwa-user-select.js +71 -85
  150. package/lib/data-form/index.js +9 -0
  151. package/lib/data-table/data-column-view.js +124 -146
  152. package/lib/data-table/data-table-card.js +49 -48
  153. package/lib/data-table/data-table-column.js +54 -57
  154. package/lib/data-table/data-table.js +327 -403
  155. package/lib/data-table/dynamic-component.js +9 -0
  156. package/lib/data-table/index.js +9 -0
  157. package/lib/data-table/use-datatable-drag.js +9 -0
  158. package/lib/datatable-settings/datatable-settings.js +285 -327
  159. package/lib/datatable-settings/index.js +9 -0
  160. package/lib/date-range/date-picker.js +124 -130
  161. package/lib/date-range/date-range.js +172 -215
  162. package/lib/date-range/index.js +9 -0
  163. package/lib/drag-list/constants.js +10 -0
  164. package/lib/drag-list/drag-item.js +50 -55
  165. package/lib/drag-list/drag-list.js +57 -59
  166. package/lib/drag-list/index.js +9 -0
  167. package/lib/drag-list/use-drag-list.js +10 -1
  168. package/lib/dragable/constants.js +10 -0
  169. package/lib/dragable/dragable-item.js +26 -22
  170. package/lib/dragable/dragable-operation.js +32 -31
  171. package/lib/dragable/dragable.js +32 -31
  172. package/lib/dragable/index.js +9 -0
  173. package/lib/dragable/use-dragable.js +9 -0
  174. package/lib/filter-panel/conditions/condition.js +9 -0
  175. package/lib/filter-panel/conditions/date-range-condition.js +50 -49
  176. package/lib/filter-panel/conditions/department-condition/department-condition.js +81 -98
  177. package/lib/filter-panel/conditions/department-condition/department-node.js +68 -72
  178. package/lib/filter-panel/conditions/index.js +9 -0
  179. package/lib/filter-panel/conditions/input-condition.js +87 -90
  180. package/lib/filter-panel/conditions/multi-user-condition.js +65 -66
  181. package/lib/filter-panel/conditions/multiple-menu-condition.js +43 -53
  182. package/lib/filter-panel/conditions/single-menu-condition.js +70 -64
  183. package/lib/filter-panel/conditions/single-user-condition.js +65 -66
  184. package/lib/filter-panel/filter-panel-item.js +50 -54
  185. package/lib/filter-panel/filter-panel.js +146 -155
  186. package/lib/filter-panel/index.js +9 -0
  187. package/lib/filter-panel/use-filter-panel-item.js +9 -0
  188. package/lib/filter-panel/use-filter-panel.js +9 -0
  189. package/lib/hooks/use-data/index.js +9 -0
  190. package/lib/index.js +9 -0
  191. package/lib/layout/index.js +9 -0
  192. package/lib/layout/layout.js +86 -84
  193. package/lib/make-installer.js +9 -0
  194. package/lib/math/Rectangle.js +10 -0
  195. package/lib/menu/index.js +9 -0
  196. package/lib/menu/menu-item.js +64 -69
  197. package/lib/menu/menu.js +63 -69
  198. package/lib/node_modules/.pnpm/{@vueuse_core@9.6.0_vue@3.2.41 → @vueuse_core@9.13.0_vue@3.5.29_typescript@4.9.5_}/node_modules/@vueuse/core/index.js +685 -451
  199. package/lib/node_modules/.pnpm/{@vueuse_shared@9.6.0_vue@3.2.41 → @vueuse_shared@9.13.0_vue@3.5.29_typescript@4.9.5_}/node_modules/@vueuse/shared/index.js +109 -44
  200. package/lib/panel/index.js +9 -0
  201. package/lib/panel/panel.js +48 -52
  202. package/lib/panel-tabs/index.js +9 -0
  203. package/lib/panel-tabs/panel-tabs.js +9 -0
  204. package/lib/pct-filter-panel/index.js +9 -0
  205. package/lib/pct-filter-panel/pct-compents/index.js +9 -0
  206. package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +72 -74
  207. package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +76 -76
  208. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +344 -373
  209. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +148 -153
  210. package/lib/pct-filter-panel/pct-filter-panel-item.js +51 -55
  211. package/lib/pct-filter-panel/pct-filter-panel.js +234 -247
  212. package/lib/pct-filter-panel/use-filter-panel-item.js +9 -0
  213. package/lib/pct-filter-panel/use-filter-panel.js +9 -0
  214. package/lib/plugins.js +9 -0
  215. package/lib/progress/index.js +9 -0
  216. package/lib/progress/progress-item.js +70 -80
  217. package/lib/progress/progress.js +73 -77
  218. package/lib/progress/use-progress.js +9 -0
  219. package/lib/utils/db.js +9 -0
  220. package/lib/utils.css +1 -0
  221. package/lib/utils.js +9 -0
  222. package/lib/where-filter-panel/index.js +9 -0
  223. package/lib/where-filter-panel/use-where-filter-panel.js +9 -0
  224. package/lib/where-filter-panel/where-filter-panel.js +20 -14
  225. package/package.json +1 -1
  226. package/style/index.css +1 -1
  227. package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +0 -28
  228. package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +0 -32
@@ -1,80 +1,75 @@
1
- import { ref, onMounted, watch, computed, unref, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, Fragment, renderList, toDisplayString } from 'vue';
1
+ import { defineComponent, ref, onMounted, watch, computed, unref, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, Fragment, renderList, toDisplayString } from 'vue';
2
2
  import { ElScrollbar } from 'element-plus';
3
3
  import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
4
4
  import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
5
5
 
6
- const _hoisted_1 = ["onClick"];
7
-
8
-
9
- const _sfc_main = {
10
- __name: 'contextmenu',
11
- props: {
12
- visible: {
13
- type: Boolean,
14
- default: false,
15
- },
16
- menus: {
17
- type: Array,
18
- default: () => [],
19
- },
20
- },
21
- emits: ['select'],
22
- setup(__props, { emit }) {
23
-
24
- const props = __props;
25
-
26
- defineOptions({ name: 'BwaContextmenu' });
27
-
28
-
29
-
30
-
31
-
32
- const ns = useNamespace('contextmenu');
33
-
34
- const scrollbarRef = ref(null);
35
-
36
- const clickHandle = (item) => {
37
- emit('select', item);
38
- };
39
-
40
- onMounted(() => {
41
- watch(
42
- computed(() => props.visible),
43
- (visible) => {
44
- if (!visible) {
45
- return;
46
- }
47
-
48
- unref(scrollbarRef).scrollTo(0, 0);
49
- }
50
- );
51
- });
52
-
53
- return (_ctx, _cache) => {
54
- return (openBlock(), createElementBlock("div", {
55
- class: normalizeClass(unref(ns).b())
56
- }, [
57
- createVNode(unref(ElScrollbar), {
58
- "max-height": "400px",
59
- ref_key: "scrollbarRef",
60
- ref: scrollbarRef
61
- }, {
62
- default: withCtx(() => [
63
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.menus, (menu) => {
64
- return (openBlock(), createElementBlock("div", {
65
- onClick: $event => (clickHandle(menu)),
66
- key: menu.id,
67
- class: normalizeClass(unref(ns).b('item'))
68
- }, toDisplayString(menu.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_1))
69
- }), 128 /* KEYED_FRAGMENT */))
70
- ]),
71
- _: 1 /* STABLE */
72
- }, 512 /* NEED_PATCH */)
73
- ], 2 /* CLASS */))
6
+ // Inject __name helper
7
+ if (typeof __name === 'undefined') {
8
+ function __name(obj, name) {
9
+ Object.defineProperty(obj, "name", {
10
+ value: name,
11
+ configurable: true
12
+ });
13
+ }
74
14
  }
75
- }
76
-
77
- };
78
- var Contextmenu = /*#__PURE__*/_export_sfc(_sfc_main, [['__file',"contextmenu.vue"]]);
15
+ const _hoisted_1 = ["onClick"];
16
+ const __default__ = defineComponent({ name: "BwaContextmenu" });
17
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
18
+ props: {
19
+ visible: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ menus: {
24
+ type: Array,
25
+ default: () => []
26
+ }
27
+ },
28
+ emits: ["select"],
29
+ setup(__props, { emit: __emit }) {
30
+ ;
31
+ const props = __props;
32
+ const emit = __emit;
33
+ const ns = useNamespace("contextmenu");
34
+ const scrollbarRef = ref(null);
35
+ const clickHandle = (item) => {
36
+ emit("select", item);
37
+ };
38
+ onMounted(() => {
39
+ watch(
40
+ computed(() => props.visible),
41
+ (visible) => {
42
+ if (!visible) {
43
+ return;
44
+ }
45
+ unref(scrollbarRef).scrollTo(0, 0);
46
+ }
47
+ );
48
+ });
49
+ return (_ctx, _cache) => {
50
+ return openBlock(), createElementBlock("div", {
51
+ class: normalizeClass(unref(ns).b())
52
+ }, [
53
+ createVNode(unref(ElScrollbar), {
54
+ "max-height": "400px",
55
+ ref_key: "scrollbarRef",
56
+ ref: scrollbarRef
57
+ }, {
58
+ default: withCtx(() => [
59
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.menus, (menu) => {
60
+ return openBlock(), createElementBlock("div", {
61
+ onClick: ($event) => clickHandle(menu),
62
+ key: menu.id,
63
+ class: normalizeClass(unref(ns).b("item"))
64
+ }, toDisplayString(menu.label), 11, _hoisted_1);
65
+ }), 128))
66
+ ]),
67
+ _: 1
68
+ }, 512)
69
+ ], 2);
70
+ };
71
+ }
72
+ });
73
+ var Contextmenu = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "contextmenu.vue"]]);
79
74
 
80
75
  export { Contextmenu as default };
@@ -1,6 +1,15 @@
1
1
  import Contextmenu from './contextmenu.mjs';
2
2
  export { useContextmenu } from './use-contextmenu.mjs';
3
3
 
4
+ // Inject __name helper
5
+ if (typeof __name === 'undefined') {
6
+ function __name(obj, name) {
7
+ Object.defineProperty(obj, "name", {
8
+ value: name,
9
+ configurable: true
10
+ });
11
+ }
12
+ }
4
13
  Contextmenu.install = (app) => {
5
14
  Contextmenu._context = app._context;
6
15
  app.component(Contextmenu.name, Contextmenu);
@@ -1,8 +1,17 @@
1
1
  import { ref, reactive, createApp, onMounted, withDirectives, h, unref, vShow, nextTick, onBeforeUnmount } from 'vue';
2
- import { useWindowSize, useElementBounding } from '../node_modules/.pnpm/@vueuse_core@9.6.0_vue@3.2.41/node_modules/@vueuse/core/index.mjs';
2
+ import { useWindowSize, useElementBounding } from '../node_modules/.pnpm/@vueuse_core@9.13.0_vue@3.5.29_typescript@4.9.5_/node_modules/@vueuse/core/index.mjs';
3
3
  import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
4
4
  import Contextmenu from './contextmenu.mjs';
5
5
 
6
+ // Inject __name helper
7
+ if (typeof __name === 'undefined') {
8
+ function __name(obj, name) {
9
+ Object.defineProperty(obj, "name", {
10
+ value: name,
11
+ configurable: true
12
+ });
13
+ }
14
+ }
6
15
  function useContextmenu({
7
16
  menus = []
8
17
  } = {}) {
@@ -1,49 +1,43 @@
1
- import { useAttrs, inject, computed, provide, reactive, unref, openBlock, createBlock, mergeProps, withCtx, renderSlot, createVNode, createCommentVNode } from 'vue';
1
+ import { defineComponent, useAttrs, inject, computed, provide, reactive, unref, openBlock, createBlock, mergeProps, withCtx, renderSlot, createVNode, createCommentVNode } from 'vue';
2
2
  import { formContextKey, ElFormItem } from 'element-plus';
3
3
  import { dataFormKey } from '@ctzy-web-client/web-base-client-vue';
4
4
  import DynamicComponent from './dynamic-component.mjs';
5
5
  import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
6
6
 
7
- const _sfc_main = {
8
- __name: 'data-form-item',
9
- props: {
10
- name: { type: String },
11
- isShowLabelColon: { type: Boolean }
12
- },
7
+ // Inject __name helper
8
+ if (typeof __name === 'undefined') {
9
+ function __name(obj, name) {
10
+ Object.defineProperty(obj, "name", {
11
+ value: name,
12
+ configurable: true
13
+ });
14
+ }
15
+ }
16
+ const __default__ = defineComponent({ name: "BwaDataFormItem" });
17
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
18
+ props: {
19
+ name: { type: String },
20
+ isShowLabelColon: { type: Boolean }
21
+ },
13
22
  setup(__props) {
14
-
15
- const props = __props;
16
-
17
- defineOptions({ name: 'BwaDataFormItem' });
18
-
19
-
20
-
21
- const attrs = useAttrs();
22
-
23
- const dataForm = inject(dataFormKey);
24
-
25
- const formContext = inject(formContextKey, {});
26
-
27
- const formColumn = dataForm
28
- .getDisplayColumns()
29
- .find((col) => col.fullAttrName == props.name);
30
-
31
- const label = computed(() => {
32
- return attrs.label || (formColumn ? formColumn.title + (props.isShowLabelColon ? ' :' : '') : '');
33
- });
34
-
35
- const _formContext = {};
36
- _formContext.disabled = computed(
37
- () => formContext.disabled || formColumn?.disabled
38
- );
39
- Reflect.setPrototypeOf(_formContext, formContext);
40
-
41
- provide(formContextKey, reactive(_formContext));
42
-
43
- return (_ctx, _cache) => {
44
- return (unref(formColumn) && unref(formColumn).visible)
45
- ? (openBlock(), createBlock(unref(ElFormItem), mergeProps({ key: 0 }, unref(attrs), {
46
- label: unref(label),
23
+ ;
24
+ const props = __props;
25
+ const attrs = useAttrs();
26
+ const dataForm = inject(dataFormKey);
27
+ const formContext = inject(formContextKey, {});
28
+ const formColumn = dataForm.getDisplayColumns().find((col) => col.fullAttrName == props.name);
29
+ const label = computed(() => {
30
+ return attrs.label || (formColumn ? formColumn.title + (props.isShowLabelColon ? " :" : "") : "");
31
+ });
32
+ const _formContext = {};
33
+ _formContext.disabled = computed(
34
+ () => formContext.disabled || (formColumn == null ? void 0 : formColumn.disabled)
35
+ );
36
+ Reflect.setPrototypeOf(_formContext, formContext);
37
+ provide(formContextKey, reactive(_formContext));
38
+ return (_ctx, _cache) => {
39
+ return unref(formColumn) && unref(formColumn).visible ? (openBlock(), createBlock(unref(ElFormItem), mergeProps({ key: 0 }, unref(attrs), {
40
+ label: label.value,
47
41
  class: { custom: !_ctx.$slots.default },
48
42
  prop: unref(formColumn).fullAttrName
49
43
  }), {
@@ -56,16 +50,14 @@ return (_ctx, _cache) => {
56
50
  createVNode(unref(DynamicComponent), {
57
51
  column: unref(formColumn),
58
52
  record: unref(dataForm).data
59
- }, null, 8 /* PROPS */, ["column", "record"])
53
+ }, null, 8, ["column", "record"])
60
54
  ])
61
55
  ]),
62
- _: 3 /* FORWARDED */
63
- }, 16 /* FULL_PROPS */, ["label", "class", "prop"]))
64
- : createCommentVNode("v-if", true)
65
- }
66
- }
67
-
68
- };
69
- var DataFormItem = /*#__PURE__*/_export_sfc(_sfc_main, [['__file',"data-form-item.vue"]]);
56
+ _: 3
57
+ }, 16, ["label", "class", "prop"])) : createCommentVNode("v-if", true);
58
+ };
59
+ }
60
+ });
61
+ var DataFormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "data-form-item.vue"]]);
70
62
 
71
63
  export { DataFormItem as default };
@@ -1,222 +1,185 @@
1
- import { useAttrs, ref, computed, watch, provide, onMounted, unref, onBeforeUnmount, openBlock, createBlock, mergeProps, withCtx, renderSlot, createElementBlock, Fragment, renderList } from 'vue';
1
+ import { defineComponent, useAttrs, ref, computed, watch, provide, onMounted, unref, onBeforeUnmount, openBlock, createBlock, mergeProps, withCtx, renderSlot, createElementBlock, Fragment, renderList } from 'vue';
2
2
  import { ElMessage, ElForm } from 'element-plus';
3
3
  import { dataFormKey } from '@ctzy-web-client/web-base-client-vue';
4
4
  import { mergeWith, isArray } from 'lodash';
5
5
  import DataFormItem from './data-form-item.mjs';
6
6
  import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
7
7
 
8
- const _sfc_main = {
9
- __name: 'data-form',
10
- props: {
11
- dataForm: {
12
- type: Object,
13
- },
14
- autoLoad: {
15
- type: Boolean,
16
- default: true,
17
- },
18
- //注册id 和 记录数据
19
- record: {
20
- type: Object,
21
- },
22
- recID: {
23
- type: String,
24
- },
25
- labelPosition: {
26
- type: String,
27
- },
28
- labelWidth: {
29
- type: String,
30
- default: '',
31
- },
32
- rules: {
33
- type: Object,
34
- default: () => ({}),
35
- },
36
- validateOnRuleChange: {
37
- type: Boolean,
38
- default: false,
39
- },
40
- isShowLabelColon: {
41
- type: Boolean,
42
- default: true,
43
- },
44
- },
45
- setup(__props, { expose }) {
46
-
47
- const props = __props;
48
-
49
- defineOptions({ name: 'BwaDataForm' });
50
-
51
-
52
-
53
- const attrs = useAttrs();
54
-
55
- const dataForm = props.dataForm;
56
-
57
- //表单对象的引用
58
- const dataFormElRef = ref();
59
-
60
- //验证规则
61
- const rules = computed(() => {
62
- let data = {};
63
-
64
- dataForm.getDisplayColumns().forEach((item) => {
65
- data[item.fullAttrName] = (
66
- item.required ? [{ required: true, message: item.title + '必填!' }] : []
67
- ).concat(item.rules);
68
- });
69
-
70
- return mergeWith(
71
- {},
72
- data,
73
- props.rules,
74
- function customizer(objValue, srcValue) {
75
- if (isArray(objValue)) {
76
- return objValue.concat(srcValue);
77
- }
78
- }
79
- );
80
- });
81
-
82
- //计算后的描述宽度
83
- const computedLabelWidth = computed(() => {
84
- if (props.labelWidth) {
85
- return props.labelWidth;
86
- }
87
-
88
- let labelWidth = 0;
89
-
90
- if (props.labelPosition != 'top') {
91
- let maxLabelCharCount = 0;
92
- dataForm.getDisplayColumns().forEach((item) => {
93
- maxLabelCharCount = Math.max(
94
- maxLabelCharCount,
95
- item.title.length + (item.required ? 1 : 0)
96
- );
97
- });
98
- labelWidth = (maxLabelCharCount + 1) * 18;
99
- }
100
- return labelWidth + 'px';
101
- });
102
-
103
- if (props.autoLoad) {
104
- //监听recid的变化 是否自动加载数据
105
- watch(
106
- computed(() => props.record),
107
- async () => {
108
- if (props.recID) {
109
- try {
110
- await dataForm.loadDataByRecId(props.recID);
111
- } catch (e) {
112
- console.error(e);
113
- ElMessage.error('获取记录失败。');
114
- }
115
- return;
116
- }
117
-
118
- if (props.record) {
119
- dataForm.setData(props.record);
120
- return;
121
- }
122
-
123
- dataForm.setData();
124
- },
125
- { immediate: true }
126
- );
127
- }
128
-
129
- //当前data table 上下文对象
130
- provide(dataFormKey, dataForm);
131
-
132
- /**
133
- * 表单验证
134
- * @param {*} data
135
- */
136
- const validate = (callback) => {
137
- return dataFormElRef.value.validate(callback);
138
- };
139
-
140
- window.dataFormElRef = dataFormElRef;
141
- window.aaavvv = validate;
142
-
143
- /**
144
- * 提交表单
145
- * @param {Object} 额外附加的提交数据
146
- */
147
- const submit = (data) => {
148
- return validate()
149
- .then(() => {
150
- dataForm
151
- .submit(data)
152
- .then(() => {
153
- ElMessage.info('保存成功!');
154
- })
155
- .catch((e) => ElMessage.error(e.message));
156
- })
157
- .catch((result) => {
158
- console.log(result);
159
- });
160
- };
161
-
162
- onMounted(() => {
163
- unref(dataForm).formValivators.push(unref(dataFormElRef));
164
- });
165
-
166
- onBeforeUnmount(() => {
167
- const _dataFormEl = unref(dataFormElRef);
168
- unref(dataForm).formValivators = unref(dataForm).formValivators.filter(
169
- (validate) => validate !== _dataFormEl
170
- );
171
- });
172
-
173
- expose({
174
- dataForm,
175
- dataFormElRef,
176
- validate,
177
- submit,
178
- rules,
179
- computedLabelWidth,
180
- });
181
-
182
- return (_ctx, _cache) => {
183
- return (openBlock(), createBlock(unref(ElForm), mergeProps({
184
- ref_key: "dataFormElRef",
185
- ref: dataFormElRef
186
- }, unref(attrs), {
187
- model: unref(dataForm).data,
188
- "label-position": __props.labelPosition,
189
- "label-width": unref(computedLabelWidth),
190
- rules: unref(rules),
191
- "validate-on-rule-change": __props.validateOnRuleChange,
192
- disabled: unref(dataForm).disabled
193
- }), {
194
- default: withCtx(() => [
195
- renderSlot(_ctx.$slots, "default", { dataForm: unref(dataForm) }, () => [
196
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(dataForm).getDisplayColumns(), (column) => {
197
- return (openBlock(), createBlock(DataFormItem, {
198
- key: column.fullAttrName,
199
- name: column.fullAttrName,
200
- isShowLabelColon: __props.isShowLabelColon
201
- }, {
202
- default: withCtx(() => [
203
- renderSlot(_ctx.$slots, 'form-item-' + column.fullAttrName, {
204
- column: column,
205
- record: unref(dataForm).data,
206
- dataForm: unref(dataForm)
207
- })
208
- ]),
209
- _: 2 /* DYNAMIC */
210
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["name", "isShowLabelColon"]))
211
- }), 128 /* KEYED_FRAGMENT */))
212
- ])
213
- ]),
214
- _: 3 /* FORWARDED */
215
- }, 16 /* FULL_PROPS */, ["model", "label-position", "label-width", "rules", "validate-on-rule-change", "disabled"]))
8
+ // Inject __name helper
9
+ if (typeof __name === 'undefined') {
10
+ function __name(obj, name) {
11
+ Object.defineProperty(obj, "name", {
12
+ value: name,
13
+ configurable: true
14
+ });
15
+ }
216
16
  }
217
- }
218
-
219
- };
220
- var DataForm = /*#__PURE__*/_export_sfc(_sfc_main, [['__file',"data-form.vue"]]);
17
+ const __default__ = defineComponent({ name: "BwaDataForm" });
18
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
19
+ props: {
20
+ dataForm: {
21
+ type: Object
22
+ },
23
+ autoLoad: {
24
+ type: Boolean,
25
+ default: true
26
+ },
27
+ record: {
28
+ type: Object
29
+ },
30
+ recID: {
31
+ type: String
32
+ },
33
+ labelPosition: {
34
+ type: String
35
+ },
36
+ labelWidth: {
37
+ type: String,
38
+ default: ""
39
+ },
40
+ rules: {
41
+ type: Object,
42
+ default: () => ({})
43
+ },
44
+ validateOnRuleChange: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ isShowLabelColon: {
49
+ type: Boolean,
50
+ default: true
51
+ }
52
+ },
53
+ setup(__props, { expose: __expose }) {
54
+ ;
55
+ const props = __props;
56
+ const attrs = useAttrs();
57
+ const dataForm = props.dataForm;
58
+ const dataFormElRef = ref();
59
+ const rules = computed(() => {
60
+ let data = {};
61
+ dataForm.getDisplayColumns().forEach((item) => {
62
+ data[item.fullAttrName] = (item.required ? [{ required: true, message: item.title + "\u5FC5\u586B!" }] : []).concat(item.rules);
63
+ });
64
+ return mergeWith(
65
+ {},
66
+ data,
67
+ props.rules,
68
+ function customizer(objValue, srcValue) {
69
+ if (isArray(objValue)) {
70
+ return objValue.concat(srcValue);
71
+ }
72
+ }
73
+ );
74
+ });
75
+ const computedLabelWidth = computed(() => {
76
+ if (props.labelWidth) {
77
+ return props.labelWidth;
78
+ }
79
+ let labelWidth = 0;
80
+ if (props.labelPosition != "top") {
81
+ let maxLabelCharCount = 0;
82
+ dataForm.getDisplayColumns().forEach((item) => {
83
+ maxLabelCharCount = Math.max(
84
+ maxLabelCharCount,
85
+ item.title.length + (item.required ? 1 : 0)
86
+ );
87
+ });
88
+ labelWidth = (maxLabelCharCount + 1) * 18;
89
+ }
90
+ return labelWidth + "px";
91
+ });
92
+ if (props.autoLoad) {
93
+ watch(
94
+ computed(() => props.record),
95
+ async () => {
96
+ if (props.recID) {
97
+ try {
98
+ await dataForm.loadDataByRecId(props.recID);
99
+ } catch (e) {
100
+ console.error(e);
101
+ ElMessage.error("\u83B7\u53D6\u8BB0\u5F55\u5931\u8D25\u3002");
102
+ }
103
+ return;
104
+ }
105
+ if (props.record) {
106
+ dataForm.setData(props.record);
107
+ return;
108
+ }
109
+ dataForm.setData();
110
+ },
111
+ { immediate: true }
112
+ );
113
+ }
114
+ provide(dataFormKey, dataForm);
115
+ const validate = (callback) => {
116
+ return dataFormElRef.value.validate(callback);
117
+ };
118
+ window.dataFormElRef = dataFormElRef;
119
+ window.aaavvv = validate;
120
+ const submit = (data) => {
121
+ return validate().then(() => {
122
+ dataForm.submit(data).then(() => {
123
+ ElMessage.info("\u4FDD\u5B58\u6210\u529F!");
124
+ }).catch((e) => ElMessage.error(e.message));
125
+ }).catch((result) => {
126
+ console.log(result);
127
+ });
128
+ };
129
+ onMounted(() => {
130
+ unref(dataForm).formValivators.push(unref(dataFormElRef));
131
+ });
132
+ onBeforeUnmount(() => {
133
+ const _dataFormEl = unref(dataFormElRef);
134
+ unref(dataForm).formValivators = unref(dataForm).formValivators.filter(
135
+ (validate2) => validate2 !== _dataFormEl
136
+ );
137
+ });
138
+ __expose({
139
+ dataForm,
140
+ dataFormElRef,
141
+ validate,
142
+ submit,
143
+ rules,
144
+ computedLabelWidth
145
+ });
146
+ return (_ctx, _cache) => {
147
+ return openBlock(), createBlock(unref(ElForm), mergeProps({
148
+ ref_key: "dataFormElRef",
149
+ ref: dataFormElRef
150
+ }, unref(attrs), {
151
+ model: unref(dataForm).data,
152
+ "label-position": __props.labelPosition,
153
+ "label-width": computedLabelWidth.value,
154
+ rules: rules.value,
155
+ "validate-on-rule-change": __props.validateOnRuleChange,
156
+ disabled: unref(dataForm).disabled
157
+ }), {
158
+ default: withCtx(() => [
159
+ renderSlot(_ctx.$slots, "default", { dataForm: unref(dataForm) }, () => [
160
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(dataForm).getDisplayColumns(), (column) => {
161
+ return openBlock(), createBlock(DataFormItem, {
162
+ key: column.fullAttrName,
163
+ name: column.fullAttrName,
164
+ isShowLabelColon: __props.isShowLabelColon
165
+ }, {
166
+ default: withCtx(() => [
167
+ renderSlot(_ctx.$slots, "form-item-" + column.fullAttrName, {
168
+ column,
169
+ record: unref(dataForm).data,
170
+ dataForm: unref(dataForm)
171
+ })
172
+ ]),
173
+ _: 2
174
+ }, 1032, ["name", "isShowLabelColon"]);
175
+ }), 128))
176
+ ])
177
+ ]),
178
+ _: 3
179
+ }, 16, ["model", "label-position", "label-width", "rules", "validate-on-rule-change", "disabled"]);
180
+ };
181
+ }
182
+ });
183
+ var DataForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "data-form.vue"]]);
221
184
 
222
185
  export { DataForm as default };