@ptcwebops/ptcw-design 3.7.3 → 3.7.6

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 (94) hide show
  1. package/dist/cjs/featured-list.cjs.entry.js +1 -1
  2. package/dist/cjs/{icon-asset_18.cjs.entry.js → icon-asset_19.cjs.entry.js} +510 -3
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/ptc-announcement.cjs.entry.js +1 -1
  5. package/dist/cjs/ptc-breadcrumb_2.cjs.entry.js +4 -4
  6. package/dist/cjs/ptc-data-lookup.cjs.entry.js +1 -1
  7. package/dist/cjs/ptc-featured-list.cjs.entry.js +1 -1
  8. package/dist/cjs/ptc-filter-level-theater.cjs.entry.js +1 -1
  9. package/dist/cjs/ptc-form-checkbox_3.cjs.entry.js +3 -3
  10. package/dist/cjs/ptc-icon-minimize.cjs.entry.js +24 -1
  11. package/dist/cjs/ptc-pricing-packaging-table.cjs.entry.js +2 -2
  12. package/dist/cjs/ptc-pricing-tabs.cjs.entry.js +1 -1
  13. package/dist/cjs/ptc-readmore-char.cjs.entry.js +1 -1
  14. package/dist/cjs/ptc-readmore.cjs.entry.js +1 -1
  15. package/dist/cjs/ptc-value-led-card.cjs.entry.js +2 -1
  16. package/dist/cjs/ptc-white-paper.cjs.entry.js +1 -1
  17. package/dist/cjs/ptcw-design.cjs.js +1 -1
  18. package/dist/cjs/sequential-bundle-example.cjs.entry.js +1 -1
  19. package/dist/collection/components/organism-bundles/bundle-featured-list/featured-list.css +1 -1
  20. package/dist/collection/components/organism-bundles/sequential-bundle-example/sequential-bundle-example.js +1 -1
  21. package/dist/collection/components/ptc-announcement/ptc-announcement.css +2 -2
  22. package/dist/collection/components/ptc-data-lookup/ptc-data-lookup.css +1 -1
  23. package/dist/collection/components/ptc-featured-list/ptc-featured-list.css +1 -1
  24. package/dist/collection/components/ptc-filter-level-theater/ptc-filter-level-theater.css +1 -1
  25. package/dist/collection/components/ptc-form-checkbox/ptc-form-checkbox.css +1 -1
  26. package/dist/collection/components/ptc-icon-minimize/ptc-icon-minimize.js +24 -1
  27. package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +5 -1
  28. package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.js +3 -3
  29. package/dist/collection/components/ptc-link/ptc-link.css +1 -1
  30. package/dist/collection/components/ptc-mobile-select/ptc-mobile-select.js +1 -1
  31. package/dist/collection/components/ptc-modal/ptc-modal.css +14 -2
  32. package/dist/collection/components/ptc-modal/ptc-modal.js +20 -0
  33. package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.css +1 -1
  34. package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.js +1 -1
  35. package/dist/collection/components/ptc-pricing-tabs/ptc-pricing-tabs.css +4 -0
  36. package/dist/collection/components/ptc-readmore/ptc-readmore.css +2 -2
  37. package/dist/collection/components/ptc-readmore-char/ptc-readmore-char.css +1 -1
  38. package/dist/collection/components/ptc-select/ptc-select.css +2 -2
  39. package/dist/collection/components/ptc-textfield/ptc-textfield.css +1 -1
  40. package/dist/collection/components/ptc-tooltip/ptc-tooltip.css +1 -1
  41. package/dist/collection/components/ptc-value-led-card/ptc-value-led-card.js +19 -1
  42. package/dist/collection/components/ptc-white-paper/ptc-white-paper.css +1 -1
  43. package/dist/custom-elements/index.js +53 -27
  44. package/dist/esm/featured-list.entry.js +1 -1
  45. package/dist/esm/{icon-asset_18.entry.js → icon-asset_19.entry.js} +558 -52
  46. package/dist/esm/loader.js +1 -1
  47. package/dist/esm/ptc-announcement.entry.js +1 -1
  48. package/dist/esm/ptc-breadcrumb_2.entry.js +4 -4
  49. package/dist/esm/ptc-data-lookup.entry.js +1 -1
  50. package/dist/esm/ptc-featured-list.entry.js +1 -1
  51. package/dist/esm/ptc-filter-level-theater.entry.js +1 -1
  52. package/dist/esm/ptc-form-checkbox_3.entry.js +3 -3
  53. package/dist/esm/ptc-icon-minimize.entry.js +24 -1
  54. package/dist/esm/ptc-pricing-packaging-table.entry.js +2 -2
  55. package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
  56. package/dist/esm/ptc-readmore-char.entry.js +1 -1
  57. package/dist/esm/ptc-readmore.entry.js +1 -1
  58. package/dist/esm/ptc-value-led-card.entry.js +2 -1
  59. package/dist/esm/ptc-white-paper.entry.js +1 -1
  60. package/dist/esm/ptcw-design.js +1 -1
  61. package/dist/esm/sequential-bundle-example.entry.js +1 -1
  62. package/dist/ptcw-design/p-132c7242.entry.js +1 -0
  63. package/dist/ptcw-design/p-32ebd0de.entry.js +1 -0
  64. package/dist/ptcw-design/{p-820009a0.entry.js → p-3ee5a50d.entry.js} +1 -1
  65. package/dist/ptcw-design/{p-a02e27e1.entry.js → p-4d1ec425.entry.js} +2 -2
  66. package/dist/ptcw-design/{p-95e1c016.entry.js → p-7293bba4.entry.js} +1 -1
  67. package/dist/ptcw-design/p-73fb1c63.entry.js +1 -0
  68. package/dist/ptcw-design/{p-3a2d08a1.entry.js → p-915cf7bd.entry.js} +1 -1
  69. package/dist/ptcw-design/{p-7621bd5a.entry.js → p-a60d6a4c.entry.js} +1 -1
  70. package/dist/ptcw-design/{p-532dd7f0.entry.js → p-ac8f446e.entry.js} +1 -1
  71. package/dist/ptcw-design/{p-3ed092d8.entry.js → p-b5bdef1d.entry.js} +1 -1
  72. package/dist/ptcw-design/{p-28c93a70.entry.js → p-bb7ad437.entry.js} +1 -1
  73. package/dist/ptcw-design/p-c0992ee6.entry.js +1 -0
  74. package/dist/ptcw-design/{p-ae0ed303.entry.js → p-c92d7efd.entry.js} +1 -1
  75. package/dist/ptcw-design/p-e86086c6.entry.js +1 -0
  76. package/dist/ptcw-design/{p-4c10e237.entry.js → p-fae44ada.entry.js} +1 -1
  77. package/dist/ptcw-design/p-ff392584.entry.js +1 -0
  78. package/dist/ptcw-design/ptcw-design.css +2 -2
  79. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  80. package/dist/types/components/ptc-icon-minimize/ptc-icon-minimize.d.ts +1 -0
  81. package/dist/types/components/ptc-modal/ptc-modal.d.ts +4 -0
  82. package/dist/types/components/ptc-value-led-card/ptc-value-led-card.d.ts +1 -0
  83. package/dist/types/components.d.ts +10 -0
  84. package/package.json +1 -1
  85. package/readme.md +1 -1
  86. package/dist/cjs/ptc-mobile-select.cjs.entry.js +0 -511
  87. package/dist/esm/ptc-mobile-select.entry.js +0 -507
  88. package/dist/ptcw-design/p-2f976047.entry.js +0 -1
  89. package/dist/ptcw-design/p-32114a6f.entry.js +0 -1
  90. package/dist/ptcw-design/p-34e13f1c.entry.js +0 -1
  91. package/dist/ptcw-design/p-68276e72.entry.js +0 -1
  92. package/dist/ptcw-design/p-84b50500.entry.js +0 -1
  93. package/dist/ptcw-design/p-c42d9009.entry.js +0 -1
  94. package/dist/ptcw-design/p-d5a3b353.entry.js +0 -1
