orion-design 0.1.2 → 0.1.3

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,15 @@
1
+ import type { Plugin } from 'vue';
2
+ declare const _default: {
3
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<{}> & Readonly<{}>, {}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
4
+ P: {};
5
+ B: {};
6
+ D: {};
7
+ C: {};
8
+ M: {};
9
+ Defaults: {};
10
+ }, Readonly<{}> & Readonly<{}>, () => any, {}, {}, {}, {}>;
11
+ __isFragment?: never;
12
+ __isTeleport?: never;
13
+ __isSuspense?: never;
14
+ } & import("vue").ComponentOptionsBase<Readonly<{}> & Readonly<{}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Plugin;
15
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default function useModal(): {
2
+ close: (params: Record<string, any>) => void;
3
+ };
@@ -0,0 +1,8 @@
1
+ import { inject } from 'vue';
2
+
3
+ function useModal() {
4
+ const $$Modal = inject('$$Modal');
5
+ return $$Modal;
6
+ }
7
+
8
+ export { useModal as default };
@@ -2,3 +2,5 @@ export { default as Space } from './Space';
2
2
  export type { SpaceProps } from './Space';
3
3
  export { Rowflex, Colflex, Flexitem } from './Flex';
4
4
  export type { RowflexProps, ColflexProps, FlexitemProps } from './Flex';
5
+ export { default as Modal } from './Modal';
6
+ export { default as useOModal } from './Modal/useModal';
@@ -1,10 +1,12 @@
1
- export { i as Space } from '../components-O4L3qYfM.js';
1
+ export { a as Modal, i as Space } from '../components-DhjIbmR3.js';
2
2
  export { Colflex, Flexitem, Rowflex } from './Flex/index.js';
3
+ export { default as useOModal } from './Modal/useModal.js';
3
4
  import 'vue';
4
5
  import './_util/props-util/index.js';
5
6
  import './_util/isValid.js';
6
7
  import './_util/props-util/initDefaultProps.js';
7
8
  import './_util/type.js';
9
+ import 'element-plus';
8
10
  import './_util/classNames.js';
9
11
  import './_util/util.js';
10
12
  import '../error/OrionError.js';
@@ -1,11 +1,13 @@
1
- import { c as components } from '../components-O4L3qYfM.js';
2
- export { i as Space } from '../components-O4L3qYfM.js';
1
+ import { c as components } from '../components-DhjIbmR3.js';
2
+ export { a as Modal, i as Space } from '../components-DhjIbmR3.js';
3
3
  export { Colflex, Flexitem, Rowflex } from './Flex/index.js';
4
+ export { default as useOModal } from './Modal/useModal.js';
4
5
  import 'vue';
5
6
  import './_util/props-util/index.js';
6
7
  import './_util/isValid.js';
7
8
  import './_util/props-util/initDefaultProps.js';
8
9
  import './_util/type.js';
10
+ import 'element-plus';
9
11
  import './_util/classNames.js';
10
12
  import './_util/util.js';
11
13
  import '../error/OrionError.js';
@@ -0,0 +1,128 @@
1
+ import { defineComponent, computed, createVNode, ref, shallowRef, provide, Fragment } from 'vue';
2
+ import { filterEmpty } from './components/_util/props-util/index.js';
3
+ import { withInstall, anyType } from './components/_util/type.js';
4
+ import { Colflex, Flexitem, Rowflex } from './components/Flex/index.js';
5
+ import { ElDialog } from 'element-plus';
6
+ import useModal from './components/Modal/useModal.js';
7
+
8
+ const spaceProps = () => ({
9
+ gutter: anyType(),
10
+ vertical: anyType()
11
+ });
12
+ const Space = defineComponent({
13
+ name: 'OSpace',
14
+ inheritAttrs: false,
15
+ props: spaceProps(),
16
+ slots: Object,
17
+ setup(props, {
18
+ slots,
19
+ attrs,
20
+ emit,
21
+ expose
22
+ }) {
23
+ const classes = computed(() => {
24
+ const {
25
+ vertical
26
+ } = props;
27
+ return ['orion-space', {
28
+ [`vertical`]: vertical === true || vertical === ''
29
+ }];
30
+ });
31
+ return () => {
32
+ const children = slots.default?.();
33
+ const items = filterEmpty(children);
34
+ const len = items.length;
35
+ if (len === 0) {
36
+ return null;
37
+ }
38
+ const gapStyle = {};
39
+ if (typeof props.gutter == 'string' && props.gutter) {
40
+ gapStyle.gap = props.gutter;
41
+ }
42
+ return createVNode("div", {
43
+ "class": [classes.value, attrs.class],
44
+ "style": [gapStyle, attrs.style]
45
+ }, [items.map(child => {
46
+ return createVNode("div", {
47
+ "class": ['orion-space-item']
48
+ }, [child]);
49
+ })]);
50
+ };
51
+ }
52
+ });
53
+ var index$1 = withInstall(Space);
54
+
55
+ const Modal = defineComponent({
56
+ name: 'OModal',
57
+ setup(props, {
58
+ slots,
59
+ attrs,
60
+ emit,
61
+ expose
62
+ }) {
63
+ const show = ref(false);
64
+ const title = ref();
65
+ const content = shallowRef();
66
+ const params = ref();
67
+ const width = ref();
68
+ const __resolve = ref();
69
+ const _open = async options => {
70
+ show.value = true;
71
+ title.value = options.title;
72
+ content.value = options.content;
73
+ if (options.params) {
74
+ params.value = options.params;
75
+ } else {
76
+ params.value = {};
77
+ }
78
+ if (options.width) {
79
+ width.value = options.width;
80
+ }
81
+ const promise = new Promise((resolve, reject) => {
82
+ __resolve.value = resolve;
83
+ });
84
+ return promise;
85
+ };
86
+ expose({
87
+ open: _open
88
+ });
89
+ const _close = options => {
90
+ const resolve = __resolve.value;
91
+ show.value = false;
92
+ title.value = undefined;
93
+ content.value = undefined;
94
+ params.value = undefined;
95
+ width.value = undefined;
96
+ __resolve.value = undefined;
97
+ resolve && resolve(options);
98
+ };
99
+ provide('$$Modal', {
100
+ close: _close
101
+ });
102
+ return () => {
103
+ const Children = content.value;
104
+ return show.value ? createVNode(ElDialog, {
105
+ "title": title.value,
106
+ "width": width.value,
107
+ "modelValue": show.value,
108
+ "beforeClose": _close,
109
+ "draggable": true
110
+ }, {
111
+ default: () => [createVNode(Children, params.value, null)]
112
+ }) : createVNode(Fragment, null, null);
113
+ };
114
+ }
115
+ });
116
+ var index = withInstall(Modal);
117
+
118
+ var components = /*#__PURE__*/Object.freeze({
119
+ __proto__: null,
120
+ Colflex: Colflex,
121
+ Flexitem: Flexitem,
122
+ Modal: index,
123
+ Rowflex: Rowflex,
124
+ Space: index$1,
125
+ useOModal: useModal
126
+ });
127
+
128
+ export { index as a, components as c, index$1 as i };
package/dist/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  export { default as OrionError } from './error/OrionError.js';
2
2
  export { install } from './components/index.js';
