@handaotech-design/bom 0.0.31 → 0.0.33

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/README.md CHANGED
@@ -11,16 +11,17 @@ import '@handaotech-design/bom/dist/style.css';
11
11
  ```
12
12
 
13
13
  ### 3. 组件注册
14
+ #### 插件批量注册
14
15
  ```javascript
15
16
  // HdBom 组件库统一注册(也可按需注册)
16
17
  import HdBom from '@handaotech-design/bom';
17
18
  app.use(HdBom)
18
-
19
+ ```
20
+ #### 单个组件注册
21
+ ```javascript
19
22
  // 相关 antd 组件注册
20
- import { Input, Tree, Dropdown } from 'ant-design-vue';
21
- app.use(Input)
22
- app.use(Tree)
23
- app.use(Dropdown)
23
+ import { HdBomWorkbench } from '@handaotech-design/bom';
24
+ app.use(HdBomWorkbench)
24
25
  ```
25
26
 
26
27
  ## 组件列表
@@ -1,5 +1,10 @@
1
- import { withInstall } from "@handaotech-design/vue";
1
+ import { Dropdown, Input, Tree } from "ant-design-vue";
2
+ import { MoreOutlined } from "@ant-design/icons-vue";
3
+ import { withInstall } from "../../utils/install.js";
2
4
  import BomTree from "./index.vue";
3
5
  export * from "./index.vue";
4
- export const HdBomTree = withInstall(BomTree);
6
+ const antdComponents = Object.fromEntries(
7
+ [Input, Tree, Dropdown, MoreOutlined].map((comp) => [comp.name, comp])
8
+ );
9
+ export const HdBomTree = withInstall(BomTree, antdComponents);
5
10
  export default HdBomTree;
@@ -6,6 +6,7 @@ import { watchDebounced } from '@vueuse/shared'
6
6
  import * as _ from 'lodash-es'
7
7
  import type { DataNode } from 'ant-design-vue/es/vc-tree-select/interface'
8
8
  import type { EventDataNode } from 'ant-design-vue/es/tree'
9
+ import { MoreOutlined } from '@ant-design/icons-vue'
9
10
  import HdGrayInput from '../gray-input'
10
11
  import type { BomTreeConfig } from '../../models'
11
12
  import { TreeMenuTriggerMode } from '../../models'
@@ -0,0 +1,2 @@
1
+ import type { SFCWithInstall } from '@handaotech-design/vue/es';
2
+ export declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E) => SFCWithInstall<T> & E;
@@ -0,0 +1,15 @@
1
+ export const withInstall = (main, extra) => {
2
+ main.install = (app) => {
3
+ for (const comp of [main, ...Object.values(extra ?? {})]) {
4
+ if (!app.component(comp.name)) {
5
+ app.component(comp.name, comp);
6
+ }
7
+ }
8
+ };
9
+ if (extra) {
10
+ for (const [key, comp] of Object.entries(extra)) {
11
+ main[key] = comp;
12
+ }
13
+ }
14
+ return main;
15
+ };
@@ -7,7 +7,9 @@ var _exportNames = {
7
7
  HdBomTree: true
8
8
  };
9
9
  module.exports = exports.HdBomTree = void 0;
10
- var _vue = require("@handaotech-design/vue");
10
+ var _antDesignVue = require("ant-design-vue");
11
+ var _iconsVue = require("@ant-design/icons-vue");
12
+ var _install = require("../../utils/install");
11
13
  var _index = _interopRequireWildcard(require("./index.vue"));
12
14
  Object.keys(_index).forEach(function (key) {
13
15
  if (key === "default" || key === "__esModule") return;
@@ -22,5 +24,6 @@ Object.keys(_index).forEach(function (key) {
22
24
  });
23
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
24
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
25
- const HdBomTree = exports.HdBomTree = (0, _vue.withInstall)(_index.default);
27
+ const antdComponents = Object.fromEntries([_antDesignVue.Input, _antDesignVue.Tree, _antDesignVue.Dropdown, _iconsVue.MoreOutlined].map(comp => [comp.name, comp]));
28
+ const HdBomTree = exports.HdBomTree = (0, _install.withInstall)(_index.default, antdComponents);
26
29
  module.exports = HdBomTree;
@@ -6,6 +6,7 @@ import { watchDebounced } from '@vueuse/shared'
6
6
  import * as _ from 'lodash-es'
7
7
  import type { DataNode } from 'ant-design-vue/es/vc-tree-select/interface'
8
8
  import type { EventDataNode } from 'ant-design-vue/es/tree'
9
+ import { MoreOutlined } from '@ant-design/icons-vue'
9
10
  import HdGrayInput from '../gray-input'
10
11
  import type { BomTreeConfig } from '../../models'
11
12
  import { TreeMenuTriggerMode } from '../../models'
@@ -0,0 +1,2 @@
1
+ import type { SFCWithInstall } from '@handaotech-design/vue/es';
2
+ export declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E) => SFCWithInstall<T> & E;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withInstall = void 0;
7
+ const withInstall = (main, extra) => {
8
+ main.install = app => {
9
+ for (const comp of [main, ...Object.values(extra ?? {})]) {
10
+ if (!app.component(comp.name)) {
11
+ app.component(comp.name, comp);
12
+ }
13
+ }
14
+ };
15
+ if (extra) {
16
+ for (const [key, comp] of Object.entries(extra)) {
17
+ main[key] = comp;
18
+ }
19
+ }
20
+ return main;
21
+ };
22
+ exports.withInstall = withInstall;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handaotech-design/bom",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {