@whitesev/pops 2.1.7 → 2.1.8

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.
Files changed (47) hide show
  1. package/dist/index.amd.js +127 -42
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +127 -42
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +127 -42
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +127 -42
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +126 -41
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +127 -42
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +1 -0
  14. package/dist/types/src/components/panel/handlerComponents.d.ts +5 -1
  15. package/dist/types/src/components/panel/types/components-button.d.ts +3 -1
  16. package/dist/types/src/components/panel/types/components-deepMenu.d.ts +3 -1
  17. package/dist/types/src/components/panel/types/components-forms.d.ts +3 -1
  18. package/dist/types/src/components/panel/types/components-input.d.ts +3 -1
  19. package/dist/types/src/components/panel/types/components-select.d.ts +3 -1
  20. package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +3 -1
  21. package/dist/types/src/components/panel/types/components-slider.d.ts +3 -1
  22. package/dist/types/src/components/panel/types/components-switch.d.ts +3 -1
  23. package/dist/types/src/components/panel/types/components-textarea.d.ts +3 -1
  24. package/dist/types/src/components/panel/types/index.d.ts +44 -19
  25. package/package.json +5 -5
  26. package/src/Pops.ts +1 -1
  27. package/src/components/alert/index.ts +2 -2
  28. package/src/components/confirm/index.ts +2 -2
  29. package/src/components/drawer/index.ts +2 -2
  30. package/src/components/folder/index.ts +1 -1
  31. package/src/components/iframe/index.ts +1 -1
  32. package/src/components/loading/index.ts +3 -1
  33. package/src/components/panel/config.ts +46 -0
  34. package/src/components/panel/handlerComponents.ts +92 -33
  35. package/src/components/panel/index.css +60 -11
  36. package/src/components/panel/index.ts +5 -4
  37. package/src/components/panel/types/components-button.ts +7 -3
  38. package/src/components/panel/types/components-deepMenu.ts +7 -3
  39. package/src/components/panel/types/components-forms.ts +7 -3
  40. package/src/components/panel/types/components-input.ts +7 -3
  41. package/src/components/panel/types/components-select.ts +7 -3
  42. package/src/components/panel/types/components-selectMultiple.ts +7 -3
  43. package/src/components/panel/types/components-slider.ts +7 -3
  44. package/src/components/panel/types/components-switch.ts +7 -3
  45. package/src/components/panel/types/components-textarea.ts +7 -3
  46. package/src/components/panel/types/index.ts +59 -27
  47. package/src/components/prompt/index.ts +1 -1
@@ -81,6 +81,9 @@ aside.pops-panel-aside {
81
81
  background: var(--aside-bg-color);
82
82
  border-right: 1px solid var(--aside-bg-color);
83
83
  font-size: 0.9em;
84
+ display: flex;
85
+ flex-direction: column;
86
+ justify-content: space-between;
84
87
  }
