@ray-js/framework 1.5.40 → 1.5.41

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.
@@ -16,5 +16,5 @@ export function createApp(options) {
16
16
  set(cfg, 'tabBar', normalizeTabBar(cfg.tabBar, cfg.routes));
17
17
 
18
18
  // 作为 web 构建的启动入口文件
19
- ReactDOM.render( /*#__PURE__*/React.createElement(Application, cfg), root);
19
+ ReactDOM.render(/*#__PURE__*/React.createElement(Application, cfg), root);
20
20
  }
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import '../../runtime';
3
2
  import React from 'react';
4
3
  import { createRouter } from '@ray-js/router';
@@ -13,13 +12,6 @@ const isClassComponent = Component => {
13
12
  export class Application extends React.Component {
14
13
  constructor(props) {
15
14
  super(props);
16
- _defineProperty(this, "getGlobalConfig", (path, defaultValue) => {
17
- const {
18
- globalConfig = {}
19
- } = this.props;
20
- const value = get(globalConfig, path, defaultValue);
21
- return value;
22
- });
23
15
  this.state = {};
24
16
  const title = this.getGlobalConfig(['window', 'navigationBarTitleText'], 'Ray App');
25
17
  document.title = title;
@@ -46,6 +38,13 @@ export class Application extends React.Component {
46
38
  }
47
39
  });
48
40
  }
