@ctzy-web-client/plugin-component-vue 1.0.0

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 (138) hide show
  1. package/package.json +43 -0
  2. package/src/advance-select/advance-operation.vue +44 -0
  3. package/src/advance-select/advance-option.vue +115 -0
  4. package/src/advance-select/advance-select.vue +343 -0
  5. package/src/advance-select/events-helpers.js +40 -0
  6. package/src/advance-select/index.js +13 -0
  7. package/src/advance-select/use-advance-option.js +58 -0
  8. package/src/advance-select/use-advance-select.js +142 -0
  9. package/src/application-slot/application-slot.js +70 -0
  10. package/src/application-slot/breadcrumb-item.vue +12 -0
  11. package/src/application-slot/header-tools-item.vue +12 -0
  12. package/src/application-slot/index.js +17 -0
  13. package/src/breadcrumb-select/breadcrumb-select.vue +97 -0
  14. package/src/breadcrumb-select/index.js +6 -0
  15. package/src/components.js +39 -0
  16. package/src/contextmenu/contextmenu-item.vue +13 -0
  17. package/src/contextmenu/contextmenu.vue +56 -0
  18. package/src/contextmenu/index.js +11 -0
  19. package/src/contextmenu/use-contextmenu.js +117 -0
  20. package/src/data-form/data-form-item.vue +49 -0
  21. package/src/data-form/data-form.vue +212 -0
  22. package/src/data-form/dynamic-component.js +24 -0
  23. package/src/data-form/form-components/Blots/AtBlot.js +32 -0
  24. package/src/data-form/form-components/bwa-date-picker.vue +43 -0
  25. package/src/data-form/form-components/bwa-date-time-picker.vue +49 -0
  26. package/src/data-form/form-components/bwa-input-float.vue +41 -0
  27. package/src/data-form/form-components/bwa-input-integer.vue +58 -0
  28. package/src/data-form/form-components/bwa-input.vue +32 -0
  29. package/src/data-form/form-components/bwa-multi-select.vue +27 -0
  30. package/src/data-form/form-components/bwa-rich-text-tinymce.vue +561 -0
  31. package/src/data-form/form-components/bwa-rich-text.vue +395 -0
  32. package/src/data-form/form-components/bwa-select.vue +67 -0
  33. package/src/data-form/form-components/bwa-textarea.vue +28 -0
  34. package/src/data-form/form-components/bwa-upload.vue +145 -0
  35. package/src/data-form/form-components/bwa-user-multi-select.vue +25 -0
  36. package/src/data-form/form-components/bwa-user-select.vue +81 -0
  37. package/src/data-form/index.js +35 -0
  38. package/src/data-table/data-column-view.vue +131 -0
  39. package/src/data-table/data-table-card.vue +81 -0
  40. package/src/data-table/data-table-column.vue +52 -0
  41. package/src/data-table/data-table.vue +426 -0
  42. package/src/data-table/dynamic-component.js +58 -0
  43. package/src/data-table/index.js +13 -0
  44. package/src/data-table/use-datatable-drag.js +156 -0
  45. package/src/datatable-settings/datatable-settings.vue +323 -0
  46. package/src/datatable-settings/index.js +6 -0
  47. package/src/date-range/date-picker.vue +115 -0
  48. package/src/date-range/date-range.vue +202 -0
  49. package/src/date-range/index.js +6 -0
  50. package/src/drag-list/constants.js +1 -0
  51. package/src/drag-list/drag-item.vue +46 -0
  52. package/src/drag-list/drag-list.vue +50 -0
  53. package/src/drag-list/index.js +6 -0
  54. package/src/drag-list/use-drag-list.js +209 -0
  55. package/src/dragable/constants.js +3 -0
  56. package/src/dragable/dragable-item.vue +19 -0
  57. package/src/dragable/dragable-operation.vue +28 -0
  58. package/src/dragable/dragable.vue +26 -0
  59. package/src/dragable/index.js +14 -0
  60. package/src/dragable/use-dragable.js +227 -0
  61. package/src/filter-panel/conditions/condition.js +35 -0
  62. package/src/filter-panel/conditions/date-range-condition.vue +35 -0
  63. package/src/filter-panel/conditions/department-condition/data.json +29537 -0
  64. package/src/filter-panel/conditions/department-condition/department-condition.vue +92 -0
  65. package/src/filter-panel/conditions/department-condition/department-node.vue +52 -0
  66. package/src/filter-panel/conditions/index.js +22 -0
  67. package/src/filter-panel/conditions/input-condition.vue +63 -0
  68. package/src/filter-panel/conditions/multi-user-condition.vue +56 -0
  69. package/src/filter-panel/conditions/multiple-menu-condition.vue +45 -0
  70. package/src/filter-panel/conditions/single-menu-condition.vue +58 -0
  71. package/src/filter-panel/conditions/single-user-condition.vue +56 -0
  72. package/src/filter-panel/filter-panel-item.vue +46 -0
  73. package/src/filter-panel/filter-panel.vue +149 -0
  74. package/src/filter-panel/index.js +17 -0
  75. package/src/filter-panel/use-filter-panel-item.js +59 -0
  76. package/src/filter-panel/use-filter-panel.js +203 -0
  77. package/src/hooks/use-data/index.js +234 -0
  78. package/src/index.js +48 -0
  79. package/src/layout/index.js +6 -0
  80. package/src/layout/layout.vue +74 -0
  81. package/src/make-installer.js +36 -0
  82. package/src/math/Rectangle.js +28 -0
  83. package/src/menu/index.js +6 -0
  84. package/src/menu/menu-item.vue +41 -0
  85. package/src/menu/menu.vue +53 -0
  86. package/src/panel/index.js +6 -0
  87. package/src/panel/panel.vue +42 -0
  88. package/src/panel-tabs/index.js +6 -0
  89. package/src/panel-tabs/panel-tabs.js +92 -0
  90. package/src/pct-filter-panel/index.js +10 -0
  91. package/src/pct-filter-panel/pct-compents/index.js +10 -0
  92. package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +63 -0
  93. package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +60 -0
  94. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +177 -0
  95. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue +142 -0
  96. package/src/pct-filter-panel/pct-filter-panel-item.vue +46 -0
  97. package/src/pct-filter-panel/pct-filter-panel.vue +201 -0
  98. package/src/pct-filter-panel/use-filter-panel-item.js +61 -0
  99. package/src/pct-filter-panel/use-filter-panel.js +206 -0
  100. package/src/plugins.js +3 -0
  101. package/src/progress/index.js +8 -0
  102. package/src/progress/progress-item.vue +81 -0
  103. package/src/progress/progress.vue +58 -0
  104. package/src/progress/use-progress.js +66 -0
  105. package/src/utils/db.js +8 -0
  106. package/src/utils.js +263 -0
  107. package/src/where-filter-panel/index.js +0 -0
  108. package/src/where-filter-panel/use-where-filter-panel.js +28 -0
  109. package/src/where-filter-panel/where-filter-panel.vue +9 -0
  110. package/style/advance-select.scss +316 -0
  111. package/style/breadcrumb-select.scss +80 -0
  112. package/style/common/var.scss +240 -0
  113. package/style/common.scss +48 -0
  114. package/style/contextmenu.scss +58 -0
  115. package/style/data-form.scss +35 -0
  116. package/style/data-table.scss +81 -0
  117. package/style/datatable-settings.scss +125 -0
  118. package/style/date-range.scss +136 -0
  119. package/style/department-condition.scss +39 -0
  120. package/style/drag-list.scss +68 -0
  121. package/style/dragable.scss +8 -0
  122. package/style/filter-panel.scss +199 -0
  123. package/style/index.scss +22 -0
  124. package/style/input-condition.scss +30 -0
  125. package/style/layout.scss +70 -0
  126. package/style/menu.scss +184 -0
  127. package/style/mixins/_var.scss +21 -0
  128. package/style/mixins/config.scss +4 -0
  129. package/style/mixins/function.scss +62 -0
  130. package/style/mixins/mixins.scss +88 -0
  131. package/style/panel-tabs.scss +60 -0
  132. package/style/panel.scss +110 -0
  133. package/style/pct-filter-panel.scss +306 -0
  134. package/style/progress.scss +122 -0
  135. package/style/rich-text.scss +30 -0
  136. package/style/theme/theme.scss +161 -0
  137. package/style/theme/var.scss +34 -0
  138. package/style/var.scss +21 -0