85
88
  aside.pops-panel-aside {
86
89
  user-select: none;
@@ -134,7 +137,7 @@ aside.pops-panel-aside ul li {
134
137
  justify-content: flex-start;
135
138
  }
136
139
  aside.pops-panel-aside .pops-is-visited,
137
- aside.pops-panel-aside ul li:hover {
140
+ aside.pops-panel-aside ul li:not(.pops-panel-disabled-aside-hover-css):hover {
138
141
  color: var(--aside-hover-color);
139
142
  background: var(--aside-hover-bg-color);
140
143
  }
@@ -197,9 +200,9 @@ section.pops-panel-container .pops-panel-item-left-text {
197
200
  }
198
201
 
199
202
  /* 左侧的主文字 */
200
- section.pops-panel-container .pops-panel-item-left-main-text {
201
- /*line-height: 2;*/
202
- }
203
+ /*section.pops-panel-container .pops-panel-item-left-main-text {
204
+
205
+ }*/
203
206
  /* 左侧的描述文字 */
204
207
  section.pops-panel-container .pops-panel-item-left-desc-text {
205
208
  font-size: var(--pops-panel-forms-container-item-left-desc-text-size);
@@ -316,6 +319,25 @@ section.pops-panel-container
316
319
  }
317
320
  }
318
321
  /* switch的CSS */
322
+ .pops-panel-switch {
323
+ --panel-switch-core-bd-color: rgb(220, 223, 230, var(--pops-bd-opacity));
324
+ --panel-switch-core-bg-color: rgb(220, 223, 230, var(--pops-bg-opacity));
325
+ --panel-switch-circle-color: #dcdfe6;
326
+ --panel-switch-circle-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
327
+ --panel-switch-checked-circle-color: #409eff;
328
+ --panel-switch-checked-core-bd-color: rgb(
329
+ 64,
330
+ 158,
331
+ 255,
332
+ var(--pops-bd-opacity)
333
+ );
334
+ --panel-switch-checked-core-bg-color: rgb(
335
+ 64,
336
+ 158,
337
+ 255,
338
+ var(--pops-bg-opacity)
339
+ );
340
+ }
319
341
  .pops-panel-switch {
320
342
  display: inline-flex;
321
343
  flex-direction: row-reverse;
@@ -353,11 +375,11 @@ section.pops-panel-container
353
375
  align-items: center;
354
376
  min-width: 40px;
355
377
  height: 20px;
356
- border: 1px solid rgb(220, 223, 230, var(--pops-bd-opacity));
378
+ border: 1px solid var(--panel-switch-core-bd-color);
357
379
  outline: 0;
358
380
  border-radius: 10px;
359
381
  box-sizing: border-box;
360
- background: rgb(220, 223, 230, var(--pops-bg-opacity));
382
+ background: var(--panel-switch-core-bg-color);
361
383
  cursor: pointer;
362
384
  transition: border-color 0.3s, background-color 0.3s;
363
385
  }
@@ -368,19 +390,19 @@ section.pops-panel-container
368
390
  transition: all 0.3s;
369
391
  width: 16px;
370
392
  height: 16px;
371
- background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
372
393
  display: flex;
373
394
  justify-content: center;
374
395
  align-items: center;
375
- color: rgb(220, 223, 230);
396
+ background-color: var(--panel-switch-circle-bg-color);
397
+ color: var(--panel-switch-circle-color);
376
398
  }
377
399
  .pops-panel-switch.pops-panel-switch-is-checked span.pops-panel-switch__core {
378
- border-color: rgb(64, 158, 255, var(--pops-bd-opacity));
379
- background-color: rgb(64, 158, 255, var(--pops-bg-opacity));
400
+ border-color: var(--panel-switch-checked-core-bd-color);
401
+ background-color: var(--panel-switch-checked-core-bg-color);
380
402
  }
381
403
  .pops-panel-switch.pops-panel-switch-is-checked .pops-panel-switch__action {
382
404
  left: calc(100% - 17px);
383
- color: rgb(64, 158, 255);
405
+ color: var(--panel-switch-checked-circle-color);
384
406
  }
385
407
  /* switch的CSS */
386
408
 
@@ -1140,6 +1162,28 @@ section.pops-panel-container
1140
1162
  fill: #f2f2f2;
1141
1163
  }
1142
1164
 
1165
+ /* switch的CSS */
1166
+ .pops-panel-switch {
1167
+ --panel-switch-core-bd-color: rgb(220, 223, 230, var(--pops-bd-opacity));
1168
+ --panel-switch-core-bg-color: rgb(220, 223, 230, var(--pops-bg-opacity));
1169
+ --panel-switch-circle-color: #dcdfe6;
1170
+ --panel-switch-circle-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
1171
+ --panel-switch-checked-circle-color: #409eff;
1172
+ --panel-switch-checked-core-bd-color: rgb(
1173
+ 64,
1174
+ 158,
1175
+ 255,
1176
+ var(--pops-bd-opacity)
1177
+ );
1178
+ --panel-switch-checked-core-bg-color: rgb(
1179
+ 64,
1180
+ 158,
1181
+ 255,
1182
+ var(--pops-bg-opacity)
1183
+ );
1184
+ }
1185
+
1186
+ /* select-multiple的CSS*/
1143
1187
  .pops-panel-select-multiple {
1144
1188
  --el-fill-color-blank: #141414;
1145
1189
  --el-border-color: #4c4d4f;
@@ -1153,7 +1197,12 @@ section.pops-panel-container
1153
1197
  --el-color-primary: #409eff;
1154
1198
  --el-color-white: #ffffff;
1155
1199
  }
