@whitesev/pops 2.5.2 → 2.5.4

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 (45) hide show
  1. package/dist/index.amd.js +76 -112
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.amd.min.js +1 -1
  4. package/dist/index.amd.min.js.map +1 -1
  5. package/dist/index.cjs.js +76 -112
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.cjs.min.js +1 -1
  8. package/dist/index.cjs.min.js.map +1 -1
  9. package/dist/index.esm.js +76 -112
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +76 -112
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.system.js +76 -112
  18. package/dist/index.system.js.map +1 -1
  19. package/dist/index.system.min.js +1 -1
  20. package/dist/index.system.min.js.map +1 -1
  21. package/dist/index.umd.js +76 -112
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/index.umd.min.js +1 -1
  24. package/dist/index.umd.min.js.map +1 -1
  25. package/dist/types/src/Pops.d.ts +4 -4
  26. package/dist/types/src/components/panel/handlerComponents.d.ts +2 -2
  27. package/dist/types/src/components/panel/types/components-common.d.ts +3 -5
  28. package/dist/types/src/components/panel/types/index.d.ts +5 -11
  29. package/dist/types/src/components/rightClickMenu/index.d.ts +1 -1
  30. package/dist/types/src/components/rightClickMenu/types/index.d.ts +3 -2
  31. package/dist/types/src/components/searchSuggestion/types/index.d.ts +3 -2
  32. package/dist/types/src/components/tooltip/index.d.ts +1 -1
  33. package/dist/types/src/components/tooltip/types/index.d.ts +2 -1
  34. package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/src/components/panel/config.ts +37 -79
  37. package/src/components/panel/handlerComponents.ts +7 -22
  38. package/src/components/panel/index.ts +12 -2
  39. package/src/components/panel/types/components-common.ts +5 -9
  40. package/src/components/panel/types/index.ts +5 -13
  41. package/src/components/rightClickMenu/types/index.ts +3 -2
  42. package/src/components/searchSuggestion/types/index.ts +3 -2
  43. package/src/components/tooltip/index.ts +1 -3
  44. package/src/components/tooltip/types/index.ts +2 -1
  45. package/src/utils/PopsDOMUtils.ts +23 -10
package/dist/index.esm.js CHANGED
@@ -1832,17 +1832,28 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
1832
1832
  * @param className className属性
1833
1833
  */
