cosey 0.3.22 → 0.4.0

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.
@@ -35,6 +35,7 @@ import { Panel } from './panel';
35
35
  import { Row } from './row';
36
36
  import { ScrollView } from './scroll-view';
37
37
  import { SnugMenu, SnugMenuItem } from './snug-menu';
38
+ import { StackDialog } from './stack-dialog';
38
39
  import { SvgIcon } from './svg-icon';
39
40
  import { Table } from './table';
40
41
  import { TableAction } from './table-action';
@@ -88,6 +89,7 @@ declare module 'vue' {
88
89
  CoScrollView: typeof ScrollView;
89
90
  CoSnugMenu: typeof SnugMenu;
90
91
  CoSnugMenuItem: typeof SnugMenuItem;
92
+ CoStackDialog: typeof StackDialog;
91
93
  CoSvgIcon: typeof SvgIcon;
92
94
  CoTable: typeof Table;
93
95
  CoTableAction: typeof TableAction;
@@ -99,4 +101,4 @@ declare module 'vue' {
99
101
  CoVideoViewer: typeof VideoViewer;
100
102
  }
101
103
  }
102
- export { AudioCard, AudioViewer, Card, Close, Col, ConfigProvider, Container, ContextMenu, ContextMenuItem, ContextSubMenu, Copy, DndSort, DndSortItem, Editor, Field, FileCard, Form, FormDialog, FormDrawer, FormGroup, FormItem, FormList, FormQuery, Highlight, HorizontalTree, Icon, IconifyIcon, ImageCard, InputNumberRange, LongText, Mask, MediaCard, MediaCardGroup, MediaViewer, NumberFormat, OnlyChild, OptionalWrapper, Panel, Row, ScrollView, SnugMenu, SnugMenuItem, SvgIcon, Table, TableAction, Toggle, Transition, TransitionGroup, Upload, VideoCard, VideoViewer, };
104
+ export { AudioCard, AudioViewer, Card, Close, Col, ConfigProvider, Container, ContextMenu, ContextMenuItem, ContextSubMenu, Copy, DndSort, DndSortItem, Editor, Field, FileCard, Form, FormDialog, FormDrawer, FormGroup, FormItem, FormList, FormQuery, Highlight, HorizontalTree, Icon, IconifyIcon, ImageCard, InputNumberRange, LongText, Mask, MediaCard, MediaCardGroup, MediaViewer, NumberFormat, OnlyChild, OptionalWrapper, Panel, Row, ScrollView, SnugMenu, SnugMenuItem, StackDialog, SvgIcon, Table, TableAction, Toggle, Transition, TransitionGroup, Upload, VideoCard, VideoViewer, };
@@ -35,6 +35,7 @@ export { Panel } from './panel/index.js';
35
35
  export { Row } from './row/index.js';
36
36
  export { ScrollView } from './scroll-view/index.js';
37
37
  export { SnugMenu, SnugMenuItem } from './snug-menu/index.js';
38
+ export { StackDialog } from './stack-dialog/index.js';
38
39
  export { SvgIcon } from './svg-icon/index.js';
39
40
  export { Table } from './table/index.js';
40
41
  export { TableAction } from './table-action/index.js';
@@ -183,7 +183,7 @@ export declare const formDialogProps: {
183
183
  };
184
184
  };
185
185
  export type FormDialogProps = ExtractPropTypes<typeof formDialogProps>;