@@ -1,511 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-4b85b38a.js');
6
-
7
- /*
8
- * mobile-select v1.4.0
9
- * Homepage: https://github.com/onlyhom/mobile-select
10
- * Released under the MIT License.
11
- * (c) 2017-present
12
- */
13
- var S = Object.defineProperty;
14
- var D = (g, t, e) => t in g ? S(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e;
15
- var h = (g, t, e) => (D(g, typeof t != "symbol" ? t + "" : t, e), e);
16
- function w() {
17
- return !navigator.userAgent.toLowerCase().match(/ipad|iphone os|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/);
18
- }
19
- const l = class {
20
- constructor(t) {
21
- h(this, "mobileSelect");
22
- h(this, "trigger");
23
- h(this, "wheelList");
24
- h(this, "sliderList");
25
- h(this, "wheelsContain");
26
- h(this, "panel");
27
- h(this, "ensureBtn");
28
- h(this, "cancelBtn");
29
- h(this, "grayLayer");
30
- h(this, "popUp");
31
- h(this, "initPosition");
32
- h(this, "initColWidth");
33
- h(this, "wheelsData");
34
- h(this, "displayJson");
35
- h(this, "curValue");
36
- h(this, "curIndexArr");
37
- h(this, "isCascade");
38
- h(this, "isJsonType");
39
- h(this, "startY");
40
- h(this, "moveEndY");
41
- h(this, "moveY");
42
- h(this, "preMoveY");
43
- h(this, "offsetY");
44
- h(this, "offsetSum");
45
- h(this, "oversizeBorder");
46
- h(this, "enableClickStatus");
47
- h(this, "optionHeight");
48
- h(this, "curDistance");
49
- h(this, "cascadeJsonData");
50
- h(this, "eventHandleMap");
51
- h(this, "initDeepCount");
52
- h(this, "config");
53
- !l.checkRequiredConfig(t) || (this.config = Object.assign({}, l.defaultConfig, t), this.wheelsData = t.wheels, this.isJsonType = !1, this.cascadeJsonData = [], this.displayJson = [], this.curValue = [], this.curIndexArr = [], this.isCascade = !1, this.offsetY = 0, this.offsetSum = 0, this.curDistance = [], this.enableClickStatus = !1, this.optionHeight = 0, this.initPosition = t.position || [], this.initColWidth = t.colWidth || [], this.init());
54
- }
55
- init() {
56
- if (!this.checkTriggerAvailable())
57
- return;
58
- const { config: t } = this;
59
- if (this.isJsonType = l.checkDataType(this.wheelsData), this.renderComponent(this.wheelsData), this.wheelList = this.mobileSelect.getElementsByClassName("ms-wheel"), this.sliderList = this.mobileSelect.getElementsByClassName("ms-select-container"), this.panel = this.mobileSelect.querySelector(".ms-panel"), this.wheelsContain = this.mobileSelect.querySelector(".ms-wheels"), this.ensureBtn = this.mobileSelect.querySelector(".ms-ensure"), this.cancelBtn = this.mobileSelect.querySelector(".ms-cancel"), this.grayLayer = this.mobileSelect.querySelector(".ms-gray-layer"), this.popUp = this.mobileSelect.querySelector(".ms-content"), this.optionHeight = this.mobileSelect.querySelector("li").offsetHeight, t.initValue && this.setTriggerInnerText(t.initValue), this.setStyle(t), this.isCascade = this.checkCascade(), this.isCascade && this.initCascade(), t.initValue && (this.initPosition = this.getPositionByInitValue()), this.initPosition.length < this.sliderList.length) {
60
- const e = this.sliderList.length - this.initPosition.length;
61
- for (let i = 0; i < e; i++)
62
- this.initPosition.push(0);
63
- }
64
- this.isCascade ? this.initPosition.forEach((e, i) => {
65
- this.checkRange(i, this.initPosition);
66
- }) : this.setCurDistance(this.initPosition), this.eventHandleMap = {
67
- cancelBtn: {
68
- event: "click",
69
- fn: () => {
70
- var e, i, s, n;
71
- this.hide(), (i = (e = this.config).cancel) == null || i.call(e, this.curIndexArr, this.curValue, this), (n = (s = this.config).onCancel) == null || n.call(s, this.curValue, this.curIndexArr, this);
72
- }
73
- },
74
- ensureBtn: {
75
- event: "click",
76
- fn: () => {
77
- var e, i, s, n;
78
- this.hide(), this.optionHeight || (this.optionHeight = this.mobileSelect.querySelector("li").offsetHeight), this.setTriggerInnerText(this.getConnectedString()), this.curIndexArr = this.getIndexArr(), this.curValue = this.getCurValue(), (i = (e = this.config).callback) == null || i.call(e, this.curIndexArr, this.curValue, this), (n = (s = this.config).onChange) == null || n.call(s, this.curValue, this.curIndexArr, this);
79
- }
80
- },
81
- trigger: {
82
- event: "click",
83
- fn: () => {
84
- this.show();
85
- }
86
- },
87
- grayLayer: {
88
- event: "click",
89
- fn: () => this.hide()
90
- },
91
- popUp: {
92
- event: "click",
93
- fn: (e) => e.stopPropagation()
94
- },
95
- panel: {
96
- event: ["touchstart", "touchend", "touchmove"],
97
- fn: (e) => this.touch(e)
98
- }
99
- }, w() && (this.eventHandleMap.panel.event = ["mousedown", "mousemove", "mouseup"]), this.registerEvents("add"), this.fixRowStyle(), t.autoFocus && this.show();
100
- }
101
- static checkDataType(t) {
102
- var e, i;
103
- return typeof ((i = (e = t[0]) == null ? void 0 : e.data) == null ? void 0 : i[0]) == "object";
104
- }
105
- static checkRequiredConfig(t) {
106
- const e = l.REQUIRED_PARAMS;
107
- if (!t) {
108
- const i = e.map((s) => `'${s}'`);
109
- return l.log("error", `missing required param ${i.join(" and ")}.`), !1;
110
- }
111
- for (let i = 0; i < e.length; i++) {
112
- const s = e[i];
113
- if (!t[s])
114
- return l.log("error", `missing required param '${s}'.`), !1;
115
- }
116
- return !0;
117
- }
118
- static log(t, e) {
119
- var i;
120
- (i = console[t]) == null || i.call(console, `[mobile-select]: ${e}`);
121
- }
122
- checkTriggerAvailable() {
123
- const { config: t } = this;
124
- return this.trigger = t.trigger instanceof HTMLElement ? t.trigger : document.querySelector(t.trigger), this.trigger ? !0 : (l.log("error", "trigger HTMLElement does not found on your document."), !1);
125
- }
126
- getPositionByInitValue() {
127
- var n;
128
- const { keyMap: t, connector: e, initValue: i } = this.config, s = (i == null ? void 0 : i.split(e)) || [];
129
- if (this.isJsonType) {
130
- let o = (n = this.wheelsData[0]) == null ? void 0 : n.data;
131
- return s.reduce((r, c) => {
132
- var u;
133
- const a = o == null ? void 0 : o.findIndex((d) => d[t.value] == c);
134
- return r.push(a < 0 ? 0 : a), o = (u = o[a]) == null ? void 0 : u[t.childs], r;
135
- }, []);
136
- }
137
- return s.reduce((o, r, c) => {
138
- var u, d;
139
- const a = (d = (u = this.wheelsData[c]) == null ? void 0 : u.data) == null ? void 0 : d.findIndex((f) => f == r);
140
- return o.push(a < 0 ? 0 : a), o;
141
- }, []);
142
- }
143
- getConnectedString() {
144
- let t = "";
145
- for (let e = 0; e < this.wheelList.length; e++)
146
- e == this.wheelList.length - 1 ? t += this.getInnerText(e) : t += this.getInnerText(e) + this.config.connector;
147
- return t;
148
- }
149
- setTriggerInnerText(t) {
150
- this.config.triggerDisplayValue && (this.trigger.textContent = t);
151
- }
152
- setValue(t) {
153
- if (!t || !t.length)
154
- return;
155
- if (this.isJsonType && typeof t[0] != "object" || !this.isJsonType && typeof t[0] == "object") {
156
- l.log("error", `The setValue() input format should be same with getValue(), like: ${JSON.stringify(this.getValue())}`);
157
- return;
158
- }
159
- const { keyMap: e } = this.config;
160
- t.forEach((i, s) => {
161
- var r;
162
- const n = this.isCascade ? this.displayJson[s] : (r = this.wheelsData[s]) == null ? void 0 : r.data, o = n == null ? void 0 : n.findIndex((c) => this.isJsonType ? i[e.id] == c[e.id] || i[e.value] == c[e.value] : i == c);
163
- this.locatePosition(s, o);
164
- }), this.setTriggerInnerText(this.getConnectedString());
165
- }
166
- setTitle(t) {
167
- this.mobileSelect.querySelector(".ms-title").innerHTML = t;
168
- }
169
- setStyle(t) {
170
- if (t.ensureBtnColor && (this.ensureBtn.style.color = t.ensureBtnColor), t.cancelBtnColor && (this.cancelBtn.style.color = t.cancelBtnColor), t.titleColor) {
171
- const e = this.mobileSelect.querySelector(".ms-title");
172
- e.style.color = t.titleColor;
173
- }
174
- if (t.textColor && (this.panel = this.mobileSelect.querySelector(".ms-panel"), this.panel.style.color = t.textColor), t.titleBgColor) {
175
- const e = this.mobileSelect.querySelector(".ms-btn-bar");
176
- e.style.backgroundColor = t.titleBgColor;
177
- }
178
- if (t.bgColor) {
179
- this.panel = this.mobileSelect.querySelector(".ms-panel");
180
- const e = this.mobileSelect.querySelector(".ms-shadow-mask");
181
- this.panel.style.backgroundColor = t.bgColor, e.style.background = "linear-gradient(to bottom, " + t.bgColor + ", rgba(255, 255, 255, 0), " + t.bgColor + ")";
182
- }
183
- if (typeof t.maskOpacity == "number") {
184
- const e = this.mobileSelect.querySelector(".ms-gray-layer");
185
- e.style.background = "rgba(0, 0, 0, " + t.maskOpacity + ")";
186
- }
187
- }
188
- show() {
189
- var t, e, i;
190
- this.mobileSelect.classList.add("ms-show"), (t = document.querySelector("body")) == null || t.classList.add("ms-show"), typeof this.config.onShow == "function" && ((i = (e = this.config).onShow) == null || i.call(e, this.curValue, this.curIndexArr, this));
191
- }
192
- hide() {
193
- var t, e, i;
194
- this.mobileSelect.classList.remove("ms-show"), (t = document.querySelector("body")) == null || t.classList.remove("ms-show"), typeof this.config.onHide == "function" && ((i = (e = this.config).onHide) == null || i.call(e, this.curValue, this.curIndexArr, this));
195
- }
196
- registerEvents(t) {
197
- for (const [e, i] of Object.entries(this.eventHandleMap))
198
- typeof i.event == "string" ? this[e][`${t}EventListener`](i.event, i.fn, { passive: !1 }) : i.event.forEach((s) => {
199
- this[e][`${t}EventListener`](s, i.fn, { passive: !1 });
200
- });
201
- }
202
- destroy() {
203
- var t, e;
204
- this.registerEvents("remove"), (e = (t = this.mobileSelect) == null ? void 0 : t.parentNode) == null || e.removeChild(this.mobileSelect);
205
- }
206
- getOptionsHtmlStr(t) {
207
- const { keyMap: e } = this.config;
208
- let i = "";
209
- if (this.isJsonType)
210
- for (let s = 0; s < t.length; s++) {
211
- const n = t[s][e.id], o = t[s][e.value];
212
- i += `<li data-id="${n}">${o}</li>`;
213
- }
214
- else
215
- for (let s = 0; s < t.length; s++)
216
- i += "<li>" + t[s] + "</li>";
217
- return i;
218
- }
219
- renderComponent(t) {
220
- this.mobileSelect = document.createElement("div"), this.mobileSelect.className = "ms-mobile-select", this.mobileSelect.innerHTML = `<div class="ms-gray-layer"></div>
221
- <div class="ms-content">
222
- <div class="ms-btn-bar">
223
- <div class="ms-fix-width">
224
- <div class="ms-cancel">${this.config.cancelBtnText}</div>
225
- <div class="ms-title">${this.config.title || ""}</div>
226
- <div class="ms-ensure">${this.config.ensureBtnText}</div>
227
- </div>
228
- </div>
229
- <div class="ms-panel">
230
- <div class="ms-fix-width">
231
- <div class="ms-wheels"></div>
232
- <div class="ms-select-line"></div>
233
- <div class="ms-shadow-mask"></div>
234
- </div>
235
- </div>`, document.body.appendChild(this.mobileSelect);
236
- let e = "";
237
- for (let i = 0; i < t.length; i++)
238
- e += `<div class="ms-wheel" data-index="${i}"><ul class="ms-select-container">`, e += this.getOptionsHtmlStr(t[i].data), e += "</ul></div>";
239
- this.mobileSelect.querySelector(".ms-wheels").innerHTML = e;
240
- }
241
- reRenderWheels() {
242
- const t = this.wheelList.length - this.displayJson.length;
243
- if (t > 0)
244
- for (let e = 0; e < t; e++)
245
- this.wheelsContain.removeChild(this.wheelList[this.wheelList.length - 1]);
246
- for (let e = 0; e < this.displayJson.length; e++)
247
- if (this.wheelList[e])
248
- this.sliderList[e].innerHTML = this.getOptionsHtmlStr(this.displayJson[e]);
249
- else {
250
- const i = document.createElement("div");
251
- i.className = "ms-wheel", i.innerHTML = `<ul class="ms-select-container">${this.getOptionsHtmlStr(this.displayJson[e])}</ul>`, i.setAttribute("data-index", e.toString()), this.wheelsContain.appendChild(i);
252
- }
253
- }
254
- checkCascade() {
255
- var e;
256
- const { keyMap: t } = this.config;
257
- if (this.isJsonType) {
258
- const i = this.wheelsData[0].data;
259
- for (let s = 0; s < i.length; s++)
260
- if (t.childs in i[s] && ((e = i[s][t.childs]) == null ? void 0 : e.length) > 0)
261
- return this.cascadeJsonData = this.wheelsData[0].data, !0;
262
- }
263
- return !1;
264
- }
265
- initCascade() {
266
- this.displayJson.push(this.cascadeJsonData), this.initPosition.length > 0 ? (this.initDeepCount = 0, this.initCheckArrDeep(this.cascadeJsonData[this.initPosition[0]])) : this.checkArrDeep(this.cascadeJsonData[0]), this.reRenderWheels();
267
- }
268
- initCheckArrDeep(t) {
269
- if (t) {
270
- const { keyMap: e } = this.config;
271
- if (e.childs in t && t[e.childs].length > 0) {
272
- this.displayJson.push(t[e.childs]), this.initDeepCount++;
273
- const i = t[e.childs][this.initPosition[this.initDeepCount]];
274
- i ? this.initCheckArrDeep(i) : this.checkArrDeep(t[e.childs][0]);
275
- }
276
- }
277
- }
278
- checkArrDeep(t) {
279
- if (!t)
280
- return;
281
- const { keyMap: e } = this.config;
282
- e.childs in t && t[e.childs].length > 0 && (this.displayJson.push(t[e.childs]), this.checkArrDeep(t[e.childs][0]));
283
- }
284
- checkRange(t, e) {
285
- var o;
286
- const i = this.displayJson.length - 1 - t, { keyMap: s } = this.config;
287
- for (let r = 0; r < i; r++)
288
- this.displayJson.pop();
289
- let n;
290
- for (let r = 0; r <= t; r++)
291
- n = r == 0 ? this.cascadeJsonData[e[0]] : (o = n == null ? void 0 : n[s.childs]) == null ? void 0 : o[e[r]];
292
- this.checkArrDeep(n), this.reRenderWheels(), this.fixRowStyle(), this.setCurDistance(this.resetPosition(t, e));
293
- }
294
- resetPosition(t, e) {
295
- const i = [...e];
296
- let s;
297
- if (this.sliderList.length > e.length) {
298
- s = this.sliderList.length - e.length;
299
- for (let n = 0; n < s; n++)
300
- i.push(0);
301
- } else if (this.sliderList.length < e.length) {
302
- s = e.length - this.sliderList.length;
303
- for (let n = 0; n < s; n++)
304
- i.pop();
305
- }
306
- for (let n = t + 1; n < i.length; n++)
307
- i[n] = 0;
308
- return i;
309
- }
310
- updateWheels(t) {
311
- if (this.isCascade) {
312
- if (this.cascadeJsonData = t, this.displayJson = [], this.initCascade(), this.initPosition.length < this.sliderList.length) {
313
- const e = this.sliderList.length - this.initPosition.length;
314
- for (let i = 0; i < e; i++)
315
- this.initPosition.push(0);
316
- }
317
- this.setCurDistance(this.initPosition), this.fixRowStyle();
318
- }
319
- }
320
- updateWheel(t, e) {
321
- if (this.isCascade) {
322
- l.log("error", "'updateWheel()' not support cascade json data, please use 'updateWheels()' instead to update the whole data source");
323
- return;
324
- }
325
- let i = "";
326
- i += this.getOptionsHtmlStr(e), this.wheelsData[t] = this.isJsonType ? { data: e } : e, this.sliderList[t].innerHTML = i;
327
- }
328
- fixRowStyle() {
329
- if (this.initColWidth.length && this.initColWidth.length === this.wheelList.length) {
330
- const e = this.initColWidth.reduce((i, s) => i + s, 0);
331
- this.initColWidth.forEach((i, s) => {
332
- this.wheelList[s].style.width = (i / e * 100).toFixed(2) + "%";
333
- });
334
- return;
335
- }
336
- const t = (100 / this.wheelList.length).toFixed(2);
337
- for (let e = 0; e < this.wheelList.length; e++)
338
- this.wheelList[e].style.width = t + "%";
339
- }
340
- getIndex(t) {
341
- return Math.round((2 * this.optionHeight - t) / this.optionHeight);
342
- }
343
- getIndexArr() {
344
- const t = [];
345
- for (let e = 0; e < this.curDistance.length; e++)
346
- t.push(this.getIndex(this.curDistance[e]));
347
- return t;
348
- }
349
- getCurValue() {
350
- const t = [], e = this.getIndexArr(), { keyMap: i } = this.config;
351
- if (this.isCascade)
352
- for (let s = 0; s < this.wheelList.length; s++) {
353
- const n = this.displayJson[s][e[s]];
354
- n && t.push({
355
- [i.id]: n[i.id],
356
- [i.value]: n[i.value]
357
- });
358
- }
359
- else if (this.isJsonType)
360
- for (let s = 0; s < this.curDistance.length; s++)
361
- t.push(this.wheelsData[s].data[this.getIndex(this.curDistance[s])]);
362
- else
363
- for (let s = 0; s < this.curDistance.length; s++)
364
- t.push(this.getInnerText(s));
365
- return t;
366
- }
367
- getValue() {
368
- return this.getCurValue();
369
- }
370
- calcDistance(t) {
371
- return 2 * this.optionHeight - t * this.optionHeight;
372
- }
373
- setCurDistance(t) {
374
- const e = [];
375
- for (let i = 0; i < this.sliderList.length; i++)
376
- e.push(this.calcDistance(t[i])), this.movePosition(this.sliderList[i], e[i]);
377
- this.curDistance = e;
378
- }
379
- fixPosition(t) {
380
- return -(this.getIndex(t) - 2) * this.optionHeight;
381
- }
382
- movePosition(t, e) {
383
- t.style.transform = "translate3d(0," + e + "px, 0)";
384
- }
385
- locatePosition(t, e) {
386
- t === void 0 || e === void 0 || e < 0 || (this.curDistance[t] = this.calcDistance(e), this.movePosition(this.sliderList[t], this.curDistance[t]), this.isCascade && this.checkRange(t, this.getIndexArr()));
387
- }
388
- updateCurDistance(t, e) {
389
- this.curDistance[e] = parseInt(t.style.transform.split(",")[1]);
390
- }
391
- getInnerText(t) {
392
- var s;
393
- const e = this.sliderList[t].getElementsByTagName("li").length;
394
- let i = this.getIndex(this.curDistance[t]);
395
- return i >= e ? i = e - 1 : i < 0 && (i = 0), ((s = this.sliderList[t].getElementsByTagName("li")[i]) == null ? void 0 : s.textContent) || "";
396
- }
397
- touch(t) {
398
- var o, r, c, a, u, d, f, v;
399
- const i = (t.composedPath && t.composedPath()).find((m) => {
400
- var p;
401
- return (p = m.classList) == null ? void 0 : p.contains("ms-wheel");
402
- });
403
- if (!i)
404
- return;
405
- const s = i.firstChild, n = parseInt(i.getAttribute("data-index") || "0");
406
- switch (t.type) {
407
- case "touchstart":
408
- case "mousedown":
409
- s.style.transition = "none 0s ease-out", this.startY = Math.floor(t instanceof TouchEvent ? t.touches[0].clientY : t.clientY), this.preMoveY = this.startY, t.type === "mousedown" && (this.enableClickStatus = !0);
410
- break;
411
- case "touchmove":
412
- case "mousemove":
413
- if (t.preventDefault(), t.type === "mousemove" && !this.enableClickStatus)
414
- break;
415
- this.moveY = Math.floor(t instanceof TouchEvent ? t.touches[0].clientY : t.clientY), this.offsetY = (this.moveY - this.preMoveY) * this.config.scrollSpeed, this.updateCurDistance(s, n), this.curDistance[n] = this.curDistance[n] + this.offsetY, this.movePosition(s, this.curDistance[n]), this.preMoveY = this.moveY;
416
- break;
417
- case "touchend":
418
- case "mouseup":
419
- if (s.style.transition = "transform 0.18s ease-out", this.moveEndY = Math.floor(t instanceof TouchEvent ? t.changedTouches[0].clientY : t.clientY), this.offsetSum = this.moveEndY - this.startY, this.oversizeBorder = -(s.getElementsByTagName("li").length - 3) * this.optionHeight, this.offsetSum == 0) {
420
- const m = Math.floor((window.innerHeight - this.moveEndY) / 40);
421
- if (m != 2) {
422
- const p = m - 2, C = this.curDistance[n] + p * this.optionHeight;
423
- C <= 2 * this.optionHeight && C >= this.oversizeBorder && (this.curDistance[n] = C, this.movePosition(s, this.curDistance[n]), (r = (o = this.config).transitionEnd) == null || r.call(o, this.getIndexArr(), this.getCurValue(), this), (a = (c = this.config).onTransitionEnd) == null || a.call(c, this.getCurValue(), this.getIndexArr(), this));
424
- }
425
- } else
426
- this.updateCurDistance(s, n), this.curDistance[n] = this.fixPosition(this.curDistance[n]), this.curDistance[n] > 2 * this.optionHeight ? this.curDistance[n] = 2 * this.optionHeight : this.curDistance[n] < this.oversizeBorder && (this.curDistance[n] = this.oversizeBorder), this.movePosition(s, this.curDistance[n]), (d = (u = this.config).transitionEnd) == null || d.call(u, this.getIndexArr(), this.getCurValue(), this), (v = (f = this.config).onTransitionEnd) == null || v.call(f, this.getCurValue(), this.getIndexArr(), this);
427
- t.type === "mouseup" && (this.enableClickStatus = !1), this.isCascade && this.checkRange(n, this.getIndexArr());
428
- break;
429
- }
430
- }
431
- };
432
- let y = l;
433
- h(y, "defaultConfig", {
434
- keyMap: { id: "id", value: "value", childs: "childs" },
435
- position: [],
436
- colWidth: [],
437
- title: "",
438
- connector: " ",
439
- ensureBtnText: "\u786E\u8BA4",
440
- cancelBtnText: "\u53D6\u6D88",
441
- triggerDisplayValue: !0,
442
- scrollSpeed: 1
443
- }), h(y, "REQUIRED_PARAMS", ["trigger", "wheels"]);
444
-
445
- const ptcMobileSelectCss = ".ms-mobile-select{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;opacity:0;visibility:hidden;-webkit-transition:opacity 0.4s, z-index 0.4s;transition:opacity 0.4s, z-index 0.4s;transform:translate(0, 0)}.ms-mobile-select *{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.ms-mobile-select .ms-gray-layer{position:fixed;top:0;left:0;bottom:0;right:0;background:rgba(0, 0, 0, 0.7);z-index:888;display:block}.ms-mobile-select .ms-content{width:100%;display:block;position:fixed;z-index:889;color:black;-webkit-transition:all 0.4s;transition:all 0.4s;bottom:-350px;left:0;background:white}.ms-mobile-select .ms-fix-width{width:90%;margin:0 auto;position:relative}.ms-mobile-select .ms-fix-width:after{content:\".\";display:block;height:0;clear:both;visibility:hidden}.ms-mobile-select .ms-btn-bar{border-bottom:1px solid #dcdcdc;font-size:15px;height:45px;position:relative;text-align:center;line-height:45px}.ms-mobile-select .ms-cancel,.ms-mobile-select .ms-ensure{height:45px;width:55px;cursor:pointer;position:absolute;top:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.ms-mobile-select .ms-cancel{left:0;color:#666}.ms-mobile-select .ms-ensure{right:0;color:#1e83d3}.ms-mobile-select .ms-title{font-size:15px;padding:0 15%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ms-mobile-select .ms-panel:after{content:\".\";display:block;height:0;clear:both;visibility:hidden}.ms-mobile-select .ms-wheels{width:100%;height:200px;overflow:hidden}.ms-mobile-select .ms-wheel{position:relative;z-index:0;float:left;width:50%;height:200px;overflow:hidden;-webkit-transition:width 0.3s ease;transition:width 0.3s ease}.ms-mobile-select .ms-select-container{display:block;text-align:center}.ms-mobile-select .ms-select-container li{font-size:15px;display:block;height:40px;line-height:40px;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.ms-mobile-select .ms-select-line{height:40px;width:100%;position:absolute;top:80px;pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box;border-top:1px solid #dcdcdc;border-bottom:1px solid #dcdcdc}.ms-mobile-select .ms-shadow-mask{position:absolute;top:0;width:100%;height:200px;background:linear-gradient(to bottom, #fffffff5, #ffffffcc 25%, #ffffff00 49%, #ffffff00 51%, #ffffffcc 75%, #fffffff5);opacity:0.9;pointer-events:none}.ms-mobile-select.ms-show{opacity:1;z-index:10000;visibility:visible}.ms-mobile-select.ms-show .ms-content{bottom:0}.ms-default-trigger{min-height:1em;color:#888}body.ms-show{overflow-y:hidden}h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link{word-break:break-word;hyphens:manual;-webkit-hyphens:manual;-moz-hyphens:manual;-ms-hyphens:manual}@supports (hyphenate-limit-chars: 12 3 3){h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link{hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;hyphenate-limit-chars:12 3 3;hyphenate-limit-lines:2;hyphenate-limit-last:always;hyphenate-limit-zone:6%;-webkit-hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;-webkit-hyphenate-limit-chars:12 3 3;-webkit-hyphenate-limit-lines:2;-moz-hyphens:auto;-moz-hyphenate-limit-chars:12 3 3;-moz-hyphenate-limit-lines:2;-ms-hyphens:auto;-ms-hyphenate-limit-chars:12 3 3;-ms-hyphenate-limit-lines:2}}.mobile-select-wrapper{display:block}.mobile-select-wrapper div{display:inline;margin-right:var(--ptc-element-spacing-03);width:100%;font-family:var(--ptc-font-latin);font-weight:var(--ptc-font-weight-regular);font-size:var(--ptc-font-size-x-small);line-height:var(--ptc-line-height-densest);color:var(--color-white);height:18px}.mobileSelect .content{top:auto}.mobileSelect .content .btnBar{border-color:var(--color-gray-10)}.mobileSelect .content .btnBar .cancel,.mobileSelect .content .btnBar .ensure,.mobileSelect .content .btnBar .title{font-family:var(--ptc-font-latin);font-weight:var(--ptc-font-weight-semibold);font-size:var(--ptc-font-size-x-small);line-height:var(--ptc-line-height-densest)}.mobileSelect .content .btnBar .ensure,.mobileSelect .content .btnBar .cancel{transform:translateY(12.5px);width:125px}.mobileSelect .content .panel .wheel .selectContainer li{font-family:var(--ptc-font-latin);font-weight:var(--ptc-font-weight-semibold);font-size:var(--ptc-font-size-x-small);line-height:var(--ptc-line-height-densest);height:45px}ptc-responsive-wrapper.xsmall .mobile-select-wrapper,ptc-responsive-wrapper.small .mobile-select-wrapper{display:block}ptc-responsive-wrapper.medium .mobile-select-wrapper,ptc-responsive-wrapper.large .mobile-select-wrapper,ptc-responsive-wrapper.xlarge .mobile-select-wrapper,ptc-responsive-wrapper.xxlarge .mobile-select-wrapper,ptc-responsive-wrapper.large2k .mobile-select-wrapper,ptc-responsive-wrapper.large4k .mobile-select-wrapper{display:none}";
446
-
447
- const PtcMobileSelect = class {
448
- constructor(hostRef) {
449
- index.registerInstance(this, hostRef);
450
- this.triggerName = undefined;
451
- this.selectedText = undefined;
452
- this.wheelData = undefined;
453
- this.selectedId = '';
454
- this.ensureBtnText = 'Confirm';
455
- this.cancelBtnText = 'Cancel';
456
- this.listTitle = undefined;
457
- }
458
- render() {
459
- return (index.h("div", { class: "mobile-select-wrapper" }, index.h("div", { id: this.triggerName }, this.selectedText, index.h("icon-asset", { type: "ptc", size: "x-small", name: "chevron-down", color: "white", "is-mobile-select": "true", "injected-style": "svg.ismobileselect{transform:translateX(10px);}" }))));
460
- }
461
- componentDidRender() {
462
- let currentId = this.selectedId; //input current lang
463
- let storeIndex = 0;
464
- let mySelect = new y({
465
- trigger: `#${this.triggerName}`,
466
- title: `${this.listTitle ? this.listTitle : ''}`,
467
- wheels: this.wheelData ? [{ data: this.wheelData }] : [{ data: ['test1', 'test2'] }],
468
- position: [0],
469
- ensureBtnText: this.ensureBtnText,
470
- cancelBtnText: this.cancelBtnText,
471
- ensureBtnColor: 'var(--color-gray-12)',
472
- cancelBtnColor: 'var(--color-gray-12)',
473
- titleColor: 'var(--color-gray-12)',
474
- onShow: function (e) {
475
- if (currentId) {
476
- let liEle = document.querySelectorAll('.selectContainer li');
477
- liEle.forEach((currentValue, currentIndex) => {
478
- if (currentValue.getAttribute('data-id') == currentId) {
479
- storeIndex = currentIndex;
480
- return;
481
- }
482
- });
483
- try {
484
- e.locatePosition(0, storeIndex);
485
- console.log("storeIndex: " + storeIndex);
486
- }
487
- catch (error) {
488
- console.log(error);
489
- // debugger
490
- }
491
- //e.locatePosition(0, storeIndex);
492
- }
493
- else {
494
- return;
495
- }
496
- },
497
- callback: function (indexArr, data) {
498
- if (data[0].id) {
499
- window.location.href = data[0].id;
500
- }
501
- else {
502
- console.log('href: ' + data[0].id + '; indexArr: ' + indexArr);
503
- }
504
- }.bind(this),
505
- });
506
- mySelect.locatePosition(0, storeIndex);
507
- }
508
- };
509
- PtcMobileSelect.style = ptcMobileSelectCss;
510
-
511
- exports.ptc_mobile_select = PtcMobileSelect;