@bdsoft/element 1.1.14 → 1.1.16

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.
package/index.js CHANGED
@@ -5,10 +5,10 @@ const dayjs = dayjsModule.default || dayjsModule;
5
5
  import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
6
6
  window.ElementPlus = ElementPlus
7
7
 
8
- import '@/assets/css/element.scss'
8
+ import './src/assets/css/element.scss'
9
9
  import 'splitpanes/dist/splitpanes.css'
10
- import '@/assets/css/layout.scss'
11
- import '@/assets/css/tailwind.scss'
10
+ import './src/assets/css/layout.scss'
11
+ import './src/assets/css/tailwind.scss'
12
12
 
13
13
  // 添加分隔组件
14
14
  import { Splitpanes, Pane } from 'splitpanes'
@@ -16,10 +16,10 @@ import { Splitpanes, Pane } from 'splitpanes'
16
16
  import * as ElementPlusIconsVue from '@element-plus/icons-vue'
17
17
  window.ElementPlusIconVue = ElementPlusIconsVue
18
18
 
19
- import LoadComponent from '@/utils/coms/load.jsx'
19
+ import LoadComponent from './src/utils/coms/load.jsx'
20
20
  // 自定义的所有组件
21
- import * as components from '@/index.js'
22
-
21
+ import * as components from './src/index.js'
22
+ debugger
23
23
  // 定义 useElement 为 Vue 插件
24
24
  const useElement = {
25
25
  install(app, options = {}) {
@@ -76,11 +76,11 @@ const useElement = {
76
76
  export default useElement
77
77
  export { useElement }
78
78
  // 功能 showwarning, showsuccess, showerror, showconfirm
79
- export * from '@/utils/message.js'
80
- export * from '@/utils/index.js'
81
- export * from '@/global/index'
82
- export * from '@/utils/hookDialog.js'
83
- export * from '@/utils/hookPage.js' // 分页hook函数
79
+ export * from './src/utils/message.js'
80
+ export * from './src/utils/index.js'
81
+ export * from './src/global/index'
82
+ export * from './src/utils/hookDialog.js'
83
+ export * from './src/utils/hookPage.js' // 分页hook函数
84
84
  export { dayjs }
85
85
  // 导出所有组件
86
- export * from '@/index.js'
86
+ export * from './src/index.js'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bdsoft/element",
3
3
  "description": "内部UI组件",
4
- "version": "1.1.14",
4
+ "version": "1.1.16",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
 
@@ -84,7 +84,7 @@
84
84
  </template>
85
85
  <script setup>
86
86
  import { ref, reactive, computed, watch, onMounted } from 'vue'
87
- import { useDialog } from '../../../utils/hookDialog.js'
87
+ import { useDialog } from '../../utils/hookDialog.js'
88
88
 
89
89
  const emits = defineEmits(['setNewChartConfig'])
90
90
 
package/src/utils/func.js CHANGED
@@ -30,3 +30,33 @@ export const debounce = (func, delay) => {
30
30
  }, delay)
31
31
  }
32
32
  }
33
+
34
+ /**
35
+ * 日期格式化
36
+ * @param {*} time
37
+ * @param {*} format
38
+ * @returns
39
+ */
40
+ export function parseTime(time, format) {
41
+ if (!time) return ''
42
+ let t = new Date(time)
43
+ let tf = function (i) {
44
+ return (i < 10 ? '0' : '') + i
45
+ }
46
+ return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) {
47
+ switch (a) {
48
+ case 'yyyy':
49
+ return tf(t.getFullYear())
50
+ case 'MM':
51
+ return tf(t.getMonth() + 1)
52
+ case 'mm':
53
+ return tf(t.getMinutes())
54
+ case 'dd':
55
+ return tf(t.getDate())
56
+ case 'HH':
57
+ return tf(t.getHours())
58
+ case 'ss':
59
+ return tf(t.getSeconds())
60
+ }
61
+ })
62
+ }
@@ -42,7 +42,7 @@
42
42
  </template>
43
43
  <script setup>
44
44
  import { ref, reactive, computed, onMounted } from 'vue';
45
- import { getUrlKey, debounce } from '../../../utils/func.js';
45
+ import { getUrlKey, debounce } from '../../utils/func.js';
46
46
 
47
47
  const emits = defineEmits(['getSearchList']);
48
48
  //