3
3
  export { default as version } from './version/version.js';
4
- export { i as Space } from './components-O4L3qYfM.js';
4
+ export { default as useOModal } from './components/Modal/useModal.js';
5
+ export { a as Modal, i as Space } from './components-DhjIbmR3.js';
5
6
  export { Colflex, Flexitem, Rowflex } from './components/Flex/index.js';
6
7
  import 'vue';
7
8
  import './components/_util/props-util/index.js';
8
9
  import './components/_util/isValid.js';
9
10
  import './components/_util/props-util/initDefaultProps.js';
10
11
  import './components/_util/type.js';
12
+ import 'element-plus';
11
13
  import './components/_util/classNames.js';
12
14
  import './components/_util/util.js';
@@ -1,2 +1,2 @@
1
- declare const _default: "0.1.2";
1
+ declare const _default: "0.1.3";
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
- var version = '0.1.2';
1
+ var version = '0.1.3';
2
2
 
3
3
  export { version as default };
package/global.d.ts CHANGED
@@ -4,6 +4,7 @@ declare module 'vue' {
4
4
  ORowflex: typeof import('orion-design')['Rowflex']
5
5
  OColflex: typeof import('orion-design')['Colflex']
6
6
  OFlexitem: typeof import('orion-design')['Flexitem']
7
+ OModal: typeof import('orion-design')['Modal']
7
8
  }
8
9
  }
9
10
  export {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orion-design",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- declare const OModal: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- export default OModal;
@@ -1,61 +0,0 @@
1
- import { defineComponent, computed, createVNode } from 'vue';
2
- import { filterEmpty } from './components/_util/props-util/index.js';
3
- import { withInstall, anyType } from './components/_util/type.js';
4
- import { Colflex, Flexitem, Rowflex } from './components/Flex/index.js';
5
-
6
- const spaceProps = () => ({
7
- gutter: anyType(),
8
- vertical: anyType()
9
- });
10
- const Space = defineComponent({
11
- name: 'OSpace',
12
- inheritAttrs: false,
13
- props: spaceProps(),
14
- slots: Object,
15
- setup(props, {
16
- slots,
17
- attrs,
18
- emit,
19
- expose
20
- }) {
21
- const classes = computed(() => {
22
- const {
23
- vertical
24
- } = props;
25
- return ['orion-space', {
26
- [`vertical`]: vertical === true || vertical === ''
27
- }];
28
- });
29
- return () => {
30
- const children = slots.default?.();
31
- const items = filterEmpty(children);
32
- const len = items.length;
33
- if (len === 0) {
34
- return null;
35
- }
36
- const gapStyle = {};
37
- if (typeof props.gutter == 'string' && props.gutter) {
38
- gapStyle.gap = props.gutter;
39
- }
40
- return createVNode("div", {
41
- "class": [classes.value, attrs.class],
42
- "style": [gapStyle, attrs.style]
43
- }, [items.map(child => {
44
- return createVNode("div", {
45
- "class": ['orion-space-item']
46
- }, [child]);
47
- })]);
48
- };
49
- }
50
- });
51
- var index = withInstall(Space);
52
-
53
- var components = /*#__PURE__*/Object.freeze({
54
- __proto__: null,
55
- Colflex: Colflex,
56
- Flexitem: Flexitem,
57
- Rowflex: Rowflex,
58
- Space: index
59
- });
60
-
61
- export { components as c, index as i };