1834
1834
  addClassName($el, className) {
1835
- if ($el == null) {
1835
+ if ($el == null)
1836
1836
  return;
1837
- }
1838
- if (typeof className !== "string") {
1837
+ if (className == null)
1839
1838
  return;
1839
+ if (typeof className === "function") {
1840
+ className = className();
1840
1841
  }
1841
- if (className.trim() === "") {
1842
- return;
1842
+ if (!Array.isArray(className)) {
1843
+ className = [className];
1843
1844
  }
1844
- const classNameList = className.split(" ").filter((item) => item.trim() !== "");
1845
- $el.classList.add(...classNameList);
1845
+ className.forEach((classNameStrItem) => {
1846
+ if (typeof classNameStrItem !== "string") {
1847
+ // 不是字符串
1848
+ return;
1849
+ }
1850
+ if (classNameStrItem.trim() === "") {
1851
+ // 空字符串
1852
+ return;
1853
+ }
1854
+ const classNameList = classNameStrItem.split(" ").filter((item) => item.trim() !== "");
1855
+ $el?.classList?.add?.(...classNameList);
1856
+ });
1846
1857
  }
1847
1858
  /**
1848
1859
  * 删除className
@@ -6050,18 +6061,16 @@ const PopsPanelConfig = () => {
6050
6061
  title: "菜单配置1",
6051
6062
  headerTitle: "菜单配置1",
6052
6063
  isDefault: false,
6053
- attributes: [
6054
- {
6055
- "data-test": "test",
6056
- "data-test-2": "test2",
6057
- },
6058
- ],
6064
+ attributes: {
6065
+ "data-test": "test",
6066
+ "data-test-2": "test2",
6067
+ },
6059
6068
  forms: [
6060
6069
  {
6061
6070
  className: "forms-1",
6062
6071
  text: "区域设置",
6063
6072
  type: "forms",
6064
- attributes: [],
6073
+ attributes: {},
6065
6074
  forms: [
6066
6075
  {
6067
6076
  className: "panel-switch",
@@ -6073,7 +6082,7 @@ const PopsPanelConfig = () => {
6073
6082
  // TODO
6074
6083
  },
6075
6084
  props: {},
6076
- attributes: [],
6085
+ attributes: {},
6077
6086
  getValue() {
6078
6087
  return true;
6079
6088
  },
@@ -6096,7 +6105,7 @@ const PopsPanelConfig = () => {
6096
6105
  isShowHoverTip: true,
6097
6106
  step: 1,
6098
6107
  props: {},
6099
- attributes: [],
6108
+ attributes: {},
6100
6109
  getValue() {
6101
6110
  return 50;
6102
6111
  },
@@ -6117,7 +6126,7 @@ const PopsPanelConfig = () => {
6117
6126
  afterAddToUListCallBack() {
6118
6127
  // TODO
6119
6128
  },
6120
- attributes: [],
6129
+ attributes: {},
6121
6130
  buttonIcon: "view",
6122
6131
  buttonIconIsLoading: true,
6123
6132
  buttonType: "default",
@@ -6131,7 +6140,7 @@ const PopsPanelConfig = () => {
6131
6140
  text: "button",
6132
6141
  type: "button",
6133
6142
  props: {},
6134
- attributes: [],
6143
+ attributes: {},
6135
6144
  buttonIcon: "eleme",
6136
6145
  buttonIconIsLoading: true,
6137
6146
  buttonType: "warning",
@@ -6146,7 +6155,7 @@ const PopsPanelConfig = () => {
6146
6155
  // @ts-ignore
6147
6156
  props: {},
6148
6157
  type: "button",
6149
- attributes: [],
6158
+ attributes: {},
6150
6159
  buttonIcon: "chromeFilled",
6151
6160
  buttonIconIsLoading: true,
6152
6161
  buttonType: "danger",
@@ -6159,7 +6168,7 @@ const PopsPanelConfig = () => {
6159
6168
  className: "panel-button",
6160
6169
  text: "button",
6161
6170
  type: "button",
6162
- attributes: [],
6171
+ attributes: {},
6163
6172
  // @ts-ignore
6164
6173
  props: {},
6165
6174
  buttonIcon: "upload",
@@ -6179,12 +6188,10 @@ const PopsPanelConfig = () => {
6179
6188
  title: "菜单配置2",
6180
6189
  headerTitle: "菜单配置2",
6181
6190
  isDefault: true,
6182
- attributes: [
6183
- {
6184
- "data-value": "value",
6185
- "data-value-2": "value2",
6186
- },
6187
- ],
6191
+ attributes: {
6192
+ "data-value": "value",
6193
+ "data-value-2": "value2",
6194
+ },
6188
6195
  forms: [
6189
6196
  {
6190
6197
  className: "panel-input",
@@ -6192,7 +6199,7 @@ const PopsPanelConfig = () => {
6192
6199
  type: "input",
6193
6200
  isNumber: false,
6194
6201
  props: {},
6195
- attributes: [],
6202
+ attributes: {},
6196
6203
  getValue() {
6197
6204
  return "50";
6198
6205
  },
@@ -6208,7 +6215,7 @@ const PopsPanelConfig = () => {
6208
6215
  type: "input",
6209
6216
  // @ts-ignore
6210
6217
  props: {},
6211
- attributes: [],
6218
+ attributes: {},
6212
6219
  getValue() {
6213
6220
  return "123456";
6214
6221
  },
@@ -6225,7 +6232,7 @@ const PopsPanelConfig = () => {
6225
6232
  type: "textarea",
6226
6233
  // @ts-ignore
6227
6234
  props: {},
6228
- attributes: [],
6235
+ attributes: {},
6229
6236
  getValue() {
6230
6237
  return "50";
6231
6238
  },
@@ -6242,7 +6249,7 @@ const PopsPanelConfig = () => {
6242
6249
  disabled: true,
6243
6250
  // @ts-ignore
6244
6251
  props: {},
6245
- attributes: [],
6252
+ attributes: {},
6246
6253
  getValue() {
6247
6254
  return 50;
6248
6255
  },
@@ -6283,7 +6290,7 @@ const PopsPanelConfig = () => {
6283
6290
  disabled: true,
6284
6291
  // @ts-ignore
6285
6292
  props: {},
6286
- attributes: [],
6293
+ attributes: {},
6287
6294
  placeholder: "请至少选择一个选项",
6288
6295
  getValue() {
6289
6296
  return ["select-1", "select-2"];
@@ -6366,7 +6373,8 @@ const PopsPanelConfig = () => {
6366
6373
  className: "forms-1",
6367
6374
  text: "区域设置",
6368
6375
  type: "forms",
6369
- attributes: [],
6376
+ attributes: {},
6377
+ props: {},
6370
6378
  forms: [
6371
6379
  {
6372
6380
  className: "panel-switch",
@@ -6374,7 +6382,7 @@ const PopsPanelConfig = () => {
6374
6382
  type: "switch",
6375
6383
  // @ts-ignore
6376
6384
  props: {},
6377
- attributes: [],
6385
+ attributes: {},
6378
6386
  getValue() {
6379
6387
  return true;
6380
6388
  },
@@ -6388,7 +6396,7 @@ const PopsPanelConfig = () => {
6388
6396
  // @ts-ignore
6389
6397
  props: {},
6390
6398
  type: "slider",
6391
- attributes: [],
6399
+ attributes: {},
6392
6400
  getValue() {
6393
6401
  return 50;
6394
6402
  },
@@ -6404,7 +6412,7 @@ const PopsPanelConfig = () => {
6404
6412
  // @ts-ignore
6405
6413
  props: {},
6406
6414
  type: "button",
6407
- attributes: [],
6415
+ attributes: {},
6408
6416
  buttonIcon: "eleme",
6409
6417
  buttonIconIsLoading: true,
6410
6418
  buttonType: "warning",
@@ -6419,7 +6427,7 @@ const PopsPanelConfig = () => {
6419
6427
  type: "button",
6420
6428
  // @ts-ignore
6421
6429
  props: {},
6422
- attributes: [],
6430
+ attributes: {},
6423
6431
  buttonIcon: "chromeFilled",
6424
6432
  buttonIconIsLoading: true,
6425
6433
  buttonType: "danger",
@@ -6434,7 +6442,7 @@ const PopsPanelConfig = () => {
6434
6442
  // @ts-ignore
6435
6443
  props: {},
6436
6444
  type: "button",
6437
- attributes: [],
6445
+ attributes: {},
6438
6446
  buttonIcon: "upload",
6439
6447
  buttonIconIsLoading: false,
6440
6448
  buttonType: "info",
@@ -6481,7 +6489,7 @@ const PopsPanelConfig = () => {
6481
6489
  // @ts-ignore
6482
6490
  props: {},
6483
6491
  type: "switch",
6484
- attributes: [],
6492
+ attributes: {},
6485
6493
  getValue() {
6486
6494
  return true;
6487
6495
  },
@@ -6500,12 +6508,10 @@ const PopsPanelConfig = () => {
6500
6508
  `,
6501
6509
  isBottom: true,
6502
6510
  disableAsideItemHoverCSS: true,
6503
- attributes: [
6504
- {
6505
- "data-value": "value",
6506
- "data-value-2": "value2",
6507
- },
6508
- ],
6511
+ attributes: {
6512
+ "data-value": "value",
6513
+ "data-value-2": "value2",
6514
+ },
6509
6515
  // @ts-ignore
6510
6516
  props: {},
6511
6517
  forms: [],
@@ -6517,12 +6523,10 @@ const PopsPanelConfig = () => {
6517
6523
  id: "whitesev-panel-bottom-config-2",
6518
6524
  title: "版本:xxx.xx.xx",
6519
6525
  isBottom: true,
6520
- attributes: [
6521
- {
6522
- "data-value": "value",
6523
- "data-value-2": "value2",
6524
- },
6525
- ],
6526
+ attributes: {
6527
+ "data-value": "value",
6528
+ "data-value-2": "value2",
6529
+ },
6526
6530
  // @ts-ignore
6527
6531
  props: {},
6528
6532
  forms: [],
@@ -6531,42 +6535,7 @@ const PopsPanelConfig = () => {
6531
6535
  },
6532
6536
  },
6533
6537
  ],
6534
- bottomContentConfig: [
6535
- {
6536
- text: "Github",
6537
- position: "left",
6538
- className: "user-home",
6539
- attributes: {
6540
- "data-url": "https://github.com/whitesevs",
6541
- },
6542
- props: {
6543
- "data-test": 1,
6544
- },
6545
- disableHoverCSS: false,
6546
- clickCallback() {
6547
- const userHomeUrl = this.attributes["data-url"];
6548
- console.log("打开个人主页:" + userHomeUrl);
6549
- window.open(userHomeUrl, "_blank");
6550
- },
6551
- afterRender(config) {
6552
- console.log(config);
6553
- },
6554
- },
6555
- {
6556
- text: "0.0.1",
6557
- position: "right",
6558
- className: "script-version",
6559
- attributes: {},
6560
- props: {},
6561
- disableHoverCSS: true,
6562
- clickCallback() {
6563
- console.log("当前版本:" + this.text);
6564
- },
6565
- afterRender(config) {
6566
- console.log(config);
6567
- },
6568
- },
6569
- ],
6538
+ bottomContentConfig: [],
6570
6539
  btn: {
6571
6540
  close: {
6572
6541
  enable: true,
@@ -6774,9 +6743,7 @@ class ToolTip {
6774
6743
  /** 箭头 */
6775
6744
  const $toolTipArrow = $toolTipContainer.querySelector(".pops-tip-arrow");
6776
6745
  // 处理className
6777
- if (typeof this.$data.config.className === "string" && this.$data.config.className.trim() !== "") {
6778
- popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6779
- }
6746
+ popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6780
6747
  // 添加z-index
6781
6748
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
6782
6749
  if (this.$data.config.style != null) {
@@ -7424,10 +7391,12 @@ const PanelHandlerComponents = () => {
7424
7391
  * @param props 属性
7425
7392
  */
7426
7393
  setElementProps($el, props) {
7427
- if (props == null) {
7394
+ if (props == null)
7428
7395
  return;
7429
- }
7430
- Object.keys(props).forEach((propName) => {
7396
+ if (typeof props !== "object")
7397
+ return;
7398
+ const propsKeys = Object.keys(props);
7399
+ propsKeys.forEach((propName) => {
7431
7400
  const value = props[propName];
7432
7401
  if (propName === "innerHTML") {
7433
7402
  PopsSafeUtils.setSafeHTML($el, value);
@@ -7442,23 +7411,7 @@ const PanelHandlerComponents = () => {
7442
7411
  * @param className
7443
7412
  */
7444
7413
  setElementClassName($el, className) {
7445
- if (className == null) {
7446
- return;
7447
- }
7448
- if (typeof className === "function") {
7449
- className = className();
7450
- }
7451
- if (typeof className === "string") {
7452
- const splitClassName = className.split(" ");
7453
- splitClassName.forEach((classNameStr) => {
7454
- $el.classList.add(classNameStr);
7455
- });
7456
- }
7457
- else if (Array.isArray(className)) {
7458
- className.forEach((classNameStr) => {
7459
- this.setElementClassName($el, classNameStr);
7460
- });
7461
- }
7414
+ popsDOMUtils.addClassName($el, className);
7462
7415
  },
7463
7416
  /**
7464
7417
  * 创建底部项元素<li>
@@ -10099,8 +10052,19 @@ const PopsPanel = {
10099
10052
  let config = PopsPanelConfig();
10100
10053
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
10101
10054
  config = popsUtils.assign(config, details);
10102
- if (details && Array.isArray(details.content)) {
10103
- config.content = details.content;
10055
+ if (details) {
10056
+ if (Array.isArray(details.content)) {
10057
+ // 存在内容配置
10058
+ config.content = details.content;
10059
+ }
10060
+ if (Array.isArray(details.bottomContentConfig)) {
10061
+ // 存在底部配置
10062
+ config.bottomContentConfig = details.bottomContentConfig;
10063
+ }
10064
+ else {
10065
+ // 不存在底部配置 清空默认的
10066
+ config.bottomContentConfig = [];
10067
+ }
10104
10068
  }
10105
10069
  config = PopsHandler.handleOnly(popsType, config);
10106
10070
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
@@ -11954,7 +11918,7 @@ const PopsSearchSuggestion = {
11954
11918
  },
11955
11919
  };
11956
11920
 
11957
- const version = "2.5.2";
11921
+ const version = "2.5.4";
11958
11922
 
11959
11923
  class Pops {
11960
11924
  /** 配置 */