package/vite.config.js CHANGED
@@ -1,58 +1,75 @@
1
- import { defineConfig } from 'vite'
2
- import { fileURLToPath } from 'node:url'
3
- import { resolve } from 'path'
4
- import vueJsx from '@vitejs/plugin-vue-jsx'
5
- import vue from '@vitejs/plugin-vue'
6
- import importToConst from 'rollup-plugin-import-to-const'
1
+ import { defineConfig } from "vite";
2
+ import { fileURLToPath } from "node:url";
3
+ // import { resolve } from 'path'
4
+ import vueJsx from "@vitejs/plugin-vue-jsx";
5
+ import vue from "@vitejs/plugin-vue";
6
+ import importToConst from "rollup-plugin-import-to-const";
7
7
 
8
- import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
8
+ import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
9
9
 
10
10
  export default defineConfig({
11
11
  resolve: {
12
12
  alias: {
13
- '@': fileURLToPath(new URL('./src', import.meta.url)),
14
- 'utils': fileURLToPath(new URL('./utils', import.meta.url)),
15
- 'global': fileURLToPath(new URL('./global', import.meta.url)),
16
- '~': fileURLToPath(new URL('./src/assets', import.meta.url))
17
- }
13
+ "@": fileURLToPath(new URL("./src", import.meta.url)),
14
+ "@utils": fileURLToPath(new URL("./src/utils", import.meta.url)),
15
+ global: fileURLToPath(new URL("./src/global", import.meta.url)),
16
+ "~": fileURLToPath(new URL("./src/assets", import.meta.url)),
17
+ },
18
18
  },
19
19
  build: {
20
20
  lib: {
21
- entry: './index.js',
22
- name: '@bdsoft/element',
23
- fileName: 'BdElement', // 输出的包文件名
24
- formats: ['es'] // 这是默认值 'umd','cjs',
21
+ entry: "./index.js",
22
+ name: "@bdsoft/element",
23
+ fileName: "BdElement", // 输出的包文件名
24
+ formats: ["es"], // 这是默认值 'umd','cjs',
25
25
  },
26
26
  // outDir: 'esaaa', // 根输出目录
27
27
  minify: false,
28
28
  rollupOptions: {
29
29
  //忽略打包vue文件
30
- external: ['vue', 'element-plus', '@element-plus/icons-vue', 'vue/server-renderer', '@vue/server-renderer'], // 这里列出你想排除的外部依赖
30
+ external: [
31
+ "vue",
32
+ "element-plus",
33
+ "dayjs",
34
+ "@element-plus/icons-vue",
35
+ "vue/server-renderer",
36
+ "@vue/server-renderer",
37
+ ], // 这里列出你想排除的外部依赖
31
38
  output: [
32
39
  {
33
40
  //配置打包根目录
34
- dir: 'dist',
41
+ dir: "dist",
35
42
  globals: {
36
- vue: 'Vue',
37
- 'element-plus': 'ElementPlus',
38
- '@element-plus/icons-vue': 'ElementPlusIconVue'
43
+ vue: "Vue",
44
+ "element-plus": "ElementPlus",
45
+ "@element-plus/icons-vue": "ElementPlusIconVue",
46
+ dayjs:'dayjs'
39
47
  },
40
- esModule: true // 强制 ES 模块输出格式的兼容性
41
- }
42
- ]
48
+ esModule: true, // 强制 ES 模块输出格式的兼容性
49
+ },
50
+ ],
51
+ },
52
+ // 3. 修复 CommonJS 模块解析(针对 dayjs)
53
+ commonjsOptions: {
54
+ transformMixedEsModules: true, // 自动转换混合模块
55
+ include: [/node_modules\/dayjs/, /node_modules\/element-plus/]
43
56
  },
44
57
  // 优化依赖:提前预构建 dayjs,避免打包时解析错误
45
58
  optimizeDeps: {
46
- include: ['dayjs']
47
- }
59
+ include: ["element-plus"],
60
+ esbuildOptions: {
61
+ define: { global: "globalThis" },
62
+ format: "esm", // 强制 ESM 格式,避免 UMD 冲突
63
+ },
64
+ },
48
65
  },
49
66
  css: {
50
67
  preprocessorOptions: {
51
68
  scss: {
52
- api: 'modern-compiler',
53
- silenceDeprecations: ['legacy-js-api']
54
- }
55
- }
69
+ api: "modern-compiler",
70
+ silenceDeprecations: ["legacy-js-api"],
71
+ },
72
+ },
56
73
  },
57
- plugins: [vue(), vueJsx(), importToConst(), cssInjectedByJsPlugin()]
58
- })
74
+ plugins: [vue(), vueJsx(), importToConst(), cssInjectedByJsPlugin()],
75
+ });