ol-base-components 3.4.5 → 3.4.7

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 (64) hide show
  1. package/dist/index.mjs +7105 -0
  2. package/dist/index.umd.js +1 -0
  3. package/dist/style.css +1 -0
  4. package/package.json +18 -4
  5. package/.eslintrc +0 -59
  6. package/.github/deploy.yml +0 -81
  7. package/.prettierignore +0 -6
  8. package/.prettierrc +0 -13
  9. package/.trae/rules/project.md +0 -2
  10. package/babel.config.js +0 -5
  11. package/jsconfig.json +0 -19
  12. package/readme1.md +0 -164
  13. package/src/App.vue +0 -932
  14. package/src/assets/Snipaste_2025-09-03_14-30-49.png +0 -0
  15. package/src/assets/api.png +0 -0
  16. package/src/assets/css/iconfont.css +0 -342
  17. package/src/assets/duojibiaotou.png +0 -0
  18. package/src/assets/effectPicture.png +0 -0
  19. package/src/assets/generator0.png +0 -0
  20. package/src/assets/generator1.png +0 -0
  21. package/src/assets/generator2.png +0 -0
  22. package/src/assets/icon/printModel.svg +0 -1
  23. package/src/assets/init.png +0 -0
  24. package/src/assets/logo.png +0 -0
  25. package/src/assets/olBaseComponentsLogo.svg +0 -100
  26. package/src/assets/print.svg +0 -1
  27. package/src/assets/run.png +0 -0
  28. package/src/assets/vscodecj.png +0 -0
  29. package/src/bin/initTemplate.js +0 -409
  30. package/src/bin/news.js +0 -171
  31. package/src/bin/openCloseloop.js +0 -154
  32. package/src/bin/openLoop.js +0 -154
  33. package/src/main.js +0 -13
  34. package/src/package/customSearch/index.js +0 -7
  35. package/src/package/customSearch/src/index.vue +0 -120
  36. package/src/package/dialog/index.js +0 -7
  37. package/src/package/dialog/src/index.vue +0 -419
  38. package/src/package/form/index.js +0 -7
  39. package/src/package/form/src/index.vue +0 -405
  40. package/src/package/formSearch/index.js +0 -7
  41. package/src/package/formSearch/src/components/SearchConfigDialog.vue +0 -957
  42. package/src/package/formSearch/src/index.js +0 -29
  43. package/src/package/formSearch/src/index.vue +0 -928
  44. package/src/package/index.js +0 -243
  45. package/src/package/numberRange/index.js +0 -7
  46. package/src/package/numberRange/src/index.vue +0 -351
  47. package/src/package/print/index.js +0 -76
  48. package/src/package/print/src/components/PaperSelector.vue +0 -109
  49. package/src/package/print/src/index.vue +0 -622
  50. package/src/package/print/src/provide/provider1.js +0 -215
  51. package/src/package/printModel/index.js +0 -7
  52. package/src/package/printModel/src/index.vue +0 -493
  53. package/src/package/table/index.js +0 -12
  54. package/src/package/table/src/TableColumn.vue +0 -77
  55. package/src/package/table/src/components/PrintTemplateSelector.vue +0 -210
  56. package/src/package/table/src/index.vue +0 -945
  57. package/src/package/table/src/nodata.jpg +0 -0
  58. package/src/package/table/src/printTable.vue +0 -196
  59. package/src/utils/getEnum.js +0 -8
  60. package/src/utils/initData.js +0 -138
  61. package/vue.config.js +0 -21
  62. /package/{public → dist}/favicon.ico +0 -0
  63. /package/{public → dist}/index.html +0 -0
  64. /package/{public → dist}/print-lock.css +0 -0
