@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
package/dist/index.cjs.js CHANGED
@@ -1834,17 +1834,28 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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 @@ const PopsPanelConfig = () => {
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: [],
@@ -6776,9 +6780,7 @@ class ToolTip {
6776
6780
  /** 箭头 */
6777
6781
  const $toolTipArrow = $toolTipContainer.querySelector(".pops-tip-arrow");
6778
6782
  // 处理className
6779
- if (typeof this.$data.config.className === "string" && this.$data.config.className.trim() !== "") {
6780
- popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6781
- }
6783
+ popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
6782
6784
  // 添加z-index
6783
6785
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
6784
6786
  if (this.$data.config.style != null) {
@@ -7426,10 +7428,12 @@ const PanelHandlerComponents = () => {
7426
7428
  * @param props 属性
7427
7429
  */
7428
7430
  setElementProps($el, props) {
7429
- if (props == null) {
7431
+ if (props == null)
7430
7432
  return;
7431
- }
7432
- Object.keys(props).forEach((propName) => {
7433
+ if (typeof props !== "object")
7434
+ return;
7435
+ const propsKeys = Object.keys(props);
7436
+ propsKeys.forEach((propName) => {
7433
7437
  const value = props[propName];
7434
7438
  if (propName === "innerHTML") {
7435
7439
  PopsSafeUtils.setSafeHTML($el, value);
@@ -7444,23 +7448,7 @@ const PanelHandlerComponents = () => {
7444
7448
  * @param className
7445
7449
  */
7446
7450
  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
- }
7451
+ popsDOMUtils.addClassName($el, className);
7464
7452
  },
7465
7453
  /**
7466
7454
  * 创建底部项元素<li>
@@ -11956,7 +11944,7 @@ const PopsSearchSuggestion = {
11956
11944
  },
11957
11945
  };
11958
11946
 
11959
- const version = "2.5.2";
11947
+ const version = "2.5.3";
11960
11948
 
11961
11949
  class Pops {
11962
11950
  /** 配置 */