186
- export interface FormDialogSlots {
186
+ export interface ElDialogSlots {
187
187
  default?: (props: Record<string, never>) => any;
188
188
  header?: (props: {
189
189
  close?: () => void;
@@ -191,6 +191,8 @@ export interface FormDialogSlots {
191
191
  titleClass?: string;
192
192
  }) => any;
193
193
  footer?: (props: Record<string, never>) => any;
194
+ }
195
+ export interface FormDialogSlots extends ElDialogSlots {
194
196
  button?: (props: {
195
197
  submitting: boolean;
196
198
  confirm: () => any | Promise<any>;
@@ -1,7 +1,6 @@
1
- import { Component } from 'vue';
1
+ import { type Plugin, Component } from 'vue';
2
2
  import { useFormDialogWidth } from './useFormDialogWidth';
3
3
  import { FormDialogProps } from './form-dialog';
4
- import { type Plugin } from 'vue';
5
4
  export * from './form-dialog';
6
5
  declare const _FormDialog: Component<FormDialogProps> & Plugin;
7
6
  export { _FormDialog as FormDialog, useFormDialogWidth };
@@ -36,6 +36,7 @@ export * from './panel';
36
36
  export * from './row';
37
37
  export * from './scroll-view';
38
38
  export * from './snug-menu';
39
+ export * from './stack-dialog';
39
40
  export * from './style';
40
41
  export * from './svg-icon';
41
42
  export * from './table';
@@ -35,6 +35,7 @@ export { Panel } from './panel/index.js';
35
35
  export { Row } from './row/index.js';
36
36
  export { ScrollView } from './scroll-view/index.js';
37
37
  export { SnugMenu, SnugMenuItem } from './snug-menu/index.js';
38
+ export { StackDialog } from './stack-dialog/index.js';
38
39
  export { SvgIcon } from './svg-icon/index.js';
39
40
  export { Table } from './table/index.js';
40
41
  export { TableAction } from './table-action/index.js';
@@ -79,6 +80,7 @@ export { defaultMediaViewerBaseProps, defaultMediaViewerProps } from './media-vi
79
80
  export { defaultNumberFormatProps } from './number-format/number-format.js';
80
81
  export { defaultBreakpoints, defaultRowProps, generateAlgorithms, rowColumns, rowContextSymbol, rowSizes } from './row/row.js';
81
82
  export { snugMenuContextSymbol } from './snug-menu/snug-menu.js';
83
+ export { createStackDialogInfo, stackDialogProps, useStackDialog, useStackDialogProvide } from './stack-dialog/stack-dialog.js';
82
84
  export { getFocusVisibleStyle, getLineClampStyle, getTruncateStyle } from './style/mixins.js';
83
85
  export { contrarotation, rotation, rotation45, spinner } from './style/animation.js';
84
86
  export { defaultTableConfig, elSlotsName, omittedTableProps, tableEmitEvents, tableEmitOnEvents, tableEmitOnProps, tableExposeKeys, tableProps } from './table/table.js';
@@ -0,0 +1,6 @@
1
+ import { Component, type Plugin } from 'vue';
2
+ import { type StackDialogProps } from './stack-dialog';
3
+ export * from './stack-dialog';
4
+ declare const _StackDialog: Component<StackDialogProps> & Plugin;
5
+ export { _StackDialog as StackDialog };
6
+ export default _StackDialog;
@@ -0,0 +1,8 @@
1
+ import { withInstall } from '../utils.js';
2
+ import stdin_default$1 from './stack-dialog.vue.js';
3
+ export { createStackDialogInfo, stackDialogProps, useStackDialog, useStackDialogProvide } from './stack-dialog.js';
4
+
5
+ const _StackDialog = withInstall(stdin_default$1);
6
+ var stdin_default = _StackDialog;
7
+
8
+ export { _StackDialog as StackDialog, stdin_default as default };
@@ -0,0 +1,161 @@
1
+ import { type DialogEmits, type DialogInstance } from 'element-plus';
2
+ import { EmitFn, ExtractPropTypes } from 'vue';
3
+ import { type ElDialogSlots } from '../form-dialog';
4
+ export declare const stackDialogProps: {
5
+ appendToBody: BooleanConstructor;
6
+ appendTo: {
7
+ readonly type: import("vue").PropType<string | HTMLElement>;
8
+ readonly required: false;
9
+ readonly validator: ((val: unknown) => boolean) | undefined;
10
+ __epPropKey: true;
11
+ } & {
12
+ readonly default: "body";
13
+ };
14
+ beforeClose: {
15
+ readonly type: import("vue").PropType<import("element-plus").DialogBeforeCloseFn>;
16
+ readonly required: false;
17
+ readonly validator: ((val: unknown) => boolean) | undefined;
18
+ __epPropKey: true;
19
+ };
20
+ destroyOnClose: BooleanConstructor;
21
+ closeOnClickModal: {
22
+ readonly type: import("vue").PropType<boolean>;
23
+ readonly required: false;
24
+ readonly validator: ((val: unknown) => boolean) | undefined;
25
+ __epPropKey: true;
26
+ } & {
27
+ readonly default: true;
28
+ };
29
+ closeOnPressEscape: {
30
+ readonly type: import("vue").PropType<boolean>;
31
+ readonly required: false;
32
+ readonly validator: ((val: unknown) => boolean) | undefined;
33
+ __epPropKey: true;
34
+ } & {
35
+ readonly default: true;
36
+ };
37
+ lockScroll: {
38
+ readonly type: import("vue").PropType<boolean>;
39
+ readonly required: false;
40
+ readonly validator: ((val: unknown) => boolean) | undefined;
41
+ __epPropKey: true;
42
+ } & {
43
+ readonly default: true;
44
+ };
45
+ modal: {
46
+ readonly type: import("vue").PropType<boolean>;
47
+ readonly required: false;
48
+ readonly validator: ((val: unknown) => boolean) | undefined;
49
+ __epPropKey: true;
50
+ } & {
51
+ readonly default: true;
52
+ };
53
+ openDelay: {
54
+ readonly type: import("vue").PropType<number>;
55
+ readonly required: false;
56
+ readonly validator: ((val: unknown) => boolean) | undefined;
57
+ __epPropKey: true;
58
+ } & {
59
+ readonly default: 0;
60
+ };
61
+ closeDelay: {
62
+ readonly type: import("vue").PropType<number>;
63
+ readonly required: false;
64
+ readonly validator: ((val: unknown) => boolean) | undefined;
65
+ __epPropKey: true;
66
+ } & {
67
+ readonly default: 0;
68
+ };
69
+ top: {
70
+ readonly type: import("vue").PropType<string>;
71
+ readonly required: false;
72
+ readonly validator: ((val: unknown) => boolean) | undefined;
73
+ __epPropKey: true;
74
+ };
75
+ modelValue: BooleanConstructor;
76
+ modalClass: StringConstructor;
77
+ headerClass: StringConstructor;
78
+ bodyClass: StringConstructor;
79
+ footerClass: StringConstructor;
80
+ width: {
81
+ readonly type: import("vue").PropType<string | number>;
82
+ readonly required: false;
83
+ readonly validator: ((val: unknown) => boolean) | undefined;
84
+ __epPropKey: true;
85
+ };
86
+ zIndex: {
87
+ readonly type: import("vue").PropType<number>;
88
+ readonly required: false;
89
+ readonly validator: ((val: unknown) => boolean) | undefined;
90
+ __epPropKey: true;
91
+ };
92
+ trapFocus: BooleanConstructor;
93
+ headerAriaLevel: {
94
+ readonly type: import("vue").PropType<string>;
95
+ readonly required: false;
96
+ readonly validator: ((val: unknown) => boolean) | undefined;
97
+ __epPropKey: true;
98
+ } & {
99
+ readonly default: "2";
100
+ };
101
+ center: BooleanConstructor;
102
+ alignCenter: BooleanConstructor;
103
+ closeIcon: {
104
+ readonly type: import("vue").PropType<string | import("vue").Component>;
105
+ readonly required: false;
106
+ readonly validator: ((val: unknown) => boolean) | undefined;
107
+ __epPropKey: true;
108
+ };
109
+ draggable: BooleanConstructor;
110
+ overflow: BooleanConstructor;
111
+ fullscreen: BooleanConstructor;
112
+ showClose: {
113
+ readonly type: import("vue").PropType<boolean>;
114
+ readonly required: false;
115
+ readonly validator: ((val: unknown) => boolean) | undefined;
116
+ __epPropKey: true;
117
+ } & {
118
+ readonly default: true;
119
+ };
120
+ title: {
121
+ readonly type: import("vue").PropType<string>;
122
+ readonly required: false;
123
+ readonly validator: ((val: unknown) => boolean) | undefined;
124
+ __epPropKey: true;
125
+ } & {
126
+ readonly default: "";
127
+ };
128
+ ariaLevel: {
129
+ readonly type: import("vue").PropType<string>;
130
+ readonly required: false;
131
+ readonly validator: ((val: unknown) => boolean) | undefined;
132
+ __epPropKey: true;
133
+ } & {
134
+ readonly default: "2";
135
+ };
136
+ };
137
+ export type StackDialogProps = ExtractPropTypes<typeof stackDialogProps>;
138
+ export interface StackDialogSlots extends ElDialogSlots {
139
+ }
140
+ export interface StackDialogEmits extends /* @vue-ignore */ EmitFn<DialogEmits> {
141
+ }
142
+ export interface StackDialogExpose extends DialogInstance {
143
+ }
144
+ export interface StackDialogInfo {
145
+ transform: string;
146
+ }
147
+ export declare function createStackDialogInfo(): {
148
+ transform: string;
149
+ };
150
+ export interface StackDialogContext {
151
+ addInfo: (info: StackDialogInfo) => void;
152
+ removeInfo: (info: StackDialogInfo) => void;
153
+ }
154
+ export declare function useStackDialogProvide(): void;
155
+ export declare function useStackDialog(): {
156
+ onShow: () => void;
157
+ onHide: () => void;
158
+ info: {
159
+ transform: string;
160
+ };
161
+ };
@@ -0,0 +1,58 @@
1
+ import { dialogProps } from 'element-plus';
2
+ import { inject, reactive, provide } from 'vue';
3
+
4
+ const stackDialogProps = {
5
+ ...dialogProps
6
+ };
7
+ function createStackDialogInfo() {
8
+ return reactive({
9
+ transform: ""
10
+ });
11
+ }
12
+ const stackDialogContextKey = Symbol("stackDialogContext");
13
+ function useStackDialogProvide() {
14
+ const infoList = [];
15
+ const updateInfo = () => {
16
+ const count = 10;
17
+ const total = 10;
18
+ infoList.forEach((info, index) => {
19
+ const x = index / count;
20
+ const t = 1 - Math.pow(1 - x, 4);
21
+ const scale = 1 - index / infoList.length * 0.05;
22
+ info.transform = `translateY(${t * total}vh) scale(${scale})`;
23
+ });
24
+ };
25
+ const addInfo = (info) => {
26
+ if (!infoList.includes(info)) {
27
+ infoList.unshift(info);
28
+ updateInfo();
29
+ }
30
+ };
31
+ const removeInfo = (info) => {
32
+ if (infoList.includes(info)) {
33
+ infoList.splice(infoList.indexOf(info), 1);
34
+ updateInfo();
35
+ }
36
+ };
37
+ provide(stackDialogContextKey, {
38
+ addInfo,
39
+ removeInfo
40
+ });
41
+ }
42
+ function useStackDialog() {
43
+ const context = inject(stackDialogContextKey, null);
44
+ const info = createStackDialogInfo();
45
+ const onShow = () => {
46
+ context?.addInfo(info);
47
+ };
48
+ const onHide = () => {
49
+ context?.removeInfo(info);
50
+ };
51
+ return {
52
+ onShow,
53
+ onHide,
54
+ info
55
+ };
56
+ }
57
+
58
+ export { createStackDialogInfo, stackDialogProps, useStackDialog, useStackDialogProvide };
@@ -0,0 +1,67 @@
1
+ import { defineComponent, useSlots, ref, createBlock, openBlock, resolveDynamicComponent, unref, createVNode, mergeProps } from 'vue';
2
+ import { stackDialogProps, useStackDialog } from './stack-dialog.js';
3
+ import stdin_default$1 from './style/index.js';
4
+ import { ElDialog } from 'element-plus';
5
+ import classNames from 'classnames';
6
+ import { elFormDialogExposeKeys } from '../form-dialog/form-dialog.js';
7
+ import { useComponentConfig } from '../config-provider/config-provider.js';
8
+ import { createMergedExpose, defineTemplate } from '../../utils/vue.js';
9
+
10
+ var stdin_default = /* @__PURE__ */defineComponent({
11
+ ...{
12
+ name: "StackDialog"
13
+ },
14
+ __name: "stack-dialog",
15
+ props: stackDialogProps,
16
+ setup(__props, {
17
+ expose: __expose,
18
+ emit: __emit
19
+ }) {
20
+ const props = __props;
21
+ const slots = useSlots();
22
+ const emit = __emit;
23
+ const {
24
+ prefixCls
25
+ } = useComponentConfig("stack-dialog", props);
26
+ const {
27
+ hashId
28
+ } = stdin_default$1(prefixCls);
29
+ const elPopupRef = ref();
30
+ const expose = createMergedExpose(elFormDialogExposeKeys, () => elPopupRef.value);
31
+ __expose(expose);
32
+ const {
33
+ onShow,
34
+ onHide,
35
+ info
36
+ } = useStackDialog();
37
+ const template = defineTemplate(() => {
38
+ return createVNode(ElDialog, mergeProps({
39
+ "ref": elPopupRef
40
+ }, props, {
41
+ "class": [hashId.value, prefixCls.value],
42
+ "headerClass": classNames(props.headerClass, `${prefixCls.value}-header`),
43
+ "bodyClass": classNames(props.bodyClass, `${prefixCls.value}-body`),
44
+ "footerClass": classNames(props.footerClass, `${prefixCls.value}-footer`),
45
+ "onUpdate:modelValue": value => emit("update:modelValue", value),
46
+ "style": {
47
+ maxWidth: props.fullscreen ? null : "calc(100vw - 32px)",
48
+ ...info
49
+ },
50
+ "append-to-body": true,
51
+ "onOpen": () => {
52
+ onShow();
53
+ emit("open");
54
+ },
55
+ "onClose": () => {
56
+ onHide();
57
+ emit("close");
58
+ }
59
+ }), slots);
60
+ });
61
+ return (_ctx, _cache) => {
62
+ return openBlock(), createBlock(resolveDynamicComponent(unref(template)));
63
+ };
64
+ }
65
+ });
66
+
67
+ export { stdin_default as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
2
+ hashId: import("vue").Ref<string, string>;
3
+ };
4
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import { getSimpleStyleHook } from 'cosey/components';
2
+
3
+ var stdin_default = getSimpleStyleHook("StackDialog", (token) => {
4
+ const { componentCls } = token;
5
+ return {
6
+ [`${componentCls}`]: {
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ margin: "5vh auto 10vh",
10
+ width: "80%",
11
+ height: "calc(100vh - 15vh)",
12
+ transition: token.motionDurationSlow,
13
+ [`${componentCls}-header`]: {
14
+ flex: "none"
15
+ },
16
+ [`${componentCls}-body`]: {
17
+ flex: 1,
18
+ minHeight: 0
19
+ },
20
+ [`${componentCls}-footer`]: {
21
+ flex: "none"
22
+ }
23
+ }
24
+ };
25
+ });
26
+
27
+ export { stdin_default as default };
@@ -1,4 +1,4 @@
1
- import { defineComponent, useSlots, unref, computed, ref, useTemplateRef, mergeProps, watch, onMounted, onBeforeUnmount, resolveComponent, resolveDirective, withDirectives, createElementBlock, openBlock, normalizeStyle, normalizeClass, createCommentVNode, createElementVNode, createVNode, renderSlot, createBlock, withCtx, createSlots, Fragment, renderList, Teleport, vShow, normalizeProps, guardReactiveProps } from 'vue';
1
+ import { defineComponent, useSlots, unref, computed, ref, useTemplateRef, mergeProps, watch, onMounted, onBeforeUnmount, resolveComponent, resolveDirective, createBlock, openBlock, Teleport, withDirectives, createElementBlock, normalizeStyle, normalizeClass, createCommentVNode, createElementVNode, createVNode, renderSlot, withCtx, createSlots, Fragment, renderList, vShow, normalizeProps, guardReactiveProps } from 'vue';
2
2
  import { merge, cloneDeep, get } from 'lodash-es';
3
3
  import { reactiveComputed, reactiveOmit } from '@vueuse/core';
4
4
  import { useNamespace, useZIndex, ElButton, Mousewheel } from 'element-plus';
@@ -353,7 +353,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
353
353
  const _component_el_table = resolveComponent("el-table");
354
354
  const _component_el_pagination = resolveComponent("el-pagination");
355
355
  const _directive_loading = resolveDirective("loading");
356
- return withDirectives((openBlock(), createElementBlock("div", {
356
+ return openBlock(), createBlock(Teleport, {
357
+ to: "body",
358
+ disabled: !unref(isFullPage)
359
+ }, [withDirectives((openBlock(), createElementBlock("div", {
357
360
  class: normalizeClass([unref(hashId), unref(prefixCls), {
358
361
  "is-fullpage": unref(isFullPage)
359
362
  }]),
@@ -568,7 +571,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
568
571
  onChange: onPageChange
569
572
  }), null, 16, ["current-page", "page-size", "class"])) : createCommentVNode("v-if", true)], 2
570
573
  /* CLASS */)], 6
571
- /* CLASS, STYLE */)), [[_directive_loading, unref(isFetching)]]);
574
+ /* CLASS, STYLE */)), [[_directive_loading, unref(isFetching)]])], 8, ["disabled"]);
572
575
  };
