@grapecity/wijmo.react.base 5.20241.7 → 5.20241.19
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/COMMERCIAL-LICENSE.html +5 -19
- package/es2015-commonjs.js +2 -2
- package/es2015-esm.js +2 -2
- package/es5-esm.js +2 -2
- package/index.d.ts +72 -67
- package/index.js +2 -2
- package/package.json +2 -2
package/COMMERCIAL-LICENSE.html
CHANGED
|
@@ -143,28 +143,14 @@ other than You as a single Developer. By way of example, if a company has five
|
|
|
143
143
|
developers using the Software, the company needs to purchase five licenses,
|
|
144
144
|
irrespective of how the Software is accessed or how many installations are accessed
|
|
145
145
|
<br>
|
|
146
|
-
License to Distribute. You are licensed to distribute the SOFTWARE as an incorporated
|
|
147
|
-
part of your Applications on a royalty-free basis. Additionally, You are licensed to use
|
|
148
|
-
and to modify the source code of the SOFTWARE for use in Applications, and You ow n
|
|
149
|
-
any original work authored by you. MESCIUS retains all copyright and other intellectual
|
|
150
|
-
property rights in and to the SOFTWARE.
|
|
146
|
+
License to Distribute. You are licensed to distribute the SOFTWARE as an incorporated part of your Applications on a royalty-free basis. Additionally, You are licensed to use and to modify the source code of the SOFTWARE for use in Applications, and You own any original work authored by you. MESCIUS retains all copyright and other intellectual property rights in and to the SOFTWARE.
|
|
151
147
|
<br>
|
|
152
|
-
Limitations. You must purchase another separate license to the SOFTWARE for each
|
|
153
|
-
additional Developer. You are not licensed to move, remove, edit, or obscure any
|
|
154
|
-
copyright, trademark, attribution, warning or disclaimer notices in the SOFTWARE. You
|
|
155
|
-
may use the SOFTWARE only to create Applications that are significantly different than
|
|
156
|
-
and do not compete with the SOFTWARE. Users of your Applications are not permitted
|
|
157
|
-
to use the SOFTWARE for development purposes, unless they also purchase a separate
|
|
158
|
-
commercial license from MESCIUS for each of the users.
|
|
148
|
+
Limitations. You must purchase another separate license to the SOFTWARE for each additional Developer. You are not licensed to move, remove, edit, or obscure any copyright, trademark, attribution, warning or disclaimer notices in the SOFTWARE. You may use the SOFTWARE only to create Applications that are significantly different than and do not compete with the SOFTWARE. Users of your Applications are not permitted to use the SOFTWARE for development purposes, unless they also purchase a separate commercial license from MESCIUS for each of the users.
|
|
159
149
|
</li>
|
|
160
150
|
<li>
|
|
161
|
-
<strong>Deployment License.</strong> Subject to the terms and conditions of this EULA, You are granted
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
to be included in an encrypted distribution key. If you are unable or unwilling to specify
|
|
165
|
-
each hostname, You can pay an additional fee to obtain a key that does not require
|
|
166
|
-
hostnames. The license grant does not extend to other Company affiliates or
|
|
167
|
-
subsidiaries.
|
|
151
|
+
<strong>Deployment License.</strong> Subject to the terms and conditions of this EULA and the terms of your purchase, You are granted a Perpetual or Annual license to distribute or deploy the SOFTWARE as part of your Application. You are licensed to deploy the SOFTWARE up to the total number of hostnames, domains or desktop and mobile applications included in your purchase. The license grant does not extend to other Company affiliates or subsidiaries.
|
|
152
|
+
<br>
|
|
153
|
+
A Unique Deployment License Key(s) will be generated for your site(s) or application(s).
|
|
168
154
|
</li>
|
|
169
155
|
<li><strong>Source Code License.</strong> This section applies only to a Source Code License. Subject to the
|
|
170
156
|
terms and conditions of this EULA, if You separately acquire a Source Code License, You
|
package/es2015-commonjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20241.
|
|
3
|
+
* Wijmo Library 5.20241.19
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(o,s){function fulfilled(t){try{step(n.next(t))}catch(t){s(t)}}function rejected(t){try{step(n.throw(t))}catch(t){s(t)}}function step(t){t.done?o(t.value):new i((function(e){e(t.value)})).then(fulfilled,rejected)}step((n=n.apply(t,e||[])).next())}))},__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),ReactDOM=__importStar(require("react-dom")),React=__importStar(require("react")),flushSyncPolyfill=t=>{t()},createRootPolyfill=()=>{throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill};let reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const t=require("react-dom/client");reactDomClient=t||ReactDOM||ReactDomPolyfill;flushSync=t.flushSync||flushSync}catch(t){reactDomClient=ReactDOM||ReactDomPolyfill}}))}class ComponentBase extends React.Component{constructor(t,e,i){super(t);this._objPropHash={};this._isMounted=!1;this._mountedCBs=[];this._hostRef=t=>this._hostRefValue=t;this._beforeRender=new wijmo_1.Event;this._afterRender=new wijmo_1.Event;this._beforeWillUnmount=new wijmo_1.Event;this._afterWillUnmount=new wijmo_1.Event;this._beforeDidUpdate=new wijmo_1.Event;this._afterDidUpdate=new wijmo_1.Event;if(this._isMounted&&!this._isChild()){clearTimeout(this.timer);return this}if(!ComponentBase._reactMajorVersion){const t=parseInt(React.version);ComponentBase._reactMajorVersion=t;t>=18&&lazyImportDomClient()}this.props=t;this.controlType=e;for(let t of i&&i.objectProps||[])this._objPropHash[t]=!0}render(){this._onBeforeRender();const t=this._renderImpl();this._onAfterRender();this.renderResult=t;if(this._isMounted&&!this._isChild()){clearTimeout(this.timer);return this.renderResult}return t}componentDidMount(){if(this._isMounted){clearTimeout(this.timer);return this.control}if(this._isChild()){let t=this.props[ComponentBase._propsParent];t&&t._mountedCB(()=>{this._setParent(t)})}else this._prepareControl();this._isMounted=!0;return this.control}static selectiveDomRender(t,e,i=!0){if(ComponentBase._reactMajorVersion<18)ReactDOM.render(t,e);else{const i=ComponentBase.elemRootMap.findIndex(t=>t.host===e);let n;if(-1===i){n=reactDomClient.createRoot(e);ComponentBase.elemRootMap.push({host:e,root:n})}else n=ComponentBase.elemRootMap[i].root;flushSync(()=>{n.render(t)})}return e}static selectiveDomUnmount(t){if(ComponentBase._reactMajorVersion<18)ReactDOM.unmountComponentAtNode(t);else{const e=ComponentBase.elemRootMap.findIndex(e=>e.host===t);if(-1!==e){const t=ComponentBase.elemRootMap[e].root;flushSync(()=>{t.unmount();ComponentBase.elemRootMap.splice(e,1)})}}}componentWillUnmount(){this._onBeforeWillUnmount();this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();let t=this.control;if(t)if(this._isChild()){let e=this._getParentProp();if(e){let i=this.parent.control[e];if(wijmo_1.isArray(i)){let e=i.indexOf(t);if(e>-1){const t=i[e];"Sheet"===t.constructor.name&&t._isEmptyGrid||i.splice(e,1)}}}}else t instanceof wijmo_1.Control&&(this.timer=setTimeout(()=>{if(t.hostElement){t._orgOuter=null;t.dispose()}},5));this._onAfterWillUnmount()}shouldComponentUpdate(t){return!0}componentDidUpdate(t){this._onBeforeDidUpdate();var e=this.control;this._copy(e,this.props,t);this._onAfterDidUpdate()}_mountedCB(t){this._isMounted&&!this._isChild()?t():this._isMounted||this._mountedCBs.push(t);setTimeout(()=>{this._mountedCBs.includes(t)||this._mountedCBs.push(t)},wijmo_1.isSafari?200:10)}_renderImpl(){let t={};t[ComponentBase._propsParent]=this;let e=React.Children.map(this.props.children,e=>e&&React.cloneElement(e,t));const i={ref:this._hostRef};this._isChild()&&(i.style={display:"none"});return React.createElement("div",i,e)}_onBeforeRender(t){this._beforeRender.raise(this,t)}_onAfterRender(t){this._afterRender.raise(this,t)}_onBeforeWillUnmount(t){this._beforeWillUnmount.raise(this,t)}_onAfterWillUnmount(t){this._afterWillUnmount.raise(this,t)}_onBeforeDidUpdate(t){this._beforeDidUpdate.raise(this,t)}_onAfterDidUpdate(t){this._afterDidUpdate.raise(this,t)}_createControl(){const t=this._isChild()?this._isParentInCtor()?this.parent.control:void 0:this._getElement();t instanceof Element&&this.props.id&&t.setAttribute("id",this.props.id);const e=new this.controlType(t);e.workingAs="React";return e}_prepareControl(){this._renderImpl();let t=this._getElement(),e=this.props;t&&!this._isChild()&&ComponentBase._copyAttrs(t,e,wijmo_1.Control._rxInputAtts);let i=this.control=this._createControl(),n=i instanceof wijmo_1.Control,o=ComponentBase;t=this._getElement();if(!this._siblingId){null==this.constructor[o._typeSiblingIdProp]&&(this.constructor[o._typeSiblingIdProp]=++o._siblingDirId+"");this._siblingId=this.constructor[o._typeSiblingIdProp]}if(t){t.setAttribute(o._typeSiblingIdProp,this._siblingId);var s={};for(var r in e){let n=e[r];this._ignoreProp(r)||wijmo_1.isUndefined(n)||(r in i?s[r]=n:this._setHostAttribute(t,r,n))}n?i.initialize(s):this._copy(i,s,null,!0);setTimeout(()=>{let t=this._mountedCBs;for(let e in t){t[e]();delete t[e]}wijmo_1.isFunction(e.initialized)&&e.initialized(i);this._isMounted=!0},wijmo_1.isSafari?201:100)}}_initParent(){if(!this._getElement())return;let t=this._getParentProp();if(t){let e=this.parent.control,i=e[t];if(wijmo_1.isArray(i)){let t=this._getSiblingIndex();(t<0||t>=i.length)&&(t=i.length);i.splice(t,0,this.control);const e=this._getElement();this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(e,{childList:!0})}else e[t]=this.control}}_setParent(t){if(t!==this.parent){if(this.parent)throw"Wijmo child component is already attached to a different parent.";this.parent=t;this._prepareControl();this._initParent()}}_isChild(){return null!=this._parentProp||null!=this._parentInCtor}_isParentInCtor(){return!0===this._parentInCtor}_getParentProp(){return this.props.wjProperty||this._parentProp}_getSiblingIndex(){var t=this._getElement(),e=t.parentElement;if(!e)return-1;for(var i=e.childNodes,n=-1,o=this._siblingId,s=0;s<i.length;s++){var r=i[s];if(1==r.nodeType&&r.getAttribute(ComponentBase._typeSiblingIdProp)==o){++n;if(r===t)return n}}return-1}_siblingInserted(t){for(let e of t)if("childList"===e.type&&e.addedNodes.length>0){if(Array.from(e.addedNodes).some(t=>t===this._getElement())){const t=this._getSiblingIndex(),e=this.control,i=this.parent.control[this._getParentProp()],n=i.indexOf(e);if(t>=0&&n>=0&&t!==n){i.splice(n,1);const o=Math.min(t,i.length);i.splice(o,0,e)}}}}_copy(t,e,i,n=!1){if(!t||!e)return;let o,s=t===this.control;for(var r in e)if(!this._ignoreProp(r)||!s){var l=e[r];if(r in t){if(this._isEvent(t,r))n&&wijmo_1.isFunction(l)&&t[r].addHandler(l);else if(!i||!this._sameValue(i[r],l))if(null==l)t[r]=l;else if(wijmo_1.isPrimitive(l)||wijmo_1.isFunction(l)||this._objPropHash[r]&&t===(o||(o=this.control)))t[r]=l;else if(wijmo_1.isArray(l)&&wijmo_1.isArray(t[r])){let e=t[r],i=l;if(i.length==e.length)for(var a=0;a<i.length;a++){if(i[a]!==e[a])return!1;this._copy(e[a],i[a])}}else wijmo_1.isObject(l)&&this._copy(t[r],e[r])}else this._setHostAttribute(t.hostElement,r,e[r])}}_setHostAttribute(t,e,i){if(t)switch(e){case"className":const n=this._appliedClassName;if(n!==i){wijmo_1.removeClass(t,n);wijmo_1.addClass(t,i);this._appliedClassName=i}break;case"style":wijmo_1.setCss(t,i);break;default:null!=t[e]?t[e]=i:"string"==typeof i&&"$"!==e[0]&&t.setAttribute(e,i)}}_sameValue(t,e){return t==e||wijmo_1.DateTime.equals(t,e)}_isEvent(t,e){let i=t&&t[e];return null!=i&&i instanceof wijmo_1.Event}_getElement(){return this._hostRefValue}_ignoreProp(t){return"children"===t}static _copyAttrs(t,e,i){if(t)for(let n in e)n.match(i)&&t.setAttribute(n,e[n])}static isInStrictMode(t){return!!(t.hasOwnProperty("_reactInternalFiber")&&1&t._reactInternalFiber.mode)}}ComponentBase._propsParent="$parent";ComponentBase._typeSiblingIdProp="_wjSiblingIdProp";ComponentBase._siblingDirId=0;ComponentBase.elemRootMap=[];exports.ComponentBase=ComponentBase;
|
|
14
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(e,r,t,n){return new(t||(t=Promise))((function(o,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):new t((function(r){r(e.value)})).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())}))},__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(r[t]=e[t]);r.default=e;return r};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),ReactDOM=__importStar(require("react-dom")),React=__importStar(require("react")),flushSyncPolyfill=e=>{e()},createRootPolyfill=()=>{throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill};let reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const e=require("react-dom/client");reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e.flushSync||flushSync}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}}))}let _oldSyncBehavior=!0;function strictStateMode(e=!1){e==_oldSyncBehavior&&(_oldSyncBehavior=!wijmo_1.asBoolean(e,!1))}exports.strictStateMode=strictStateMode;exports.ControlBaseMeta={inputs:["isDisabled","tabOrder"],events:["gotFocus","invalidInput","lostFocus","refreshed","refreshing"]};const alwaysClearProps=new Set(["columns","columnGroups"]),unsuppressedChangedEventProps=new Set(["panes","columnGroups","columns","items"]),specialProps=new Set(["initialized","wjItemTemplate"]);function updateChildProperties(e,r){const t=e.controlRef.current,n={},o={};if(r){const s=wijmo_1.isArray(r)?r.flat(1/0):[r],c=[];let i=0;const l=new Set;for(let e of s){if(e&&e.type&&e.type.$$typeof==Symbol.for("react.forward_ref")){c.push(e.type.render(e.props,e.ref));c[c.length-1].$index=i;c[c.length-1].$key=e.key}else if(e&&wijmo_1.isFunction(e.type)){c.push(e.type(e.props));c[c.length-1].$index=i;c[c.length-1].$key=e.key}e||l.add(i);i++}const a=[];for(let e of c)if(e.assignedToParent){if(e.wjProperty){e.parentProp=wijmo_1.asString(e.wjProperty);e.isParentPropArray=t[e.parentProp]&&wijmo_1.isArray(t[e.parentProp])}e.isParentPropArray&&!n[e.parentProp]&&(n[e.parentProp]=[]);e.isParentPropArray?n[e.parentProp].push({getInstance:e.getInstance,props:e.props,$key:e.$key,$index:e.$index}):n[e.parentProp]={getInstance:e.getInstance,props:e.props}}else a.push(e);const u=e.childInfo;for(let e in n)if(wijmo_1.isArray(n[e])){let r=!1;if(t[e]&&null!=t[e]._updating&&!unsuppressedChangedEventProps.has(e)){t[e]._updating++;r=!0}let s=u[e];o[e]=[];if(!u[e]){s=[];t[e]&&t[e].clear?t[e].clear():t[e]||(t[e]=new wijmo_1.ObservableArray)}!_oldSyncBehavior&&alwaysClearProps.has(e)&&t[e]&&t[e].clear&&t[e].clear();if(_oldSyncBehavior)for(let r=s.length-1;r>=0;r--)if(l.has(s[r].$index)){t[e].remove(s[r].instance);s.splice(r,1)}const c=[],i={};for(let e of s)null!=e.$key?i[""+e.$key]=e:c.push(e);let a=0;const getExistingInstance=(e=null)=>{if(null!=e){let r=i[e];null!=r&&delete i[e];return r}return c[a++]};for(let r=0;r<n[e].length;r++){let s=getExistingInstance(n[e][r].$key),c=!1;if(s)s.updateProps(n[e][r].props);else{s=n[e][r].getInstance(t);c=!0}s.$index=n[e][r].$index;s.$key=n[e][r].$key;(!_oldSyncBehavior&&alwaysClearProps.has(e)||c)&&(t[e].length==r?t[e].push(s.instance):t[e].splice(r,0,s.instance));o[e].push(s)}for(let r of Object.keys(i))t[e].remove(i[r].instance);for(;!_oldSyncBehavior&&t[e].length>o[e].length;)t[e].pop();if(r){t[e]._updating--;u[e]&&u[e].length==n[e].length||t[e]._raiseCollectionChanged&&t[e]._raiseCollectionChanged()}}else{let r=u[e];if(r)r.updateProps(n[e].props);else{r=n[e].getInstance(t);t[e]=r.instance}o[e]=r}const p=[];for(let e of u.$_nonassignable||[])l.has(e.$index)?e.instance&&e.instance.dispose&&wijmo_1.isFunction(e.instance.dispose)&&e.instance.dispose():p.push(e);const f=[];let d=0;for(;d<a.length;d++){let e=p[d];e?e.updateProps(a[d].props):e=a[d].getInstance(t);e.$index=a[d].$index;f.push(e)}o.$_nonassignable=f;for(;d<p.length;d++)p[d].instance&&p[d].instance.dispose&&wijmo_1.isFunction(p[d].instance.dispose)&&p[d].instance.dispose()}if(_oldSyncBehavior)for(let r of Object.keys(e.childInfo))if(wijmo_1.isArray(e.childInfo[r])&&!n[r]&&t[r]&&t[r].remove)for(let n of e.childInfo[r])t[r].remove(n.instance);return o}function getPropsAccordingToSyncMode(e,r,t=null){if(!r||!_oldSyncBehavior){return Object.assign({},e)}let n={};for(let o in e){let s=!1;t&&(s=t.knowProperties.has(o)||t.knowEvents.has(o)||t.knowCustomProps.has(o));(t&&!s||e[o]!==r[o])&&(n[o]=e[o])}return n}function useWjComponentBase(e){const r=React.useRef({}),t=React.useRef(),n=React.useRef(),o=React.useRef(),s=React.useRef(),c=React.useRef({}),i=React.useRef(!1);e.customProps||(e.customProps={});if(!t.current){t.current={};t.current.knowProperties=new Set(e.properties);t.current.knowEvents=new Set(e.events);t.current.knowCustomProps=new Set(Object.keys(e.customProps))}let l=e.props;if(s.current){l=getPropsAccordingToSyncMode(e.props,r.current,t.current);r.current=e.props}const a={},u={},p={},f={},d=e.ref||null;for(let r in l)if(t.current.knowProperties.has(r))a[r]=l[r];else if(t.current.knowEvents.has(r)){u[r]=l[r];a[r]=l[r]}else e.customProps[r]?f[r]=l[r]:specialProps.has(r)||(p[r]=l[r]);if(s.current&&_oldSyncBehavior)for(let e in u)delete a[e];const updateProps=()=>{d&&d.current&&(d.current.props=e.props);updateChildProps();let r=[],t=a;if(o.current&&s.current&&!_oldSyncBehavior){for(let e in o.current)if(s.current[e]){if(s.current[e]._handlersChanged){s.current[e]._cachedHandlersChanged=s.current[e]._handlersChanged;s.current[e]._handlersChanged=null;r.push(s.current[e])}s.current[e].removeHandler(o.current[e])}t=Object.assign({},a);for(let e in u){delete t[e];s.current[e].addHandler(u[e])}}else if(!o.current){t=Object.assign({},a);for(let e in u)delete t[e]}o.current=u;if(s.current){wijmo_1.copy(s.current,t,!1,!0);for(let r in f)e.customProps[r](s.current,f[r]);(()=>{for(let e of r)if(e._cachedHandlersChanged){e._handlersChanged=e._cachedHandlersChanged;e._cachedHandlersChanged=null}r=[]})();s.current.invalidate()}},updateChildProps=()=>{c.current=updateChildProperties({controlRef:s,childInfo:c.current},e.props.children)};React.useEffect(()=>{if(n.current&&!s.current){s.current=new e.constructor(n.current,a);e.prePropsInit&&e.prePropsInit(s.current);d&&(wijmo_1.isFunction(d)?d({control:s.current,props:e.props}):d.current&&d.current.control==s.current||(d.current={control:s.current,props:e.props}));updateProps();e.initControl&&e.initControl(s.current);e.props.initialized&&setTimeout(()=>{s.current&&e.props.initialized(s.current)})}else i.current&&(i.current=!1);return()=>{if(s.current){const e=s.current;i.current=!0;queueMicrotask(()=>{if(i.current){e.dispose();s.current=null;c.current={};i.current=!1}})}}},[]);s.current&&updateProps();return{renderResult:React.createElement("div",Object.assign({ref:n},p),[]),wjControl:s.current}}exports.useWjComponentBase=useWjComponentBase;function filterKnownProps(e,r,t){const n={};for(let o in e)(r.has(o)||t.has(o))&&(n[o]=e[o]);return n}function clearAndGetEvents(e,r,t,n){const o=n.current;for(let r in o)e[r]&&e[r].removeHandler(o[r]);const s={};for(let e in r)t.has(e)&&(s[e]=r[e]);return s}function getCustomPropsData(e,r){const t={};for(let n in r)void 0!==e[n]&&(t[n]=e[n]);return t}function useWjComponentChildBase(e){const r={};r.knowProperties=new Set(e.properties);r.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:t=>{const n={current:{}},o={current:{}},s={current:{}},c=getPropsAccordingToSyncMode(e.props,n.current),i=filterKnownProps(c,r.knowProperties,r.knowEvents),l=getCustomPropsData(c,e.customProps||{}),a=e.customConstructor?e.customConstructor(t,i,l):new e.constructor(e.needParentInstance?t:i,e.needParentInstance?i:void 0);e.ref&&(wijmo_1.isFunction(e.ref)?e.ref({control:a,props:e.props}):e.ref.current&&e.ref.current.control==a||(e.ref.current={control:a,props:e.props}));s.current=clearAndGetEvents(a,c,r.knowEvents,s);const updateProps=t=>{const c=getPropsAccordingToSyncMode(t,n.current);n.current=t;e.ref&&e.ref.current&&(e.ref.current.props=t);s.current=clearAndGetEvents(a,c,r.knowEvents,s);const i=filterKnownProps(c,r.knowProperties,r.knowEvents);a.initialize?a.initialize(i):wijmo_1.copy(a,i,!1,!0);for(let r in e.customProps)void 0!==c[r]&&e.customProps[r](a,c[r]);(e=>{o.current=updateChildProperties({controlRef:{current:a},childInfo:o.current},e)})(t.children||[])};updateProps(e.props||[]);e.props.initialized&&wijmo_1.isFunction(e.props.initialized)&&e.props.initialized(a);return{instance:a,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}exports.useWjComponentChildBase=useWjComponentChildBase;let _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){const e=parseInt(React.version);_reactMajorVersion=e;e>=18&&lazyImportDomClient()}const flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{const e=console.error;let r=!1;console.error=function(){const e=arguments[0]||"";e.includes("flushSync")&&(r=!0)};flushSync(()=>{});console.error=e;flushSyncStateCache.isReactRendering=r}catch(e){}finally{queueMicrotask(()=>{flushSyncStateCache.isReactRendering=null})}return!!flushSyncStateCache.isReactRendering}function selectiveDomRender(e,r,t=!1){if(_reactMajorVersion<18)ReactDOM.render(e,r);else{isReactRendering()&&(t=!0);const n=elemRootMap.findIndex(e=>e.host===r);let o;if(-1===n){o=reactDomClient.createRoot(r);elemRootMap.push({host:r,root:o})}else o=elemRootMap[n].root;o.__scheduledForUnmount=!1;t?queueMicrotask(()=>{flushSync(()=>{o.render(e)})}):flushSync(()=>{o.render(e)})}return r}exports.selectiveDomRender=selectiveDomRender;function selectiveDomUnmount(e){if(_reactMajorVersion<18)ReactDOM.unmountComponentAtNode(e);else{const r=elemRootMap.findIndex(r=>r.host===e);if(-1!==r){const e=elemRootMap[r].root;if(isReactRendering()){e.__scheduledForUnmount=!0;queueMicrotask(()=>{e.__scheduledForUnmount&&flushSync(()=>{e.unmount();e.__scheduledForUnmount=null;elemRootMap.splice(r,1)})})}else flushSync(()=>{e.unmount();elemRootMap.splice(r,1)})}}}exports.selectiveDomUnmount=selectiveDomUnmount;function baseFlushSync(){flushSync(()=>{})}exports.baseFlushSync=baseFlushSync;
|
package/es2015-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20241.
|
|
3
|
+
* Wijmo Library 5.20241.19
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,o){function fulfilled(t){try{step(n.next(t))}catch(t){o(t)}}function rejected(t){try{step(n.throw(t))}catch(t){o(t)}}function step(t){t.done?s(t.value):new i((function(e){e(t.value)})).then(fulfilled,rejected)}step((n=n.apply(t,e||[])).next())}))};import{Control,Event,isArray,addClass,removeClass,setCss,isFunction,isPrimitive,isObject,DateTime,isUndefined,isSafari}from"@grapecity/wijmo";import*as ReactDOM from"react-dom";import*as React from"react";const flushSyncPolyfill=t=>{t()},createRootPolyfill=()=>{throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill};let reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const t=require("react-dom/client");reactDomClient=t||ReactDOM||ReactDomPolyfill;flushSync=t.flushSync||flushSync}catch(t){reactDomClient=ReactDOM||ReactDomPolyfill}}))}export class ComponentBase extends React.Component{constructor(t,e,i){super(t);this._objPropHash={};this._isMounted=!1;this._mountedCBs=[];this._hostRef=t=>this._hostRefValue=t;this._beforeRender=new Event;this._afterRender=new Event;this._beforeWillUnmount=new Event;this._afterWillUnmount=new Event;this._beforeDidUpdate=new Event;this._afterDidUpdate=new Event;if(this._isMounted&&!this._isChild()){clearTimeout(this.timer);return this}if(!ComponentBase._reactMajorVersion){const t=parseInt(React.version);ComponentBase._reactMajorVersion=t;t>=18&&lazyImportDomClient()}this.props=t;this.controlType=e;for(let t of i&&i.objectProps||[])this._objPropHash[t]=!0}render(){this._onBeforeRender();const t=this._renderImpl();this._onAfterRender();this.renderResult=t;if(this._isMounted&&!this._isChild()){clearTimeout(this.timer);return this.renderResult}return t}componentDidMount(){if(this._isMounted){clearTimeout(this.timer);return this.control}if(this._isChild()){let t=this.props[ComponentBase._propsParent];t&&t._mountedCB(()=>{this._setParent(t)})}else this._prepareControl();this._isMounted=!0;return this.control}static selectiveDomRender(t,e,i=!0){if(ComponentBase._reactMajorVersion<18)ReactDOM.render(t,e);else{const i=ComponentBase.elemRootMap.findIndex(t=>t.host===e);let n;if(-1===i){n=reactDomClient.createRoot(e);ComponentBase.elemRootMap.push({host:e,root:n})}else n=ComponentBase.elemRootMap[i].root;flushSync(()=>{n.render(t)})}return e}static selectiveDomUnmount(t){if(ComponentBase._reactMajorVersion<18)ReactDOM.unmountComponentAtNode(t);else{const e=ComponentBase.elemRootMap.findIndex(e=>e.host===t);if(-1!==e){const t=ComponentBase.elemRootMap[e].root;flushSync(()=>{t.unmount();ComponentBase.elemRootMap.splice(e,1)})}}}componentWillUnmount(){this._onBeforeWillUnmount();this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();let t=this.control;if(t)if(this._isChild()){let e=this._getParentProp();if(e){let i=this.parent.control[e];if(isArray(i)){let e=i.indexOf(t);if(e>-1){const t=i[e];"Sheet"===t.constructor.name&&t._isEmptyGrid||i.splice(e,1)}}}}else t instanceof Control&&(this.timer=setTimeout(()=>{if(t.hostElement){t._orgOuter=null;t.dispose()}},5));this._onAfterWillUnmount()}shouldComponentUpdate(t){return!0}componentDidUpdate(t){this._onBeforeDidUpdate();var e=this.control;this._copy(e,this.props,t);this._onAfterDidUpdate()}_mountedCB(t){this._isMounted&&!this._isChild()?t():this._isMounted||this._mountedCBs.push(t);setTimeout(()=>{this._mountedCBs.includes(t)||this._mountedCBs.push(t)},isSafari?200:10)}_renderImpl(){let t={};t[ComponentBase._propsParent]=this;let e=React.Children.map(this.props.children,e=>e&&React.cloneElement(e,t));const i={ref:this._hostRef};this._isChild()&&(i.style={display:"none"});return React.createElement("div",i,e)}_onBeforeRender(t){this._beforeRender.raise(this,t)}_onAfterRender(t){this._afterRender.raise(this,t)}_onBeforeWillUnmount(t){this._beforeWillUnmount.raise(this,t)}_onAfterWillUnmount(t){this._afterWillUnmount.raise(this,t)}_onBeforeDidUpdate(t){this._beforeDidUpdate.raise(this,t)}_onAfterDidUpdate(t){this._afterDidUpdate.raise(this,t)}_createControl(){const t=this._isChild()?this._isParentInCtor()?this.parent.control:void 0:this._getElement();t instanceof Element&&this.props.id&&t.setAttribute("id",this.props.id);const e=new this.controlType(t);e.workingAs="React";return e}_prepareControl(){this._renderImpl();let t=this._getElement(),e=this.props;t&&!this._isChild()&&ComponentBase._copyAttrs(t,e,Control._rxInputAtts);let i=this.control=this._createControl(),n=i instanceof Control,s=ComponentBase;t=this._getElement();if(!this._siblingId){null==this.constructor[s._typeSiblingIdProp]&&(this.constructor[s._typeSiblingIdProp]=++s._siblingDirId+"");this._siblingId=this.constructor[s._typeSiblingIdProp]}if(t){t.setAttribute(s._typeSiblingIdProp,this._siblingId);var o={};for(var r in e){let n=e[r];this._ignoreProp(r)||isUndefined(n)||(r in i?o[r]=n:this._setHostAttribute(t,r,n))}n?i.initialize(o):this._copy(i,o,null,!0);setTimeout(()=>{let t=this._mountedCBs;for(let e in t){t[e]();delete t[e]}isFunction(e.initialized)&&e.initialized(i);this._isMounted=!0},isSafari?201:100)}}_initParent(){if(!this._getElement())return;let t=this._getParentProp();if(t){let e=this.parent.control,i=e[t];if(isArray(i)){let t=this._getSiblingIndex();(t<0||t>=i.length)&&(t=i.length);i.splice(t,0,this.control);const e=this._getElement();this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(e,{childList:!0})}else e[t]=this.control}}_setParent(t){if(t!==this.parent){if(this.parent)throw"Wijmo child component is already attached to a different parent.";this.parent=t;this._prepareControl();this._initParent()}}_isChild(){return null!=this._parentProp||null!=this._parentInCtor}_isParentInCtor(){return!0===this._parentInCtor}_getParentProp(){return this.props.wjProperty||this._parentProp}_getSiblingIndex(){var t=this._getElement(),e=t.parentElement;if(!e)return-1;for(var i=e.childNodes,n=-1,s=this._siblingId,o=0;o<i.length;o++){var r=i[o];if(1==r.nodeType&&r.getAttribute(ComponentBase._typeSiblingIdProp)==s){++n;if(r===t)return n}}return-1}_siblingInserted(t){for(let e of t)if("childList"===e.type&&e.addedNodes.length>0){if(Array.from(e.addedNodes).some(t=>t===this._getElement())){const t=this._getSiblingIndex(),e=this.control,i=this.parent.control[this._getParentProp()],n=i.indexOf(e);if(t>=0&&n>=0&&t!==n){i.splice(n,1);const s=Math.min(t,i.length);i.splice(s,0,e)}}}}_copy(t,e,i,n=!1){if(!t||!e)return;let s,o=t===this.control;for(var r in e)if(!this._ignoreProp(r)||!o){var l=e[r];if(r in t){if(this._isEvent(t,r))n&&isFunction(l)&&t[r].addHandler(l);else if(!i||!this._sameValue(i[r],l))if(null==l)t[r]=l;else if(isPrimitive(l)||isFunction(l)||this._objPropHash[r]&&t===(s||(s=this.control)))t[r]=l;else if(isArray(l)&&isArray(t[r])){let e=t[r],i=l;if(i.length==e.length)for(var a=0;a<i.length;a++){if(i[a]!==e[a])return!1;this._copy(e[a],i[a])}}else isObject(l)&&this._copy(t[r],e[r])}else this._setHostAttribute(t.hostElement,r,e[r])}}_setHostAttribute(t,e,i){if(t)switch(e){case"className":const n=this._appliedClassName;if(n!==i){removeClass(t,n);addClass(t,i);this._appliedClassName=i}break;case"style":setCss(t,i);break;default:null!=t[e]?t[e]=i:"string"==typeof i&&"$"!==e[0]&&t.setAttribute(e,i)}}_sameValue(t,e){return t==e||DateTime.equals(t,e)}_isEvent(t,e){let i=t&&t[e];return null!=i&&i instanceof Event}_getElement(){return this._hostRefValue}_ignoreProp(t){return"children"===t}static _copyAttrs(t,e,i){if(t)for(let n in e)n.match(i)&&t.setAttribute(n,e[n])}static isInStrictMode(t){return!!(t.hasOwnProperty("_reactInternalFiber")&&1&t._reactInternalFiber.mode)}}ComponentBase._propsParent="$parent";ComponentBase._typeSiblingIdProp="_wjSiblingIdProp";ComponentBase._siblingDirId=0;ComponentBase.elemRootMap=[];
|
|
14
|
+
var __awaiter=this&&this.__awaiter||function(e,r,n,t){return new(n||(n=Promise))((function(o,s){function fulfilled(e){try{step(t.next(e))}catch(e){s(e)}}function rejected(e){try{step(t.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):new n((function(r){r(e.value)})).then(fulfilled,rejected)}step((t=t.apply(e,r||[])).next())}))};import{ObservableArray,asString,copy,isArray,isFunction,asBoolean}from"@grapecity/wijmo";import*as ReactDOM from"react-dom";import*as React from"react";const flushSyncPolyfill=e=>{e()},createRootPolyfill=()=>{throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill};let reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const e=require("react-dom/client");reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e.flushSync||flushSync}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}}))}let _oldSyncBehavior=!0;export function strictStateMode(e=!1){e==_oldSyncBehavior&&(_oldSyncBehavior=!asBoolean(e,!1))}export const ControlBaseMeta={inputs:["isDisabled","tabOrder"],events:["gotFocus","invalidInput","lostFocus","refreshed","refreshing"]};const alwaysClearProps=new Set(["columns","columnGroups"]),unsuppressedChangedEventProps=new Set(["panes","columnGroups","columns","items"]),specialProps=new Set(["initialized","wjItemTemplate"]);function updateChildProperties(e,r){const n=e.controlRef.current,t={},o={};if(r){const s=isArray(r)?r.flat(1/0):[r],c=[];let i=0;const l=new Set;for(let e of s){if(e&&e.type&&e.type.$$typeof==Symbol.for("react.forward_ref")){c.push(e.type.render(e.props,e.ref));c[c.length-1].$index=i;c[c.length-1].$key=e.key}else if(e&&isFunction(e.type)){c.push(e.type(e.props));c[c.length-1].$index=i;c[c.length-1].$key=e.key}e||l.add(i);i++}const a=[];for(let e of c)if(e.assignedToParent){if(e.wjProperty){e.parentProp=asString(e.wjProperty);e.isParentPropArray=n[e.parentProp]&&isArray(n[e.parentProp])}e.isParentPropArray&&!t[e.parentProp]&&(t[e.parentProp]=[]);e.isParentPropArray?t[e.parentProp].push({getInstance:e.getInstance,props:e.props,$key:e.$key,$index:e.$index}):t[e.parentProp]={getInstance:e.getInstance,props:e.props}}else a.push(e);const u=e.childInfo;for(let e in t)if(isArray(t[e])){let r=!1;if(n[e]&&null!=n[e]._updating&&!unsuppressedChangedEventProps.has(e)){n[e]._updating++;r=!0}let s=u[e];o[e]=[];if(!u[e]){s=[];n[e]&&n[e].clear?n[e].clear():n[e]||(n[e]=new ObservableArray)}!_oldSyncBehavior&&alwaysClearProps.has(e)&&n[e]&&n[e].clear&&n[e].clear();if(_oldSyncBehavior)for(let r=s.length-1;r>=0;r--)if(l.has(s[r].$index)){n[e].remove(s[r].instance);s.splice(r,1)}const c=[],i={};for(let e of s)null!=e.$key?i[""+e.$key]=e:c.push(e);let a=0;const getExistingInstance=(e=null)=>{if(null!=e){let r=i[e];null!=r&&delete i[e];return r}return c[a++]};for(let r=0;r<t[e].length;r++){let s=getExistingInstance(t[e][r].$key),c=!1;if(s)s.updateProps(t[e][r].props);else{s=t[e][r].getInstance(n);c=!0}s.$index=t[e][r].$index;s.$key=t[e][r].$key;(!_oldSyncBehavior&&alwaysClearProps.has(e)||c)&&(n[e].length==r?n[e].push(s.instance):n[e].splice(r,0,s.instance));o[e].push(s)}for(let r of Object.keys(i))n[e].remove(i[r].instance);for(;!_oldSyncBehavior&&n[e].length>o[e].length;)n[e].pop();if(r){n[e]._updating--;u[e]&&u[e].length==t[e].length||n[e]._raiseCollectionChanged&&n[e]._raiseCollectionChanged()}}else{let r=u[e];if(r)r.updateProps(t[e].props);else{r=t[e].getInstance(n);n[e]=r.instance}o[e]=r}const p=[];for(let e of u.$_nonassignable||[])l.has(e.$index)?e.instance&&e.instance.dispose&&isFunction(e.instance.dispose)&&e.instance.dispose():p.push(e);const f=[];let d=0;for(;d<a.length;d++){let e=p[d];e?e.updateProps(a[d].props):e=a[d].getInstance(n);e.$index=a[d].$index;f.push(e)}o.$_nonassignable=f;for(;d<p.length;d++)p[d].instance&&p[d].instance.dispose&&isFunction(p[d].instance.dispose)&&p[d].instance.dispose()}if(_oldSyncBehavior)for(let r of Object.keys(e.childInfo))if(isArray(e.childInfo[r])&&!t[r]&&n[r]&&n[r].remove)for(let t of e.childInfo[r])n[r].remove(t.instance);return o}function getPropsAccordingToSyncMode(e,r,n=null){if(!r||!_oldSyncBehavior){return Object.assign({},e)}let t={};for(let o in e){let s=!1;n&&(s=n.knowProperties.has(o)||n.knowEvents.has(o)||n.knowCustomProps.has(o));(n&&!s||e[o]!==r[o])&&(t[o]=e[o])}return t}export function useWjComponentBase(e){const r=React.useRef({}),n=React.useRef(),t=React.useRef(),o=React.useRef(),s=React.useRef(),c=React.useRef({}),i=React.useRef(!1);e.customProps||(e.customProps={});if(!n.current){n.current={};n.current.knowProperties=new Set(e.properties);n.current.knowEvents=new Set(e.events);n.current.knowCustomProps=new Set(Object.keys(e.customProps))}let l=e.props;if(s.current){l=getPropsAccordingToSyncMode(e.props,r.current,n.current);r.current=e.props}const a={},u={},p={},f={},d=e.ref||null;for(let r in l)if(n.current.knowProperties.has(r))a[r]=l[r];else if(n.current.knowEvents.has(r)){u[r]=l[r];a[r]=l[r]}else e.customProps[r]?f[r]=l[r]:specialProps.has(r)||(p[r]=l[r]);if(s.current&&_oldSyncBehavior)for(let e in u)delete a[e];const updateProps=()=>{d&&d.current&&(d.current.props=e.props);updateChildProps();let r=[],n=a;if(o.current&&s.current&&!_oldSyncBehavior){for(let e in o.current)if(s.current[e]){if(s.current[e]._handlersChanged){s.current[e]._cachedHandlersChanged=s.current[e]._handlersChanged;s.current[e]._handlersChanged=null;r.push(s.current[e])}s.current[e].removeHandler(o.current[e])}n=Object.assign({},a);for(let e in u){delete n[e];s.current[e].addHandler(u[e])}}else if(!o.current){n=Object.assign({},a);for(let e in u)delete n[e]}o.current=u;if(s.current){copy(s.current,n,!1,!0);for(let r in f)e.customProps[r](s.current,f[r]);(()=>{for(let e of r)if(e._cachedHandlersChanged){e._handlersChanged=e._cachedHandlersChanged;e._cachedHandlersChanged=null}r=[]})();s.current.invalidate()}},updateChildProps=()=>{c.current=updateChildProperties({controlRef:s,childInfo:c.current},e.props.children)};React.useEffect(()=>{if(t.current&&!s.current){s.current=new e.constructor(t.current,a);e.prePropsInit&&e.prePropsInit(s.current);d&&(isFunction(d)?d({control:s.current,props:e.props}):d.current&&d.current.control==s.current||(d.current={control:s.current,props:e.props}));updateProps();e.initControl&&e.initControl(s.current);e.props.initialized&&setTimeout(()=>{s.current&&e.props.initialized(s.current)})}else i.current&&(i.current=!1);return()=>{if(s.current){const e=s.current;i.current=!0;queueMicrotask(()=>{if(i.current){e.dispose();s.current=null;c.current={};i.current=!1}})}}},[]);s.current&&updateProps();return{renderResult:React.createElement("div",Object.assign({ref:t},p),[]),wjControl:s.current}}function filterKnownProps(e,r,n){const t={};for(let o in e)(r.has(o)||n.has(o))&&(t[o]=e[o]);return t}function clearAndGetEvents(e,r,n,t){const o=t.current;for(let r in o)e[r]&&e[r].removeHandler(o[r]);const s={};for(let e in r)n.has(e)&&(s[e]=r[e]);return s}function getCustomPropsData(e,r){const n={};for(let t in r)void 0!==e[t]&&(n[t]=e[t]);return n}export function useWjComponentChildBase(e){const r={};r.knowProperties=new Set(e.properties);r.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:n=>{const t={current:{}},o={current:{}},s={current:{}},c=getPropsAccordingToSyncMode(e.props,t.current),i=filterKnownProps(c,r.knowProperties,r.knowEvents),l=getCustomPropsData(c,e.customProps||{}),a=e.customConstructor?e.customConstructor(n,i,l):new e.constructor(e.needParentInstance?n:i,e.needParentInstance?i:void 0);e.ref&&(isFunction(e.ref)?e.ref({control:a,props:e.props}):e.ref.current&&e.ref.current.control==a||(e.ref.current={control:a,props:e.props}));s.current=clearAndGetEvents(a,c,r.knowEvents,s);const updateProps=n=>{const c=getPropsAccordingToSyncMode(n,t.current);t.current=n;e.ref&&e.ref.current&&(e.ref.current.props=n);s.current=clearAndGetEvents(a,c,r.knowEvents,s);const i=filterKnownProps(c,r.knowProperties,r.knowEvents);a.initialize?a.initialize(i):copy(a,i,!1,!0);for(let r in e.customProps)void 0!==c[r]&&e.customProps[r](a,c[r]);(e=>{o.current=updateChildProperties({controlRef:{current:a},childInfo:o.current},e)})(n.children||[])};updateProps(e.props||[]);e.props.initialized&&isFunction(e.props.initialized)&&e.props.initialized(a);return{instance:a,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}let _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){const e=parseInt(React.version);_reactMajorVersion=e;e>=18&&lazyImportDomClient()}const flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{const e=console.error;let r=!1;console.error=function(){const e=arguments[0]||"";e.includes("flushSync")&&(r=!0)};flushSync(()=>{});console.error=e;flushSyncStateCache.isReactRendering=r}catch(e){}finally{queueMicrotask(()=>{flushSyncStateCache.isReactRendering=null})}return!!flushSyncStateCache.isReactRendering}export function selectiveDomRender(e,r,n=!1){if(_reactMajorVersion<18)ReactDOM.render(e,r);else{isReactRendering()&&(n=!0);const t=elemRootMap.findIndex(e=>e.host===r);let o;if(-1===t){o=reactDomClient.createRoot(r);elemRootMap.push({host:r,root:o})}else o=elemRootMap[t].root;o.__scheduledForUnmount=!1;n?queueMicrotask(()=>{flushSync(()=>{o.render(e)})}):flushSync(()=>{o.render(e)})}return r}export function selectiveDomUnmount(e){if(_reactMajorVersion<18)ReactDOM.unmountComponentAtNode(e);else{const r=elemRootMap.findIndex(r=>r.host===e);if(-1!==r){const e=elemRootMap[r].root;if(isReactRendering()){e.__scheduledForUnmount=!0;queueMicrotask(()=>{e.__scheduledForUnmount&&flushSync(()=>{e.unmount();e.__scheduledForUnmount=null;elemRootMap.splice(r,1)})})}else flushSync(()=>{e.unmount();elemRootMap.splice(r,1)})}}}export function baseFlushSync(){flushSync(()=>{})}
|
package/es5-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20241.
|
|
3
|
+
* Wijmo Library 5.20241.19
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __extends=this&&this.__extends||function(){var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};return function(t,e){extendStatics(t,e);function __(){this.constructor=t}t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}(),__awaiter=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function fulfilled(t){try{step(o.next(t))}catch(t){r(t)}}function rejected(t){try{step(o.throw(t))}catch(t){r(t)}}function step(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(fulfilled,rejected)}step((o=o.apply(t,e||[])).next())}))},__generator=this&&this.__generator||function(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function verb(r){return function(a){return function step(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;(o=0,i)&&(r=[2&r[0],i.value]);switch(r[0]){case 0:case 1:i=r;break;case 4:s.label++;return{value:r[1],done:!1};case 5:s.label++;o=r[1];r=[0];continue;case 7:r=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1];i=r;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(r);break}i[2]&&s.ops.pop();s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t];o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}};import{Control,Event,isArray,addClass,removeClass,setCss,isFunction,isPrimitive,isObject,DateTime,isUndefined,isSafari}from"@grapecity/wijmo";import*as ReactDOM from"react-dom";import*as React from"react";var flushSyncPolyfill=function(t){t()},createRootPolyfill=function(){throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill},reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){try{t=require("react-dom/client");reactDomClient=t||ReactDOM||ReactDomPolyfill;flushSync=t.flushSync||flushSync}catch(t){reactDomClient=ReactDOM||ReactDomPolyfill}return[2]}))}))}var ComponentBase=function(t){__extends(ComponentBase,t);function ComponentBase(e,n,o){var i=t.call(this,e)||this;i._objPropHash={};i._isMounted=!1;i._mountedCBs=[];i._hostRef=function(t){return i._hostRefValue=t};i._beforeRender=new Event;i._afterRender=new Event;i._beforeWillUnmount=new Event;i._afterWillUnmount=new Event;i._beforeDidUpdate=new Event;i._afterDidUpdate=new Event;if(i._isMounted&&!i._isChild()){clearTimeout(i.timer);return i}if(!ComponentBase._reactMajorVersion){var r=parseInt(React.version);ComponentBase._reactMajorVersion=r;r>=18&&lazyImportDomClient()}i.props=e;i.controlType=n;for(var s=0,a=o&&o.objectProps||[];s<a.length;s++){var p=a[s];i._objPropHash[p]=!0}return i}ComponentBase.prototype.render=function(){this._onBeforeRender();var t=this._renderImpl();this._onAfterRender();this.renderResult=t;if(this._isMounted&&!this._isChild()){clearTimeout(this.timer);return this.renderResult}return t};ComponentBase.prototype.componentDidMount=function(){var t=this;if(this._isMounted){clearTimeout(this.timer);return this.control}if(this._isChild()){var e=this.props[ComponentBase._propsParent];e&&e._mountedCB((function(){t._setParent(e)}))}else this._prepareControl();this._isMounted=!0;return this.control};ComponentBase.selectiveDomRender=function(t,e,n){void 0===n&&(n=!0);if(ComponentBase._reactMajorVersion<18)ReactDOM.render(t,e);else{var o,i=ComponentBase.elemRootMap.findIndex((function(t){return t.host===e}));if(-1===i){o=reactDomClient.createRoot(e);ComponentBase.elemRootMap.push({host:e,root:o})}else o=ComponentBase.elemRootMap[i].root;flushSync((function(){o.render(t)}))}return e};ComponentBase.selectiveDomUnmount=function(t){if(ComponentBase._reactMajorVersion<18)ReactDOM.unmountComponentAtNode(t);else{var e=ComponentBase.elemRootMap.findIndex((function(e){return e.host===t}));if(-1!==e){var n=ComponentBase.elemRootMap[e].root;flushSync((function(){n.unmount();ComponentBase.elemRootMap.splice(e,1)}))}}};ComponentBase.prototype.componentWillUnmount=function(){this._onBeforeWillUnmount();this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();var t=this.control;if(t)if(this._isChild()){var e=this._getParentProp();if(e){var n=this.parent.control[e];if(isArray(n)){var o=n.indexOf(t);if(o>-1){var i=n[o];"Sheet"===i.constructor.name&&i._isEmptyGrid||n.splice(o,1)}}}}else t instanceof Control&&(this.timer=setTimeout((function(){if(t.hostElement){t._orgOuter=null;t.dispose()}}),5));this._onAfterWillUnmount()};ComponentBase.prototype.shouldComponentUpdate=function(t){return!0};ComponentBase.prototype.componentDidUpdate=function(t){this._onBeforeDidUpdate();var e=this.control;this._copy(e,this.props,t);this._onAfterDidUpdate()};ComponentBase.prototype._mountedCB=function(t){var e=this;this._isMounted&&!this._isChild()?t():this._isMounted||this._mountedCBs.push(t);setTimeout((function(){e._mountedCBs.includes(t)||e._mountedCBs.push(t)}),isSafari?200:10)};ComponentBase.prototype._renderImpl=function(){var t={};t[ComponentBase._propsParent]=this;var e=React.Children.map(this.props.children,(function(e){return e&&React.cloneElement(e,t)})),n={ref:this._hostRef};this._isChild()&&(n.style={display:"none"});return React.createElement("div",n,e)};ComponentBase.prototype._onBeforeRender=function(t){this._beforeRender.raise(this,t)};ComponentBase.prototype._onAfterRender=function(t){this._afterRender.raise(this,t)};ComponentBase.prototype._onBeforeWillUnmount=function(t){this._beforeWillUnmount.raise(this,t)};ComponentBase.prototype._onAfterWillUnmount=function(t){this._afterWillUnmount.raise(this,t)};ComponentBase.prototype._onBeforeDidUpdate=function(t){this._beforeDidUpdate.raise(this,t)};ComponentBase.prototype._onAfterDidUpdate=function(t){this._afterDidUpdate.raise(this,t)};ComponentBase.prototype._createControl=function(){var t=this._isChild()?this._isParentInCtor()?this.parent.control:void 0:this._getElement();t instanceof Element&&this.props.id&&t.setAttribute("id",this.props.id);var e=new this.controlType(t);e.workingAs="React";return e};ComponentBase.prototype._prepareControl=function(){var t=this;this._renderImpl();var e=this._getElement(),n=this.props;e&&!this._isChild()&&ComponentBase._copyAttrs(e,n,Control._rxInputAtts);var o=this.control=this._createControl(),i=o instanceof Control,r=ComponentBase;e=this._getElement();if(!this._siblingId){null==this.constructor[r._typeSiblingIdProp]&&(this.constructor[r._typeSiblingIdProp]=++r._siblingDirId+"");this._siblingId=this.constructor[r._typeSiblingIdProp]}if(e){e.setAttribute(r._typeSiblingIdProp,this._siblingId);var s={};for(var a in n){var p=n[a];this._ignoreProp(a)||isUndefined(p)||(a in o?s[a]=p:this._setHostAttribute(e,a,p))}i?o.initialize(s):this._copy(o,s,null,!0);setTimeout((function(){var e=t._mountedCBs;for(var i in e){e[i]();delete e[i]}isFunction(n.initialized)&&n.initialized(o);t._isMounted=!0}),isSafari?201:100)}};ComponentBase.prototype._initParent=function(){if(this._getElement()){var t=this._getParentProp();if(t){var e=this.parent.control,n=e[t];if(isArray(n)){var o=this._getSiblingIndex();(o<0||o>=n.length)&&(o=n.length);n.splice(o,0,this.control);var i=this._getElement();this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(i,{childList:!0})}else e[t]=this.control}}};ComponentBase.prototype._setParent=function(t){if(t!==this.parent){if(this.parent)throw"Wijmo child component is already attached to a different parent.";this.parent=t;this._prepareControl();this._initParent()}};ComponentBase.prototype._isChild=function(){return null!=this._parentProp||null!=this._parentInCtor};ComponentBase.prototype._isParentInCtor=function(){return!0===this._parentInCtor};ComponentBase.prototype._getParentProp=function(){return this.props.wjProperty||this._parentProp};ComponentBase.prototype._getSiblingIndex=function(){var t=this._getElement(),e=t.parentElement;if(!e)return-1;for(var n=e.childNodes,o=-1,i=this._siblingId,r=0;r<n.length;r++){var s=n[r];if(1==s.nodeType&&s.getAttribute(ComponentBase._typeSiblingIdProp)==i){++o;if(s===t)return o}}return-1};ComponentBase.prototype._siblingInserted=function(t){for(var e=this,n=0,o=t;n<o.length;n++){var i=o[n];if("childList"===i.type&&i.addedNodes.length>0){if(Array.from(i.addedNodes).some((function(t){return t===e._getElement()}))){var r=this._getSiblingIndex(),s=this.control,a=this.parent.control[this._getParentProp()],p=a.indexOf(s);if(r>=0&&p>=0&&r!==p){a.splice(p,1);var l=Math.min(r,a.length);a.splice(l,0,s)}}}}};ComponentBase.prototype._copy=function(t,e,n,o){void 0===o&&(o=!1);if(t&&e){var i,r=t===this.control;for(var s in e)if(!this._ignoreProp(s)||!r){var a=e[s];if(s in t){if(this._isEvent(t,s))o&&isFunction(a)&&t[s].addHandler(a);else if(!n||!this._sameValue(n[s],a))if(null==a)t[s]=a;else if(isPrimitive(a)||isFunction(a)||this._objPropHash[s]&&t===(i||(i=this.control)))t[s]=a;else if(isArray(a)&&isArray(t[s])){var p=t[s],l=a;if(l.length==p.length)for(var c=0;c<l.length;c++){if(l[c]!==p[c])return!1;this._copy(p[c],l[c])}}else isObject(a)&&this._copy(t[s],e[s])}else this._setHostAttribute(t.hostElement,s,e[s])}}};ComponentBase.prototype._setHostAttribute=function(t,e,n){if(t)switch(e){case"className":var o=this._appliedClassName;if(o!==n){removeClass(t,o);addClass(t,n);this._appliedClassName=n}break;case"style":setCss(t,n);break;default:null!=t[e]?t[e]=n:"string"==typeof n&&"$"!==e[0]&&t.setAttribute(e,n)}};ComponentBase.prototype._sameValue=function(t,e){return t==e||DateTime.equals(t,e)};ComponentBase.prototype._isEvent=function(t,e){var n=t&&t[e];return null!=n&&n instanceof Event};ComponentBase.prototype._getElement=function(){return this._hostRefValue};ComponentBase.prototype._ignoreProp=function(t){return"children"===t};ComponentBase._copyAttrs=function(t,e,n){if(t)for(var o in e)o.match(n)&&t.setAttribute(o,e[o])};ComponentBase.isInStrictMode=function(t){return!!(t.hasOwnProperty("_reactInternalFiber")&&1&t._reactInternalFiber.mode)};ComponentBase._propsParent="$parent";ComponentBase._typeSiblingIdProp="_wjSiblingIdProp";ComponentBase._siblingDirId=0;ComponentBase.elemRootMap=[];return ComponentBase}(React.Component);export{ComponentBase};
|
|
14
|
+
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,r,n,t){return new(n||(n=Promise))((function(o,a){function fulfilled(e){try{step(t.next(e))}catch(e){a(e)}}function rejected(e){try{step(t.throw(e))}catch(e){a(e)}}function step(e){e.done?o(e.value):new n((function(r){r(e.value)})).then(fulfilled,rejected)}step((t=t.apply(e,r||[])).next())}))},__generator=this&&this.__generator||function(e,r){var n,t,o,a,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function verb(a){return function(i){return function step(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;(t=0,o)&&(a=[2&a[0],o.value]);switch(a[0]){case 0:case 1:o=a;break;case 4:s.label++;return{value:a[1],done:!1};case 5:s.label++;t=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1];o=a;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(a);break}o[2]&&s.ops.pop();s.trys.pop();continue}a=r.call(e,s)}catch(e){a=[6,e];t=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};import{ObservableArray,asString,copy,isArray,isFunction,asBoolean}from"@grapecity/wijmo";import*as ReactDOM from"react-dom";import*as React from"react";var flushSyncPolyfill=function(e){e()},createRootPolyfill=function(){throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill},reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(r){try{e=require("react-dom/client");reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e.flushSync||flushSync}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}return[2]}))}))}var _oldSyncBehavior=!0;export function strictStateMode(e){void 0===e&&(e=!1);e==_oldSyncBehavior&&(_oldSyncBehavior=!asBoolean(e,!1))}export var ControlBaseMeta={inputs:["isDisabled","tabOrder"],events:["gotFocus","invalidInput","lostFocus","refreshed","refreshing"]};var alwaysClearProps=new Set(["columns","columnGroups"]),unsuppressedChangedEventProps=new Set(["panes","columnGroups","columns","items"]),specialProps=new Set(["initialized","wjItemTemplate"]);function updateChildProperties(e,r){var n=e.controlRef.current,t={},o={};if(r){for(var a=isArray(r)?r.flat(1/0):[r],s=[],i=0,c=new Set,u=0,l=a;u<l.length;u++){if((m=l[u])&&m.type&&m.type.$$typeof==Symbol.for("react.forward_ref")){s.push(m.type.render(m.props,m.ref));s[s.length-1].$index=i;s[s.length-1].$key=m.key}else if(m&&isFunction(m.type)){s.push(m.type(m.props));s[s.length-1].$index=i;s[s.length-1].$key=m.key}m||c.add(i);i++}for(var p=[],f=0,d=s;f<d.length;f++){if((m=d[f]).assignedToParent){if(m.wjProperty){m.parentProp=asString(m.wjProperty);m.isParentPropArray=n[m.parentProp]&&isArray(n[m.parentProp])}m.isParentPropArray&&!t[m.parentProp]&&(t[m.parentProp]=[]);m.isParentPropArray?t[m.parentProp].push({getInstance:m.getInstance,props:m.props,$key:m.$key,$index:m.$index}):t[m.parentProp]={getInstance:m.getInstance,props:m.props}}else p.push(m)}var h=e.childInfo,_loop_1=function(e){if(isArray(t[e])){var r=!1;if(n[e]&&null!=n[e]._updating&&!unsuppressedChangedEventProps.has(e)){n[e]._updating++;r=!0}var a=h[e];o[e]=[];if(!h[e]){a=[];n[e]&&n[e].clear?n[e].clear():n[e]||(n[e]=new ObservableArray)}!_oldSyncBehavior&&alwaysClearProps.has(e)&&n[e]&&n[e].clear&&n[e].clear();if(_oldSyncBehavior)for(var s=a.length-1;s>=0;s--)if(c.has(a[s].$index)){n[e].remove(a[s].instance);a.splice(s,1)}for(var i=[],u={},l=0,p=a;l<p.length;l++){var f=p[l];null!=f.$key?u[""+f.$key]=f:i.push(f)}for(var d=0,getExistingInstance=function(e){void 0===e&&(e=null);if(null!=e){var r=u[e];null!=r&&delete u[e];return r}return i[d++]},v=0;v<t[e].length;v++){var y=!1;if(_=getExistingInstance(t[e][v].$key))_.updateProps(t[e][v].props);else{_=t[e][v].getInstance(n);y=!0}_.$index=t[e][v].$index;_.$key=t[e][v].$key;(!_oldSyncBehavior&&alwaysClearProps.has(e)||y)&&(n[e].length==v?n[e].push(_.instance):n[e].splice(v,0,_.instance));o[e].push(_)}for(var g=0,P=Object.keys(u);g<P.length;g++){var m=P[g];n[e].remove(u[m].instance)}for(;!_oldSyncBehavior&&n[e].length>o[e].length;)n[e].pop();if(r){n[e]._updating--;h[e]&&h[e].length==t[e].length||n[e]._raiseCollectionChanged&&n[e]._raiseCollectionChanged()}}else{var _;if(_=h[e])_.updateProps(t[e].props);else{_=t[e].getInstance(n);n[e]=_.instance}o[e]=_}};for(var v in t)_loop_1(v);for(var y=[],g=0,P=h.$_nonassignable||[];g<P.length;g++){var m=P[g];c.has(m.$index)?m.instance&&m.instance.dispose&&isFunction(m.instance.dispose)&&m.instance.dispose():y.push(m)}for(var _=[],R=0;R<p.length;R++){var w=y[R];w?w.updateProps(p[R].props):w=p[R].getInstance(n);w.$index=p[R].$index;_.push(w)}o.$_nonassignable=_;for(;R<y.length;R++)y[R].instance&&y[R].instance.dispose&&isFunction(y[R].instance.dispose)&&y[R].instance.dispose()}if(_oldSyncBehavior)for(var S=0,C=Object.keys(e.childInfo);S<C.length;S++){var k=C[S];if(isArray(e.childInfo[k])&&!t[k]&&n[k]&&n[k].remove)for(var b=0,M=e.childInfo[k];b<M.length;b++){var I=M[b];n[k].remove(I.instance)}}return o}function getPropsAccordingToSyncMode(e,r,n){void 0===n&&(n=null);if(!r||!_oldSyncBehavior){return __assign({},e)}var t={};for(var o in e){var a=!1;n&&(a=n.knowProperties.has(o)||n.knowEvents.has(o)||n.knowCustomProps.has(o));(n&&!a||e[o]!==r[o])&&(t[o]=e[o])}return t}export function useWjComponentBase(e){var r=React.useRef({}),n=React.useRef(),t=React.useRef(),o=React.useRef(),a=React.useRef(),s=React.useRef({}),i=React.useRef(!1);e.customProps||(e.customProps={});if(!n.current){n.current={};n.current.knowProperties=new Set(e.properties);n.current.knowEvents=new Set(e.events);n.current.knowCustomProps=new Set(Object.keys(e.customProps))}var c=e.props;if(a.current){c=getPropsAccordingToSyncMode(e.props,r.current,n.current);r.current=e.props}var u={},l={},p={},f={},d=e.ref||null;for(var h in c)if(n.current.knowProperties.has(h))u[h]=c[h];else if(n.current.knowEvents.has(h)){l[h]=c[h];u[h]=c[h]}else e.customProps[h]?f[h]=c[h]:specialProps.has(h)||(p[h]=c[h]);if(a.current&&_oldSyncBehavior)for(var h in l)delete u[h];var updateProps=function(){d&&d.current&&(d.current.props=e.props);updateChildProps();var r=[],n=u;if(o.current&&a.current&&!_oldSyncBehavior){for(var t in o.current)if(a.current[t]){if(a.current[t]._handlersChanged){a.current[t]._cachedHandlersChanged=a.current[t]._handlersChanged;a.current[t]._handlersChanged=null;r.push(a.current[t])}a.current[t].removeHandler(o.current[t])}n=__assign({},u);for(var s in l){delete n[s];a.current[s].addHandler(l[s])}}else if(!o.current){n=__assign({},u);for(var s in l)delete n[s]}o.current=l;if(a.current){copy(a.current,n,!1,!0);for(var i in f)e.customProps[i](a.current,f[i]);!function(){for(var e=0,n=r;e<n.length;e++){var t=n[e];if(t._cachedHandlersChanged){t._handlersChanged=t._cachedHandlersChanged;t._cachedHandlersChanged=null}}r=[]}();a.current.invalidate()}},updateChildProps=function(){s.current=updateChildProperties({controlRef:a,childInfo:s.current},e.props.children)};React.useEffect((function(){if(t.current&&!a.current){a.current=new e.constructor(t.current,u);e.prePropsInit&&e.prePropsInit(a.current);d&&(isFunction(d)?d({control:a.current,props:e.props}):d.current&&d.current.control==a.current||(d.current={control:a.current,props:e.props}));updateProps();e.initControl&&e.initControl(a.current);e.props.initialized&&setTimeout((function(){a.current&&e.props.initialized(a.current)}))}else i.current&&(i.current=!1);return function(){if(a.current){var e=a.current;i.current=!0;queueMicrotask((function(){if(i.current){e.dispose();a.current=null;s.current={};i.current=!1}}))}}}),[]);a.current&&updateProps();return{renderResult:React.createElement("div",__assign({ref:t},p),[]),wjControl:a.current}}function filterKnownProps(e,r,n){var t={};for(var o in e)(r.has(o)||n.has(o))&&(t[o]=e[o]);return t}function clearAndGetEvents(e,r,n,t){var o=t.current;for(var a in o)e[a]&&e[a].removeHandler(o[a]);var s={};for(var i in r)n.has(i)&&(s[i]=r[i]);return s}function getCustomPropsData(e,r){var n={};for(var t in r)void 0!==e[t]&&(n[t]=e[t]);return n}export function useWjComponentChildBase(e){var r={};r.knowProperties=new Set(e.properties);r.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:function(n){var t={current:{}},o={current:{}},a={current:{}},s=getPropsAccordingToSyncMode(e.props,t.current),i=filterKnownProps(s,r.knowProperties,r.knowEvents),c=getCustomPropsData(s,e.customProps||{}),u=e.customConstructor?e.customConstructor(n,i,c):new e.constructor(e.needParentInstance?n:i,e.needParentInstance?i:void 0);e.ref&&(isFunction(e.ref)?e.ref({control:u,props:e.props}):e.ref.current&&e.ref.current.control==u||(e.ref.current={control:u,props:e.props}));a.current=clearAndGetEvents(u,s,r.knowEvents,a);var updateProps=function(n){var s=getPropsAccordingToSyncMode(n,t.current);t.current=n;e.ref&&e.ref.current&&(e.ref.current.props=n);a.current=clearAndGetEvents(u,s,r.knowEvents,a);var i,c=filterKnownProps(s,r.knowProperties,r.knowEvents);u.initialize?u.initialize(c):copy(u,c,!1,!0);for(var l in e.customProps)void 0!==s[l]&&e.customProps[l](u,s[l]);i=n.children||[],o.current=updateChildProperties({controlRef:{current:u},childInfo:o.current},i)};updateProps(e.props||[]);e.props.initialized&&isFunction(e.props.initialized)&&e.props.initialized(u);return{instance:u,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}var _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){var version=parseInt(React.version);_reactMajorVersion=version;version>=18&&lazyImportDomClient()}var flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{var e=console.error,r=!1;console.error=function(){var e=arguments[0]||"";e.includes("flushSync")&&(r=!0)};flushSync((function(){}));console.error=e;flushSyncStateCache.isReactRendering=r}catch(e){}finally{queueMicrotask((function(){flushSyncStateCache.isReactRendering=null}))}return!!flushSyncStateCache.isReactRendering}export function selectiveDomRender(e,r,n){void 0===n&&(n=!1);if(_reactMajorVersion<18)ReactDOM.render(e,r);else{isReactRendering()&&(n=!0);var t,o=elemRootMap.findIndex((function(e){return e.host===r}));if(-1===o){t=reactDomClient.createRoot(r);elemRootMap.push({host:r,root:t})}else t=elemRootMap[o].root;t.__scheduledForUnmount=!1;n?queueMicrotask((function(){flushSync((function(){t.render(e)}))})):flushSync((function(){t.render(e)}))}return r}export function selectiveDomUnmount(e){if(_reactMajorVersion<18)ReactDOM.unmountComponentAtNode(e);else{var r=elemRootMap.findIndex((function(r){return r.host===e}));if(-1!==r){var n=elemRootMap[r].root;if(isReactRendering()){n.__scheduledForUnmount=!0;queueMicrotask((function(){n.__scheduledForUnmount&&flushSync((function(){n.unmount();n.__scheduledForUnmount=null;elemRootMap.splice(r,1)}))}))}else flushSync((function(){n.unmount();elemRootMap.splice(r,1)}))}}}export function baseFlushSync(){flushSync((function(){}))}
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20241.
|
|
3
|
+
* Wijmo Library 5.20241.19
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,77 +11,82 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
|
-
* {@module wijmo.react.base}
|
|
14
|
+
* {@module wijmo.react.base}
|
|
15
15
|
* Contains base classes for all Wijmo for React directives.
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
export declare var ___keepComment: any;
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
import { CancelEventArgs, Control, EventArgs, IEventHandler } from '@grapecity/wijmo';
|
|
22
|
+
export declare function strictStateMode(newValue?: boolean): void;
|
|
23
|
+
export declare type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
24
|
+
export declare type WjRef<T> = {
|
|
25
|
+
control: T;
|
|
26
|
+
props: any;
|
|
27
|
+
};
|
|
28
|
+
export declare type ControlBaseEvents<T> = {
|
|
29
|
+
gotFocus?: IEventHandler<T, EventArgs>;
|
|
30
|
+
invalidInput?: IEventHandler<T, CancelEventArgs>;
|
|
31
|
+
lostFocus?: IEventHandler<T, EventArgs>;
|
|
32
|
+
refreshed?: IEventHandler<T, EventArgs>;
|
|
33
|
+
refreshing?: IEventHandler<T, EventArgs>;
|
|
34
|
+
};
|
|
35
|
+
export declare type ControlBaseInputs = {
|
|
36
|
+
isDisabled?: boolean;
|
|
37
|
+
tabOrder?: number;
|
|
38
|
+
initialized?: any;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
children?: any;
|
|
41
|
+
};
|
|
42
|
+
export declare type BaseInputs = {
|
|
43
|
+
initialized?: any;
|
|
44
|
+
ref?: any;
|
|
45
|
+
};
|
|
46
|
+
export declare const ControlBaseMeta: {
|
|
47
|
+
inputs: string[];
|
|
48
|
+
events: string[];
|
|
49
|
+
};
|
|
50
|
+
export declare function useWjComponentBase(initInfo: {
|
|
51
|
+
properties: string[];
|
|
52
|
+
events: string[];
|
|
53
|
+
customProps?: {
|
|
54
|
+
[key: string]: (control: any, value: any) => void;
|
|
55
|
+
};
|
|
56
|
+
constructor: typeof Control;
|
|
36
57
|
props: any;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
protected _siblingId: string;
|
|
42
|
-
protected _hostRef: (ref: any) => any;
|
|
43
|
-
protected _hostRefValue: HTMLElement;
|
|
44
|
-
timer: any;
|
|
58
|
+
ref?: any;
|
|
59
|
+
prePropsInit?: (control: any) => void;
|
|
60
|
+
initControl?: (control: any) => void;
|
|
61
|
+
}): {
|
|
45
62
|
renderResult: any;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
private _getParentProp;
|
|
77
|
-
private _getSiblingIndex;
|
|
78
|
-
private _siblingInserted;
|
|
79
|
-
private _copy;
|
|
80
|
-
private _setHostAttribute;
|
|
81
|
-
private _sameValue;
|
|
82
|
-
private _isEvent;
|
|
83
|
-
protected _getElement(): HTMLElement;
|
|
84
|
-
private _ignoreProp;
|
|
85
|
-
private static _copyAttrs;
|
|
86
|
-
static isInStrictMode(component: any): boolean;
|
|
87
|
-
}
|
|
63
|
+
wjControl: any;
|
|
64
|
+
};
|
|
65
|
+
export declare function useWjComponentChildBase(initInfo: {
|
|
66
|
+
ref?: any;
|
|
67
|
+
properties: string[];
|
|
68
|
+
events: string[];
|
|
69
|
+
constructor: any;
|
|
70
|
+
props: any;
|
|
71
|
+
needParentInstance: boolean;
|
|
72
|
+
parentProp: string;
|
|
73
|
+
isParentPropArray: boolean;
|
|
74
|
+
assignedToParent: boolean;
|
|
75
|
+
customConstructor?: (parent: any, initData: any, customPropData?: any) => any;
|
|
76
|
+
customProps?: {
|
|
77
|
+
[key: string]: (control: any, value: any) => void;
|
|
78
|
+
};
|
|
79
|
+
}): {
|
|
80
|
+
getInstance: (parentProp?: any) => {
|
|
81
|
+
instance: any;
|
|
82
|
+
updateProps: (props: any) => void;
|
|
83
|
+
};
|
|
84
|
+
props: any;
|
|
85
|
+
parentProp: string;
|
|
86
|
+
wjProperty: any;
|
|
87
|
+
isParentPropArray: boolean;
|
|
88
|
+
assignedToParent: boolean;
|
|
89
|
+
};
|
|
90
|
+
export declare function selectiveDomRender(component: any, host: HTMLElement, useMicroTask?: boolean): HTMLElement;
|
|
91
|
+
export declare function selectiveDomUnmount(host?: HTMLElement): void;
|
|
92
|
+
export declare function baseFlushSync(): void;
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20241.
|
|
3
|
+
* Wijmo Library 5.20241.19
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};return function(t,e){extendStatics(t,e);function __(){this.constructor=t}t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}(),__awaiter=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function fulfilled(t){try{step(o.next(t))}catch(t){r(t)}}function rejected(t){try{step(o.throw(t))}catch(t){r(t)}}function step(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(fulfilled,rejected)}step((o=o.apply(t,e||[])).next())}))},__generator=this&&this.__generator||function(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function verb(r){return function(a){return function step(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;(o=0,i)&&(r=[2&r[0],i.value]);switch(r[0]){case 0:case 1:i=r;break;case 4:s.label++;return{value:r[1],done:!1};case 5:s.label++;o=r[1];r=[0];continue;case 7:r=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1];i=r;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(r);break}i[2]&&s.ops.pop();s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t];o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}},__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),ReactDOM=__importStar(require("react-dom")),React=__importStar(require("react")),flushSyncPolyfill=function(t){t()},createRootPolyfill=function(){throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill},reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){try{t=require("react-dom/client");reactDomClient=t||ReactDOM||ReactDomPolyfill;flushSync=t.flushSync||flushSync}catch(t){reactDomClient=ReactDOM||ReactDomPolyfill}return[2]}))}))}var ComponentBase=function(t){__extends(ComponentBase,t);function ComponentBase(e,n,o){var i=t.call(this,e)||this;i._objPropHash={};i._isMounted=!1;i._mountedCBs=[];i._hostRef=function(t){return i._hostRefValue=t};i._beforeRender=new wijmo_1.Event;i._afterRender=new wijmo_1.Event;i._beforeWillUnmount=new wijmo_1.Event;i._afterWillUnmount=new wijmo_1.Event;i._beforeDidUpdate=new wijmo_1.Event;i._afterDidUpdate=new wijmo_1.Event;if(i._isMounted&&!i._isChild()){clearTimeout(i.timer);return i}if(!ComponentBase._reactMajorVersion){var r=parseInt(React.version);ComponentBase._reactMajorVersion=r;r>=18&&lazyImportDomClient()}i.props=e;i.controlType=n;for(var s=0,a=o&&o.objectProps||[];s<a.length;s++){var p=a[s];i._objPropHash[p]=!0}return i}ComponentBase.prototype.render=function(){this._onBeforeRender();var t=this._renderImpl();this._onAfterRender();this.renderResult=t;if(this._isMounted&&!this._isChild()){clearTimeout(this.timer);return this.renderResult}return t};ComponentBase.prototype.componentDidMount=function(){var t=this;if(this._isMounted){clearTimeout(this.timer);return this.control}if(this._isChild()){var e=this.props[ComponentBase._propsParent];e&&e._mountedCB((function(){t._setParent(e)}))}else this._prepareControl();this._isMounted=!0;return this.control};ComponentBase.selectiveDomRender=function(t,e,n){void 0===n&&(n=!0);if(ComponentBase._reactMajorVersion<18)ReactDOM.render(t,e);else{var o,i=ComponentBase.elemRootMap.findIndex((function(t){return t.host===e}));if(-1===i){o=reactDomClient.createRoot(e);ComponentBase.elemRootMap.push({host:e,root:o})}else o=ComponentBase.elemRootMap[i].root;flushSync((function(){o.render(t)}))}return e};ComponentBase.selectiveDomUnmount=function(t){if(ComponentBase._reactMajorVersion<18)ReactDOM.unmountComponentAtNode(t);else{var e=ComponentBase.elemRootMap.findIndex((function(e){return e.host===t}));if(-1!==e){var n=ComponentBase.elemRootMap[e].root;flushSync((function(){n.unmount();ComponentBase.elemRootMap.splice(e,1)}))}}};ComponentBase.prototype.componentWillUnmount=function(){this._onBeforeWillUnmount();this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();var t=this.control;if(t)if(this._isChild()){var e=this._getParentProp();if(e){var n=this.parent.control[e];if(wijmo_1.isArray(n)){var o=n.indexOf(t);if(o>-1){var i=n[o];"Sheet"===i.constructor.name&&i._isEmptyGrid||n.splice(o,1)}}}}else t instanceof wijmo_1.Control&&(this.timer=setTimeout((function(){if(t.hostElement){t._orgOuter=null;t.dispose()}}),5));this._onAfterWillUnmount()};ComponentBase.prototype.shouldComponentUpdate=function(t){return!0};ComponentBase.prototype.componentDidUpdate=function(t){this._onBeforeDidUpdate();var e=this.control;this._copy(e,this.props,t);this._onAfterDidUpdate()};ComponentBase.prototype._mountedCB=function(t){var e=this;this._isMounted&&!this._isChild()?t():this._isMounted||this._mountedCBs.push(t);setTimeout((function(){e._mountedCBs.includes(t)||e._mountedCBs.push(t)}),wijmo_1.isSafari?200:10)};ComponentBase.prototype._renderImpl=function(){var t={};t[ComponentBase._propsParent]=this;var e=React.Children.map(this.props.children,(function(e){return e&&React.cloneElement(e,t)})),n={ref:this._hostRef};this._isChild()&&(n.style={display:"none"});return React.createElement("div",n,e)};ComponentBase.prototype._onBeforeRender=function(t){this._beforeRender.raise(this,t)};ComponentBase.prototype._onAfterRender=function(t){this._afterRender.raise(this,t)};ComponentBase.prototype._onBeforeWillUnmount=function(t){this._beforeWillUnmount.raise(this,t)};ComponentBase.prototype._onAfterWillUnmount=function(t){this._afterWillUnmount.raise(this,t)};ComponentBase.prototype._onBeforeDidUpdate=function(t){this._beforeDidUpdate.raise(this,t)};ComponentBase.prototype._onAfterDidUpdate=function(t){this._afterDidUpdate.raise(this,t)};ComponentBase.prototype._createControl=function(){var t=this._isChild()?this._isParentInCtor()?this.parent.control:void 0:this._getElement();t instanceof Element&&this.props.id&&t.setAttribute("id",this.props.id);var e=new this.controlType(t);e.workingAs="React";return e};ComponentBase.prototype._prepareControl=function(){var t=this;this._renderImpl();var e=this._getElement(),n=this.props;e&&!this._isChild()&&ComponentBase._copyAttrs(e,n,wijmo_1.Control._rxInputAtts);var o=this.control=this._createControl(),i=o instanceof wijmo_1.Control,r=ComponentBase;e=this._getElement();if(!this._siblingId){null==this.constructor[r._typeSiblingIdProp]&&(this.constructor[r._typeSiblingIdProp]=++r._siblingDirId+"");this._siblingId=this.constructor[r._typeSiblingIdProp]}if(e){e.setAttribute(r._typeSiblingIdProp,this._siblingId);var s={};for(var a in n){var p=n[a];this._ignoreProp(a)||wijmo_1.isUndefined(p)||(a in o?s[a]=p:this._setHostAttribute(e,a,p))}i?o.initialize(s):this._copy(o,s,null,!0);setTimeout((function(){var e=t._mountedCBs;for(var i in e){e[i]();delete e[i]}wijmo_1.isFunction(n.initialized)&&n.initialized(o);t._isMounted=!0}),wijmo_1.isSafari?201:100)}};ComponentBase.prototype._initParent=function(){if(this._getElement()){var t=this._getParentProp();if(t){var e=this.parent.control,n=e[t];if(wijmo_1.isArray(n)){var o=this._getSiblingIndex();(o<0||o>=n.length)&&(o=n.length);n.splice(o,0,this.control);var i=this._getElement();this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(i,{childList:!0})}else e[t]=this.control}}};ComponentBase.prototype._setParent=function(t){if(t!==this.parent){if(this.parent)throw"Wijmo child component is already attached to a different parent.";this.parent=t;this._prepareControl();this._initParent()}};ComponentBase.prototype._isChild=function(){return null!=this._parentProp||null!=this._parentInCtor};ComponentBase.prototype._isParentInCtor=function(){return!0===this._parentInCtor};ComponentBase.prototype._getParentProp=function(){return this.props.wjProperty||this._parentProp};ComponentBase.prototype._getSiblingIndex=function(){var t=this._getElement(),e=t.parentElement;if(!e)return-1;for(var n=e.childNodes,o=-1,i=this._siblingId,r=0;r<n.length;r++){var s=n[r];if(1==s.nodeType&&s.getAttribute(ComponentBase._typeSiblingIdProp)==i){++o;if(s===t)return o}}return-1};ComponentBase.prototype._siblingInserted=function(t){for(var e=this,n=0,o=t;n<o.length;n++){var i=o[n];if("childList"===i.type&&i.addedNodes.length>0){if(Array.from(i.addedNodes).some((function(t){return t===e._getElement()}))){var r=this._getSiblingIndex(),s=this.control,a=this.parent.control[this._getParentProp()],p=a.indexOf(s);if(r>=0&&p>=0&&r!==p){a.splice(p,1);var l=Math.min(r,a.length);a.splice(l,0,s)}}}}};ComponentBase.prototype._copy=function(t,e,n,o){void 0===o&&(o=!1);if(t&&e){var i,r=t===this.control;for(var s in e)if(!this._ignoreProp(s)||!r){var a=e[s];if(s in t){if(this._isEvent(t,s))o&&wijmo_1.isFunction(a)&&t[s].addHandler(a);else if(!n||!this._sameValue(n[s],a))if(null==a)t[s]=a;else if(wijmo_1.isPrimitive(a)||wijmo_1.isFunction(a)||this._objPropHash[s]&&t===(i||(i=this.control)))t[s]=a;else if(wijmo_1.isArray(a)&&wijmo_1.isArray(t[s])){var p=t[s],l=a;if(l.length==p.length)for(var u=0;u<l.length;u++){if(l[u]!==p[u])return!1;this._copy(p[u],l[u])}}else wijmo_1.isObject(a)&&this._copy(t[s],e[s])}else this._setHostAttribute(t.hostElement,s,e[s])}}};ComponentBase.prototype._setHostAttribute=function(t,e,n){if(t)switch(e){case"className":var o=this._appliedClassName;if(o!==n){wijmo_1.removeClass(t,o);wijmo_1.addClass(t,n);this._appliedClassName=n}break;case"style":wijmo_1.setCss(t,n);break;default:null!=t[e]?t[e]=n:"string"==typeof n&&"$"!==e[0]&&t.setAttribute(e,n)}};ComponentBase.prototype._sameValue=function(t,e){return t==e||wijmo_1.DateTime.equals(t,e)};ComponentBase.prototype._isEvent=function(t,e){var n=t&&t[e];return null!=n&&n instanceof wijmo_1.Event};ComponentBase.prototype._getElement=function(){return this._hostRefValue};ComponentBase.prototype._ignoreProp=function(t){return"children"===t};ComponentBase._copyAttrs=function(t,e,n){if(t)for(var o in e)o.match(n)&&t.setAttribute(o,e[o])};ComponentBase.isInStrictMode=function(t){return!!(t.hasOwnProperty("_reactInternalFiber")&&1&t._reactInternalFiber.mode)};ComponentBase._propsParent="$parent";ComponentBase._typeSiblingIdProp="_wjSiblingIdProp";ComponentBase._siblingDirId=0;ComponentBase.elemRootMap=[];return ComponentBase}(React.Component);exports.ComponentBase=ComponentBase;
|
|
14
|
+
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,r,n,t){return new(n||(n=Promise))((function(o,s){function fulfilled(e){try{step(t.next(e))}catch(e){s(e)}}function rejected(e){try{step(t.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):new n((function(r){r(e.value)})).then(fulfilled,rejected)}step((t=t.apply(e,r||[])).next())}))},__generator=this&&this.__generator||function(e,r){var n,t,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function verb(s){return function(a){return function step(s){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;(t=0,o)&&(s=[2&s[0],o.value]);switch(s[0]){case 0:case 1:o=s;break;case 4:i.label++;return{value:s[1],done:!1};case 5:i.label++;t=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1];o=s;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(s);break}o[2]&&i.ops.pop();i.trys.pop();continue}s=r.call(e,i)}catch(e){s=[6,e];t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(r[n]=e[n]);r.default=e;return r};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),ReactDOM=__importStar(require("react-dom")),React=__importStar(require("react")),flushSyncPolyfill=function(e){e()},createRootPolyfill=function(){throw"Wijmo: React dependencies not loaded properly"},ReactDomPolyfill={flushSync:flushSyncPolyfill,createRoot:createRootPolyfill},reactDomClient=ReactDOM||ReactDomPolyfill,flushSync=reactDomClient.flushSync;function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(r){try{e=require("react-dom/client");reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e.flushSync||flushSync}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}return[2]}))}))}var _oldSyncBehavior=!0;function strictStateMode(e){void 0===e&&(e=!1);e==_oldSyncBehavior&&(_oldSyncBehavior=!wijmo_1.asBoolean(e,!1))}exports.strictStateMode=strictStateMode;exports.ControlBaseMeta={inputs:["isDisabled","tabOrder"],events:["gotFocus","invalidInput","lostFocus","refreshed","refreshing"]};var alwaysClearProps=new Set(["columns","columnGroups"]),unsuppressedChangedEventProps=new Set(["panes","columnGroups","columns","items"]),specialProps=new Set(["initialized","wjItemTemplate"]);function updateChildProperties(e,r){var n=e.controlRef.current,t={},o={};if(r){for(var s=wijmo_1.isArray(r)?r.flat(1/0):[r],i=[],a=0,c=new Set,u=0,l=s;u<l.length;u++){if((g=l[u])&&g.type&&g.type.$$typeof==Symbol.for("react.forward_ref")){i.push(g.type.render(g.props,g.ref));i[i.length-1].$index=a;i[i.length-1].$key=g.key}else if(g&&wijmo_1.isFunction(g.type)){i.push(g.type(g.props));i[i.length-1].$index=a;i[i.length-1].$key=g.key}g||c.add(a);a++}for(var p=[],f=0,d=i;f<d.length;f++){if((g=d[f]).assignedToParent){if(g.wjProperty){g.parentProp=wijmo_1.asString(g.wjProperty);g.isParentPropArray=n[g.parentProp]&&wijmo_1.isArray(n[g.parentProp])}g.isParentPropArray&&!t[g.parentProp]&&(t[g.parentProp]=[]);g.isParentPropArray?t[g.parentProp].push({getInstance:g.getInstance,props:g.props,$key:g.$key,$index:g.$index}):t[g.parentProp]={getInstance:g.getInstance,props:g.props}}else p.push(g)}var h=e.childInfo,_loop_1=function(e){if(wijmo_1.isArray(t[e])){var r=!1;if(n[e]&&null!=n[e]._updating&&!unsuppressedChangedEventProps.has(e)){n[e]._updating++;r=!0}var s=h[e];o[e]=[];if(!h[e]){s=[];n[e]&&n[e].clear?n[e].clear():n[e]||(n[e]=new wijmo_1.ObservableArray)}!_oldSyncBehavior&&alwaysClearProps.has(e)&&n[e]&&n[e].clear&&n[e].clear();if(_oldSyncBehavior)for(var i=s.length-1;i>=0;i--)if(c.has(s[i].$index)){n[e].remove(s[i].instance);s.splice(i,1)}for(var a=[],u={},l=0,p=s;l<p.length;l++){var f=p[l];null!=f.$key?u[""+f.$key]=f:a.push(f)}for(var d=0,getExistingInstance=function(e){void 0===e&&(e=null);if(null!=e){var r=u[e];null!=r&&delete u[e];return r}return a[d++]},v=0;v<t[e].length;v++){var y=!1;if(P=getExistingInstance(t[e][v].$key))P.updateProps(t[e][v].props);else{P=t[e][v].getInstance(n);y=!0}P.$index=t[e][v].$index;P.$key=t[e][v].$key;(!_oldSyncBehavior&&alwaysClearProps.has(e)||y)&&(n[e].length==v?n[e].push(P.instance):n[e].splice(v,0,P.instance));o[e].push(P)}for(var m=0,_=Object.keys(u);m<_.length;m++){var g=_[m];n[e].remove(u[g].instance)}for(;!_oldSyncBehavior&&n[e].length>o[e].length;)n[e].pop();if(r){n[e]._updating--;h[e]&&h[e].length==t[e].length||n[e]._raiseCollectionChanged&&n[e]._raiseCollectionChanged()}}else{var P;if(P=h[e])P.updateProps(t[e].props);else{P=t[e].getInstance(n);n[e]=P.instance}o[e]=P}};for(var v in t)_loop_1(v);for(var y=[],m=0,_=h.$_nonassignable||[];m<_.length;m++){var g=_[m];c.has(g.$index)?g.instance&&g.instance.dispose&&wijmo_1.isFunction(g.instance.dispose)&&g.instance.dispose():y.push(g)}for(var P=[],w=0;w<p.length;w++){var R=y[w];R?R.updateProps(p[w].props):R=p[w].getInstance(n);R.$index=p[w].$index;P.push(R)}o.$_nonassignable=P;for(;w<y.length;w++)y[w].instance&&y[w].instance.dispose&&wijmo_1.isFunction(y[w].instance.dispose)&&y[w].instance.dispose()}if(_oldSyncBehavior)for(var S=0,C=Object.keys(e.childInfo);S<C.length;S++){var j=C[S];if(wijmo_1.isArray(e.childInfo[j])&&!t[j]&&n[j]&&n[j].remove)for(var k=0,b=e.childInfo[j];k<b.length;k++){var M=b[k];n[j].remove(M.instance)}}return o}function getPropsAccordingToSyncMode(e,r,n){void 0===n&&(n=null);if(!r||!_oldSyncBehavior){return __assign({},e)}var t={};for(var o in e){var s=!1;n&&(s=n.knowProperties.has(o)||n.knowEvents.has(o)||n.knowCustomProps.has(o));(n&&!s||e[o]!==r[o])&&(t[o]=e[o])}return t}function useWjComponentBase(e){var r=React.useRef({}),n=React.useRef(),t=React.useRef(),o=React.useRef(),s=React.useRef(),i=React.useRef({}),a=React.useRef(!1);e.customProps||(e.customProps={});if(!n.current){n.current={};n.current.knowProperties=new Set(e.properties);n.current.knowEvents=new Set(e.events);n.current.knowCustomProps=new Set(Object.keys(e.customProps))}var c=e.props;if(s.current){c=getPropsAccordingToSyncMode(e.props,r.current,n.current);r.current=e.props}var u={},l={},p={},f={},d=e.ref||null;for(var h in c)if(n.current.knowProperties.has(h))u[h]=c[h];else if(n.current.knowEvents.has(h)){l[h]=c[h];u[h]=c[h]}else e.customProps[h]?f[h]=c[h]:specialProps.has(h)||(p[h]=c[h]);if(s.current&&_oldSyncBehavior)for(var h in l)delete u[h];var updateProps=function(){d&&d.current&&(d.current.props=e.props);updateChildProps();var r=[],n=u;if(o.current&&s.current&&!_oldSyncBehavior){for(var t in o.current)if(s.current[t]){if(s.current[t]._handlersChanged){s.current[t]._cachedHandlersChanged=s.current[t]._handlersChanged;s.current[t]._handlersChanged=null;r.push(s.current[t])}s.current[t].removeHandler(o.current[t])}n=__assign({},u);for(var i in l){delete n[i];s.current[i].addHandler(l[i])}}else if(!o.current){n=__assign({},u);for(var i in l)delete n[i]}o.current=l;if(s.current){wijmo_1.copy(s.current,n,!1,!0);for(var a in f)e.customProps[a](s.current,f[a]);!function(){for(var e=0,n=r;e<n.length;e++){var t=n[e];if(t._cachedHandlersChanged){t._handlersChanged=t._cachedHandlersChanged;t._cachedHandlersChanged=null}}r=[]}();s.current.invalidate()}},updateChildProps=function(){i.current=updateChildProperties({controlRef:s,childInfo:i.current},e.props.children)};React.useEffect((function(){if(t.current&&!s.current){s.current=new e.constructor(t.current,u);e.prePropsInit&&e.prePropsInit(s.current);d&&(wijmo_1.isFunction(d)?d({control:s.current,props:e.props}):d.current&&d.current.control==s.current||(d.current={control:s.current,props:e.props}));updateProps();e.initControl&&e.initControl(s.current);e.props.initialized&&setTimeout((function(){s.current&&e.props.initialized(s.current)}))}else a.current&&(a.current=!1);return function(){if(s.current){var e=s.current;a.current=!0;queueMicrotask((function(){if(a.current){e.dispose();s.current=null;i.current={};a.current=!1}}))}}}),[]);s.current&&updateProps();return{renderResult:React.createElement("div",__assign({ref:t},p),[]),wjControl:s.current}}exports.useWjComponentBase=useWjComponentBase;function filterKnownProps(e,r,n){var t={};for(var o in e)(r.has(o)||n.has(o))&&(t[o]=e[o]);return t}function clearAndGetEvents(e,r,n,t){var o=t.current;for(var s in o)e[s]&&e[s].removeHandler(o[s]);var i={};for(var a in r)n.has(a)&&(i[a]=r[a]);return i}function getCustomPropsData(e,r){var n={};for(var t in r)void 0!==e[t]&&(n[t]=e[t]);return n}function useWjComponentChildBase(e){var r={};r.knowProperties=new Set(e.properties);r.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:function(n){var t={current:{}},o={current:{}},s={current:{}},i=getPropsAccordingToSyncMode(e.props,t.current),a=filterKnownProps(i,r.knowProperties,r.knowEvents),c=getCustomPropsData(i,e.customProps||{}),u=e.customConstructor?e.customConstructor(n,a,c):new e.constructor(e.needParentInstance?n:a,e.needParentInstance?a:void 0);e.ref&&(wijmo_1.isFunction(e.ref)?e.ref({control:u,props:e.props}):e.ref.current&&e.ref.current.control==u||(e.ref.current={control:u,props:e.props}));s.current=clearAndGetEvents(u,i,r.knowEvents,s);var updateProps=function(n){var i=getPropsAccordingToSyncMode(n,t.current);t.current=n;e.ref&&e.ref.current&&(e.ref.current.props=n);s.current=clearAndGetEvents(u,i,r.knowEvents,s);var a,c=filterKnownProps(i,r.knowProperties,r.knowEvents);u.initialize?u.initialize(c):wijmo_1.copy(u,c,!1,!0);for(var l in e.customProps)void 0!==i[l]&&e.customProps[l](u,i[l]);a=n.children||[],o.current=updateChildProperties({controlRef:{current:u},childInfo:o.current},a)};updateProps(e.props||[]);e.props.initialized&&wijmo_1.isFunction(e.props.initialized)&&e.props.initialized(u);return{instance:u,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}exports.useWjComponentChildBase=useWjComponentChildBase;var _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){var version=parseInt(React.version);_reactMajorVersion=version;version>=18&&lazyImportDomClient()}var flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{var e=console.error,r=!1;console.error=function(){var e=arguments[0]||"";e.includes("flushSync")&&(r=!0)};flushSync((function(){}));console.error=e;flushSyncStateCache.isReactRendering=r}catch(e){}finally{queueMicrotask((function(){flushSyncStateCache.isReactRendering=null}))}return!!flushSyncStateCache.isReactRendering}function selectiveDomRender(e,r,n){void 0===n&&(n=!1);if(_reactMajorVersion<18)ReactDOM.render(e,r);else{isReactRendering()&&(n=!0);var t,o=elemRootMap.findIndex((function(e){return e.host===r}));if(-1===o){t=reactDomClient.createRoot(r);elemRootMap.push({host:r,root:t})}else t=elemRootMap[o].root;t.__scheduledForUnmount=!1;n?queueMicrotask((function(){flushSync((function(){t.render(e)}))})):flushSync((function(){t.render(e)}))}return r}exports.selectiveDomRender=selectiveDomRender;function selectiveDomUnmount(e){if(_reactMajorVersion<18)ReactDOM.unmountComponentAtNode(e);else{var r=elemRootMap.findIndex((function(r){return r.host===e}));if(-1!==r){var n=elemRootMap[r].root;if(isReactRendering()){n.__scheduledForUnmount=!0;queueMicrotask((function(){n.__scheduledForUnmount&&flushSync((function(){n.unmount();n.__scheduledForUnmount=null;elemRootMap.splice(r,1)}))}))}else flushSync((function(){n.unmount();elemRootMap.splice(r,1)}))}}}exports.selectiveDomUnmount=selectiveDomUnmount;function baseFlushSync(){flushSync((function(){}))}exports.baseFlushSync=baseFlushSync;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grapecity/wijmo.react.base",
|
|
3
|
-
"version": "5.20241.
|
|
3
|
+
"version": "5.20241.19",
|
|
4
4
|
"description": "UI library for pure JS, Angular, React, Vue and more...",
|
|
5
5
|
"author": "MESCIUS inc",
|
|
6
6
|
"license": "Commercial",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grapecity/wijmo": "5.20241.
|
|
10
|
+
"@grapecity/wijmo": "5.20241.19"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://developer.mescius.com/wijmo",
|
|
13
13
|
"bugs": {
|