@whitesev/pops 2.5.2 → 2.5.3

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 (44) hide show
  1. package/dist/index.amd.js +62 -74
  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 +62 -74
  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 +62 -74
  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 +62 -74
  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 +62 -74
  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 +62 -74
  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 +36 -43
  37. package/src/components/panel/handlerComponents.ts +7 -22
  38. package/src/components/panel/types/components-common.ts +5 -9
  39. package/src/components/panel/types/index.ts +5 -13
  40. package/src/components/rightClickMenu/types/index.ts +3 -2
  41. package/src/components/searchSuggestion/types/index.ts +3 -2
  42. package/src/components/tooltip/index.ts +1 -3
  43. package/src/components/tooltip/types/index.ts +2 -1
  44. package/src/utils/PopsDOMUtils.ts +23 -10
@@ -1835,17 +1835,28 @@ var pops = (function () {
1835
1835
  * @param className className属性
1836
1836
  */
1837
1837
  addClassName($el, className) {
1838
- if ($el == null) {
1838
+ if ($el == null)
1839
1839
  return;
1840
- }
1841
- if (typeof className !== "string") {
1840
+ if (className == null)
1842
1841
  return;
1842
+ if (typeof className === "function") {
1843
+ className = className();
1843
1844
  }
1844
- if (className.trim() === "") {
1845
- return;
1845
+ if (!Array.isArray(className)) {
1846
+ className = [className];
1846
1847
  }
1847
- const classNameList = className.split(" ").filter((item) => item.trim() !== "");
1848
- $el.classList.add(...classNameList);
1848
+ className.forEach((classNameStrItem) => {
1849
+ if (typeof classNameStrItem !== "string") {
1850
+ // 不是字符串
1851
+ return;
1852
+ }
1853
+ if (classNameStrItem.trim() === "") {
1854
+ // 空字符串
1855
+ return;
1856
+ }
1857
+ const classNameList = classNameStrItem.split(" ").filter((item) => item.trim() !== "");
1858
+ $el?.classList?.add?.(...classNameList);
1859
+ });
1849
1860
  }
1850
1861
  /**
1851
1862
  * 删除className
@@ -6053,18 +6064,16 @@ var pops = (function () {
6053
6064
  title: "菜单配置1",
6054
6065
  headerTitle: "菜单配置1",
6055
6066
  isDefault: false,
6056
- attributes: [
6057
- {
6058
- "data-test": "test",
6059
- "data-test-2": "test2",
6060
- },
6061
- ],
6067
+ attributes: {
6068
+ "data-test": "test",
6069
+ "data-test-2": "test2",
6070
+ },
6062
6071
  forms: [
6063
6072
  {
6064
6073
  className: "forms-1",
6065
6074
  text: "区域设置",
6066
6075
  type: "forms",
6067
- attributes: [],
6076
+ attributes: {},
6068
6077
  forms: [
6069
6078
  {
6070
6079
  className: "panel-switch",
@@ -6076,7 +6085,7 @@ var pops = (function () {
6076
6085
  // TODO
6077
6086
  },
6078
6087
  props: {},
6079
- attributes: [],
6088
+ attributes: {},
6080
6089
  getValue() {
6081
6090
  return true;
6082
6091
  },
@@ -6099,7 +6108,7 @@ var pops = (function () {
6099
6108
  isShowHoverTip: true,
6100
6109
  step: 1,
6101
6110
  props: {},
6102
- attributes: [],
6111
+ attributes: {},
6103
6112
  getValue() {
6104
6113
  return 50;
6105
6114
  },
@@ -6120,7 +6129,7 @@ var pops = (function () {
6120
6129
  afterAddToUListCallBack() {
6121
6130
  // TODO
6122
6131
  },
6123
- attributes: [],
6132
+ attributes: {},
6124
6133
  buttonIcon: "view",
6125
6134
  buttonIconIsLoading: true,
6126
6135
  buttonType: "default",
@@ -6134,7 +6143,7 @@ var pops = (function () {
6134
6143
  text: "button",
6135
6144
  type: "button",
6136
6145
  props: {},
6137
- attributes: [],
6146
+ attributes: {},
6138
6147
  buttonIcon: "eleme",
6139
6148
  buttonIconIsLoading: true,
6140
6149
  buttonType: "warning",
@@ -6149,7 +6158,7 @@ var pops = (function () {
6149
6158
  // @ts-ignore
6150
6159
  props: {},
6151
6160
  type: "button",
6152
- attributes: [],
6161
+ attributes: {},
6153
6162
  buttonIcon: "chromeFilled",
6154
6163
  buttonIconIsLoading: true,
6155
6164
  buttonType: "danger",
@@ -6162,7 +6171,7 @@ var pops = (function () {
6162
6171
  className: "panel-button",
6163
6172
  text: "button",
6164
6173
  type: "button",
6165
- attributes: [],
6174
+ attributes: {},
6166
6175
  // @ts-ignore
6167
6176
  props: {},
6168
6177
  buttonIcon: "upload",
@@ -6182,12 +6191,10 @@ var pops = (function () {
6182
6191
  title: "菜单配置2",
6183
6192
  headerTitle: "菜单配置2",
6184
6193
  isDefault: true,
6185
- attributes: [
6186
- {
6187
- "data-value": "value",
6188
- "data-value-2": "value2",
6189
- },
6190
- ],
6194
+ attributes: {
6195
+ "data-value": "value",
6196
+ "data-value-2": "value2",
6197
+ },
6191
6198
  forms: [
6192
6199
  {
6193
6200
  className: "panel-input",
@@ -6195,7 +6202,7 @@ var pops = (function () {
6195
6202
  type: "input",
6196
6203
  isNumber: false,
6197
6204
  props: {},
6198
- attributes: [],
6205
+ attributes: {},
6199
6206
  getValue() {
6200
6207
  return "50";
6201
6208
  },
@@ -6211,7 +6218,7 @@ var pops = (function () {
6211
6218
  type: "input",
6212
6219
  // @ts-ignore
6213
6220
  props: {},
6214
- attributes: [],
6221
+ attributes: {},
6215
6222
  getValue() {
6216
6223
  return "123456";
6217
6224
  },
@@ -6228,7 +6235,7 @@ var pops = (function () {
6228
6235
  type: "textarea",
6229
6236
  // @ts-ignore
6230
6237
  props: {},
6231
- attributes: [],
6238
+ attributes: {},
6232
6239
  getValue() {
6233
6240
  return "50";
6234
6241
  },
@@ -6245,7 +6252,7 @@ var pops = (function () {
6245
6252
  disabled: true,
6246
6253
  // @ts-ignore
6247
6254
  props: {},
6248
- attributes: [],
6255
+ attributes: {},
6249
6256
  getValue() {
6250
6257
  return 50;
6251
6258
  },
@@ -6286,7 +6293,7 @@ var pops = (function () {
6286
6293
  disabled: true,
6287
6294
  // @ts-ignore
6288
6295
  props: {},
6289
- attributes: [],
6296
+ attributes: {},
6290
6297
  placeholder: "请至少选择一个选项",
6291
6298
  getValue() {
6292
6299
  return ["select-1", "select-2"];
@@ -6369,7 +6376,8 @@ var pops = (function () {
6369
6376
  className: "forms-1",
6370
6377
  text: "区域设置",
6371
6378
  type: "forms",
6372
- attributes: [],
6379
+ attributes: {},
6380
+ props: {},
6373
6381
  forms: [
6374
6382
  {
6375
6383
  className: "panel-switch",
@@ -6377,7 +6385,7 @@ var pops = (function () {
6377
6385
  type: "switch",
6378
6386
  // @ts-ignore
6379
6387
  props: {},
6380
- attributes: [],
6388
+ attributes: {},
6381
6389
  getValue() {
6382
6390
  return true;
6383
6391
  },
@@ -6391,7 +6399,7 @@ var pops = (function () {
6391
6399
  // @ts-ignore
6392
6400
  props: {},
6393
6401
  type: "slider",
6394
- attributes: [],
6402
+ attributes: {},
6395
6403
  getValue() {
6396
6404
  return 50;
6397
6405
  },
@@ -6407,7 +6415,7 @@ var pops = (function () {
6407
6415
  // @ts-ignore
6408
6416
  props: {},
6409
6417
  type: "button",
6410
- attributes: [],
6418
+ attributes: {},
6411
6419
  buttonIcon: "eleme",
6412
6420
  buttonIconIsLoading: true,
6413
6421
  buttonType: "warning",
@@ -6422,7 +6430,7 @@ var pops = (function () {
6422
6430
  type: "button",
6423
6431
  // @ts-ignore
6424
6432
  props: {},
6425
- attributes: [],
6433
+ attributes: {},
6426
6434
  buttonIcon: "chromeFilled",
6427
6435
  buttonIconIsLoading: true,
6428
6436
  buttonType: "danger",
@@ -6437,7 +6445,7 @@ var pops = (function () {
6437
6445
  // @ts-ignore
6438
6446
  props: {},
6439
6447
  type: "button",
6440
- attributes: [],
6448
+ attributes: {},
6441
6449
  buttonIcon: "upload",
6442
6450
  buttonIconIsLoading: false,
6443
6451
  buttonType: "info",
@@ -6484,7 +6492,7 @@ var pops = (function () {
6484
6492
  // @ts-ignore
6485
6493
  props: {},
6486
6494
  type: "switch",
6487
- attributes: [],
6495
+ attributes: {},
6488
6496
  getValue() {
6489
6497
  return true;
6490
6498
  },
@@ -6503,12 +6511,10 @@ var pops = (function () {
6503
6511
  `,
6504
6512
  isBottom: true,
6505
6513
  disableAsideItemHoverCSS: true,
6506
- attributes: [
6507
- {
6508
- "data-value": "value",
6509
- "data-value-2": "value2",
6510
- },
6511
- ],
6514
+ attributes: {
6515
+ "data-value": "value",
6516
+ "data-value-2": "value2",
6517
+ },
6512
6518
  // @ts-ignore
6513
6519
  props: {},
6514
6520
  forms: [],
@@ -6520,12 +6526,10 @@ var pops = (function () {
6520
6526
  id: "whitesev-panel-bottom-config-2",
6521
6527
  title: "版本:xxx.xx.xx",
6522
6528
  isBottom: true,
6523
- attributes: [
6524
- {
6525
- "data-value": "value",
6526
- "data-value-2": "value2",
6527
- },
6528
- ],
6529
+ attributes: {
6530
+ "data-value": "value",
6531
+ "data-value-2": "value2",
6532
+ },
6529
6533
  // @ts-ignore
6530
6534
  props: {},
6531
6535
  forms: [],
@@ -6777,9 +6781,7 @@ var pops = (function () {
6777
6781
  /** 箭头 */
6778
6782
  const $toolTipArrow = $toolTipContainer.querySelector(".pops-tip-arrow");
6779
6783
  // 处理className
6780
- if (typeof this.$data.config.className === "string" && this.$data.config.className.trim() !== "") {
6781
- popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6782
- }
6784
+ popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6783
6785
  // 添加z-index
6784
6786
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
6785
6787
  if (this.$data.config.style != null) {
@@ -7427,10 +7429,12 @@ var pops = (function () {
7427
7429
  * @param props 属性
7428
7430
  */
7429
7431
  setElementProps($el, props) {
7430
- if (props == null) {
7432
+ if (props == null)
7431
7433
  return;
7432
- }
7433
- Object.keys(props).forEach((propName) => {
7434
+ if (typeof props !== "object")
7435
+ return;
7436
+ const propsKeys = Object.keys(props);
7437
+ propsKeys.forEach((propName) => {
7434
7438
  const value = props[propName];
7435
7439
  if (propName === "innerHTML") {
7436
7440
  PopsSafeUtils.setSafeHTML($el, value);
@@ -7445,23 +7449,7 @@ var pops = (function () {
7445
7449
  * @param className
7446
7450
  */
7447
7451
  setElementClassName($el, className) {
7448
- if (className == null) {
7449
- return;
7450
- }
7451
- if (typeof className === "function") {
7452
- className = className();
7453
- }
7454
- if (typeof className === "string") {
7455
- const splitClassName = className.split(" ");
7456
- splitClassName.forEach((classNameStr) => {
7457
- $el.classList.add(classNameStr);
7458
- });
7459
- }
7460
- else if (Array.isArray(className)) {
7461
- className.forEach((classNameStr) => {
7462
- this.setElementClassName($el, classNameStr);
7463
- });
7464
- }
7452
+ popsDOMUtils.addClassName($el, className);
7465
7453
  },
7466
7454
  /**
7467
7455
  * 创建底部项元素<li>
@@ -11957,7 +11945,7 @@ var pops = (function () {
11957
11945
  },
11958
11946
  };
11959
11947
 
11960
- const version = "2.5.2";
11948
+ const version = "2.5.3";
11961
11949
 
11962
11950
  class Pops {
11963
11951
  /** 配置 */