@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.umd.js CHANGED
@@ -1838,17 +1838,28 @@
1838
1838
  * @param className className属性
1839
1839
  */
1840
1840
  addClassName($el, className) {
1841
- if ($el == null) {
1841
+ if ($el == null)
1842
1842
  return;
1843
- }
1844
- if (typeof className !== "string") {
1843
+ if (className == null)
1845
1844
  return;
1845
+ if (typeof className === "function") {
1846
+ className = className();
1846
1847
  }
1847
- if (className.trim() === "") {
1848
- return;
1848
+ if (!Array.isArray(className)) {
1849
+ className = [className];
1849
1850
  }
1850
- const classNameList = className.split(" ").filter((item) => item.trim() !== "");
1851
- $el.classList.add(...classNameList);
1851
+ className.forEach((classNameStrItem) => {
1852
+ if (typeof classNameStrItem !== "string") {
1853
+ // 不是字符串
1854
+ return;
1855
+ }
1856
+ if (classNameStrItem.trim() === "") {
1857
+ // 空字符串
1858
+ return;
1859
+ }
1860
+ const classNameList = classNameStrItem.split(" ").filter((item) => item.trim() !== "");
1861
+ $el?.classList?.add?.(...classNameList);
1862
+ });
1852
1863
  }
1853
1864
  /**
1854
1865
  * 删除className
@@ -6056,18 +6067,16 @@
6056
6067
  title: "菜单配置1",
6057
6068
  headerTitle: "菜单配置1",
6058
6069
  isDefault: false,
6059
- attributes: [
6060
- {
6061
- "data-test": "test",
6062
- "data-test-2": "test2",
6063
- },
6064
- ],
6070
+ attributes: {
6071
+ "data-test": "test",
6072
+ "data-test-2": "test2",
6073
+ },
6065
6074
  forms: [
6066
6075
  {
6067
6076
  className: "forms-1",
6068
6077
  text: "区域设置",
6069
6078
  type: "forms",
6070
- attributes: [],
6079
+ attributes: {},
6071
6080
  forms: [
6072
6081
  {
6073
6082
  className: "panel-switch",
@@ -6079,7 +6088,7 @@
6079
6088
  // TODO
6080
6089
  },
6081
6090
  props: {},
6082
- attributes: [],
6091
+ attributes: {},
6083
6092
  getValue() {
6084
6093
  return true;
6085
6094
  },
@@ -6102,7 +6111,7 @@
6102
6111
  isShowHoverTip: true,
6103
6112
  step: 1,
6104
6113
  props: {},
6105
- attributes: [],
6114
+ attributes: {},
6106
6115
  getValue() {
6107
6116
  return 50;
6108
6117
  },
@@ -6123,7 +6132,7 @@
6123
6132
  afterAddToUListCallBack() {
6124
6133
  // TODO
6125
6134
  },
6126
- attributes: [],
6135
+ attributes: {},
6127
6136
  buttonIcon: "view",
6128
6137
  buttonIconIsLoading: true,
6129
6138
  buttonType: "default",
@@ -6137,7 +6146,7 @@
6137
6146
  text: "button",
6138
6147
  type: "button",
6139
6148
  props: {},
6140
- attributes: [],
6149
+ attributes: {},
6141
6150
  buttonIcon: "eleme",
6142
6151
  buttonIconIsLoading: true,
6143
6152
  buttonType: "warning",
@@ -6152,7 +6161,7 @@
6152
6161
  // @ts-ignore
6153
6162
  props: {},
6154
6163
  type: "button",
6155
- attributes: [],
6164
+ attributes: {},
6156
6165
  buttonIcon: "chromeFilled",
6157
6166
  buttonIconIsLoading: true,
6158
6167
  buttonType: "danger",
@@ -6165,7 +6174,7 @@
6165
6174
  className: "panel-button",
6166
6175
  text: "button",
6167
6176
  type: "button",
6168
- attributes: [],
6177
+ attributes: {},
6169
6178
  // @ts-ignore
6170
6179
  props: {},
6171
6180
  buttonIcon: "upload",
@@ -6185,12 +6194,10 @@
6185
6194
  title: "菜单配置2",
6186
6195
  headerTitle: "菜单配置2",
6187
6196
  isDefault: true,
6188
- attributes: [
6189
- {
6190
- "data-value": "value",
6191
- "data-value-2": "value2",
6192
- },
6193
- ],
6197
+ attributes: {
6198
+ "data-value": "value",
6199
+ "data-value-2": "value2",
6200
+ },
6194
6201
  forms: [
6195
6202
  {
6196
6203
  className: "panel-input",
@@ -6198,7 +6205,7 @@
6198
6205
  type: "input",
6199
6206
  isNumber: false,
6200
6207
  props: {},
6201
- attributes: [],
6208
+ attributes: {},
6202
6209
  getValue() {
6203
6210
  return "50";
6204
6211
  },
@@ -6214,7 +6221,7 @@
6214
6221
  type: "input",
6215
6222
  // @ts-ignore
6216
6223
  props: {},
6217
- attributes: [],
6224
+ attributes: {},
6218
6225
  getValue() {
6219
6226
  return "123456";
6220
6227
  },
@@ -6231,7 +6238,7 @@
6231
6238
  type: "textarea",
6232
6239
  // @ts-ignore
6233
6240
  props: {},
6234
- attributes: [],
6241
+ attributes: {},
6235
6242
  getValue() {
6236
6243
  return "50";
6237
6244
  },
@@ -6248,7 +6255,7 @@
6248
6255
  disabled: true,
6249
6256
  // @ts-ignore
6250
6257
  props: {},
6251
- attributes: [],
6258
+ attributes: {},
6252
6259
  getValue() {
6253
6260
  return 50;
6254
6261
  },
@@ -6289,7 +6296,7 @@
6289
6296
  disabled: true,
6290
6297
  // @ts-ignore
6291
6298
  props: {},
6292
- attributes: [],
6299
+ attributes: {},
6293
6300
  placeholder: "请至少选择一个选项",
6294
6301
  getValue() {
6295
6302
  return ["select-1", "select-2"];
@@ -6372,7 +6379,8 @@
6372
6379
  className: "forms-1",
6373
6380
  text: "区域设置",
6374
6381
  type: "forms",
6375
- attributes: [],
6382
+ attributes: {},
6383
+ props: {},
6376
6384
  forms: [
6377
6385
  {
6378
6386
  className: "panel-switch",
@@ -6380,7 +6388,7 @@
6380
6388
  type: "switch",
6381
6389
  // @ts-ignore
6382
6390
  props: {},
6383
- attributes: [],
6391
+ attributes: {},
6384
6392
  getValue() {
6385
6393
  return true;
6386
6394
  },
@@ -6394,7 +6402,7 @@
6394
6402
  // @ts-ignore
6395
6403
  props: {},
6396
6404
  type: "slider",
6397
- attributes: [],
6405
+ attributes: {},
6398
6406
  getValue() {
6399
6407
  return 50;
6400
6408
  },
@@ -6410,7 +6418,7 @@
6410
6418
  // @ts-ignore
6411
6419
  props: {},
6412
6420
  type: "button",
6413
- attributes: [],
6421
+ attributes: {},
6414
6422
  buttonIcon: "eleme",
6415
6423
  buttonIconIsLoading: true,
6416
6424
  buttonType: "warning",
@@ -6425,7 +6433,7 @@
6425
6433
  type: "button",
6426
6434
  // @ts-ignore
6427
6435
  props: {},
6428
- attributes: [],
6436
+ attributes: {},
6429
6437
  buttonIcon: "chromeFilled",
6430
6438
  buttonIconIsLoading: true,
6431
6439
  buttonType: "danger",
@@ -6440,7 +6448,7 @@
6440
6448
  // @ts-ignore
6441
6449
  props: {},
6442
6450
  type: "button",
6443
- attributes: [],
6451
+ attributes: {},
6444
6452
  buttonIcon: "upload",
6445
6453
  buttonIconIsLoading: false,
6446
6454
  buttonType: "info",
@@ -6487,7 +6495,7 @@
6487
6495
  // @ts-ignore
6488
6496
  props: {},
6489
6497
  type: "switch",
6490
- attributes: [],
6498
+ attributes: {},
6491
6499
  getValue() {
6492
6500
  return true;
6493
6501
  },
@@ -6506,12 +6514,10 @@
6506
6514
  `,
6507
6515
  isBottom: true,
6508
6516
  disableAsideItemHoverCSS: true,
6509
- attributes: [
6510
- {
6511
- "data-value": "value",
6512
- "data-value-2": "value2",
6513
- },
6514
- ],
6517
+ attributes: {
6518
+ "data-value": "value",
6519
+ "data-value-2": "value2",
6520
+ },
6515
6521
  // @ts-ignore
6516
6522
  props: {},
6517
6523
  forms: [],
@@ -6523,12 +6529,10 @@
6523
6529
  id: "whitesev-panel-bottom-config-2",
6524
6530
  title: "版本:xxx.xx.xx",
6525
6531
  isBottom: true,
6526
- attributes: [
6527
- {
6528
- "data-value": "value",
6529
- "data-value-2": "value2",
6530
- },
6531
- ],
6532
+ attributes: {
6533
+ "data-value": "value",
6534
+ "data-value-2": "value2",
6535
+ },
6532
6536
  // @ts-ignore
6533
6537
  props: {},
6534
6538
  forms: [],
@@ -6537,42 +6541,7 @@
6537
6541
  },
6538
6542
  },
6539
6543
  ],
6540
- bottomContentConfig: [
6541
- {
6542
- text: "Github",
6543
- position: "left",
6544
- className: "user-home",
6545
- attributes: {
6546
- "data-url": "https://github.com/whitesevs",
6547
- },
6548
- props: {
6549
- "data-test": 1,
6550
- },
6551
- disableHoverCSS: false,
6552
- clickCallback() {
6553
- const userHomeUrl = this.attributes["data-url"];
6554
- console.log("打开个人主页:" + userHomeUrl);
6555
- window.open(userHomeUrl, "_blank");
6556
- },
6557
- afterRender(config) {
6558
- console.log(config);
6559
- },
6560
- },
6561
- {
6562
- text: "0.0.1",
6563
- position: "right",
6564
- className: "script-version",
6565
- attributes: {},
6566
- props: {},
6567
- disableHoverCSS: true,
6568
- clickCallback() {
6569
- console.log("当前版本:" + this.text);
6570
- },
6571
- afterRender(config) {
6572
- console.log(config);
6573
- },
6574
- },
6575
- ],
6544
+ bottomContentConfig: [],
6576
6545
  btn: {
6577
6546
  close: {
6578
6547
  enable: true,
@@ -6780,9 +6749,7 @@
6780
6749
  /** 箭头 */
6781
6750
  const $toolTipArrow = $toolTipContainer.querySelector(".pops-tip-arrow");
6782
6751
  // 处理className
6783
- if (typeof this.$data.config.className === "string" && this.$data.config.className.trim() !== "") {
6784
- popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6785
- }
6752
+ popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6786
6753
  // 添加z-index
6787
6754
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
6788
6755
  if (this.$data.config.style != null) {
@@ -7430,10 +7397,12 @@
7430
7397
  * @param props 属性
7431
7398
  */
7432
7399
  setElementProps($el, props) {
7433
- if (props == null) {
7400
+ if (props == null)
7434
7401
  return;
7435
- }
7436
- Object.keys(props).forEach((propName) => {
7402
+ if (typeof props !== "object")
7403
+ return;
7404
+ const propsKeys = Object.keys(props);
7405
+ propsKeys.forEach((propName) => {
7437
7406
  const value = props[propName];
7438
7407
  if (propName === "innerHTML") {
7439
7408
  PopsSafeUtils.setSafeHTML($el, value);
@@ -7448,23 +7417,7 @@
7448
7417
  * @param className
7449
7418
  */
7450
7419
  setElementClassName($el, className) {
7451
- if (className == null) {
7452
- return;
7453
- }
7454
- if (typeof className === "function") {
7455
- className = className();
7456
- }
7457
- if (typeof className === "string") {
7458
- const splitClassName = className.split(" ");
7459
- splitClassName.forEach((classNameStr) => {
7460
- $el.classList.add(classNameStr);
7461
- });
7462
- }
7463
- else if (Array.isArray(className)) {
7464
- className.forEach((classNameStr) => {
7465
- this.setElementClassName($el, classNameStr);
7466
- });
7467
- }
7420
+ popsDOMUtils.addClassName($el, className);
7468
7421
  },
7469
7422
  /**
7470
7423
  * 创建底部项元素<li>
@@ -10105,8 +10058,19 @@
10105
10058
  let config = PopsPanelConfig();
10106
10059
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
10107
10060
  config = popsUtils.assign(config, details);
10108
- if (details && Array.isArray(details.content)) {
10109
- config.content = details.content;
10061
+ if (details) {
10062
+ if (Array.isArray(details.content)) {
10063
+ // 存在内容配置
10064
+ config.content = details.content;
10065
+ }
10066
+ if (Array.isArray(details.bottomContentConfig)) {
10067
+ // 存在底部配置
10068
+ config.bottomContentConfig = details.bottomContentConfig;
10069
+ }
10070
+ else {
10071
+ // 不存在底部配置 清空默认的
10072
+ config.bottomContentConfig = [];
10073
+ }
10110
10074
  }
10111
10075
  config = PopsHandler.handleOnly(popsType, config);
10112
10076
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
@@ -11960,7 +11924,7 @@
11960
11924
  },
11961
11925
  };
11962
11926
 
11963
- const version = "2.5.2";
11927
+ const version = "2.5.4";
11964
11928
 
11965
11929
  class Pops {
11966
11930
  /** 配置 */