Skip to content

Commit 5c29c18

Browse files
committed
dmeos
1 parent 8c15fd9 commit 5c29c18

File tree

22,297 files changed

+6242757
-409688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

22,297 files changed

+6242757
-409688
lines changed

accordion/accordion.d.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export { AccordionProperties } from "./../index";
55
export { Animation, AccordionExpandMode } from './../index';
66
export { AccordionItem } from './accordionitem';
77
export { AccordionItemProperties } from "./../index";
8-
export declare const Smart: any;
8+
declare let Smart: any;
9+
export { Smart };
910
export interface AccordionProps extends AccordionProperties {
1011
className?: string;
1112
style?: React.CSSProperties;
@@ -51,6 +52,11 @@ export declare class Accordion extends React.Component<React.HTMLAttributes<Elem
5152
*/
5253
get expandMode(): AccordionExpandMode | string;
5354
set expandMode(value: AccordionExpandMode | string);
55+
/** Sets or gets the unlockKey which unlocks the product.
56+
* Property type: string
57+
*/
58+
get unlockKey(): string;
59+
set unlockKey(value: string);
5460
/** Sets or gets the language. Used in conjunction with the property messages.
5561
* Property type: string
5662
*/
@@ -176,6 +182,7 @@ export declare class Accordion extends React.Component<React.HTMLAttributes<Elem
176182
componentWillUnmount(): void;
177183
render(): React.ReactElement<{
178184
ref: any;
179-
}, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
185+
suppressHydrationWarning: boolean;
186+
}, string | React.JSXElementConstructor<any>>;
180187
}
181188
export default Accordion;

accordion/accordion.esm.js

Lines changed: 129 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11

2-
if (!window['Smart']) {
3-
window['Smart'] = { RenderMode: 'manual' };
4-
}
5-
else {
6-
window['Smart'].RenderMode = 'manual';
7-
}
8-
import '../source/modules/smart.accordion';
2+
"use client";
3+
4+
import '../source/modules/smart.accordion'
95

6+
if(typeof window !== 'undefined') {
7+
if (!window['Smart']) {
8+
window['Smart'] = { RenderMode: 'manual' };
9+
}
10+
else {
11+
window['Smart'].RenderMode = 'manual';
12+
}
13+
//require('../source/modules/smart.accordion');
14+
}
1015
import React from 'react';
16+
import ReactDOM from 'react-dom/client';
1117