@@ -1,243 +0,0 @@
1
- import OlTable, { OlDropdownPrint } from "./table";
2
- import OlSearch from "./formSearch";
3
- import OlCustomSearch from "./customSearch";
4
- import Dialog from "./dialog";
5
- import OlForm from "./form";
6
- import OlNumberRange from "./numberRange";
7
- import OlPrintModel from "./printModel";
8
-
9
- import OlPrint, { Hiprint } from "./print";
10
-
11
- import SwaggerClient from "swagger-client";
12
-
13
- const consoleTooltip = () => {
14
- // 定义颜色和样式
15
- const reset = "\x1b[0m"; // 重置样式
16
- const green = "\x1b[32m"; // 绿色
17
- const cyan = "\x1b[36m"; // 青色
18
- const bold = "\x1b[1m"; // 粗体
19
- const underline = "\x1b[4m"; // 下划线
20
-
21
- // 定义图案
22
- const star = "⭐";
23
- const checkMark = "✔️";
24
-
25
- // 输出成功提示
26
- console.log(`
27
- ${cyan}${bold}${star.repeat(
28
- 3
29
- )}${green}${bold}${underline}ol-base-components 插件加载成功! ${checkMark}
30
- ${cyan}感谢使用我们的组件库,期待你的精彩应用!${reset}
31
- `);
32
- };
33
- const consoleSwagger = () => {
34
- // 定义颜色和样式
35
- const reset = "\x1b[0m"; // 重置样式
36
- const green = "\x1b[32m"; // 绿色
37
- const cyan = "\x1b[36m"; // 青色
38
- const bold = "\x1b[1m"; // 粗体
39
- const underline = "\x1b[4m"; // 下划线
40
-
41
- // 定义图案
42
- const star = "⭐";
43
- const checkMark = "✔️";
44
-
45
- // 输出成功提示
46
- console.log(`
47
- ${cyan}${bold}${star.repeat(
48
- 3
49
- )}${green}${bold}${underline}ol-base-components swagger服务加载成功! ${checkMark}
50
- `);
51
- };
52
-
53
- const DB_NAME = "SwaggerDB";
54
- const DB_VERSION = 1;
55
- const STORE_NAME = "swaggerDataStore";
56
-
57
- // 打开数据库
58
- function openDatabase() {
59
- return new Promise((resolve, reject) => {
60
- const request = indexedDB.open(DB_NAME, DB_VERSION);
61
-
62
- request.onupgradeneeded = event => {
63
- const db = event.target.result;
64
- db.createObjectStore(STORE_NAME);
65
- };
66
-
67
- request.onsuccess = event => {
68
- resolve(event.target.result);
69
- };
70
-
71
- request.onerror = event => {
72
- reject(event.target.error);
73
- };
74
- });
75
- }
76
-
77
- // 存储数据
78
- function storeData(data) {
79
- return openDatabase().then(db => {
80
- return new Promise((resolve, reject) => {
81
- const transaction = db.transaction(STORE_NAME, "readwrite");
82
- const store = transaction.objectStore(STORE_NAME);
83
- store.put(data, "swaggerData"); // 使用 'swaggerData' 作为键
84
- transaction.oncomplete = () => resolve();
85
- transaction.onerror = event => reject(event.target.error);
86
- });
87
- });
88
- }
89
-
90
- // 获取数据
91
- export function getData() {
92
- return openDatabase().then(db => {
93
- return new Promise((resolve, reject) => {
94
- const transaction = db.transaction(STORE_NAME, "readonly");
95
- const store = transaction.objectStore(STORE_NAME);
96
- const request = store.get("swaggerData");
97
-
98
- request.onsuccess = event => {
99
- resolve(event.target.result);
100
- };
101
-
102
- request.onerror = event => {
103
- reject(event.target.error);
104
- };
105
- });
106
- });
107
- }
108
-
109
- // 清除数据
110
- function clearData() {
111
- return openDatabase().then(db => {
112
- return new Promise((resolve, reject) => {
113
- const transaction = db.transaction(STORE_NAME, "readwrite");
114
- const store = transaction.objectStore(STORE_NAME);
115
- store.delete("swaggerData"); // 删除存储的数据
116
- transaction.oncomplete = () => resolve();
117
- transaction.onerror = event => reject(event.target.error);
118
- });
119
- });
120
- }
121
-
122
- // 注册
123
- const swaggerInstall = async swaggerUrl => {
124
- if (!swaggerUrl) return Promise.reject(new Error("Swagger URL is required.")); // 检查 Swagger URL
125
-
126
- // IndexedDB 获取 Swagger 数据
127
- const cachedData = await getData();
128
- if (cachedData) {
129
- consoleSwagger();
130
- return Promise.resolve(cachedData);
131
- } else {
132
- // 如果没有缓存数据,重新请求 Swagger 数据
133
- try {
134
- showLoading();
135
- const client = await SwaggerClient(swaggerUrl);
136
- const swaggerData = client.spec;
137
- await storeData(swaggerData);
138
- hideLoading();
139
- consoleSwagger();
140
- return Promise.resolve(swaggerData);
141
- } catch (error) {
142
- hideLoading();
143
- console.error("获取 Swagger 数据失败:", error);
144
- return Promise.reject(error);
145
- }
146
- }
147
- };
148
- // 销毁
149
- const swaggerUnload = async function () {
150
- await clearData(); // 清空 IndexedDB 中的缓存数据
151
- };
152
-
153
- // 自定义加载指示器
154
- function showLoading() {
155
- const style = document.createElement("style");
156
- style.innerHTML = `
157
- @keyframes spin {
158
- 0% { transform: rotate(0deg); }
159
- 100% { transform: rotate(360deg); }
160
- }
161
- #loading-spinner {
162
- width: 50px; /* 调整大小 */
163
- height: 50px; /* 调整大小 */
164
- border: 8px solid rgba(255, 255, 255, 0.3);
165
- border-top: 8px solid #a8c8e0; /* 与背景色协调的颜色 */
166
- border-radius: 50%;
167
- animation: spin 1s linear infinite; /* 添加旋转动画 */
168
- margin-bottom: 10px; /* 图标和文本之间的间距 */
169
- }
170
- #loading {
171
- background: linear-gradient(135deg, #a8c8e0, #f0f4f8); /* 更柔和的渐变背景 */
172
- color: #333; /* 文本颜色 */
173
- z-index:9999999;
174
- }
175
- `;
176
- document.head.appendChild(style);
177
-
178
- // 创建加载指示器
179
- const loadingDiv = document.createElement("div");
180
- loadingDiv.id = "loading";
181
- loadingDiv.style.position = "fixed";
182
- loadingDiv.style.top = "0";
183
- loadingDiv.style.left = "0";
184
- loadingDiv.style.width = "100%";
185
- loadingDiv.style.height = "100%";
186
- loadingDiv.style.display = "flex";
187
- loadingDiv.style.flexDirection = "column";
188
- loadingDiv.style.justifyContent = "center";
189
- loadingDiv.style.alignItems = "center";
190
-
191
- // 创建旋转的加载图标
192
- const spinner = document.createElement("div");
193
- spinner.id = "loading-spinner";
194
- loadingDiv.appendChild(spinner);
195
-
196
- // 添加文本
197
- const loadingText = document.createElement("div");
198
- loadingText.innerText = "初始化数据中,请耐心等待...";
199
- loadingDiv.appendChild(loadingText);
200
-
201
- document.body.appendChild(loadingDiv);
202
- }
203
-
204
- function hideLoading() {
205
- const loadingDiv = document.getElementById("loading");
206
- if (loadingDiv) {
207
- document.body.removeChild(loadingDiv);
208
- }
209
- }
210
-
211
- const components = [
212
- OlTable,
213
- OlDropdownPrint,
214
- OlSearch,
215
- OlCustomSearch,
216
- Dialog,
217
- OlForm,
218
- OlNumberRange,
219
- OlPrint,
220
- OlPrintModel,
221
- ];
222
- const install = async function (Vue, options) {
223
- // 设置全局数据
224
- components.map(item => {
225
- Vue.component(`ol-${item.name}`, item);
226
- });
227
- Vue.prototype.$olBaseConfig = options || {};
228
- consoleTooltip();
229
- };
230
-
231
- export default install;
232
- export {
233
- OlTable,
234
- OlDropdownPrint,
235
- OlSearch,
236
- OlCustomSearch,
237
- Dialog,
238
- OlForm,
239
- OlNumberRange,
240
- OlPrint,
241
- OlPrintModel,
242
- };
243
- export { swaggerInstall, swaggerUnload, Hiprint };
@@ -1,7 +0,0 @@
1
- import OlNumberRange from "./src/index.vue";
2
-
3
- OlNumberRange.install = function (Vue) {
4
- Vue.component("ol-number-range ", OlNumberRange);
5
- };
6
-
7
- export default OlNumberRange;
@@ -1,351 +0,0 @@
1
- <template>
2
- <div class="ol-number-range" :class="{ 'is-disabled': disabled }">
3
- <el-input
4
- ref="startInput"
5
- v-model="startValue"
6
- type="number"
7
- :placeholder="startPlaceholder"
8
- :min="min"
9
- :max="max"
10
- :disabled="disabled"
11
- class="range-input start-input"
12
- @blur="handleStartBlur"
13
- @input="handleStartInput"
14
- @keyup.enter.native="handleStartBlur"
15
- />
16
- <span class="range-separator">-</span>
17
- <el-input
18
- ref="endInput"
19
- v-model="endValue"
20
- type="number"
21
- :placeholder="endPlaceholder"
22
- :min="min"
23
- :max="max"
24
- :disabled="disabled"
25
- class="range-input end-input"
26
- @blur="handleEndBlur"
27
- @input="handleEndInput"
28
- @keyup.enter.native="handleEndBlur"
29
- />
30
- <i
31
- v-if="clearable && !disabled && (startValue || endValue)"
32
- class="el-icon-circle-close clear-icon"
33
- @click="handleClear"
34
- />
35
- </div>
36
- </template>
37
-
38
- <script>
39
- export default {
40
- name: "number-range",
41
- props: {
42
- value: {
43
- type: Array,
44
- default: () => [null, null],
45
- },
46
- min: {
47
- type: Number,
48
- default: 0,
49
- },
50
- max: {
51
- type: Number,
52
- default: 999999,
53
- },
54
- startPlaceholder: {
55
- type: String,
56
- default: "起始值",
57
- },
58
- endPlaceholder: {
59
- type: String,
60
- default: "终止值",
61
- },
62
- clearable: {
63
- type: Boolean,
64
- default: true,
65
- },
66
- // 是否启用默认填充最大最小值
67
- autoFillDefault: {
68
- type: Boolean,
69
- default: false,
70
- },
71
- disabled: {
72
- type: Boolean,
73
- default: false,
74
- },
75
- // 数值精度,类似el-input-Number组件precision
76
- precision: {
77
- type: Number,
78
- default: 0,
79
- validator(val) {
80
- return val === undefined || (Number.isInteger(val) && val >= 0);
81
- },
82
- },
83
- },
84
- data() {
85
- return {
86
- startValue: null,
87
- endValue: null,
88
- };
89
- },
90
- watch: {
91
- value: {
92
- handler(newVal) {
93
- if (Array.isArray(newVal) && newVal.length === 2) {
94
- this.startValue =
95
- newVal[0] !== null && newVal[0] !== undefined
96
- ? this.formatPrecision(Number(newVal[0]))
97
- : null;
98
- this.endValue =
99
- newVal[1] !== null && newVal[1] !== undefined
100
- ? this.formatPrecision(Number(newVal[1]))
101
- : null;
102
- } else {
103
- this.startValue = null;
104
- this.endValue = null;
105
- }
106
- },
107
- immediate: true,
108
- deep: true,
109
- },
110
- },
111
- methods: {
112
- // 格式化精度
113
- formatPrecision(num) {
114
- if (this.precision !== undefined && this.precision !== null) {
115
- return Number(Number(num).toFixed(this.precision));
116
- }
117
- return num;
118
- },
119
- // 处理起始值输入
120
- handleStartInput(val) {
121
- if (this.disabled) return;
122
- if (val === "" || val === null || val === undefined) {
123
- this.startValue = null;
124
- } else {
125
- let num = Number(val);
126
- // 限制在 min 和 max 范围内
127
- if (num < this.min) {
128
- num = this.min;
129
- } else if (num > this.max) {
130
- num = this.max;
131
- }
132
- // 应用精度
133
- this.startValue = this.formatPrecision(num);
134
- }
135
- this.emitValue();
136
- },
137
- // 处理结束值输入
138
- handleEndInput(val) {
139
- if (this.disabled) return;
140
- if (val === "" || val === null || val === undefined) {
141
- this.endValue = null;
142
- } else {
143
- let num = Number(val);
144
- // 限制在 min 和 max 范围内
145
- if (num < this.min) {
146
- num = this.min;
147
- } else if (num > this.max) {
148
- num = this.max;
149
- }
150
- // 应用精度
151
- this.endValue = this.formatPrecision(num);
152
- }
153
- this.emitValue();
154
- },
155
- // 处理起始值失焦
156
- handleStartBlur() {
157
- if (this.disabled) return;
158
- // 只有当启用自动填充默认值,且只输入了起始值,结束值才默认为最大值
159
- if (this.autoFillDefault && this.startValue !== null && this.endValue === null) {
160
- this.endValue = this.formatPrecision(this.max);
161
- }
162
- // 应用精度
163
- if (this.startValue !== null) {
164
- this.startValue = this.formatPrecision(this.startValue);
165
- }
166
- // 验证范围
167
- this.validateRange();
168
- this.emitValue();
169
- },
170
- // 处理结束值失焦
171
- handleEndBlur() {
172
- if (this.disabled) return;
173
- // 只有当启用自动填充默认值,且只输入了结束值,起始值才默认为最小值
174
- if (this.autoFillDefault && this.endValue !== null && this.startValue === null) {
175
- this.startValue = this.formatPrecision(this.min);
176
- }
177
- // 应用精度
178
- if (this.endValue !== null) {
179
- this.endValue = this.formatPrecision(this.endValue);
180
- }
181
- // 验证范围
182
- this.validateRange();
183
- this.emitValue();
184
- },
185
- // 验证范围
186
- validateRange() {
187
- if (this.startValue !== null && this.endValue !== null) {
188
- // 确保起始值不大于结束值
189
- if (this.startValue > this.endValue) {
190
- // 如果起始值大于结束值,交换它们
191
- const temp = this.startValue;
192
- this.startValue = this.formatPrecision(this.endValue);
193
- this.endValue = this.formatPrecision(temp);
194
- }
195
- }
196
- },
197
- // 清空
198
- handleClear() {
199
- if (this.disabled) return;
200
- this.startValue = null;
201
- this.endValue = null;
202
- this.emitValue();
203
- },
204
- // 触发 v-model 更新
205
- emitValue() {
206
- const result = [this.startValue, this.endValue];
207
- this.$emit("input", result);
208
- this.$emit("change", result);
209
- },
210
- },
211
- };
212
- </script>
213
-
214
- <style lang="scss" scoped>
215
- .ol-number-range {
216
- position: relative;
217
- display: inline-flex;
218
- align-items: center;
219
- width: 100%;
220
- background-color: #fff;
221
- border: 1px solid #dcdfe6;
222
- border-radius: 4px;
223
- transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
224
- padding: 0 30px 0 10px;
225
- box-sizing: border-box;
226
- height: 32px;
227
- line-height: 32px;
228
-
229
- &:hover {
230
- border-color: #c0c4cc;
231
- }
232
-
233
- &:focus-within {
234
- border-color: #409eff;
235
- outline: none;
236
- }
237
-
238
- .range-input {
239
- flex: 1;
240
- border: none;
241
- background: transparent;
242
- padding: 0;
243
- height: 100%;
244
- line-height: inherit;
245
-
246
- ::v-deep .el-input__inner {
247
- border: none;
248
- padding: 0;
249
- height: 100%;
250
- line-height: inherit;
251
- background: transparent;
252
- text-align: center;
253
- font-size: 14px;
254
- color: #606266;
255
-
256
- &:focus {
257
- border: none;
258
- outline: none;
259
- }
260
-
261
- &::placeholder {
262
- color: #c0c4cc;
263
- }
264
- }
265
-
266
- ::v-deep .el-input__inner::-webkit-outer-spin-button,
267
- ::v-deep .el-input__inner::-webkit-inner-spin-button {
268
- -webkit-appearance: none;
269
- margin: 0;
270
- }
271
-
272
- ::v-deep .el-input__inner[type="number"] {
273
- -moz-appearance: textfield;
274
- appearance: textfield;
275
- }
276
- }
277
-
278
- .start-input {
279
- ::v-deep .el-input__inner {
280
- text-align: center;
281
- }
282
- }
283
-
284
- .end-input {
285
- ::v-deep .el-input__inner {
286
- text-align: center;
287
- }
288
- }
289
-
290
- .range-separator {
291
- flex-shrink: 0;
292
- padding: 0 8px;
293
- color: #c0c4cc;
294
- font-size: 14px;
295
- line-height: 1;
296
- }
297
-
298
- .clear-icon {
299
- position: absolute;
300
- right: 8px;
301
- top: 50%;
302
- transform: translateY(-50%);
303
- cursor: pointer;
304
- color: #c0c4cc;
305
- font-size: 14px;
306
- transition: color 0.2s;
307
- z-index: 1;
308
-
309
- &:hover {
310
- color: #909399;
311
- }
312
- }
313
- }
314
-
315
- // 小尺寸适配
316
- ::v-deep .el-form-item--small .ol-number-range {
317
- padding: 0 30px 0 10px;
318
- height: 28px;
319
- line-height: 28px;
320
-
321
- .range-input {
322
- height: 28px;
323
- line-height: 28px;
324
-
325
- ::v-deep .el-input__inner {
326
- height: 28px;
327
- line-height: 28px;
328
- font-size: 13px;
329
- }
330
- }
331
- }
332
-
333
- // 禁用状态
334
- .ol-number-range.is-disabled {
335
- background-color: #f5f7fa;
336
- border-color: #e4e7ed;
337
- cursor: not-allowed;
338
-
339
- .range-input {
340
- ::v-deep .el-input__inner {
341
- background-color: #f5f7fa;
342
- color: #c0c4cc;
343
- cursor: not-allowed;
344
- }
345
- }
346
-
347
- .clear-icon {
348
- display: none;
349
- }
350
- }
351
- </style>
@@ -1,76 +0,0 @@
1
- import OlPrint from "./src/index.vue";
2
-
3
- // 方式1:组件方式注册
4
- OlPrint.install = function (Vue) {
5
- Vue.component("ol-print", OlPrint);
6
- };
7
-
8
- // 方式2:插件方式注册(全局方法)
9
- let printInstance = null;
10
- let container = null;
11
-
12
- const Hiprint = {
13
- install(Vue) {
14
- const hiprint = function (options) {
15
- const { printData, onPrintData, defaultTemplate, onSubmit, grid } = options || {};
16
- // 销毁旧实例
17
- if (printInstance) {
18
- printInstance.$destroy();
19
- if (container && container.parentNode) {
20
- container.parentNode.removeChild(container);
21
- }
22
- printInstance = null;
23
- container = null;
24
- }
25
-
26
- // 创建新实例
27
- container = document.createElement("div");
28
- document.body.appendChild(container);
29
-
30
- const PrintComponent = Vue.extend(OlPrint);
31
- const propsData = {
32
- grid,
33
- };
34
- if (printData) {
35
- propsData.printData = printData;
36
- }
37
- if (onPrintData) {
38
- propsData.onPrintData = onPrintData;
39
- }
40
-
41
- if (defaultTemplate) {
42
- propsData.defaultTemplate = defaultTemplate;
43
- }
44
-
45
- printInstance = new PrintComponent({
46
- propsData,
47
- });
48
-
49
- // 监听 submit 事件
50
- if (onSubmit && typeof onSubmit === "function") {
51
- printInstance.$on("submit", json => {
52
- onSubmit(json);
53
- });
54
- }
55
-
56
- printInstance.$mount(container);
57
-
58
- // 返回实例,方便外部调用
59
- return printInstance;
60
- };
61
- Vue.prototype.$hiprint = hiprint;
62
-
63
- // 快捷方法:直接打印
64
- Vue.prototype.$hiprint.print = function (options) {
65
- const instance = hiprint(options);
66
- instance.print();
67
- instance.$nextTick(() => {
68
- instance.close();
69
- });
70
- };
71
- },
72
- };
73
-
74
- // 导出组件和插件
75
- export { OlPrint, Hiprint };
76
- export default OlPrint;