@cloudbase/lowcode-builder 0.1.26 → 1.0.0
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.
- package/lib/builder/core/index.d.ts +1 -3
- package/lib/builder/core/index.js +42 -52
- package/lib/builder/h5/compile.d.ts +1 -1
- package/lib/builder/h5/compile.js +59 -20
- package/lib/builder/h5/copy.js +2 -4
- package/lib/builder/h5/generate.js +3 -3
- package/lib/builder/h5/index.d.ts +5 -4
- package/lib/builder/h5/index.js +25 -14
- package/lib/builder/h5/material.js +6 -11
- package/lib/builder/h5/npm.js +6 -5
- package/lib/builder/mp/index.js +38 -49
- package/lib/builder/mp/materials.js +25 -18
- package/lib/builder/mp/mixMode.js +7 -10
- package/lib/builder/mp/mp_config.js +2 -3
- package/lib/builder/mp/wxml.js +1 -1
- package/lib/builder/service/webpack.d.ts +7 -1
- package/lib/builder/service/webpack.js +97 -24
- package/lib/builder/types/common.d.ts +1 -1
- package/lib/builder/types/common.js +2 -1
- package/lib/builder/util/common.js +1 -4
- package/lib/builder/util/generateFiles.js +12 -10
- package/lib/builder/util/mp.js +2 -8
- package/lib/builder.web.js +71 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +6 -0
- package/lib/types.d.ts +1 -0
- package/lib/types.js +11 -0
- package/package.json +3 -8
- package/template/html/index.html.ejs +59 -29
- package/template/mp/common/weapp-page.js +23 -1
- package/template/mp/package.json +1 -1
- package/template/mp/page/index.js +2 -1
- package/template/package.json +5 -2
- package/template/webpack/getCSSModuleLocalIdent.js +28 -0
- package/template/webpack/web.prod.js +112 -103
- package/template/src/app/common.js +0 -13
- package/template/src/app/global-api.js +0 -99
- package/template/src/app/handlers.js +0 -13
- package/template/src/app/material-actions.js +0 -16
- package/template/src/app/mountAppApis.js +0 -25
- package/template/src/app/mountMpApis.js +0 -4
- package/template/src/datasources/config.js.tpl +0 -23
- package/template/src/datasources/dataset-profiles.js.tpl +0 -5
- package/template/src/datasources/datasource-profiles.js.tpl +0 -4
- package/template/src/datasources/index.js +0 -31
- package/template/src/handlers/FieldMiddleware/renderer.jsx +0 -331
- package/template/src/handlers/HotAreas.js +0 -36
- package/template/src/handlers/PositionHandler.jsx +0 -8
- package/template/src/handlers/actionHandler/utils.js +0 -149
- package/template/src/handlers/componentEventActionEmitter.js +0 -29
- package/template/src/handlers/componentNodeMap.js +0 -24
- package/template/src/handlers/controller.js +0 -5
- package/template/src/handlers/emitComponentEvent.js +0 -8
- package/template/src/handlers/eventListener/componentEventListener.js +0 -15
- package/template/src/handlers/eventListener/hotAreaEventListener.js +0 -32
- package/template/src/handlers/eventListener/index.js +0 -29
- package/template/src/handlers/eventListener/pageEventListener.js +0 -11
- package/template/src/handlers/eventListener/types.js +0 -32
- package/template/src/handlers/hooks/index.js +0 -14
- package/template/src/handlers/initWebEnv.js +0 -4
- package/template/src/handlers/injectStyle.js +0 -14
- package/template/src/handlers/instanceMap.js +0 -39
- package/template/src/handlers/lifecycle.js +0 -232
- package/template/src/handlers/render.jsx +0 -131
- package/template/src/handlers/utils/common.js +0 -151
- package/template/src/handlers/utils/eventProxy.js +0 -64
- package/template/src/handlers/utils/events.js +0 -8
- package/template/src/handlers/utils/index.js +0 -4
- package/template/src/handlers/utils/widgets.js +0 -320
- package/template/src/index.jsx +0 -142
- package/template/src/index.less +0 -119
- package/template/src/libraries/default-lib/wx_yypt_report_v2.js +0 -441
- package/template/src/pages/app.tpl +0 -124
- package/template/src/router/index.tpl +0 -28
- package/template/src/store/computed.js +0 -11
- package/template/src/store/index.js +0 -40
- package/template/src/utils/ScanCodeComponent.js +0 -396
- package/template/src/utils/date.js +0 -324
- package/template/src/utils/history.js +0 -72
- package/template/src/utils/index.js +0 -67
- package/template/src/utils/kbone.js +0 -18
- package/template/src/utils/monitor-jssdk.min.js +0 -763
- package/template/src/utils/request.js +0 -5
- package/template/src/utils/scan-code-action.js +0 -27
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
// 日期转换
|
|
2
|
-
class CustomDate {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.i18n = {
|
|
5
|
-
dayNames: [
|
|
6
|
-
'Sun',
|
|
7
|
-
'Mon',
|
|
8
|
-
'Tue',
|
|
9
|
-
'Wed',
|
|
10
|
-
'Thu',
|
|
11
|
-
'Fri',
|
|
12
|
-
'Sat',
|
|
13
|
-
'Sunday',
|
|
14
|
-
'Monday',
|
|
15
|
-
'Tuesday',
|
|
16
|
-
'Wednesday',
|
|
17
|
-
'Thursday',
|
|
18
|
-
'Friday',
|
|
19
|
-
'Saturday',
|
|
20
|
-
],
|
|
21
|
-
monthNames: [
|
|
22
|
-
'Jan',
|
|
23
|
-
'Feb',
|
|
24
|
-
'Mar',
|
|
25
|
-
'Apr',
|
|
26
|
-
'May',
|
|
27
|
-
'Jun',
|
|
28
|
-
'Jul',
|
|
29
|
-
'Aug',
|
|
30
|
-
'Sep',
|
|
31
|
-
'Oct',
|
|
32
|
-
'Nov',
|
|
33
|
-
'Dec',
|
|
34
|
-
'January',
|
|
35
|
-
'February',
|
|
36
|
-
'March',
|
|
37
|
-
'April',
|
|
38
|
-
'May',
|
|
39
|
-
'June',
|
|
40
|
-
'July',
|
|
41
|
-
'August',
|
|
42
|
-
'September',
|
|
43
|
-
'October',
|
|
44
|
-
'November',
|
|
45
|
-
'December',
|
|
46
|
-
],
|
|
47
|
-
timeNames: ['a', 'p', 'am', 'pm', 'A', 'P', 'AM', 'PM'],
|
|
48
|
-
};
|
|
49
|
-
this.masks = {
|
|
50
|
-
default: 'ddd mmm dd yyyy HH:MM:ss',
|
|
51
|
-
shortDate: 'm/d/yy',
|
|
52
|
-
paddedShortDate: 'mm/dd/yyyy',
|
|
53
|
-
mediumDate: 'mmm d, yyyy',
|
|
54
|
-
longDate: 'mmmm d, yyyy',
|
|
55
|
-
fullDate: 'dddd, mmmm d, yyyy',
|
|
56
|
-
shortTime: 'h:MM TT',
|
|
57
|
-
mediumTime: 'h:MM:ss TT',
|
|
58
|
-
longTime: 'h:MM:ss TT Z',
|
|
59
|
-
isoDate: 'yyyy-mm-dd',
|
|
60
|
-
isoTime: 'HH:MM:ss',
|
|
61
|
-
isoDateTime: "yyyy-mm-dd'T'HH:MM:sso",
|
|
62
|
-
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",
|
|
63
|
-
expiresHeaderFormat: 'ddd, dd mmm yyyy HH:MM:ss Z',
|
|
64
|
-
};
|
|
65
|
-
this.token = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g;
|
|
66
|
-
this.timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
|
|
67
|
-
this.timezoneClip = /[^-+\dA-Z]/g;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/*
|
|
71
|
-
*
|
|
72
|
-
| Name | Mask | Example |
|
|
73
|
-
| ----------------- | ------------------------------ | ------------------------ |
|
|
74
|
-
| `default` | `ddd mmm dd yyyy HH:MM:ss` | Sat Jun 09 2007 17:46:21 |
|
|
75
|
-
| `shortDate` | `m/d/yy` | 6/9/07 |
|
|
76
|
-
| `paddedShortDate` | `mm/dd/yyyy` | 06/09/2007 |
|
|
77
|
-
| `mediumDate` | `mmm d, yyyy` | Jun 9, 2007 |
|
|
78
|
-
| `longDate` | `mmmm d, yyyy` | June 9, 2007 |
|
|
79
|
-
| `fullDate` | `dddd, mmmm d, yyyy` | Saturday, June 9, 2007 |
|
|
80
|
-
| `shortTime` | `h:MM TT` | 5:46 PM |
|
|
81
|
-
| `mediumTime` | `h:MM:ss TT` | 5:46:21 PM |
|
|
82
|
-
| `longTime` | `h:MM:ss TT Z` | 5:46:21 PM EST |
|
|
83
|
-
| `isoDate` | `yyyy-mm-dd` | 2007-06-09 |
|
|
84
|
-
| `isoTime` | `HH:MM:ss` | 17:46:21 |
|
|
85
|
-
| `isoDateTime` | `yyyy-mm-dd'T'HH:MM:sso` | 2007-06-09T17:46:21+0700 |
|
|
86
|
-
| `isoUtcDateTime` | `UTC:yyyy-mm-dd'T'HH:MM:ss'Z'` | 2007-06-09T22:46:21Z |
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
|
-
format(date, mask, utc, gmt) {
|
|
90
|
-
let newMask = mask;
|
|
91
|
-
let newDate = date;
|
|
92
|
-
let newUtc = utc;
|
|
93
|
-
let newGmt = gmt;
|
|
94
|
-
if (
|
|
95
|
-
arguments.length === 1 &&
|
|
96
|
-
this._kindOf(newDate) === 'string' &&
|
|
97
|
-
!/\d/.test(newDate)
|
|
98
|
-
) {
|
|
99
|
-
newDate = undefined;
|
|
100
|
-
}
|
|
101
|
-
newDate = newDate || newDate === 0 ? newDate : new Date();
|
|
102
|
-
if (!(newDate instanceof Date)) newDate = new Date(newDate);
|
|
103
|
-
if (isNaN(newDate)) throw TypeError('Invalid date');
|
|
104
|
-
newMask = String(this.masks[newMask] || newMask || this.masks['default']);
|
|
105
|
-
const maskSlice = newMask.slice(0, 4);
|
|
106
|
-
if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
|
|
107
|
-
newMask = newMask.slice(4);
|
|
108
|
-
newUtc = true;
|
|
109
|
-
if (maskSlice === 'GMT:') newGmt = true;
|
|
110
|
-
}
|
|
111
|
-
const _ = newUtc ? 'getUTC' : 'get';
|
|
112
|
-
const _d = newDate[`${_}Date`]();
|
|
113
|
-
const D = newDate[`${_}Day`]();
|
|
114
|
-
const _m = newDate[`${_}Month`]();
|
|
115
|
-
const y = newDate[`${_}FullYear`]();
|
|
116
|
-
const _H = newDate[`${_}Hours`]();
|
|
117
|
-
const _M = newDate[`${_}Minutes`]();
|
|
118
|
-
const _s = newDate[`${_}Seconds`]();
|
|
119
|
-
const _L = newDate[`${_}Milliseconds`]();
|
|
120
|
-
const _o = newUtc ? 0 : newDate.getTimezoneOffset();
|
|
121
|
-
const _W = this._getWeek(newDate);
|
|
122
|
-
const _N = this._getDayOfWeek(newDate);
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
124
|
-
const self = this;
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
const flags = {
|
|
128
|
-
d: () => _d,
|
|
129
|
-
dd: () => self._pad(_d),
|
|
130
|
-
ddd: () => self.i18n.dayNames[D],
|
|
131
|
-
DDD: () =>
|
|
132
|
-
self._getDayName({
|
|
133
|
-
y,
|
|
134
|
-
m: _m,
|
|
135
|
-
d: _d,
|
|
136
|
-
_,
|
|
137
|
-
dayName: self.i18n.dayNames[D],
|
|
138
|
-
short: true,
|
|
139
|
-
}),
|
|
140
|
-
dddd: () => self.i18n.dayNames[D + 7],
|
|
141
|
-
DDDD: () =>
|
|
142
|
-
self._getDayName({
|
|
143
|
-
y: y,
|
|
144
|
-
m: _m,
|
|
145
|
-
d: _d,
|
|
146
|
-
_: _,
|
|
147
|
-
dayName: self.i18n.dayNames[D + 7],
|
|
148
|
-
}),
|
|
149
|
-
m: () => _m + 1,
|
|
150
|
-
mm: () => self._pad(_m + 1),
|
|
151
|
-
mmm: () => self.i18n.monthNames[_m],
|
|
152
|
-
mmmm: () => self.i18n.monthNames[_m + 12],
|
|
153
|
-
yy: () => String(y).slice(2),
|
|
154
|
-
yyyy: () => self._pad(y, 4),
|
|
155
|
-
h: () => _H % 12 || 12,
|
|
156
|
-
hh: () => self._pad(_H % 12 || 12),
|
|
157
|
-
H: () => _H,
|
|
158
|
-
HH: () => self._pad(_H),
|
|
159
|
-
M: () => _M,
|
|
160
|
-
MM: () => self._pad(_M),
|
|
161
|
-
s: () => _s,
|
|
162
|
-
ss: () => self._pad(_s),
|
|
163
|
-
l: () => self._pad(_L, 3),
|
|
164
|
-
L: () => self._pad(Math.floor(_L / 10)),
|
|
165
|
-
t: () => (_H < 12 ? self.i18n.timeNames[0] : self.i18n.timeNames[1]),
|
|
166
|
-
tt: () => (_H < 12 ? self.i18n.timeNames[2] : self.i18n.timeNames[3]),
|
|
167
|
-
T: () => (_H < 12 ? self.i18n.timeNames[4] : self.i18n.timeNames[5]),
|
|
168
|
-
TT: () => (_H < 12 ? self.i18n.timeNames[6] : self.i18n.timeNames[7]),
|
|
169
|
-
// eslint-disable-next-line no-nested-ternary
|
|
170
|
-
Z: () =>
|
|
171
|
-
newGmt
|
|
172
|
-
? 'GMT'
|
|
173
|
-
: newUtc
|
|
174
|
-
? 'UTC'
|
|
175
|
-
: (String(newDate).match(self.timezone) || [''])
|
|
176
|
-
.pop()
|
|
177
|
-
.replace(self.timezoneClip, '')
|
|
178
|
-
.replace(/GMT\+0000/g, 'UTC'),
|
|
179
|
-
o: () =>
|
|
180
|
-
(_o > 0 ? '-' : '+') +
|
|
181
|
-
self._pad(Math.floor(Math.abs(_o) / 60) * 100 + (Math.abs(_o) % 60), 4),
|
|
182
|
-
p: () =>
|
|
183
|
-
`${
|
|
184
|
-
(_o > 0 ? '-' : '+') + self._pad(Math.floor(Math.abs(_o) / 60), 2)
|
|
185
|
-
}:${self._pad(Math.floor(Math.abs(_o) % 60), 2)}`,
|
|
186
|
-
// @ts-ignore
|
|
187
|
-
S: () =>
|
|
188
|
-
['th', 'st', 'nd', 'rd'][
|
|
189
|
-
_d % 10 > 3 ? 0 : (((_d % 100) - (_d % 10) != 10) * _d) % 10
|
|
190
|
-
],
|
|
191
|
-
W: () => _W,
|
|
192
|
-
WW: () => self._pad(_W),
|
|
193
|
-
N: () => _N,
|
|
194
|
-
};
|
|
195
|
-
return mask.replace(this.token, (match) => {
|
|
196
|
-
if (match in flags) {
|
|
197
|
-
return flags[match]();
|
|
198
|
-
}
|
|
199
|
-
return match.slice(1, match.length - 1);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
_pad(val, len) {
|
|
204
|
-
let newVal = String(val);
|
|
205
|
-
const newLen = len || 2;
|
|
206
|
-
while (newVal.length < newLen) {
|
|
207
|
-
newVal = `0${newVal}`;
|
|
208
|
-
}
|
|
209
|
-
return newVal;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
_getDayName(_ref) {
|
|
213
|
-
const { y, m, d, _, dayName } = _ref;
|
|
214
|
-
const _ref$short = _ref['short'];
|
|
215
|
-
const _short = _ref$short === void 0 ? false : _ref$short;
|
|
216
|
-
const today = new Date();
|
|
217
|
-
const yesterday = new Date();
|
|
218
|
-
yesterday.setDate(yesterday[`${_}Date`]() - 1);
|
|
219
|
-
const tomorrow = new Date();
|
|
220
|
-
tomorrow.setDate(tomorrow[`${_}Date`]() + 1);
|
|
221
|
-
const today_d = function today_d() {
|
|
222
|
-
return today[`${_}Date`]();
|
|
223
|
-
};
|
|
224
|
-
const today_m = function today_m() {
|
|
225
|
-
return today[`${_}Month`]();
|
|
226
|
-
};
|
|
227
|
-
const today_y = function today_y() {
|
|
228
|
-
return today[`${_}FullYear`]();
|
|
229
|
-
};
|
|
230
|
-
const yesterday_d = function yesterday_d() {
|
|
231
|
-
return yesterday[`${_}Date`]();
|
|
232
|
-
};
|
|
233
|
-
const yesterday_m = function yesterday_m() {
|
|
234
|
-
return yesterday[`${_}Month`]();
|
|
235
|
-
};
|
|
236
|
-
const yesterday_y = function yesterday_y() {
|
|
237
|
-
return yesterday[`${_}FullYear`]();
|
|
238
|
-
};
|
|
239
|
-
const tomorrow_d = function tomorrow_d() {
|
|
240
|
-
return tomorrow[`${_}Date`]();
|
|
241
|
-
};
|
|
242
|
-
const tomorrow_m = function tomorrow_m() {
|
|
243
|
-
return tomorrow[`${_}Month`]();
|
|
244
|
-
};
|
|
245
|
-
const tomorrow_y = function tomorrow_y() {
|
|
246
|
-
return tomorrow[`${_}FullYear`]();
|
|
247
|
-
};
|
|
248
|
-
if (today_y() === y && today_m() === m && today_d() === d) {
|
|
249
|
-
return _short ? 'Tdy' : 'Today';
|
|
250
|
-
}
|
|
251
|
-
if (yesterday_y() === y && yesterday_m() === m && yesterday_d() === d) {
|
|
252
|
-
return _short ? 'Ysd' : 'Yesterday';
|
|
253
|
-
}
|
|
254
|
-
if (tomorrow_y() === y && tomorrow_m() === m && tomorrow_d() === d) {
|
|
255
|
-
return _short ? 'Tmw' : 'Tomorrow';
|
|
256
|
-
}
|
|
257
|
-
return dayName;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
_getWeek(date) {
|
|
261
|
-
const targetThursday = new Date(
|
|
262
|
-
date.getFullYear(),
|
|
263
|
-
date.getMonth(),
|
|
264
|
-
date.getDate()
|
|
265
|
-
);
|
|
266
|
-
targetThursday.setDate(
|
|
267
|
-
targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3
|
|
268
|
-
);
|
|
269
|
-
const firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
|
|
270
|
-
firstThursday.setDate(
|
|
271
|
-
firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3
|
|
272
|
-
);
|
|
273
|
-
const ds =
|
|
274
|
-
targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
|
|
275
|
-
targetThursday.setHours(targetThursday.getHours() - ds);
|
|
276
|
-
const weekDiff = (targetThursday - firstThursday) / (864e5 * 7);
|
|
277
|
-
return 1 + Math.floor(weekDiff);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
_getDayOfWeek(date) {
|
|
281
|
-
let dow = date.getDay();
|
|
282
|
-
if (dow === 0) {
|
|
283
|
-
dow = 7;
|
|
284
|
-
}
|
|
285
|
-
return dow;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
_kindOf(val) {
|
|
289
|
-
if (val === null) {
|
|
290
|
-
return 'null';
|
|
291
|
-
}
|
|
292
|
-
if (val === undefined) {
|
|
293
|
-
return 'undefined';
|
|
294
|
-
}
|
|
295
|
-
if (this._typeof(val) !== 'object') {
|
|
296
|
-
return this._typeof(val);
|
|
297
|
-
}
|
|
298
|
-
if (Array.isArray(val)) {
|
|
299
|
-
return 'array';
|
|
300
|
-
}
|
|
301
|
-
return {}.toString.call(val).slice(8, -1).toLowerCase();
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
_typeof(obj) {
|
|
305
|
-
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
|
|
306
|
-
this._typeof = function _typeof(obj) {
|
|
307
|
-
return typeof obj;
|
|
308
|
-
};
|
|
309
|
-
} else {
|
|
310
|
-
this._typeof = function _typeof(obj) {
|
|
311
|
-
return obj &&
|
|
312
|
-
typeof Symbol === 'function' &&
|
|
313
|
-
obj.constructor === Symbol &&
|
|
314
|
-
obj !== Symbol.prototype
|
|
315
|
-
? 'symbol'
|
|
316
|
-
: typeof obj;
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
return this._typeof(obj);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const dataInstance = new CustomDate();
|
|
324
|
-
export const formatDate = new CustomDate().format.bind(dataInstance);
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { createHashHistory, createBrowserHistory } from 'history';
|
|
2
|
-
let history;
|
|
3
|
-
window._WEAPPS_HISTORY = history;
|
|
4
|
-
|
|
5
|
-
function removeS(path) {
|
|
6
|
-
if (path && path[0] === '/') {
|
|
7
|
-
return path.slice(1);
|
|
8
|
-
}
|
|
9
|
-
return path;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// if (!process.env.isMiniprogram) {
|
|
13
|
-
const createHistory =
|
|
14
|
-
process.env.isApp ||
|
|
15
|
-
process.env.isAdminPortal ||
|
|
16
|
-
process.env.historyType === 'HASH'
|
|
17
|
-
? createHashHistory
|
|
18
|
-
: createBrowserHistory;
|
|
19
|
-
history = createHistory({
|
|
20
|
-
basename: '', // The base URL of the app (see below)
|
|
21
|
-
forceRefresh: false, // Set true to force full page refreshes
|
|
22
|
-
keyLength: 6, // The length of location.key
|
|
23
|
-
});
|
|
24
|
-
// } else {
|
|
25
|
-
// history = {
|
|
26
|
-
// push(path) {
|
|
27
|
-
// wx.navigateTo({
|
|
28
|
-
// url: '/pages/' + removeS(path) + '/index',
|
|
29
|
-
// });
|
|
30
|
-
// },
|
|
31
|
-
// replace(path) {
|
|
32
|
-
// wx.redirectTo({
|
|
33
|
-
// url: '/pages/' + removeS(path) + '/index',
|
|
34
|
-
// });
|
|
35
|
-
// },
|
|
36
|
-
// reLaunch(path) {
|
|
37
|
-
// wx.reLaunch({
|
|
38
|
-
// url: '/pages/' + removeS(path) + '/index',
|
|
39
|
-
// });
|
|
40
|
-
// },
|
|
41
|
-
// navigateBack(delta = 1) {
|
|
42
|
-
// wx.navigateBack({
|
|
43
|
-
// delta,
|
|
44
|
-
// });
|
|
45
|
-
// },
|
|
46
|
-
// };
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
function generateBrowserHistory(param) {
|
|
50
|
-
history = createBrowserHistory(param);
|
|
51
|
-
window._WEAPPS_HISTORY = history;
|
|
52
|
-
return history;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function generateHashHistory(param) {
|
|
56
|
-
history = createHashHistory(param);
|
|
57
|
-
window._WEAPPS_HISTORY = history;
|
|
58
|
-
return history;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// const createHistory = (basename) => {
|
|
62
|
-
// if (process.env.isApp) {
|
|
63
|
-
// return createHashHistory({
|
|
64
|
-
// basename: '', // The base URL of the app (see below)
|
|
65
|
-
// });
|
|
66
|
-
// }
|
|
67
|
-
// return createBrowserHistory({
|
|
68
|
-
// basename,
|
|
69
|
-
// });
|
|
70
|
-
// };
|
|
71
|
-
|
|
72
|
-
export { history, createHistory, generateBrowserHistory, generateHashHistory };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { get as lodashGet, set as lodashSet } from 'lodash';
|
|
2
|
-
|
|
3
|
-
export function createComputed(funcs, bindContext = null) {
|
|
4
|
-
const obj = {};
|
|
5
|
-
for (const name in funcs) {
|
|
6
|
-
Object.defineProperty(obj, name, {
|
|
7
|
-
get: bindContext ? funcs[name].bind(bindContext) : funcs[name],
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
return obj;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function checkVisible({ _visible }) {
|
|
14
|
-
return _visible !== false && _visible !== '';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const SCOPE_SLOT_COMPONENT_LIB = ['tea_basis', 'tea_shop', 'crm_basis'];
|
|
18
|
-
|
|
19
|
-
const SCOPE_SLOT_MAP = SCOPE_SLOT_COMPONENT_LIB.reduce((map, lib) => {
|
|
20
|
-
map[`${lib}:TableMatching`] = {
|
|
21
|
-
headerSlot: true,
|
|
22
|
-
recordSlot: true,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
map[`${lib}:TableExpanded`] = {
|
|
26
|
-
headerSlot: true,
|
|
27
|
-
recordSlot: true,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
map[`${lib}:TabsTable`] = {
|
|
31
|
-
headerSlot: true,
|
|
32
|
-
recordSlot: true,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
map[`${lib}:Table`] = {
|
|
36
|
-
headerSlot: true,
|
|
37
|
-
recordSlot: true,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return map;
|
|
41
|
-
}, {});
|
|
42
|
-
|
|
43
|
-
export function isScopeSlot(comp, slot) {
|
|
44
|
-
const { 'x-props': xProps } = comp;
|
|
45
|
-
const sourceKey = xProps && xProps.sourceKey;
|
|
46
|
-
const map = SCOPE_SLOT_MAP[sourceKey];
|
|
47
|
-
return map && map[slot];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function _isMobile() {
|
|
51
|
-
if (window.matchMedia) {
|
|
52
|
-
return Boolean(window.matchMedia('(max-width: 1024px)')?.matches);
|
|
53
|
-
}
|
|
54
|
-
let check = false;
|
|
55
|
-
(function (a) {
|
|
56
|
-
if (
|
|
57
|
-
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
58
|
-
a,
|
|
59
|
-
) ||
|
|
60
|
-
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
|
|
61
|
-
a.substr(0, 4),
|
|
62
|
-
)
|
|
63
|
-
)
|
|
64
|
-
check = true;
|
|
65
|
-
})(navigator.userAgent || navigator.vendor || window.opera);
|
|
66
|
-
return check;
|
|
67
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Be default, variables on window of kbone are not shared across pages.
|
|
3
|
-
* Define vars to be shared across pages, Refer https://wechat-miniprogram.github.io/kbone/docs/domextend/#window-global
|
|
4
|
-
*/
|
|
5
|
-
function shareVarsCrossPage(vars) {
|
|
6
|
-
vars.forEach(name => {
|
|
7
|
-
Object.defineProperty(window, name, {
|
|
8
|
-
get: () => window.$$global[name],
|
|
9
|
-
set(v) {
|
|
10
|
-
window.$$global[name] = v
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (process.env.isMiniprogram) {
|
|
17
|
-
shareVarsCrossPage(['__mobxGlobals', '__mobxInstanceCount'])
|
|
18
|
-
}
|