12-
const Smart = window.Smart;
18+
let Smart$1;
19+
if (typeof window !== "undefined") {
20+
Smart$1 = window.Smart;
21+
}
1322
/**
1423
Single item in an Accordion view.
1524
*/
1625
class AccordionItem extends React.Component {
17-
constructor(props) {
18-
super(props);
19-
this.componentRef = React.createRef();
20-
}
2126
// Gets the id of the React component.
2227
get id() {
2328
if (!this._id) {
@@ -77,11 +82,29 @@ class AccordionItem extends React.Component {
7782
get eventListeners() {
7883
return ["onCollapse", "onExpand", "onCreate", "onReady"];
7984
}
85+
constructor(props) {
86+
super(props);
87+
this.componentRef = React.createRef();
88+
}
8089
componentDidRender(initialize) {
8190
const that = this;
8291
const props = {};
8392
const events = {};
8493
let styles = null;
94+
const stringifyCircularJSON = (obj) => {
95+
const seen = new WeakSet();
96+
return JSON.stringify(obj, (k, v) => {
97+
if (v !== null && typeof v === 'object') {
98+
if (seen.has(v))
99+
return;
100+
seen.add(v);
101+
}
102+
if (k === 'Smart') {
103+
return v;
104+
}
105+
return v;
106+
});
107+
};
85108
for (let prop in that.props) {
86109
if (prop === 'children') {
87110
continue;
@@ -98,10 +121,27 @@ class AccordionItem extends React.Component {
98121
}
99122
if (initialize) {
100123
that.nativeElement = this.componentRef.current;
124+
that.nativeElement.React = React;
125+
that.nativeElement.ReactDOM = ReactDOM;
126+
if (that.nativeElement && !that.nativeElement.isCompleted) {
127+
that.nativeElement.reactStateProps = JSON.parse(stringifyCircularJSON(props));
128+
}
129+
}
130+
if (initialize && that.nativeElement && that.nativeElement.isCompleted) {
131+
// return;
101132
}
102133
for (let prop in props) {
103134
if (prop === 'class' || prop === 'className') {
104135
const classNames = props[prop].trim().split(' ');
136+
if (that.nativeElement._classNames) {
137+
const oldClassNames = that.nativeElement._classNames;
138+
for (let className in oldClassNames) {
139+
if (that.nativeElement.classList.contains(oldClassNames[className]) && oldClassNames[className] !== "") {
140+
that.nativeElement.classList.remove(oldClassNames[className]);
141+
}
142+
}
143+
}
144+
that.nativeElement._classNames = classNames;
105145
for (let className in classNames) {
106146
if (!that.nativeElement.classList.contains(classNames[className]) && classNames[className] !== "") {
107147
that.nativeElement.classList.add(classNames[className]);
@@ -119,7 +159,17 @@ class AccordionItem extends React.Component {
119159
that.nativeElement.setAttribute(prop, '');
120160
}
121161
const normalizedProp = normalizeProp(prop);
122-
that.nativeElement[normalizedProp] = props[prop];
162+
if (that.nativeElement[normalizedProp] === undefined) {
163+
that.nativeElement.setAttribute(prop, props[prop]);
164+
}
165+
if (props[prop] !== undefined) {
166+
if (typeof props[prop] === 'object' && that.nativeElement.reactStateProps && !initialize) {
167+
if (stringifyCircularJSON(props[prop]) === stringifyCircularJSON(that.nativeElement.reactStateProps[normalizedProp])) {
168+
continue;
169+
}
170+
}
171+
that.nativeElement[normalizedProp] = props[prop];
172+
}
123173
}
124174
}
125175
for (let eventName in events) {
@@ -161,19 +211,18 @@ class AccordionItem extends React.Component {
161211
}
162212
}
163213
render() {
164-
return (React.createElement("smart-accordion-item", { ref: this.componentRef }, this.props.children));
214+
return (React.createElement("smart-accordion-item", { ref: this.componentRef, suppressHydrationWarning: true }, this.props.children));
165215
}
166216
}
167217

168-
const Smart$1 = window.Smart;
218+
let Smart;
219+
if (typeof window !== "undefined") {
220+
Smart = window.Smart;
221+
}
169222
/**
170223
Accordion organizes content within collapsable items.
171224
*/
172225
class Accordion extends React.Component {
173-
constructor(props) {
174-
super(props);
175-
this.componentRef = React.createRef();
176-
}
177226
// Gets the id of the React component.
178227
get id() {
179228
if (!this._id) {
@@ -236,6 +285,17 @@ class Accordion extends React.Component {
236285
this.nativeElement.expandMode = value;
237286
}
238287
}
288+
/** Sets or gets the unlockKey which unlocks the product.
289+
* Property type: string
290+
*/
291+
get unlockKey() {
292+
return this.nativeElement ? this.nativeElement.unlockKey : undefined;
293+
}
294+
set unlockKey(value) {
295+
if (this.nativeElement) {
296+
this.nativeElement.unlockKey = value;
297+
}
298+
}
239299
/** Sets or gets the language. Used in conjunction with the property messages.
240300
* Property type: string
241301
*/
@@ -326,7 +386,7 @@ class Accordion extends React.Component {
326386
}
327387
// Gets the properties of the React component.
328388
get properties() {
329-
return ["animation", "dataSource", "disabled", "expandedIndexes", "expandMode", "locale", "localizeFormatFunction", "messages", "readonly", "reorder", "rightToLeft", "theme", "unfocusable"];
389+
return ["animation", "dataSource", "disabled", "expandedIndexes", "expandMode", "unlockKey", "locale", "localizeFormatFunction", "messages", "readonly", "reorder", "rightToLeft", "theme", "unfocusable"];
330390
}
331391
// Gets the events of the React component.
332392
get eventListeners() {
@@ -399,11 +459,29 @@ class Accordion extends React.Component {
399459
});
400460
}
401461
}
462+
constructor(props) {
463+
super(props);
464+
this.componentRef = React.createRef();
465+
}
402466
componentDidRender(initialize) {
403467
const that = this;
404468
const props = {};
405469
const events = {};
406470
let styles = null;
471+
const stringifyCircularJSON = (obj) => {
472+
const seen = new WeakSet();
473+
return JSON.stringify(obj, (k, v) => {
474+
if (v !== null && typeof v === 'object') {
475+
if (seen.has(v))
476+
return;
477+
seen.add(v);
478+
}
479+
if (k === 'Smart') {
480+
return v;
481+
}
482+
return v;
483+
});
484+
};
407485
for (let prop in that.props) {
408486
if (prop === 'children') {
409487
continue;
@@ -420,10 +498,27 @@ class Accordion extends React.Component {
420498
}
421499
if (initialize) {
422500
that.nativeElement = this.componentRef.current;
501+
that.nativeElement.React = React;
502+
that.nativeElement.ReactDOM = ReactDOM;
503+
if (that.nativeElement && !that.nativeElement.isCompleted) {
504+
that.nativeElement.reactStateProps = JSON.parse(stringifyCircularJSON(props));
505+
}
506+
}
507+
if (initialize && that.nativeElement && that.nativeElement.isCompleted) {
508+
// return;
423509
}
424510
for (let prop in props) {
425511
if (prop === 'class' || prop === 'className') {
426512
const classNames = props[prop].trim().split(' ');
513+
if (that.nativeElement._classNames) {
514+
const oldClassNames = that.nativeElement._classNames;
515+
for (let className in oldClassNames) {
516+
if (that.nativeElement.classList.contains(oldClassNames[className]) && oldClassNames[className] !== "") {
517+
that.nativeElement.classList.remove(oldClassNames[className]);
518+
}
519+
}
520+
}
521+
that.nativeElement._classNames = classNames;
427522
for (let className in classNames) {
428523
if (!that.nativeElement.classList.contains(classNames[className]) && classNames[className] !== "") {
429524
that.nativeElement.classList.add(classNames[className]);
@@ -441,15 +536,25 @@ class Accordion extends React.Component {
441536
that.nativeElement.setAttribute(prop, '');
442537
}
443538
const normalizedProp = normalizeProp(prop);
444-
that.nativeElement[normalizedProp] = props[prop];
539+
if (that.nativeElement[normalizedProp] === undefined) {
540+
that.nativeElement.setAttribute(prop, props[prop]);
541+
}
542+
if (props[prop] !== undefined) {
543+
if (typeof props[prop] === 'object' && that.nativeElement.reactStateProps && !initialize) {
544+
if (stringifyCircularJSON(props[prop]) === stringifyCircularJSON(that.nativeElement.reactStateProps[normalizedProp])) {
545+
continue;
546+
}
547+
}
548+
that.nativeElement[normalizedProp] = props[prop];
549+
}
445550
}
446551
}
447552
for (let eventName in events) {
448553
that[eventName] = events[eventName];
449554
that.nativeElement[eventName.toLowerCase()] = events[eventName];
450555
}
451556
if (initialize) {
452-
Smart$1.Render();
557+
Smart.Render();
453558
if (that.onCreate) {
454559
that.onCreate();
455560
}
@@ -484,9 +589,8 @@ class Accordion extends React.Component {
484589
}
485590
}
486591
render() {
487-
return (React.createElement("smart-accordion", { ref: this.componentRef }, this.props.children));
592+
return (React.createElement("smart-accordion", { ref: this.componentRef, suppressHydrationWarning: true }, this.props.children));
488593
}
489594
}
490595

491-
export default Accordion;
492-
export { Smart$1 as Smart, Accordion, AccordionItem };
596+
export { Accordion, AccordionItem, Smart, Accordion as default };

0 commit comments

Comments
 (0)