@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.amd.js CHANGED
@@ -1834,17 +1834,28 @@ define((function () { 'use strict';
1834
1834
  * @param className className属性
1835
1835
  */
1836
1836
  addClassName($el, className) {
1837
- if ($el == null) {
1837
+ if ($el == null)
1838
1838
  return;
1839
- }
1840
- if (typeof className !== "string") {
1839
+ if (className == null)
1841
1840
  return;
1841
+ if (typeof className === "function") {
1842
+ className = className();
1842
1843
  }
1843
- if (className.trim() === "") {
1844
- return;
1844
+ if (!Array.isArray(className)) {
1845
+ className = [className];
1845
1846
  }
1846
- const classNameList = className.split(" ").filter((item) => item.trim() !== "");
1847
- $el.classList.add(...classNameList);
1847
+ className.forEach((classNameStrItem) => {
1848
+ if (typeof classNameStrItem !== "string") {
1849
+ // 不是字符串
1850
+ return;
1851
+ }
1852
+ if (classNameStrItem.trim() === "") {
1853
+ // 空字符串
1854
+ return;
1855
+ }
1856
+ const classNameList = classNameStrItem.split(" ").filter((item) => item.trim() !== "");
1857
+ $el?.classList?.add?.(...classNameList);
1858
+ });
1848
1859
  }
1849
1860
  /**
1850
1861
  * 删除className
@@ -6052,18 +6063,16 @@ define((function () { 'use strict';
6052
6063
  title: "菜单配置1",
6053
6064
  headerTitle: "菜单配置1",
6054
6065
  isDefault: false,
6055
- attributes: [
6056
- {
6057
- "data-test": "test",
6058
- "data-test-2": "test2",
6059
- },
6060
- ],
6066
+ attributes: {
6067
+ "data-test": "test",
6068
+ "data-test-2": "test2",
6069
+ },
6061
6070
  forms: [
6062
6071
  {
6063
6072
  className: "forms-1",
6064
6073
  text: "区域设置",
6065
6074
  type: "forms",
6066
- attributes: [],
6075
+ attributes: {},
6067
6076
  forms: [
6068
6077
  {
6069
6078
  className: "panel-switch",
@@ -6075,7 +6084,7 @@ define((function () { 'use strict';
6075
6084
  // TODO
6076
6085
  },
6077
6086
  props: {},
6078
- attributes: [],
6087
+ attributes: {},
6079
6088
  getValue() {
6080
6089
  return true;
6081
6090
  },
@@ -6098,7 +6107,7 @@ define((function () { 'use strict';
6098
6107
  isShowHoverTip: true,
6099
6108
  step: 1,
6100
6109
  props: {},
6101
- attributes: [],
6110
+ attributes: {},
6102
6111
  getValue() {
6103
6112
  return 50;
6104
6113
  },
@@ -6119,7 +6128,7 @@ define((function () { 'use strict';
6119
6128
  afterAddToUListCallBack() {
6120
6129
  // TODO
6121
6130
  },
6122
- attributes: [],
6131
+ attributes: {},
6123
6132
  buttonIcon: "view",
6124
6133
  buttonIconIsLoading: true,
6125
6134
  buttonType: "default",
@@ -6133,7 +6142,7 @@ define((function () { 'use strict';
6133
6142
  text: "button",
6134
6143
  type: "button",
6135
6144
  props: {},
6136
- attributes: [],
6145
+ attributes: {},
6137
6146
  buttonIcon: "eleme",
6138
6147
  buttonIconIsLoading: true,
6139
6148
  buttonType: "warning",
@@ -6148,7 +6157,7 @@ define((function () { 'use strict';
6148
6157
  // @ts-ignore
6149
6158
  props: {},
6150
6159
  type: "button",
6151
- attributes: [],
6160
+ attributes: {},
6152
6161
  buttonIcon: "chromeFilled",
6153
6162
  buttonIconIsLoading: true,
6154
6163
  buttonType: "danger",
@@ -6161,7 +6170,7 @@ define((function () { 'use strict';
6161
6170
  className: "panel-button",
6162
6171
  text: "button",
6163
6172
  type: "button",
6164
- attributes: [],
6173
+ attributes: {},
6165
6174
  // @ts-ignore
6166
6175
  props: {},
6167
6176
  buttonIcon: "upload",
@@ -6181,12 +6190,10 @@ define((function () { 'use strict';
6181
6190
  title: "菜单配置2",
6182
6191
  headerTitle: "菜单配置2",
6183
6192
  isDefault: true,
6184
- attributes: [
6185
- {
6186
- "data-value": "value",
6187
- "data-value-2": "value2",
6188
- },
6189
- ],
6193
+ attributes: {
6194
+ "data-value": "value",
6195
+ "data-value-2": "value2",
6196
+ },
6190
6197
  forms: [
6191
6198
  {
6192
6199
  className: "panel-input",
@@ -6194,7 +6201,7 @@ define((function () { 'use strict';
6194
6201
  type: "input",
6195
6202
  isNumber: false,
6196
6203
  props: {},
6197
- attributes: [],
6204
+ attributes: {},
6198
6205
  getValue() {
6199
6206
  return "50";
6200
6207
  },
@@ -6210,7 +6217,7 @@ define((function () { 'use strict';
6210
6217
  type: "input",
6211
6218
  // @ts-ignore
6212
6219
  props: {},
6213
- attributes: [],
6220
+ attributes: {},
6214
6221
  getValue() {
6215
6222
  return "123456";
6216
6223
  },
@@ -6227,7 +6234,7 @@ define((function () { 'use strict';
6227
6234
  type: "textarea",
6228
6235
  // @ts-ignore
6229
6236
  props: {},
6230
- attributes: [],
6237
+ attributes: {},
6231
6238
  getValue() {
6232
6239
  return "50";
6233
6240
  },
@@ -6244,7 +6251,7 @@ define((function () { 'use strict';
6244
6251
  disabled: true,
6245
6252
  // @ts-ignore
6246
6253
  props: {},
6247
- attributes: [],
6254
+ attributes: {},
6248
6255
  getValue() {
6249
6256
  return 50;
6250
6257
  },
@@ -6285,7 +6292,7 @@ define((function () { 'use strict';
6285
6292
  disabled: true,
6286
6293
  // @ts-ignore
6287
6294
  props: {},
6288
- attributes: [],
6295
+ attributes: {},
6289
6296
  placeholder: "请至少选择一个选项",
6290
6297
  getValue() {
6291
6298
  return ["select-1", "select-2"];
@@ -6368,7 +6375,8 @@ define((function () { 'use strict';
6368
6375
  className: "forms-1",
6369
6376
  text: "区域设置",
6370
6377
  type: "forms",
6371
- attributes: [],
6378
+ attributes: {},
6379
+ props: {},
6372
6380
  forms: [
6373
6381
  {
6374
6382
  className: "panel-switch",
@@ -6376,7 +6384,7 @@ define((function () { 'use strict';
6376
6384
  type: "switch",
6377
6385
  // @ts-ignore
6378
6386
  props: {},
6379
- attributes: [],
6387
+ attributes: {},
6380
6388
  getValue() {
6381
6389
  return true;
6382
6390
  },
@@ -6390,7 +6398,7 @@ define((function () { 'use strict';
6390
6398
  // @ts-ignore
6391
6399
  props: {},
6392
6400
  type: "slider",
6393
- attributes: [],
6401
+ attributes: {},
6394
6402
  getValue() {
6395
6403
  return 50;
6396
6404
  },
@@ -6406,7 +6414,7 @@ define((function () { 'use strict';
6406
6414
  // @ts-ignore
6407
6415
  props: {},
6408
6416
  type: "button",
6409
- attributes: [],
6417
+ attributes: {},
6410
6418
  buttonIcon: "eleme",
6411
6419
  buttonIconIsLoading: true,
6412
6420
  buttonType: "warning",
@@ -6421,7 +6429,7 @@ define((function () { 'use strict';
6421
6429
  type: "button",
6422
6430
  // @ts-ignore
6423
6431
  props: {},
6424
- attributes: [],
6432
+ attributes: {},
6425
6433
  buttonIcon: "chromeFilled",
6426
6434
  buttonIconIsLoading: true,
6427
6435
  buttonType: "danger",
@@ -6436,7 +6444,7 @@ define((function () { 'use strict';
6436
6444
  // @ts-ignore
6437
6445
  props: {},
6438
6446
  type: "button",
6439
- attributes: [],
6447
+ attributes: {},
6440
6448
  buttonIcon: "upload",
6441
6449
  buttonIconIsLoading: false,
6442
6450
  buttonType: "info",
@@ -6483,7 +6491,7 @@ define((function () { 'use strict';
6483
6491
  // @ts-ignore
6484
6492
  props: {},
6485
6493
  type: "switch",
6486
- attributes: [],
6494
+ attributes: {},
6487
6495
  getValue() {
6488
6496
  return true;
6489
6497
  },
@@ -6502,12 +6510,10 @@ define((function () { 'use strict';
6502
6510
  `,
6503
6511
  isBottom: true,
6504
6512
  disableAsideItemHoverCSS: true,
6505
- attributes: [
6506
- {
6507
- "data-value": "value",
6508
- "data-value-2": "value2",
6509
- },
6510
- ],
6513
+ attributes: {
6514
+ "data-value": "value",
6515
+ "data-value-2": "value2",
6516
+ },
6511
6517
  // @ts-ignore
6512
6518
  props: {},
6513
6519
  forms: [],
@@ -6519,12 +6525,10 @@ define((function () { 'use strict';
6519
6525
  id: "whitesev-panel-bottom-config-2",
6520
6526
  title: "版本:xxx.xx.xx",
6521
6527
  isBottom: true,
6522
- attributes: [
6523
- {
6524
- "data-value": "value",
6525
- "data-value-2": "value2",
6526
- },
6527
- ],
6528
+ attributes: {
6529
+ "data-value": "value",
6530
+ "data-value-2": "value2",
6531
+ },
6528
6532
  // @ts-ignore
6529
6533
  props: {},
6530
6534
  forms: [],
@@ -6533,42 +6537,7 @@ define((function () { 'use strict';
6533
6537
  },
6534
6538
  },
6535
6539
  ],
6536
- bottomContentConfig: [
6537
- {
6538
- text: "Github",
6539
- position: "left",
6540
- className: "user-home",
6541
- attributes: {
6542
- "data-url": "https://github.com/whitesevs",
6543
- },
6544
- props: {
6545
- "data-test": 1,
6546
- },
6547
- disableHoverCSS: false,
6548
- clickCallback() {
6549
- const userHomeUrl = this.attributes["data-url"];
6550
- console.log("打开个人主页:" + userHomeUrl);
6551
- window.open(userHomeUrl, "_blank");
6552
- },
6553
- afterRender(config) {
6554
- console.log(config);
6555
- },
6556
- },
6557
- {
6558
- text: "0.0.1",
6559
- position: "right",
6560
- className: "script-version",
6561
- attributes: {},
6562
- props: {},
6563
- disableHoverCSS: true,
6564
- clickCallback() {
6565
- console.log("当前版本:" + this.text);
6566
- },
6567
- afterRender(config) {
6568
- console.log(config);
6569
- },
6570
- },
6571
- ],
6540
+ bottomContentConfig: [],
6572
6541
  btn: {
6573
6542
  close: {
6574
6543
  enable: true,
@@ -6776,9 +6745,7 @@ define((function () { 'use strict';
6776
6745
  /** 箭头 */
6777
6746
  const $toolTipArrow = $toolTipContainer.querySelector(".pops-tip-arrow");
6778
6747
  // 处理className
6779
- if (typeof this.$data.config.className === "string" && this.$data.config.className.trim() !== "") {
6780
- popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6781
- }
6748
+ popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6782
6749
  // 添加z-index
6783
6750
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
6784
6751
  if (this.$data.config.style != null) {
@@ -7426,10 +7393,12 @@ define((function () { 'use strict';
7426
7393
  * @param props 属性
7427
7394
  */
7428
7395
  setElementProps($el, props) {
7429
- if (props == null) {
7396
+ if (props == null)
7430
7397
  return;
7431
- }
7432
- Object.keys(props).forEach((propName) => {
7398
+ if (typeof props !== "object")
7399
+ return;
7400
+ const propsKeys = Object.keys(props);
7401
+ propsKeys.forEach((propName) => {
7433
7402
  const value = props[propName];
7434
7403
  if (propName === "innerHTML") {
7435
7404
  PopsSafeUtils.setSafeHTML($el, value);
@@ -7444,23 +7413,7 @@ define((function () { 'use strict';
7444
7413
  * @param className
7445
7414
  */
7446
7415
  setElementClassName($el, className) {
7447
- if (className == null) {
7448
- return;
7449
- }
7450
- if (typeof className === "function") {
7451
- className = className();
7452
- }
7453
- if (typeof className === "string") {
7454
- const splitClassName = className.split(" ");
7455
- splitClassName.forEach((classNameStr) => {
7456
- $el.classList.add(classNameStr);
7457
- });
7458
- }
7459
- else if (Array.isArray(className)) {
7460
- className.forEach((classNameStr) => {
7461
- this.setElementClassName($el, classNameStr);
7462
- });
7463
- }
7416
+ popsDOMUtils.addClassName($el, className);
7464
7417
  },
7465
7418
  /**
7466
7419
  * 创建底部项元素<li>
@@ -10101,8 +10054,19 @@ define((function () { 'use strict';
10101
10054
  let config = PopsPanelConfig();
10102
10055
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
10103
10056
  config = popsUtils.assign(config, details);
10104
- if (details && Array.isArray(details.content)) {
10105
- config.content = details.content;
10057
+ if (details) {
10058
+ if (Array.isArray(details.content)) {
10059
+ // 存在内容配置
10060
+ config.content = details.content;
10061
+ }
10062
+ if (Array.isArray(details.bottomContentConfig)) {
10063
+ // 存在底部配置
10064
+ config.bottomContentConfig = details.bottomContentConfig;
10065
+ }
10066
+ else {
10067
+ // 不存在底部配置 清空默认的
10068
+ config.bottomContentConfig = [];
10069
+ }
10106
10070
  }
10107
10071
  config = PopsHandler.handleOnly(popsType, config);
10108
10072
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
@@ -11956,7 +11920,7 @@ define((function () { 'use strict';
11956
11920
  },
11957
11921
  };
11958
11922
 
11959
- const version = "2.5.2";
11923
+ const version = "2.5.4";
11960
11924
 
11961
11925
  class Pops {
11962
11926
  /** 配置 */