@@ -0,0 +1,212 @@
1
+ <template>
2
+ <ElForm
3
+ ref="dataFormElRef"
4
+ v-bind="attrs"
5
+ :model="dataForm.data"
6
+ :label-position="labelPosition"
7
+ :label-width="computedLabelWidth"
8
+ :rules="rules"
9
+ :validate-on-rule-change="validateOnRuleChange"
10
+ :disabled="dataForm.disabled"
11
+ >
12
+ <slot :dataForm="dataForm">
13
+ <BwaDataFormItem
14
+ v-for="column in dataForm.getDisplayColumns()"
15
+ :key="column.fullAttrName"
16
+ :name="column.fullAttrName"
17
+ :isShowLabelColon="isShowLabelColon"
18
+ >
19
+ <slot
20
+ :name="'form-item-' + column.fullAttrName"
21
+ :column="column"
22
+ :record="dataForm.data"
23
+ :dataForm="dataForm"
24
+ >
25
+ </slot>
26
+ </BwaDataFormItem>
27
+ </slot>
28
+ </ElForm>
29
+ </template>
30
+ <script setup>
31
+ import {
32
+ provide,
33
+ ref,
34
+ computed,
35
+ watch,
36
+ useAttrs,
37
+ onMounted,
38
+ unref,
39
+ onBeforeUnmount,
40
+ } from 'vue';
41
+ import { ElMessage, ElForm } from 'element-plus';
42
+ import { dataFormKey } from 'web-base-client-vue';
43
+ import { mergeWith, isArray } from 'lodash';
44
+ import BwaDataFormItem from './data-form-item.vue';
45
+
46
+ defineOptions({ name: 'BwaDataForm' });
47
+
48
+ const props = defineProps({
49
+ dataForm: {
50
+ type: Object,
51
+ },
52
+ autoLoad: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ //注册id 和 记录数据
57
+ record: {
58
+ type: Object,
59
+ },
60
+ recID: {
61
+ type: String,
62
+ },
63
+ labelPosition: {
64
+ type: String,
65
+ },
66
+ labelWidth: {
67
+ type: String,
68
+ default: '',
69
+ },
70
+ rules: {
71
+ type: Object,
72
+ default: () => ({}),
73
+ },
74
+ validateOnRuleChange: {
75
+ type: Boolean,
76
+ default: false,
77
+ },
78
+ isShowLabelColon: {
79
+ type: Boolean,
80
+ default: true,
81
+ },
82
+ });
83
+
84
+ const attrs = useAttrs();
85
+
86
+ const dataForm = props.dataForm;
87
+
88
+ //表单对象的引用
89
+ const dataFormElRef = ref();
90
+
91
+ //验证规则
92
+ const rules = computed(() => {
93
+ let data = {};
94
+
95
+ dataForm.getDisplayColumns().forEach((item) => {
96
+ data[item.fullAttrName] = (
97
+ item.required ? [{ required: true, message: item.title + '必填!' }] : []
98
+ ).concat(item.rules);
99
+ });
100
+
101
+ return mergeWith(
102
+ {},
103
+ data,
104
+ props.rules,
105
+ function customizer(objValue, srcValue) {
106
+ if (isArray(objValue)) {
107
+ return objValue.concat(srcValue);
108
+ }
109
+ }
110
+ );
111
+ });
112
+
113
+ //计算后的描述宽度
114
+ const computedLabelWidth = computed(() => {
115
+ if (props.labelWidth) {
116
+ return props.labelWidth;
117
+ }
118
+
119
+ let labelWidth = 0;
120
+
121
+ if (props.labelPosition != 'top') {
122
+ let maxLabelCharCount = 0;
123
+ dataForm.getDisplayColumns().forEach((item) => {
124
+ maxLabelCharCount = Math.max(
125
+ maxLabelCharCount,
126
+ item.title.length + (item.required ? 1 : 0)
127
+ );
128
+ });
129
+ labelWidth = (maxLabelCharCount + 1) * 18;
130
+ }
131
+ return labelWidth + 'px';
132
+ });
133
+
134
+ if (props.autoLoad) {
135
+ //监听recid的变化 是否自动加载数据
136
+ watch(
137
+ computed(() => props.record),
138
+ async () => {
139
+ if (props.recID) {
140
+ try {
141
+ await dataForm.loadDataByRecId(props.recID);
142
+ } catch (e) {
143
+ console.error(e);
144
+ ElMessage.error('获取记录失败。');
145
+ }
146
+ return;
147
+ }
148
+
149
+ if (props.record) {
150
+ dataForm.setData(props.record);
151
+ return;
152
+ }
153
+
154
+ dataForm.setData();
155
+ },
156
+ { immediate: true }
157
+ );
158
+ }
159
+
160
+ //当前data table 上下文对象
161
+ provide(dataFormKey, dataForm);
162
+
163
+ /**
164
+ * 表单验证
165
+ * @param {*} data
166
+ */
167
+ const validate = (callback) => {
168
+ return dataFormElRef.value.validate(callback);
169
+ };
170
+
171
+ window.dataFormElRef = dataFormElRef;
172
+ window.aaavvv = validate;
173
+
174
+ /**
175
+ * 提交表单
176
+ * @param {Object} 额外附加的提交数据
177
+ */
178
+ const submit = (data) => {
179
+ return validate()
180
+ .then(() => {
181
+ dataForm
182
+ .submit(data)
183
+ .then(() => {
184
+ ElMessage.info('保存成功!');
185
+ })
186
+ .catch((e) => ElMessage.error(e.message));
187
+ })
188
+ .catch((result) => {
189
+ console.log(result);
190
+ });
191
+ };
192
+
193
+ onMounted(() => {
194
+ unref(dataForm).formValivators.push(unref(dataFormElRef));
195
+ });
196
+
197
+ onBeforeUnmount(() => {
198
+ const _dataFormEl = unref(dataFormElRef);
199
+ unref(dataForm).formValivators = unref(dataForm).formValivators.filter(
200
+ (validate) => validate !== _dataFormEl
201
+ );
202
+ });
203
+
204
+ defineExpose({
205
+ dataForm,
206
+ dataFormElRef,
207
+ validate,
208
+ submit,
209
+ rules,
210
+ computedLabelWidth,
211
+ });
212
+ </script>
@@ -0,0 +1,24 @@
1
+ import { h, unref } from 'vue';
2
+ import get from 'lodash/get';
3
+ import set from 'lodash/set';
4
+ import { useDynamicComponent } from '../utils.js';
5
+ export default {
6
+ props: {
7
+ column: Object,
8
+ record: Object,
9
+ },
10
+ emits: ['on-change'],
11
+ setup(props, context) {
12
+ //组件信息
13
+ const { component, params } = useDynamicComponent(
14
+ props,
15
+ context,
16
+ 'BwaInput',
17
+ 'fullAttrName'
18
+ );
19
+
20
+ return () => {
21
+ return h(unref(component), unref(params));
22
+ };
23
+ },
24
+ };
@@ -0,0 +1,32 @@
1
+ import Quill from 'quill';
2
+
3
+ const Parchment = Quill.imports.parchment;
4
+ // const BlockEmbed = Quill.import('blots/block/embed');
5
+
6
+ class AtBlot extends Parchment.Embed {
7
+ static blotName = 'at';
8
+ static tagName = 'span';
9
+
10
+ static create(options) {
11
+ options = options || '';
12
+ let node = super.create();
13
+ node.setAttribute('d-id', options.id);
14
+ node.setAttribute('class', options.class || 'ptp-at-item');
15
+ options.style && node.setAttribute('style', options.style);
16
+ node.innerHTML = options.desc.startsWith('@')
17
+ ? options.desc
18
+ : '@' + options.desc;
19
+ return node;
20
+ }
21
+
22
+ static value(node) {
23
+ return {
24
+ id: node.getAttribute('d-id'),
25
+ desc: node.innerHTML,
26
+ style: node.getAttribute('style'),
27
+ class: node.getAttribute('ptp-at-item'),
28
+ };
29
+ }
30
+ }
31
+
32
+ Quill.register(AtBlot, true);
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <el-date-picker
3
+ v-model="modelValue"
4
+ type="date"
5
+ :placeholder="placeholder"
6
+ v-bind="attrs"
7
+ :teleported="false"
8
+ style="width: 100%"
9
+ />
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, useAttrs } from 'vue';
14
+ import { ElDatePicker, dayjs } from 'element-plus';
15
+
16
+ defineOptions({
17
+ name: 'BwaDatePicker',
18
+ });
19
+
20
+ const props = defineProps({
21
+ modelValue: {
22
+ type: [String, Date],
23
+ default: null,
24
+ },
25
+ placeholder: {
26
+ type: String,
27
+ default: '请选择',
28
+ },
29
+ });
30
+
31
+ const attrs = useAttrs();
32
+
33
+ const emit = defineEmits(['update:model-value']);
34
+
35
+ const modelValue = computed({
36
+ get: () => props.modelValue,
37
+ set: (v) =>
38
+ emit(
39
+ 'update:model-value',
40
+ v ? dayjs(new Date(v.getTime())).format('YYYY-MM-DD') : ''
41
+ ),
42
+ });
43
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <el-date-picker
3
+ v-bind="attrs"
4
+ v-model="modelValue"
5
+ type="datetime"
6
+ :placeholder="placeholder"
7
+ :teleported="false"
8
+ style="width: 100%"
9
+ />
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, useAttrs } from 'vue';
14
+ import { ElDatePicker, dayjs } from 'element-plus';
15
+
16
+ defineOptions({
17
+ name: 'BwaDateTimePicker',
18
+ });
19
+
20
+ const props = defineProps({
21
+ modelValue: {
22
+ type: [String, Date],
23
+ default: null,
24
+ },
25
+ placeholder: {
26
+ type: String,
27
+ default: '请选择',
28
+ },
29
+ });
30
+
31
+ const attrs = useAttrs();
32
+
33
+ const emit = defineEmits(['update:model-value']);
34
+
35
+ const modelValue = computed({
36
+ get: () => props.modelValue,
37
+ set: (v) => {
38
+ if (!v) {
39
+ emit('update:model-value', '');
40
+ return;
41
+ }
42
+
43
+ emit(
44
+ 'update:model-value',
45
+ dayjs(new Date(v.getTime())).format('YYYY-MM-DD HH:mm:ss')
46
+ );
47
+ },
48
+ });
49
+ </script>
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <BwaInputInteger
3
+ v-bind="attrs"
4
+ v-model="modelValue"
5
+ :precision="precision"
6
+ :step="step"
7
+ />
8
+ </template>
9
+
10
+ <script setup>
11
+ import { useAttrs, computed } from 'vue';
12
+ import BwaInputInteger from './bwa-input-integer.vue';
13
+
14
+ defineOptions({
15
+ name: 'BwaInputFloat',
16
+ });
17
+
18
+ const props = defineProps({
19
+ modelValue: {
20
+ type: [String, Number],
21
+ default: 0,
22
+ },
23
+ precision: {
24
+ type: Number,
25
+ default: 1,
26
+ },
27
+ step: {
28
+ type: Number,
29
+ default: 0.1,
30
+ },
31
+ });
32
+
33
+ const attrs = useAttrs();
34
+
35
+ const emit = defineEmits(['update:model-value']);
36
+
37
+ const modelValue = computed({
38
+ get: () => props.modelValue,
39
+ set: (v) => emit('update:model-value', v),
40
+ });
41
+ </script>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <el-input-number v-bind="attrs" v-model="value" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { useAttrs, computed, unref, watch, ref } from 'vue';
7
+ import { ElInputNumber } from 'element-plus';
8
+
9
+ defineOptions({
10
+ name: 'BwaInputInteger',
11
+ });
12
+
13
+ const props = defineProps({
14
+ modelValue: {
15
+ type: [String, Number],
16
+ default: 0,
17
+ },
18
+ });
19
+
20
+ const attrs = useAttrs();
21
+
22
+ const emit = defineEmits(['update:model-value']);
23
+
24
+ const modelValue = computed({
25
+ get: () => props.modelValue,
26
+ set: (v) => {
27
+ emit('update:model-value', v);
28
+ },
29
+ });
30
+
31
+ const value = ref(modelValue.value);
32
+
33
+ watch(value, (newValue) => {
34
+ if (newValue === unref(modelValue)) {
35
+ return;
36
+ }
37
+
38
+ modelValue.value = newValue;
39
+ });
40
+
41
+ watch(
42
+ modelValue,
43
+ (newValue) => {
44
+ if (typeof newValue === 'string') {
45
+ newValue = Number.parseFloat(newValue);
46
+
47
+ newValue = Number.isNaN(newValue) ? 0 : newValue;
48
+ }
49
+
50
+ if (value.value === newValue && value.value !== unref(modelValue)) {
51
+ modelValue.value = newValue;
52
+ }
53
+
54
+ value.value = newValue;
55
+ },
56
+ { immediate: true }
57
+ );
58
+ </script>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <el-input v-bind="attrs" v-model="modelValue" :placeholder="placeholder" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { useAttrs, computed } from 'vue';
7
+ import { ElInput } from 'element-plus';
8
+
9
+ defineOptions({
10
+ name: 'BwaInput',
11
+ });
12
+
13
+ const props = defineProps({
14
+ value: {
15
+ type: [String, Number],
16
+ default: '',
17
+ },
18
+ placeholder: {
19
+ type: String,
20
+ default: '请输入'
21
+ }
22
+ });
23
+
24
+ const attrs = useAttrs();
25
+
26
+ const emit = defineEmits(['update:model-value']);
27
+
28
+ const modelValue = computed({
29
+ get: () => props.modelValue,
30
+ set: (v) => emit('update:model-value', v),
31
+ });
32
+ </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <BwaSelect v-model="modelValue" v-bind="attrs" multiple>
3
+ <slot></slot>
4
+ </BwaSelect>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { computed, useAttrs } from 'vue';
9
+ import BwaSelect from './bwa-select.vue';
10
+
11
+ defineOptions({
12
+ name: 'BwaMultiSelect',
13
+ });
14
+
15
+ const props = defineProps({
16
+ modelValue: null,
17
+ });
18
+
19
+ const emit = defineEmits(['update:model-value']);
20
+
21
+ const modelValue = computed({
22
+ get: () => props.modelValue,
23
+ set: (v) => emit('update:model-value', v),
24
+ });
25
+
26
+ const attrs = useAttrs();
27
+ </script>