41
+ getGlobalConfig = (path, defaultValue) => {
42
+ const {
43
+ globalConfig = {}
44
+ } = this.props;
45
+ const value = get(globalConfig, path, defaultValue);
46
+ return value;
47
+ };
49
48
  render() {
50
49
  const {
51
50
  app: App,
@@ -1,55 +1,14 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
+ import "core-js/modules/esnext.iterator.constructor.js";
2
+ import "core-js/modules/esnext.iterator.for-each.js";
2
3
  import React from 'react';
3
4
  import { lifecycle, PageInstance, PageInstanceContext } from '@ray-js/runtime';
4
5
  import { pageLifecycles } from '@ray-js/types';
5
6
  import { get } from '../../utils';
6
7
  import './index.module.less';
7
8
  export class PageWrapper extends React.Component {
9
+ $reachBottomDistance = 50;
8
10
  constructor(props) {
9
11
  super(props);
10
- _defineProperty(this, "$reachBottomDistance", 50);
11
- _defineProperty(this, "handlePageResize", () => {
12
- const windowWidth = document.documentElement.clientWidth;
13
- const windowHeight = document.documentElement.clientHeight;
14
- lifecycle.emit({
15
- uniqueId: this.$instance.uniqueId,
16
- name: pageLifecycles.onResize,
17
- args: {
18
- windowWidth,
19
- windowHeight
20
- }
21
- });
22
- });
23
- _defineProperty(this, "handlePageScroll", () => {
24
- const event = {
25
- scrollTop: window.scrollY
26
- };
27
- lifecycle.emit({
28
- uniqueId: this.$instance.uniqueId,
29
- name: pageLifecycles.onPageScroll,
30
- args: event
31
- });
32
- this.checkReachBottom();
33
- });
34
- _defineProperty(this, "checkReachBottom", () => {
35
- const isCurrentReachBottom = document.body.scrollHeight - (window.innerHeight + window.scrollY) <= this.$reachBottomDistance;
36
- if (!this.$isReachBottom && isCurrentReachBottom) {
37
- this.$isReachBottom = true;
38
- lifecycle.emit({
39
- uniqueId: this.$instance.uniqueId,
40
- name: pageLifecycles.onReachBottom
41
- });
42
- return;
43
- }
44
- this.$isReachBottom = isCurrentReachBottom;
45
- });
46
- _defineProperty(this, "getPageConfig", (field, defaultValue) => {
47
- const {
48
- page
49
- } = this.props;
50
- const pageConfig = page.config;
51
- return get(pageConfig, field, defaultValue);
52
- });
53
12
  this.$instance = new PageInstance();
54
13
  lifecycle.addInstance(this.$instance);
55
14
  this.getGlobalConfig = this.props.getGlobalConfig;
@@ -95,6 +54,48 @@ export class PageWrapper extends React.Component {
95
54
  lifecycle.removeInstance(this.$instance);
96
55
  // TODO: 实现 onPullDownRefresh 生命周期
97
56
  }
57
+ handlePageResize = () => {
58
+ const windowWidth = document.documentElement.clientWidth;
59
+ const windowHeight = document.documentElement.clientHeight;
60
+ lifecycle.emit({
61
+ uniqueId: this.$instance.uniqueId,
62
+ name: pageLifecycles.onResize,
63
+ args: {
64
+ windowWidth,
65
+ windowHeight
66
+ }
67
+ });
68
+ };
69
+ handlePageScroll = () => {
70
+ const event = {
71
+ scrollTop: window.scrollY
72
+ };
73
+ lifecycle.emit({
74
+ uniqueId: this.$instance.uniqueId,
75
+ name: pageLifecycles.onPageScroll,
76
+ args: event
77
+ });
78
+ this.checkReachBottom();
79
+ };
80
+ checkReachBottom = () => {
81
+ const isCurrentReachBottom = document.body.scrollHeight - (window.innerHeight + window.scrollY) <= this.$reachBottomDistance;
82
+ if (!this.$isReachBottom && isCurrentReachBottom) {
83
+ this.$isReachBottom = true;
84
+ lifecycle.emit({
85
+ uniqueId: this.$instance.uniqueId,
86
+ name: pageLifecycles.onReachBottom
87
+ });
88
+ return;
89
+ }
90
+ this.$isReachBottom = isCurrentReachBottom;
91
+ };
92
+ getPageConfig = (field, defaultValue) => {
93
+ const {
94
+ page
95
+ } = this.props;
96
+ const pageConfig = page.config;
97
+ return get(pageConfig, field, defaultValue);
98
+ };
98
99
  render() {
99
100
  const {
100
101
  page,
@@ -1,5 +1,4 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import "core-js/modules/web.dom-collections.iterator.js";
1
+ import "core-js/modules/esnext.iterator.map.js";
3
2
  import clsx from 'clsx';
4
3
  import React from 'react';
5
4
  import router from '@ray-js/router';
@@ -7,13 +6,10 @@ import { events, appStoreEmitter, renderOptions } from '../../store/appStore';
7
6
  import { withPublicPath } from '../../utils';
8
7
  import styles from './index.module.less';
9
8
  export class TabBar extends React.Component {
10
- constructor() {
11
- super(...arguments);
12
- _defineProperty(this, "state", {
13
- currentRoute: router.scheduler.currentRoute,
14
- renderOptions: renderOptions
15
- });
16
- }
9
+ state = (() => ({
10
+ currentRoute: router.scheduler.currentRoute,
11
+ renderOptions: renderOptions
12
+ }))();
17
13
  componentDidMount() {
18
14
  this.unChangeHandle = router.scheduler.on('routeChange', route => {
19
15
  this.setState({
@@ -61,7 +57,7 @@ export class TabBar extends React.Component {
61
57
  }
62
58
  }, item.icon && /*#__PURE__*/React.createElement("img", {
63
59
  className: styles.icon,
64
- src: "".concat(withPublicPath(isActive ? item.activeIcon : item.icon))
60
+ src: `${withPublicPath(isActive ? item.activeIcon : item.icon)}`
65
61
  }), /*#__PURE__*/React.createElement("span", {
66
62
  className: styles.text,
67
63
  style: {
@@ -3,13 +3,13 @@ export function responsive() {
3
3
  function setRem() {
4
4
  let clientWidth = htmlRoot.clientWidth;
5
5
  // clientWidth = Math.min(clientWidth, 640); // PC 模式下限定最大值
6
- htmlRoot.style.fontSize = "".concat(clientWidth / 7.5, "px");
6
+ htmlRoot.style.fontSize = `${clientWidth / 7.5}px`;
7
7
  const div = document.createElement('div');
8
8
  div.style.width = '7.5rem';
9
9
  document.body.appendChild(div);
10
- htmlRoot.style.fontSize = "".concat(parseFloat(htmlRoot.style.fontSize) * clientWidth / div.clientWidth, "px");
10
+ htmlRoot.style.fontSize = `${parseFloat(htmlRoot.style.fontSize) * clientWidth / div.clientWidth}px`;
11
11
  document.body.removeChild(div);
12
- document.body.style.fontSize = "16px";
12
+ document.body.style.fontSize = `16px`;
13
13
  }
14
14
  let b = null;
15
15
  window.addEventListener('resize', function () {
@@ -1,4 +1,3 @@
1
- import "core-js/modules/es.string.replace.js";
2
1
  export function withPublicPath(basePath) {
3
2
  return PUBLIC_PATH + basePath.replace(/^\//, '');
4
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/framework",
3
- "version": "1.5.40",
3
+ "version": "1.5.41",
4
4
  "description": "Ray Core",
5
5
  "keywords": [
6
6
  "ray"
@@ -23,12 +23,12 @@
23
23
  "watch": "tsc -p ./tsconfig.build.json --module esnext --outDir lib --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@ray-js/framework-mp": "1.5.40",
27
- "@ray-js/framework-shared": "1.5.40",
28
- "@ray-js/library": "1.5.40",
29
- "@ray-js/location": "1.5.40",
30
- "@ray-js/router": "1.5.40",
31
- "@ray-js/runtime": "1.5.40",
26
+ "@ray-js/framework-mp": "1.5.41",
27
+ "@ray-js/framework-shared": "1.5.41",
28
+ "@ray-js/library": "1.5.41",
29
+ "@ray-js/location": "1.5.41",
30
+ "@ray-js/router": "1.5.41",
31
+ "@ray-js/runtime": "1.5.41",
32
32
  "clsx": "^1.2.1",
33
33
  "hoist-non-react-statics": "^3.3.2",
34
34
  "lodash.get": "^4.4.2",
@@ -37,12 +37,12 @@
37
37
  "tiny-invariant": "^1.3.3"
38
38
  },
39
39
  "devDependencies": {
40
- "@ray-js/cli": "1.5.40",
41
- "@ray-js/types": "1.5.40"
40
+ "@ray-js/cli": "1.5.41",
41
+ "@ray-js/types": "1.5.41"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public",
45
45
  "registry": "https://registry.npmjs.com"
46
46
  },
47
- "gitHead": "e8a643ccba2beedc367608816be210c5f55120cf"
47
+ "gitHead": "08f9269589769f029e63b3835dfa92b48c6a6f15"
48
48
  }