@ptcwebops/ptcw-design 3.7.2 → 3.7.5

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