hfn-components 0.0.1 → 0.0.2

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.
@@ -0,0 +1,28 @@
1
+ function styleInject(css, ref) {
2
+ if ( ref === void 0 ) ref = {};
3
+ var insertAt = ref.insertAt;
4
+
5
+ if (!css || typeof document === 'undefined') { return; }
6
+
7
+ var head = document.head || document.getElementsByTagName('head')[0];
8
+ var style = document.createElement('style');
9
+ style.type = 'text/css';
10
+
11
+ if (insertAt === 'top') {
12
+ if (head.firstChild) {
13
+ head.insertBefore(style, head.firstChild);
14
+ } else {
15
+ head.appendChild(style);
16
+ }
17
+ } else {
18
+ head.appendChild(style);
19
+ }
20
+
21
+ if (style.styleSheet) {
22
+ style.styleSheet.cssText = css;
23
+ } else {
24
+ style.appendChild(document.createTextNode(css));
25
+ }
26
+ }
27
+
28
+ export { styleInject as default };
@@ -0,0 +1,6 @@
1
+ import _sfc_main from './HtButton.vue2.mjs';
2
+ import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
3
+
4
+ var button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/libiluo/Desktop/company/component-library/packages/components/button/HtButton.vue"]]);
5
+
6
+ export { button as default };
@@ -0,0 +1,15 @@
1
+ import { defineComponent, openBlock, createElementBlock } from 'vue';
2
+
3
+ var _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{
5
+ name: "HtButton"
6
+ },
7
+ __name: "HtButton",
8
+ setup(__props) {
9
+ return (_ctx, _cache) => {
10
+ return openBlock(), createElementBlock("button", null, "\u6D4B\u8BD5\u6309\u94AElibiluo");
11
+ };
12
+ }
13
+ });
14
+
15
+ export { _sfc_main as default };
@@ -0,0 +1,7 @@
1
+ import button from './HtButton.vue.mjs';
2
+
3
+ button.install = (app) => {
4
+ app.component(button.name, button);
5
+ };
6
+
7
+ export { button as default };
@@ -0,0 +1,13 @@
1
+ import './button/index.mjs';
2
+ import HtTable from './table/index.mjs';
3
+ import button from './button/HtButton.vue.mjs';
4
+
5
+ const components = [
6
+ button,
7
+ HtTable
8
+ ];
9
+ const install = (app) => {
10
+ components.forEach((component) => app.component(component.name, component));
11
+ };
12
+
13
+ export { button as HtButton, HtTable, install as default };
@@ -0,0 +1,6 @@
1
+ import _sfc_main from './HtTable.vue2.mjs';
2
+ import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
3
+
4
+ var Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/libiluo/Desktop/company/component-library/packages/components/table/HtTable.vue"]]);
5
+
6
+ export { Table as default };
@@ -0,0 +1,110 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createElementBlock, createCommentVNode, toDisplayString, Fragment, renderList, createTextVNode } from 'vue';
2
+ import { Table, Tag } from 'ant-design-vue';
3
+ import '../../../node_modules/.pnpm/ant-design-vue@3.2.20_vue@3.4.21_typescript@5.3.3_/node_modules/ant-design-vue/dist/antd.css.mjs';
4
+
5
+ const _hoisted_1 = { key: 0 };
6
+ const _hoisted_2 = { key: 0 };
7
+ const _hoisted_3 = { key: 1 };
8
+ var _sfc_main = /* @__PURE__ */ defineComponent({
9
+ ...{
10
+ name: "HtTable"
11
+ },
12
+ __name: "HtTable",
13
+ setup(__props) {
14
+ const columns = [
15
+ {
16
+ name: "Name",
17
+ dataIndex: "name",
18
+ key: "name"
19
+ },
20
+ {
21
+ title: "Age",
22
+ dataIndex: "age",
23
+ key: "age"
24
+ },
25
+ {
26
+ title: "Address",
27
+ dataIndex: "address",
28
+ key: "address"
29
+ },
30
+ {
31
+ title: "Tags",
32
+ key: "tags",
33
+ dataIndex: "tags"
34
+ },
35
+ {
36
+ title: "Action",
37
+ key: "action"
38
+ }
39
+ ];
40
+ const data = [
41
+ {
42
+ key: "1",
43
+ name: "John Brown",
44
+ age: 32,
45
+ address: "New York No. 1 Lake Park",
46
+ tags: ["nice", "developer"]
47
+ },
48
+ {
49
+ key: "2",
50
+ name: "Jim Green",
51
+ age: 42,
52
+ address: "London No. 1 Lake Park",
53
+ tags: ["loser"]
54
+ },
55
+ {
56
+ key: "3",
57
+ name: "Joe Black",
58
+ age: 32,
59
+ address: "Sidney No. 1 Lake Park",
60
+ tags: ["cool", "teacher"]
61
+ }
62
+ ];
63
+ return (_ctx, _cache) => {
64
+ return openBlock(), createBlock(unref(Table), {
65
+ columns,
66
+ "data-source": data
67
+ }, {
68
+ headerCell: withCtx(({ column }) => [
69
+ column.key === "name" ? (openBlock(), createElementBlock("span", _hoisted_1, " Name ")) : createCommentVNode("v-if", true)
70
+ ]),
71
+ bodyCell: withCtx(({ column, record }) => [
72
+ column.key === "name" ? (openBlock(), createElementBlock(
73
+ "a",
74
+ _hoisted_2,
75
+ toDisplayString(record.name),
76
+ 1
77
+ /* TEXT */
78
+ )) : column.key === "tags" ? (openBlock(), createElementBlock("span", _hoisted_3, [
79
+ (openBlock(true), createElementBlock(
80
+ Fragment,
81
+ null,
82
+ renderList(record.tags, (tag) => {
83
+ return openBlock(), createBlock(unref(Tag), {
84
+ key: tag,
85
+ color: tag === "loser" ? "volcano" : tag.length > 5 ? "geekblue" : "green"
86
+ }, {
87
+ default: withCtx(() => [
88
+ createTextVNode(
89
+ toDisplayString(tag.toUpperCase()),
90
+ 1
91
+ /* TEXT */
92
+ )
93
+ ]),
94
+ _: 2
95
+ /* DYNAMIC */
96
+ }, 1032, ["color"]);
97
+ }),
98
+ 128
99
+ /* KEYED_FRAGMENT */
100
+ ))
101
+ ])) : createCommentVNode("v-if", true)
102
+ ]),
103
+ _: 1
104
+ /* STABLE */
105
+ });
106
+ };
107
+ }
108
+ });
109
+
110
+ export { _sfc_main as default };
@@ -0,0 +1,6 @@
1
+ import Table from './HtTable.vue.mjs';
2
+ import { withInstall } from '../../utils/common.mjs';
3
+
4
+ const HtTable = withInstall(Table);
5
+
6
+ export { HtTable as default };
@@ -0,0 +1,15 @@
1
+ const withInstall = (main, extra) => {
2
+ main.install = (app) => {
3
+ for (const comp of [main, ...Object.values(extra ?? {})]) {
4
+ app.component(comp.name, comp);
5
+ }
6
+ };
7
+ if (extra) {
8
+ for (const [key, comp] of Object.entries(extra)) {
9
+ main[key] = comp;
10
+ }
11
+ }
12
+ return main;
13
+ };
14
+
15
+ export { withInstall };
@@ -0,0 +1,26 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ columns: ({
3
+ name: string;
4
+ dataIndex: string;
5
+ key: string;
6
+ title?: undefined;
7
+ } | {
8
+ title: string;
9
+ dataIndex: string;
10
+ key: string;
11
+ name?: undefined;
12
+ } | {
13
+ title: string;
14
+ key: string;
15
+ name?: undefined;
16
+ dataIndex?: undefined;
17
+ })[];
18
+ data: {
19
+ key: string;
20
+ name: string;
21
+ age: number;
22
+ address: string;
23
+ tags: string[];
24
+ }[];
25
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
26
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import button from './HtButton.vue';
2
+ export default button;
@@ -0,0 +1,6 @@
1
+ import HtButton from './button';
2
+ import HtTable from './table';
3
+ import type { App } from 'vue';
4
+ declare const install: (app: App) => void;
5
+ export { HtButton, HtTable };
6
+ export default install;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from 'vue';
2
+ export type SFCWithInstall<T> = T & Plugin;
3
+ export declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E) => SFCWithInstall<T> & E;
@@ -0,0 +1 @@
1
+ export * from './common';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "hfn-components",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "",
5
- "main": "dist/components/index.full.js",
5
+ "main": "dist/es/packages/components/index.mjs",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
@@ -13,6 +13,7 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "devDependencies": {
16
+ "ant-design-vue": "3.2.20",
16
17
  "typescript": "^5.3.3"
17
18
  },
18
19
  "peerDependencies": {
@@ -1,36 +0,0 @@
1
- import { openBlock, createElementBlock } from 'vue';
2
-
3
- var _export_sfc = (sfc, props) => {
4
- const target = sfc.__vccOpts || sfc;
5
- for (const [key, val] of props) {
6
- target[key] = val;
7
- }
8
- return target;
9
- };
10
-
11
- const _sfc_main = {
12
- name: 'htButton'
13
- };
14
-
15
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
16
- return (openBlock(), createElementBlock("button", null, "测试按钮"))
17
- }
18
- var button = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"/Users/libiluo/Desktop/ht/packages/components/button/button.vue"]]);
19
-
20
- button.install = (app) => {
21
- app.component(button.name, button);
22
- };
23
-
24
- const components = [
25
- button
26
- ];
27
- const install = (app) => {
28
- if (install.installed)
29
- return;
30
- components.forEach((component) => app.component(component.name, component));
31
- };
32
- if (typeof window !== "undefined" && window.Vue) {
33
- install(window.Vue.createApp());
34
- }
35
-
36
- export { install as default, button as htButton };