@whitesev/pops 1.6.4 → 1.6.5

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.
@@ -1,149 +1,165 @@
1
- import type { PopsPanelButtonDetails } from "./buttonType";
2
- import type { PopsPanelRightAsideContainerOptions } from "./commonType";
3
- import type { PopsPanelDeepMenuDetails } from "./deepMenuType";
4
- import type { PopsPanelContentConfig, PopsPanelDetails, PopsPanelFormsTotalDetails } from "./indexType";
5
- import type { PopsPanelInputDetails } from "./inputType";
6
- import type { PopsPanelOwnDetails } from "./ownType";
7
- import type { PopsPanelSelectMultipleDetails } from "./selectMultipleType";
8
- import type { PopsPanelSelectDetails } from "./selectType";
9
- import type { PopsPanelSliderDetails } from "./sliderType";
10
- import type { PopsPanelSwitchDetails } from "./switchType";
11
- import type { PopsPanelTextAreaDetails } from "./textareaType";
12
- export declare const PanelHandleContentDetails: () => {
13
- /**
14
- * 左侧的ul容器
15
- */
16
- asideULElement: HTMLUListElement;
17
- /**
18
- * 右侧主内容的顶部文字ul容器
19
- */
20
- sectionContainerHeaderULElement: HTMLUListElement;
21
- /**
22
- * 右侧主内容的ul容器
23
- */
24
- sectionContainerULElement: HTMLUListElement;
25
- $el: {
26
- $content: HTMLDivElement;
27
- $contentAside: HTMLDivElement;
28
- $contentSectionContainer: HTMLDivElement;
29
- };
30
- init(details: {
31
- config: Required<PopsPanelDetails>;
32
- $el: {
33
- $content: HTMLDivElement;
34
- $contentAside: HTMLDivElement;
35
- $contentSectionContainer: HTMLDivElement;
36
- };
37
- }): void;
38
- /**
39
- * 清空container容器的元素
40
- */
41
- clearContainer(): void;
42
- /**
43
- * 清空左侧容器已访问记录
44
- */
45
- clearAsideItemIsVisited(): void;
46
- /**
47
- * 设置左侧容器已访问记录
48
- * @param element
49
- */
50
- setAsideItemIsVisited(element: HTMLElement): void;
51
- /**
52
- * 为元素添加自定义属性
53
- * @param element
54
- * @param attributes
55
- */
56
- addElementAttributes(element: HTMLElement, attributes?: any): void;
57
- /**
58
- * 为元素设置(自定义)属性
59
- * @param element
60
- * @param props
61
- */
62
- setElementProps(element: HTMLElement, props?: any): void;
63
- /**
64
- * 获取左侧容器元素<li>
65
- * @param asideConfig
66
- */
67
- getAsideItem(asideConfig: PopsPanelContentConfig): HTMLLIElement;
68
- /**
69
- * 获取中间容器的元素<li>
70
- * type ==> switch
71
- * @param formConfig
72
- */
73
- getSectionContainerItem_switch(formConfig: PopsPanelSwitchDetails): HTMLLIElement;
74
- /**
75
- * 获取中间容器的元素<li>
76
- * type ==> slider
77
- * @param formConfig
78
- */
79
- getSectionContainerItem_slider(formConfig: PopsPanelSliderDetails): HTMLLIElement;
80
- /**
81
- * 获取中间容器的元素<li>
82
- * type ==> slider
83
- * @param formConfig
84
- */
85
- getSectionContainerItem_slider_new(formConfig: PopsPanelSliderDetails): HTMLLIElement;
86
- /**
87
- * 获取中间容器的元素<li>
88
- * type ==> input
89
- * @param formConfig
90
- */
91
- getSectionContainerItem_input(formConfig: PopsPanelInputDetails): HTMLLIElement;
92
- /**
93
- * 获取中间容器的元素<li>
94
- * type ==> textarea
95
- * @param formConfig
96
- */
97
- getSectionContainerItem_textarea(formConfig: PopsPanelTextAreaDetails): HTMLLIElement;
98
- /**
99
- * 获取中间容器的元素<li>
100
- * type ==> select
101
- * @param formConfig
102
- */
103
- getSectionContainerItem_select(formConfig: PopsPanelSelectDetails<any>): HTMLLIElement;
104
- /**
105
- * 获取中间容器的元素<li>
106
- * type ==> select-multiple
107
- * @param formConfig
108
- */
109
- getSectionContainerItem_select_multiple_new(formConfig: PopsPanelSelectMultipleDetails<any>): HTMLLIElement;
110
- /**
111
- * 获取中间容器的元素<li>
112
- * type ==> button
113
- * @param formConfig
114
- */
115
- getSectionContainerItem_button(formConfig: PopsPanelButtonDetails): HTMLLIElement;
116
- /**
117
- * 获取深层容器的元素<li>
118
- * @param formConfig
119
- */
120
- getSectionContainerItem_deepMenu(formConfig: PopsPanelDeepMenuDetails): HTMLLIElement;
121
- /**
122
- * 获取中间容器的元素<li>
123
- * type ===> own
124
- * @param formConfig
125
- */
126
- getSectionContainerItem_own(formConfig: PopsPanelOwnDetails): HTMLLIElement;
127
- /**
128
- * 获取中间容器的元素<li>
129
- * @param formConfig
130
- */
131
- getSectionContainerItem(formConfig: PopsPanelFormsTotalDetails): HTMLLIElement | undefined;
132
- /**
133
- * 生成配置每一项的元素
134
- * @param formConfig
135
- */
136
- initFormItem(formConfig: PopsPanelContentConfig): void;
137
- /**
138
- *
139
- * @param formConfig
140
- * @param containerOptions
141
- */
142
- uListContainerAddItem(formConfig: PopsPanelFormsTotalDetails, containerOptions: PopsPanelRightAsideContainerOptions): void;
143
- /**
144
- * 为左侧容器元素添加点击事件
145
- * @param asideLiElement 左侧的容器<li>元素
146
- * @param asideConfig 配置
147
- */
148
- setAsideItemClickEvent(asideLiElement: HTMLElement, asideConfig: PopsPanelContentConfig): void;
149
- };
1
+ import type { PopsPanelButtonDetails } from "./buttonType";
2
+ import type { PopsPanelRightAsideContainerOptions } from "./commonType";
3
+ import type { PopsPanelDeepMenuDetails } from "./deepMenuType";
4
+ import type { PopsPanelContentConfig, PopsPanelDetails, PopsPanelFormsTotalDetails } from "./indexType";
5
+ import type { PopsPanelInputDetails } from "./inputType";
6
+ import type { PopsPanelOwnDetails } from "./ownType";
7
+ import type { PopsPanelSelectMultipleDetails } from "./selectMultipleType";
8
+ import type { PopsPanelSelectDetails } from "./selectType";
9
+ import type { PopsPanelSliderDetails } from "./sliderType";
10
+ import type { PopsPanelSwitchDetails } from "./switchType";
11
+ import type { PopsPanelTextAreaDetails } from "./textareaType";
12
+ export declare const PanelHandleContentDetails: () => {
13
+ /**
14
+ * 左侧的ul容器
15
+ */
16
+ asideULElement: HTMLUListElement;
17
+ /**
18
+ * 右侧主内容的顶部文字ul容器
19
+ */
20
+ sectionContainerHeaderULElement: HTMLUListElement;
21
+ /**
22
+ * 右侧主内容的ul容器
23
+ */
24
+ sectionContainerULElement: HTMLUListElement;
25
+ /**
26
+ * 元素
27
+ */
28
+ $el: {
29
+ /** 内容 */
30
+ $content: HTMLDivElement;
31
+ /** 左侧容器 */
32
+ $contentAside: HTMLDivElement;
33
+ /** 右侧容器 */
34
+ $contentSectionContainer: HTMLDivElement;
35
+ };
36
+ /**
37
+ * 初始化
38
+ * @param details
39
+ */
40
+ init(details: {
41
+ config: Required<PopsPanelDetails>;
42
+ $el: {
43
+ $content: HTMLDivElement;
44
+ $contentAside: HTMLDivElement;
45
+ $contentSectionContainer: HTMLDivElement;
46
+ };
47
+ }): void;
48
+ /**
49
+ * 清空container容器的元素
50
+ */
51
+ clearContainer(): void;
52
+ /**
53
+ * 清空左侧容器已访问记录
54
+ */
55
+ clearAsideItemIsVisited(): void;
56
+ /**
57
+ * 设置左侧容器已访问记录
58
+ * @param element
59
+ */
60
+ setAsideItemIsVisited(element: HTMLElement): void;
61
+ /**
62
+ * 为元素添加自定义属性
63
+ * @param element
64
+ * @param attributes
65
+ */
66
+ setElementAttributes(element: HTMLElement, attributes?: any): void;
67
+ /**
68
+ * 为元素设置(自定义)属性
69
+ * @param element
70
+ * @param props
71
+ */
72
+ setElementProps(element: HTMLElement, props?: any): void;
73
+ /**
74
+ * 为元素设置classname
75
+ * @param element
76
+ * @param className
77
+ */
78
+ setElementClassName(element: HTMLElement, className?: string | string[] | (() => string | string[])): void;
79
+ /**
80
+ * 创建左侧容器元素<li>
81
+ * @param asideConfig
82
+ */
83
+ createAsideItem(asideConfig: PopsPanelContentConfig): HTMLLIElement;
84
+ /**
85
+ * 创建中间容器的元素<li>
86
+ * type ==> switch
87
+ * @param formConfig
88
+ */
89
+ createSectionContainerItem_switch(formConfig: PopsPanelSwitchDetails): HTMLLIElement;
90
+ /**
91
+ * 获取中间容器的元素<li>
92
+ * type ==> slider
93
+ * @param formConfig
94
+ */
95
+ createSectionContainerItem_slider(formConfig: PopsPanelSliderDetails): HTMLLIElement;
96
+ /**
97
+ * 获取中间容器的元素<li>
98
+ * type ==> slider
99
+ * @param formConfig
100
+ */
101
+ createSectionContainerItem_slider_new(formConfig: PopsPanelSliderDetails): HTMLLIElement;
102
+ /**
103
+ * 获取中间容器的元素<li>
104
+ * type ==> input
105
+ * @param formConfig
106
+ */
107
+ createSectionContainerItem_input(formConfig: PopsPanelInputDetails): HTMLLIElement;
108
+ /**
109
+ * 获取中间容器的元素<li>
110
+ * type ==> textarea
111
+ * @param formConfig
112
+ */
113
+ createSectionContainerItem_textarea(formConfig: PopsPanelTextAreaDetails): HTMLLIElement;
114
+ /**
115
+ * 获取中间容器的元素<li>
116
+ * type ==> select
117
+ * @param formConfig
118
+ */
119
+ createSectionContainerItem_select(formConfig: PopsPanelSelectDetails<any>): HTMLLIElement;
120
+ /**
121
+ * 获取中间容器的元素<li>
122
+ * type ==> select-multiple
123
+ * @param formConfig
124
+ */
125
+ createSectionContainerItem_select_multiple_new(formConfig: PopsPanelSelectMultipleDetails<any>): HTMLLIElement;
126
+ /**
127
+ * 获取中间容器的元素<li>
128
+ * type ==> button
129
+ * @param formConfig
130
+ */
131
+ createSectionContainerItem_button(formConfig: PopsPanelButtonDetails): HTMLLIElement;
132
+ /**
133
+ * 获取深层容器的元素<li>
134
+ * @param formConfig
135
+ */
136
+ createSectionContainerItem_deepMenu(formConfig: PopsPanelDeepMenuDetails): HTMLLIElement;
137
+ /**
138
+ * 获取中间容器的元素<li>
139
+ * type ===> own
140
+ * @param formConfig
141
+ */
142
+ createSectionContainerItem_own(formConfig: PopsPanelOwnDetails): HTMLLIElement;
143
+ /**
144
+ * 获取中间容器的元素<li>
145
+ * @param formConfig
146
+ */
147
+ createSectionContainerItem(formConfig: PopsPanelFormsTotalDetails): HTMLLIElement | undefined;
148
+ /**
149
+ * 生成配置每一项的元素
150
+ * @param formConfig
151
+ */
152
+ initFormItem(formConfig: PopsPanelContentConfig): void;
153
+ /**
154
+ *
155
+ * @param formConfig
156
+ * @param containerOptions
157
+ */
158
+ uListContainerAddItem(formConfig: PopsPanelFormsTotalDetails, containerOptions: PopsPanelRightAsideContainerOptions): void;
159
+ /**
160
+ * 为左侧容器元素添加点击事件
161
+ * @param asideLiElement 左侧的容器<li>元素
162
+ * @param asideConfig 配置
163
+ */
164
+ setAsideItemClickEvent(asideLiElement: HTMLElement, asideConfig: PopsPanelContentConfig): void;
165
+ };
@@ -1,87 +1,102 @@
1
- import type { PopsTitleConfig, PopsDragConfig, PopsCommonConfig } from "../../types/components";
2
- import type { PopsPanelFormsDetails } from "./formsType";
3
- import type { PopsPanelSwitchDetails } from "./switchType";
4
- import type { PopsPanelSliderDetails } from "./sliderType";
5
- import type { PopsPanelInputDetails } from "./inputType";
6
- import type { PopsPanelTextAreaDetails } from "./textareaType";
7
- import type { PopsPanelSelectDetails } from "./selectType";
8
- import type { PopsPanelButtonDetails } from "./buttonType";
9
- import type { PopsPanelDeepMenuDetails } from "./deepMenuType";
10
- import type { PopsPanelOwnDetails } from "./ownType";
11
- import type { PopsHeaderCloseButtonDetails } from "../../types/button";
12
- import { PopsPanelSelectMultipleDetails } from "./selectMultipleType";
13
- /** panel的各种类型的配置项 */
14
- export type PopsPanelFormsTotalDetails = PopsPanelSwitchDetails | PopsPanelSliderDetails | PopsPanelInputDetails | PopsPanelTextAreaDetails | PopsPanelSelectDetails<any> | PopsPanelSelectMultipleDetails<any> | PopsPanelButtonDetails | PopsPanelDeepMenuDetails | PopsPanelOwnDetails;
15
- /**
16
- * pops.panel的content配置信息
17
- */
18
- export interface PopsPanelContentConfig {
19
- /**
20
- * 元素属性id
21
- */
22
- id: string;
23
- /**
24
- * 左侧的标题
25
- */
26
- title: string;
27
- /**
28
- * (可选)中间顶部的标题
29
- */
30
- headerTitle?: string;
31
- /**
32
- * (可选)内容高度是否自动适应(与headerTitle的高度有关)
33
- */
34
- autoAdaptionContentHeight?: string;
35
- /**
36
- * (可选)是否是默认的,指打开弹窗的先显示出来的内容
37
- */
38
- isDefault?: boolean | (() => boolean);
39
- /**
40
- * (可选)是否自动滚动到默认的项
41
- */
42
- scrollToDefaultView?: boolean;
43
- /**
44
- * (可选)自定义元素属性
45
- */
46
- attributes?: any;
47
- /**
48
- * (可选)自定义属性
49
- */
50
- props?: HTMLElement;
51
- /**
52
- * 子配置
53
- */
54
- forms: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
55
- /**
56
- * 左侧容器的点击回调
57
- */
58
- callback?: (event: MouseEvent | PointerEvent, rightHeaderElement: HTMLUListElement, rightContainerElement: HTMLUListElement) => void;
59
- }
60
- /**
61
- * pops.panel
62
- */
63
- export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsCommonConfig {
64
- /**
65
- * 内容配置
66
- */
67
- content: PopsPanelContentConfig[];
68
- /**
69
- * 按钮配置
70
- */
71
- btn?: {
72
- /**
73
- * 右上角的关闭按钮
74
- */
75
- close?: PopsHeaderCloseButtonDetails;
76
- };
77
- /**
78
- * 移动端适配的的className,默认为pops-panel-is-mobile
79
- */
80
- mobileClassName?: string;
81
- /**
82
- * 是否强制是移动端,默认false
83
- * + true 强制为移动端
84
- * + false 自动根据UA判断是否是移动端
85
- */
86
- isMobile?: boolean;
87
- }
1
+ import type { PopsTitleConfig, PopsDragConfig, PopsCommonConfig } from "../../types/components";
2
+ import type { PopsPanelFormsDetails } from "./formsType";
3
+ import type { PopsPanelSwitchDetails } from "./switchType";
4
+ import type { PopsPanelSliderDetails } from "./sliderType";
5
+ import type { PopsPanelInputDetails } from "./inputType";
6
+ import type { PopsPanelTextAreaDetails } from "./textareaType";
7
+ import type { PopsPanelSelectDetails } from "./selectType";
8
+ import type { PopsPanelButtonDetails } from "./buttonType";
9
+ import type { PopsPanelDeepMenuDetails } from "./deepMenuType";
10
+ import type { PopsPanelOwnDetails } from "./ownType";
11
+ import type { PopsHeaderCloseButtonDetails } from "../../types/button";
12
+ import { PopsPanelSelectMultipleDetails } from "./selectMultipleType";
13
+ /** panel的各种类型的配置项 */
14
+ export type PopsPanelFormsTotalDetails = PopsPanelSwitchDetails | PopsPanelSliderDetails | PopsPanelInputDetails | PopsPanelTextAreaDetails | PopsPanelSelectDetails<any> | PopsPanelSelectMultipleDetails<any> | PopsPanelButtonDetails | PopsPanelDeepMenuDetails | PopsPanelOwnDetails;
15
+ /**
16
+ * pops.panel的content配置信息
17
+ */
18
+ export interface PopsPanelContentConfig {
19
+ /**
20
+ * 元素属性id
21
+ */
22
+ id: string;
23
+ /**
24
+ * 元素的className
25
+ */
26
+ className?: string | string[];
27
+ /**
28
+ * 左侧的标题,可以是html格式
29
+ */
30
+ title: string;
31
+ /**
32
+ * (可选)中间顶部的标题
33
+ */
34
+ headerTitle?: string;
35
+ /**
36
+ * (可选)内容高度是否自动适应(与headerTitle的高度有关)
37
+ */
38
+ autoAdaptionContentHeight?: string;
39
+ /**
40
+ * (可选)是否是默认的,指打开弹窗的先显示出来的内容
41
+ */
42
+ isDefault?: boolean | (() => boolean);
43
+ /**
44
+ * (可选)是否自动滚动到默认的项
45
+ */
46
+ scrollToDefaultView?: boolean;
47
+ /**
48
+ * (可选)自定义元素属性
49
+ */
50
+ attributes?: any;
51
+ /**
52
+ * (可选)自定义属性
53
+ */
54
+ props?: HTMLElement;
55
+ /**
56
+ * 子配置
57
+ */
58
+ forms: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
59
+ /**
60
+ * 左侧容器的点击回调
61
+ */
62
+ callback?: (event: MouseEvent | PointerEvent, rightHeaderElement: HTMLUListElement, rightContainerElement: HTMLUListElement) => void;
63
+ /**
64
+ * 左侧容器添加到panel后的回调
65
+ * @param rightHeaderElement
66
+ * @param rightContainerElement
67
+ */
68
+ afterRender?: (data: {
69
+ /** 容器配置 */
70
+ asideConfig: PopsPanelContentConfig;
71
+ /** 左侧容器的元素 */
72
+ $asideLiElement: HTMLLIElement;
73
+ }) => void;
74
+ }
75
+ /**
76
+ * pops.panel
77
+ */
78
+ export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsCommonConfig {
79
+ /**
80
+ * 内容配置
81
+ */
82
+ content: PopsPanelContentConfig[];
83
+ /**
84
+ * 按钮配置
85
+ */
86
+ btn?: {
87
+ /**
88
+ * 右上角的关闭按钮
89
+ */
90
+ close?: PopsHeaderCloseButtonDetails;
91
+ };
92
+ /**
93
+ * 移动端适配的的className,默认为pops-panel-is-mobile
94
+ */
95
+ mobileClassName?: string;
96
+ /**
97
+ * 是否强制是移动端,默认false
98
+ * + true 强制为移动端
99
+ * + false 自动根据UA判断是否是移动端
100
+ */
101
+ isMobile?: boolean;
102
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "弹窗库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",