573
576
  }
574
577
  });
@@ -8,6 +8,7 @@ import 'element-plus/theme-chalk/dark/css-vars.css';
8
8
  import { useColorSchemeProvide } from '../hooks/useColorScheme.js';
9
9
  import { useUploadProvide } from '../components/upload-context.js';
10
10
  import { containerContextKey } from '../components/container/container.js';
11
+ import { useStackDialogProvide } from '../components/stack-dialog/stack-dialog.js';
11
12
  import { ConfigProvider as _ConfigProvider } from '../components/config-provider/index.js';
12
13
 
13
14
  var stdin_default = /* @__PURE__ */defineComponent({
@@ -62,6 +63,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
62
63
  provide(containerContextKey, reactive({
63
64
  height: computed(() => `calc(100vh - ${layoutStore.headerHeight}px)`)
64
65
  }));
66
+ useStackDialogProvide();
65
67
  return (_ctx, _cache) => {
66
68
  const _component_ElConfigProvider = resolveComponent("ElConfigProvider");
67
69
  return openBlock(), createBlock(unref(_ConfigProvider), normalizeProps(guardReactiveProps(mergedConfigProviderProps.value)), {
@@ -42,7 +42,7 @@ export interface UseUpsertReturn<Model extends Record<string, any>, Row extends
42
42
  isEdit: ComputedRef<boolean>;
43
43
  isAdd: ComputedRef<boolean>;
44
44
  }
45
- export declare function useUpsert<Model extends Record<string, any>, Row extends Record<string, any> = Model, Data = any>(options: MaybeRef<UseUpsertOptions<Model, Row>>): UseUpsertReturn<Model, Row>;
45
+ export declare function useUpsert<Model extends Record<string, any>, Row extends Record<string, any> = Model, Data = any>(options: MaybeRef<UseUpsertOptions<Model, Row, Data>>): UseUpsertReturn<Model, Row, Data>;
46
46
  export interface UseExternalUpsertOptions {
47
47
  success?: () => any;
48
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.3.22",
3
+ "version": "0.4.0",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",