1200
+ /* select-multiple的CSS*/
1156
1201
  .pops-panel-select-multiple .el-tag {
1157
1202
  --el-color-info-light-9: #202121;
1158
1203
  }
1204
+ /* slider的CSS */
1205
+ .pops-slider {
1206
+ --pops-slider-border-color-light: #414243;
1207
+ }
1159
1208
  }
@@ -54,15 +54,16 @@ export const PopsPanel = {
54
54
  };${headerStyle}">${
55
55
  config.title.html
56
56
  ? config.title.text
57
- : `<p pops style="${headerPStyle}">${config.title.text}</p>`
57
+ : `<p pops class="pops-${PopsType}-title-text" class="pops-${PopsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
58
58
  }${headerBtnHTML}</div>
59
59
  <div class="pops-content pops-${PopsType}-content">
60
60
  <aside class="pops-${PopsType}-aside">
61
- <ul></ul>
61
+ <ul class="pops-${PopsType}-aside-top-container"></ul>
62
+ <ul class="pops-${PopsType}-aside-bottom-container"></ul>
62
63
  </aside>
63
64
  <section class="pops-${PopsType}-container">
64
- <ul class="pops-panel-container-header-ul"></ul>
65
- <ul></ul>
65
+ <ul class="pops-${PopsType}-container-header-ul"></ul>
66
+ <ul class="pops-${PopsType}-container-main-ul"></ul>
66
67
  </section>
67
68
  </div>`,
68
69
  "",
@@ -13,9 +13,13 @@ export interface PopsPanelButtonDetails
13
13
  /**
14
14
  * (可选)自定义元素属性
15
15
  */
16
- attributes?: {
17
- [key: string]: any;
18
- };
16
+ attributes?:
17
+ | {
18
+ [key: string]: any;
19
+ }
20
+ | {
21
+ [key: string]: any;
22
+ }[];
19
23
  /**
20
24
  * (可选)自定义属性
21
25
  */
@@ -17,9 +17,13 @@ export interface PopsPanelDeepMenuDetails
17
17
  /**
18
18
  * (可选)自定义元素属性
19
19
  */
20
- attributes?: {
21
- [key: string]: any;
22
- };
20
+ attributes?:
21
+ | {
22
+ [key: string]: any;
23
+ }
24
+ | {
25
+ [key: string]: any;
26
+ }[];
23
27
  /**
24
28
  * (可选)自定义属性
25
29
  */
@@ -13,9 +13,13 @@ export interface PopsPanelFormsDetails
13
13
  /**
14
14
  * (可选)自定义元素属性
15
15
  */
16
- attributes?: {
17
- [key: string]: any;
18
- };
16
+ attributes?:
17
+ | {
18
+ [key: string]: any;
19
+ }
20
+ | {
21
+ [key: string]: any;
22
+ }[];
19
23
  /**
20
24
  * (可选)自定义属性
21
25
  */
@@ -12,9 +12,13 @@ export interface PopsPanelInputDetails
12
12
  /**
13
13
  * (可选)自定义元素属性
14
14
  */
15
- attributes?: {
16
- [key: string]: any;
17
- };
15
+ attributes?:
16
+ | {
17
+ [key: string]: any;
18
+ }
19
+ | {
20
+ [key: string]: any;
21
+ }[];
18
22
  /**
19
23
  * (可选)自定义属性
20
24
  */
