@ray-js/framework 1.4.30 → 1.4.32

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.
@@ -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,12 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import React from 'react';
3
2
  import { lifecycle, PageInstance, PageInstanceContext } from '@ray-js/runtime';
4
3
  import { pageLifecycles } from '@ray-js/types';
5
4
  import { get } from '../../utils';
6
5
  import './index.module.less';
7
6
  export class PageWrapper extends React.Component {
7
+ $reachBottomDistance = 50;
8
8
  constructor(props) {
9
9
  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
10
  this.$instance = new PageInstance();
54
11
  lifecycle.addInstance(this.$instance);
55
12
  this.getGlobalConfig = this.props.getGlobalConfig;
@@ -95,6 +52,48 @@ export class PageWrapper extends React.Component {
95
52
  lifecycle.removeInstance(this.$instance);
96
53
  // TODO: 实现 onPullDownRefresh 生命周期
97
54
  }
55
+ handlePageResize = () => {
56
+ const windowWidth = document.documentElement.clientWidth;
57
+ const windowHeight = document.documentElement.clientHeight;
58
+ lifecycle.emit({
59
+ uniqueId: this.$instance.uniqueId,
60
+ name: pageLifecycles.onResize,
61
+ args: {
62
+ windowWidth,
63
+ windowHeight
64
+ }
65
+ });
66
+ };
67
+ handlePageScroll = () => {
68
+ const event = {
69
+ scrollTop: window.scrollY
70
+ };
71
+ lifecycle.emit({
72
+ uniqueId: this.$instance.uniqueId,
73
+ name: pageLifecycles.onPageScroll,
74
+ args: event
75
+ });
76
+ this.checkReachBottom();
77
+ };
78
+ checkReachBottom = () => {
79
+ const isCurrentReachBottom = document.body.scrollHeight - (window.innerHeight + window.scrollY) <= this.$reachBottomDistance;
80
+ if (!this.$isReachBottom && isCurrentReachBottom) {
81
+ this.$isReachBottom = true;
82
+ lifecycle.emit({
83
+ uniqueId: this.$instance.uniqueId,
84
+ name: pageLifecycles.onReachBottom
85
+ });
86
+ return;
87
+ }
88
+ this.$isReachBottom = isCurrentReachBottom;
89
+ };
90
+ getPageConfig = (field, defaultValue) => {
91
+ const {
92
+ page
93
+ } = this.props;
94
+ const pageConfig = page.config;
95
+ return get(pageConfig, field, defaultValue);
96
+ };
98
97
  render() {
99
98
  const {
100
99
  page,
@@ -1,5 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import "core-js/modules/web.dom-collections.iterator.js";
3
1
  import clsx from 'clsx';
4
2
  import React from 'react';
5
3
  import router from '@ray-js/router';
@@ -7,13 +5,10 @@ import { events, appStoreEmitter, renderOptions } from '../../store/appStore';
7
5
  import { withPublicPath } from '../../utils';
8
6
  import styles from './index.module.less';
9
7
  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
- }
8
+ state = {
9
+ currentRoute: router.scheduler.currentRoute,
10
+ renderOptions: renderOptions
11
+ };
17
12
  componentDidMount() {
18
13
  this.unChangeHandle = router.scheduler.on('routeChange', route => {
19
14
  this.setState({
@@ -61,7 +56,7 @@ export class TabBar extends React.Component {
61
56
  }
62
57
  }, item.icon && /*#__PURE__*/React.createElement("img", {
63
58
  className: styles.icon,
64
- src: "".concat(withPublicPath(isActive ? item.activeIcon : item.icon))
59
+ src: `${withPublicPath(isActive ? item.activeIcon : item.icon)}`
65
60
  }), /*#__PURE__*/React.createElement("span", {
66
61
  className: styles.text,
67
62
  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.4.30",
3
+ "version": "1.4.32",
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.4.30",
27
- "@ray-js/framework-shared": "^1.4.30",
28
- "@ray-js/library": "^1.4.30",
29
- "@ray-js/location": "^1.4.30",
30
- "@ray-js/router": "^1.4.30",
31
- "@ray-js/runtime": "^1.4.30",
26
+ "@ray-js/framework-mp": "1.4.32",
27
+ "@ray-js/framework-shared": "1.4.32",
28
+ "@ray-js/library": "1.4.32",
29
+ "@ray-js/location": "1.4.32",
30
+ "@ray-js/router": "1.4.32",
31
+ "@ray-js/runtime": "1.4.32",
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.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@ray-js/cli": "^1.4.30",
41
- "@ray-js/types": "^1.4.30"
40
+ "@ray-js/cli": "1.4.32",
41
+ "@ray-js/types": "1.4.32"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public",
45
45
  "registry": "https://registry.npmjs.org"
46
46
  },
47
- "gitHead": "3fd8c1689f3cc6c461f192189056f67f6314f812"
47
+ "gitHead": "883f1ad59b1036a84b026e280e27c71ebdbc12cd"
48
48
  }