tee3apps-cms-sdk-react 0.0.35 → 0.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tee3apps-cms-sdk-react",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "Uses JSON to dynamically generate and render UI pages in a website",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var resolve = require('@rollup/plugin-node-resolve');
6
+ var commonjs = require('@rollup/plugin-commonjs');
7
+ var typescript = require('@rollup/plugin-typescript');
8
+ var dts = require('rollup-plugin-dts');
9
+ var terser = require('@rollup/plugin-terser');
10
+ var peerDepsExternal = require('rollup-plugin-peer-deps-external');
11
+ var postcss = require('rollup-plugin-postcss');
12
+
13
+ const packageJson = require("./package.json");
14
+
15
+ var rollup_config = [
16
+ {
17
+ input: "src/index.ts",
18
+ output: [
19
+ {
20
+ file: packageJson.main,
21
+ format: "cjs",
22
+ sourcemap: true,
23
+ },
24
+ {
25
+ file: packageJson.module,
26
+ format: "esm",
27
+ sourcemap: true,
28
+ },
29
+ ],
30
+ plugins: [
31
+ peerDepsExternal(),
32
+ resolve(),
33
+ commonjs(),
34
+ typescript({ tsconfig: "./tsconfig.json" }),
35
+ terser(),
36
+ postcss(),
37
+ ],
38
+ external: ["react", "react-dom"],
39
+ },
40
+ {
41
+ input: "src/index.ts",
42
+ output: [{ file: packageJson.types }],
43
+ plugins: [dts.default()],
44
+ external: [/\.css$/],
45
+ },
46
+ ];
47
+
48
+ exports.default = rollup_config;
package/src/Page.tsx CHANGED
@@ -124,7 +124,7 @@ const Page = ({ data, showsp = true, showdiscount = true }: any) => {
124
124
  deviceMode={deviceMode} />;
125
125
  }
126
126
  case 'RichTextBoxComponent':
127
- return <RichTextComponent key={compIndex} props={component.props as RichTextComponentProps} />;
127
+ return <RichTextComponent key={compIndex} props={component.props as RichTextComponentProps} deviceMode={deviceMode} />;
128
128
  default:
129
129
  return null;
130
130
  }
@@ -30,6 +30,7 @@ interface RowProps {
30
30
  nowrap: boolean;
31
31
  bgsize: React.CSSProperties['backgroundSize'];
32
32
  mode: DeviceModes;
33
+ idname:string;
33
34
  }
34
35
 
35
36
  interface RowComponentProps {
@@ -132,7 +133,8 @@ const getJustifyContent = (): React.CSSProperties['justifyContent'] => {
132
133
  };
133
134
 
134
135
  return (
135
- <div
136
+ <section
137
+ id={props.idname}
136
138
  style={{
137
139
  minHeight: getRowMinHeight(),
138
140
  backgroundColor: props.bgColor,
@@ -159,7 +161,7 @@ const getJustifyContent = (): React.CSSProperties['justifyContent'] => {
159
161
  }}
160
162
  >
161
163
  {children}
162
- </div>
164
+ </section>
163
165
  );
164
166
  };
165
167
 
@@ -1,13 +1,21 @@
1
1
  import React from 'react';
2
2
 
3
3
  export interface RichTextComponentProps {
4
- content: {
5
- all: string;
4
+ content?: {
5
+ all?: string;
6
+ } | string;
7
+ mode?: {
8
+ [key: string]: {
9
+ content: string;
10
+ };
6
11
  };
7
12
  }
8
13
 
9
- const RichTextComponent: React.FC<{ props: RichTextComponentProps }> = ({ props }) => {
10
- const htmlContent = props?.content?.all || props?.content;
14
+ const RichTextComponent: React.FC<{ props: RichTextComponentProps; deviceMode?: string }> = ({ props, deviceMode = 'web' }) => {
15
+ const modeData = props?.mode?.[deviceMode] as { content?: string } | undefined;
16
+ const contentAll = typeof props?.content === 'string' ? props?.content : props?.content?.all;
17
+
18
+ const htmlContent = modeData?.content || contentAll || '';
11
19
 
12
20
  return (
13
21
  <div