@@ -14,9 +14,13 @@ export interface PopsPanelSelectDetails<T = any>
14
14
  /**
15
15
  * (可选)自定义元素属性
16
16
  */
17
- attributes?: {
18
- [key: string]: any;
19
- };
17
+ attributes?:
18
+ | {
19
+ [key: string]: any;
20
+ }
21
+ | {
22
+ [key: string]: any;
23
+ }[];
20
24
  /**
21
25
  * (可选)自定义属性
22
26
  */
@@ -47,9 +47,13 @@ export interface PopsPanelSelectMultipleDetails<T = any>
47
47
  /**
48
48
  * (可选)自定义元素属性
49
49
  */
50
- attributes?: {
51
- [key: string]: any;
52
- };
50
+ attributes?:
51
+ | {
52
+ [key: string]: any;
53
+ }
54
+ | {
55
+ [key: string]: any;
56
+ }[];
53
57
  /**
54
58
  * (可选)自定义属性
55
59
  */
@@ -13,9 +13,13 @@ export interface PopsPanelSliderDetails
13
13
  /**
14
14
  * 自定义元素属性
15
15
  */
16
- attributes?: {
17
- [key: string]: any;
18
- };
16
+ attributes?:
17
+ | {
18
+ [key: string]: any;
19
+ }
20
+ | {
21
+ [key: string]: any;
22
+ }[];
19
23
  /**
20
24
  * 自定义属性
21
25
  */
@@ -12,9 +12,13 @@ export interface PopsPanelSwitchDetails
12
12
  /**
13
13
  * (可选)自定义元素属性
14
14
  */
15
- attributes?: {
16
- [key: string]: any;
17
- };
15
+ attributes?:
16
+ | {
17
+ [key: string]: any;
18
+ }
19
+ | {
20
+ [key: string]: any;
21
+ }[];
18
22
  /**
19
23
  * (可选)自定义属性
20
24
  */
@@ -12,9 +12,13 @@ export interface PopsPanelTextAreaDetails
12
12
  /**
13
13
  * (可选)自定义元素属性
14
14
  */
15
- attributes?: {
16
- [key: string]: any;
17
- };
15
+ attributes?:
16
+ | {
17
+ [key: string]: any;
18
+ }
19
+ | {
20
+ [key: string]: any;
21
+ }[];
18
22
  /**
19
23
  * (可选)自定义属性
20
24
  */
@@ -51,37 +51,52 @@ export interface PopsPanelContentConfig {
51
51
  */
52
52
  id: string;
53
53
  /**
54
- * 元素的className
54
+ * (可选)元素的className,值为空的话就不设置
55
+ * @default ""
55
56
  */
56
57
  className?: string | string[];
57
58
  /**
58
59
  * 左侧的标题,可以是html格式
59
60
  */
60
- title: string;
61
+ title: string | (() => string);
61
62
  /**
62
- * (可选)中间顶部的标题
63
+ * (可选)中间顶部的标题,如果为空,则使用title的值代替
64
+ * @default title
63
65
  */
64
- headerTitle?: string;
66
+ headerTitle?: string | (() => string);
65
67
  /**
66
- * (可选)内容高度是否自动适应(与headerTitle的高度有关)
68
+ * (可选)是否是默认的,指打开弹窗的先显示出来的内容,默认为首位第一个项,如果多个配置都设置了isDefault的值为true,那么只有第一个值生效
69
+ * @default false
67
70
  */
68
- autoAdaptionContentHeight?: string;
71
+ isDefault?: boolean | (() => boolean);
69
72
  /**
70
- * (可选)是否是默认的,指打开弹窗的先显示出来的内容
73
+ * (可选)是否是位于底部的
74
+ *
75
+ * 自上而下排序
76
+ * @default false
71
77
  */
72
- isDefault?: boolean | (() => boolean);
78
+ isBottom?: boolean | (() => boolean);
79
+ /**
80
+ * (可选)是否禁用左侧项的hover的CSS样式
81
+ */
82
+ disableAsideItemHoverCSS?: boolean | (() => boolean);
73
83
  /**
74
84
  * (可选)是否自动滚动到默认的项
85
+ * @default false
75
86
  */
76
87
  scrollToDefaultView?: boolean;
77
88
  /**
78
- * (可选)自定义元素属性
89
+ * (可选)自定义元素属性.setAttribute、.getAttribute
79
90
  */
80
- attributes?: {
81
- [key: string]: any;
82
- };
91
+ attributes?:
92
+ | {
93
+ [key: string]: any;
94
+ }
95
+ | {
96
+ [key: string]: any;
97
+ }[];
83
98
  /**
84
- * (可选)自定义属性
99
+ * (可选)自定义元素内部的属性值
85
100
  */
86
101
  props?: {
87
102
  [K in keyof HTMLElement]?: HTMLElement[K];
@@ -90,25 +105,40 @@ export interface PopsPanelContentConfig {
90
105
  * 子配置
91
106
  */
92
107
  forms: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
108
+ /**
109
+ * 左侧容器的点击回调(点击后第一个触发该回调)
110
+ * @returns
111
+ * + false 阻止默认行为
112
+ */
113
+ clickFirstCallback?: (
114
+ event: MouseEvent | PointerEvent,
115
+ rightHeaderElement: HTMLUListElement,
116
+ rightContainerElement: HTMLUListElement
117
+ ) => void | boolean | Promise<void | boolean>;
93
118
  /**
94
119
  * 左侧容器的点击回调
120
+ * @returns
121
+ * + false 阻止默认进入菜单详情
95
122
  */
96
- callback?: (
123
+ clickCallback?: (
97
124
  event: MouseEvent | PointerEvent,
98
125
  rightHeaderElement: HTMLUListElement,
99
126
  rightContainerElement: HTMLUListElement
100
- ) => void;
127
+ ) => void | boolean | Promise<void | boolean>;
101
128
  /**
102
- * 左侧容器添加到panel后的回调
103
- * @param rightHeaderElement
104
- * @param rightContainerElement
129
+ * 左侧项添加到panel后的回调
105
130
  */
106
- afterRender?: (data: {
107
- /** 容器配置 */
108
- asideConfig: PopsPanelContentConfig;
109
- /** 左侧容器的元素 */
110
- $asideLiElement: HTMLLIElement;
111
- }) => void;
131
+ afterRender?: (
132
+ /**
133
+ * 配置
134
+ */
135
+ data: {
136
+ /** 容器配置 */
137
+ asideConfig: PopsPanelContentConfig;
138
+ /** 左侧容器的元素 */
139
+ $asideLiElement: HTMLLIElement;
140
+ }
141
+ ) => void;
112
142
  }
113
143
 
114
144
  /**
@@ -123,16 +153,18 @@ export interface PopsPanelDetails
123
153
  */
124
154
  content: PopsPanelContentConfig[];
125
155
  /**
126
- * 按钮配置
156
+ * 右上角的按钮配置
127
157
  */
128
158
  btn?: {
129
159
  /**
130
- * 右上角的关闭按钮
160
+ * 关闭按钮
131
161
  */
132
162
  close?: PopsHeaderCloseButtonDetails;
133
163
  };
134
164
  /**
135
- * 移动端适配的的className,默认为pops-panel-is-mobile
165
+ * 移动端适配的的className
166
+ *
167
+ * @default "pops-panel-is-mobile"
136
168
  */
137
169
  mobileClassName?: string;
138
170
  /**
@@ -54,7 +54,7 @@ export const PopsPrompt = {
54
54
  };${headerStyle}">${
55
55
  config.title.html
56
56
  ? config.title.text
57
- : `<p pops style="${headerPStyle}">${config.title.text}</p>`
57
+ : `<p pops class="pops-${PopsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
58
58
  }${headerBtnHTML}</div>
59
59
  <div class="pops-content pops-${PopsType}-content" style="${contentPStyle}">${
60
60
  config.content.row