@mescius/wijmo.react.base 5.20261.45-nightly.d20251218.t163151 → 5.20261.45-nightly.d20260105.t163143
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/es2015-commonjs.js +2 -2
- package/es2015-esm.js +2 -2
- package/es5-esm.js +1 -1
- package/index.d.ts +50 -50
- package/index.js +1 -1
- package/package.json +2 -2
package/es2015-commonjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20261.45-nightly.
|
|
3
|
+
* Wijmo Library 5.20261.45-nightly.d20260105.t163143
|
|
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(e,t,n,r){return new(n||(n=Promise))((function(o,s){function fulfilled(e){try{step(r.next(e))}catch(e){s(e)}}function rejected(e){try{step(r.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):new n((function(t){t(e.value)})).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))},__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@mescius/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,reactDomClientLoadPromise=null,reactDomClientReady=!1;function setReactDomClient(e){reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e&&e.flushSync||flushSync}function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const e=yield Promise.resolve().then(()=>__importStar(require("react-dom/client")));setReactDomClient(e.default||e)}catch(e){try{setReactDomClient(require("react-dom/client"))}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}}reactDomClientReady=!0}))}function ensureReactDomClientLoaded(){return __awaiter(this,void 0,void 0,(function*(){reactDomClientLoadPromise&&(yield reactDomClientLoadPromise)}))}let _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){const e=parseInt(React.version);_reactMajorVersion=e;e>=18?reactDomClientLoadPromise=lazyImportDomClient():reactDomClientReady=!0}function wjForwardRef(e){return _reactMajorVersion>=19?t=>e(t,t.ref):React.forwardRef(e)}exports.wjForwardRef=wjForwardRef;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"]),buildInProps=new Set(["className"]);function updateChildProperties(e,t){const n=e.controlRef.current,r={},o={};if(t){const s=wijmo_1.isArray(t)?t.flat(1/0):[t],c=[];let i=0;const a=new Set;for(let e of s){if(e&&e.type&&e.type.$$typeof==Symbol.for("react.forward_ref")){_reactMajorVersion>=19?c.push(e.type.render(e.props,e.props.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||a.add(i);i++}const l=[];for(let e of c)if(e.assignedToParent){if(e.wjProperty){e.parentProp=wijmo_1.asString(e.wjProperty);e.isParentPropArray=n[e.parentProp]&&wijmo_1.isArray(n[e.parentProp])}e.isParentPropArray&&!r[e.parentProp]&&(r[e.parentProp]=[]);e.isParentPropArray?r[e.parentProp].push({getInstance:e.getInstance,props:e.props,$key:e.$key,$index:e.$index}):r[e.parentProp]={getInstance:e.getInstance,props:e.props}}else l.push(e);const u=e.childInfo;for(let e in r)if(wijmo_1.isArray(r[e])){let t=!1;if(n[e]&&null!=n[e]._updating&&!unsuppressedChangedEventProps.has(e)){n[e]._updating++;t=!0}let s=u[e];o[e]=[];let c=!1;if(!u[e]){s=[];if(n[e]&&n[e].clear){n[e].clear();c=!0}else n[e]||(n[e]=new wijmo_1.ObservableArray)}if(!_oldSyncBehavior&&alwaysClearProps.has(e)){if(n[e]&&n[e].clear){n[e].clear();c=!0}}else if(!isKeyOrderSame(s,r[e],"$key")&&n[e]&&n[e].clear){n[e].clear();c=!0}if(_oldSyncBehavior)for(let t=s.length-1;t>=0;t--)if(a.has(s[t].$index)){n[e].remove(s[t].instance);s.splice(t,1)}const i=[],l={};for(let e of s)null!=e.$key?l[""+e.$key]=e:i.push(e);let p=0;const getExistingInstance=(e=null)=>{if(null!=e){let t=l[e];null!=t&&delete l[e];return t}return i[p++]};for(let t=0;t<r[e].length;t++){let s=getExistingInstance(r[e][t].$key),i=!1;if(s)s.updateProps(r[e][t].props);else{s=r[e][t].getInstance(n);i=!0}s.$index=r[e][t].$index;s.$key=r[e][t].$key;(c||i)&&(n[e].length==t?n[e].push(s.instance):n[e].splice(t,0,s.instance));o[e].push(s)}for(let t of Object.keys(l))n[e].remove(l[t].instance);for(;!_oldSyncBehavior&&n[e].length>o[e].length;)n[e].pop();if(t){n[e]._updating--;!c&&u[e]&&u[e].length==r[e].length||n[e]._raiseCollectionChanged&&n[e]._raiseCollectionChanged()}}else{let t=u[e];if(t)t.updateProps(r[e].props);else{t=r[e].getInstance(n);n[e]=t.instance}o[e]=t}const p=[];for(let e of u.$_nonassignable||[])a.has(e.$index)?e.instance&&e.instance.dispose&&wijmo_1.isFunction(e.instance.dispose)&&e.instance.dispose():p.push(e);const d=[];let f=0;for(;f<l.length;f++){let e=p[f];e?e.updateProps(l[f].props):e=l[f].getInstance(n);e.$index=l[f].$index;d.push(e)}o.$_nonassignable=d;for(;f<p.length;f++)p[f].instance&&p[f].instance.dispose&&wijmo_1.isFunction(p[f].instance.dispose)&&p[f].instance.dispose()}if(_oldSyncBehavior)for(let t of Object.keys(e.childInfo))if(wijmo_1.isArray(e.childInfo[t])&&!r[t]&&n[t]&&n[t].remove)for(let r of e.childInfo[t])n[t].remove(r.instance);return o}function getPropsAccordingToSyncMode(e,t,n=null){if(!t||!_oldSyncBehavior){return Object.assign({},e)}let r={};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]!==t[o])&&(r[o]=e[o])}return r}function useWjComponentBase(e){const t=React.useRef({}),n=React.useRef(),r=React.useRef(),o=React.useRef(),s=React.useRef(),c=React.useRef({}),i=React.useRef(!1),a=React.useRef(null),l=React.useRef(null);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 u=e.props;if(s.current){u=getPropsAccordingToSyncMode(e.props,t.current,n.current);t.current=e.props}const p={},d={},f={},h={},m={},y=e.ref||null;for(let t in u)if(n.current.knowProperties.has(t))p[t]=u[t];else if(n.current.knowEvents.has(t)){d[t]=u[t];p[t]=u[t]}else e.customProps[t]?h[t]=u[t]:buildInProps.has(t)?m[t]=u[t]:specialProps.has(t)||(f[t]=u[t]);if(s.current&&_oldSyncBehavior)for(let e in d)delete p[e];const updateProps=()=>{y&&y.current&&(y.current.props=e.props);updateChildProps();let t=[],n=p;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;t.push(s.current[e])}s.current[e].removeHandler(o.current[e])}n=Object.assign({},p);for(let e in d){delete n[e];s.current[e].addHandler(d[e])}}else if(!o.current){n=Object.assign({},p);for(let e in d)delete n[e]}o.current=d;if(s.current){wijmo_1.copy(s.current,n,!1,!0);for(let e in m)_setHostAttribute(s.current.hostElement,e,m[e]);for(let t in h)e.customProps[t](s.current,h[t]);(()=>{for(let e of t)if(e._cachedHandlersChanged){e._handlersChanged=e._cachedHandlersChanged;e._cachedHandlersChanged=null}t=[]})()}},updateChildProps=()=>{c.current=updateChildProperties({controlRef:s,childInfo:c.current},e.props.children)};React.useLayoutEffect(()=>{if(r.current&&!s.current){s.current=new e.constructor(r.current,p);e.prePropsInit&&e.prePropsInit(s.current);if(y)if(wijmo_1.isFunction(y)){const t=y({control:s.current,props:e.props});wijmo_1.isFunction(t)&&(a.current=t)}else y.current&&y.current.control==s.current||(y.current={control:s.current,props:e.props});for(let e in m)_setHostAttribute(s.current.hostElement,e,m[e]);e.props.children&&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;a.current&&a.current()}})}}},[]);s.current&&queueMicrotask(()=>updateProps());const _=React.createElement("div",Object.assign({},f,{ref:r}),[]),_setHostAttribute=(e,t,n)=>{if(e)switch(t){case"className":const t=l.current;if(t!==n){wijmo_1.removeClass(e,t);wijmo_1.addClass(e,n);l.current=n}}};return{renderResult:_,wjControl:s.current}}exports.useWjComponentBase=useWjComponentBase;function filterKnownProps(e,t,n){const r={};for(let o in e)(t.has(o)||n.has(o))&&(r[o]=e[o]);return r}function clearAndGetEvents(e,t,n,r){const o=r.current,s={};for(let e in t)n.has(e)&&(s[e]=t[e]);for(let n in o)e[n]&&(!_oldSyncBehavior||t[n]?e[n].removeHandler(o[n]):s[n]=o[n]);return s}function getCustomPropsData(e,t){const n={};for(let r in t)void 0!==e[r]&&(n[r]=e[r]);return n}function useWjComponentChildBase(e){const t={};t.knowProperties=new Set(e.properties);t.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:n=>{const r={current:{}},o={current:{}},s={current:{}},c=getPropsAccordingToSyncMode(e.props,r.current),i=filterKnownProps(c,t.knowProperties,t.knowEvents),a=getCustomPropsData(c,e.customProps||{}),l=e.customConstructor?e.customConstructor(n,i,a):new e.constructor(e.needParentInstance?n:i,e.needParentInstance?i:void 0);e.ref&&(wijmo_1.isFunction(e.ref)?e.ref({control:l,props:e.props}):e.ref.current&&e.ref.current.control==l||(e.ref.current={control:l,props:e.props}));s.current=clearAndGetEvents(l,c,t.knowEvents,s);const updateProps=n=>{const c=getPropsAccordingToSyncMode(n,r.current);r.current=n;e.ref&&e.ref.current&&(e.ref.current.props=n);s.current=clearAndGetEvents(l,c,t.knowEvents,s);const i=filterKnownProps(c,t.knowProperties,t.knowEvents);l.initialize?l.initialize(i):wijmo_1.copy(l,i,!1,!0);for(let t in e.customProps)void 0!==c[t]&&e.customProps[t](l,c[t]);a=n.children||[],o.current=updateChildProperties({controlRef:{current:l},childInfo:o.current},a);var a};updateProps(e.props||[]);e.props.initialized&&wijmo_1.isFunction(e.props.initialized)&&e.props.initialized(l);return{instance:l,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}exports.useWjComponentChildBase=useWjComponentChildBase;const flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{const e=console.error;let t=!1;console.error=function(){const e=arguments[0]||"";e.includes("flushSync")&&(t=!0)};flushSync(()=>{});console.error=e;flushSyncStateCache.isReactRendering=t}catch(e){}finally{queueMicrotask(()=>{flushSyncStateCache.isReactRendering=null})}return!!flushSyncStateCache.isReactRendering}function getReactDOM(){return ReactDOM}function _doRender(e,t,n=!1){isReactRendering()&&(n=!0);const r=elemRootMap.findIndex(e=>e.host===t);let o;if(-1===r){o=reactDomClient.createRoot(t);elemRootMap.push({host:t,root:o})}else o=elemRootMap[r].root;o.__scheduledForUnmount=!1;n?queueMicrotask(()=>{flushSync(()=>{o.render(e)})}):flushSync(()=>{o.render(e)})}function selectiveDomRender(e,t,n=!1){if(_reactMajorVersion<18){(0,getReactDOM().render)(e,t)}else if(reactDomClientReady)_doRender(e,t,n);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doRender(e,t,n)})))()}return t}exports.selectiveDomRender=selectiveDomRender;function unmountSafely(e){const t=e._internalRoot&&e._internalRoot.containerInfo.firstChild,n=e._internalRoot&&e._internalRoot.current&&e._internalRoot.current.child&&e._internalRoot.current.child.stateNode;n&&t==n?e.unmount():e._internalRoot=null;e.__scheduledForUnmount=null}function _doUnmount(e){const t=elemRootMap.findIndex(t=>t.host===e);if(-1!==t){const e=elemRootMap[t].root;if(isReactRendering()){e.__scheduledForUnmount=!0;queueMicrotask(()=>{e.__scheduledForUnmount&&flushSync(()=>{unmountSafely(e);elemRootMap.splice(t,1)})})}else flushSync(()=>{unmountSafely(e);elemRootMap.splice(t,1)})}}function selectiveDomUnmount(e){if(_reactMajorVersion<18){(0,getReactDOM().unmountComponentAtNode)(e)}else if(reactDomClientReady)_doUnmount(e);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doUnmount(e)})))()}}exports.selectiveDomUnmount=selectiveDomUnmount;function isKeyOrderSame(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(e[r][n]!=t[r][n])return!1;return!0}function baseFlushSync(){flushSync(()=>{})}exports.baseFlushSync=baseFlushSync;
|
|
14
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(o,s){function fulfilled(e){try{step(r.next(e))}catch(e){s(e)}}function rejected(e){try{step(r.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):new t((function(n){n(e.value)})).then(fulfilled,rejected)}step((r=r.apply(e,n||[])).next())}))},__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);n.default=e;return n};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@mescius/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,reactDomClientLoadPromise=null,reactDomClientReady=!1;function setReactDomClient(e){reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e&&e.flushSync||flushSync}function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const e=yield Promise.resolve().then(()=>__importStar(require("react-dom/client")));setReactDomClient(e.default||e)}catch(e){try{setReactDomClient(require("react-dom/client"))}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}}reactDomClientReady=!0}))}function ensureReactDomClientLoaded(){return __awaiter(this,void 0,void 0,(function*(){reactDomClientLoadPromise&&(yield reactDomClientLoadPromise)}))}let _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){const e=parseInt(React.version);_reactMajorVersion=e;e>=18?reactDomClientLoadPromise=lazyImportDomClient():reactDomClientReady=!0}function wjForwardRef(e){return _reactMajorVersion>=19?n=>e(n,n.ref):React.forwardRef(e)}exports.wjForwardRef=wjForwardRef;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"]),buildInProps=new Set(["className"]);function updateChildProperties(e,n){const t=e.controlRef.current,r={},o={};if(n){const s=wijmo_1.isArray(n)?n.flat(1/0):[n],c=[];let i=0;const a=new Set;for(const e of s){if(e&&e.type&&e.type.$$typeof==Symbol.for("react.forward_ref")){_reactMajorVersion>=19?c.push(e.type.render(e.props,e.props.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||a.add(i);i++}const l=[];for(const 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&&!r[e.parentProp]&&(r[e.parentProp]=[]);e.isParentPropArray?r[e.parentProp].push({getInstance:e.getInstance,props:e.props,$key:e.$key,$index:e.$index}):r[e.parentProp]={getInstance:e.getInstance,props:e.props}}else l.push(e);const u=e.childInfo;for(const e in r)if(wijmo_1.isArray(r[e])){let n=!1;if(t[e]&&null!=t[e]._updating&&!unsuppressedChangedEventProps.has(e)){t[e]._updating++;n=!0}let s=u[e];o[e]=[];let c=!1;if(!u[e]){s=[];if(t[e]&&t[e].clear){t[e].clear();c=!0}else t[e]||(t[e]=new wijmo_1.ObservableArray)}if(!_oldSyncBehavior&&alwaysClearProps.has(e)){if(t[e]&&t[e].clear){t[e].clear();c=!0}}else if(!isKeyOrderSame(s,r[e],"$key")&&t[e]&&t[e].clear){t[e].clear();c=!0}if(_oldSyncBehavior)for(let n=s.length-1;n>=0;n--)if(a.has(s[n].$index)){t[e].remove(s[n].instance);s.splice(n,1)}const i=[],l={};for(const e of s)null!=e.$key?l[""+e.$key]=e:i.push(e);let p=0;const getExistingInstance=(e=null)=>{if(null!=e){const n=l[e];null!=n&&delete l[e];return n}return i[p++]};for(let n=0;n<r[e].length;n++){let s=getExistingInstance(r[e][n].$key),i=!1;if(s)s.updateProps(r[e][n].props);else{s=r[e][n].getInstance(t);i=!0}s.$index=r[e][n].$index;s.$key=r[e][n].$key;(c||i)&&(t[e].length==n?t[e].push(s.instance):t[e].splice(n,0,s.instance));o[e].push(s)}for(const n of Object.keys(l))t[e].remove(l[n].instance);for(;!_oldSyncBehavior&&t[e].length>o[e].length;)t[e].pop();if(n){t[e]._updating--;!c&&u[e]&&u[e].length==r[e].length||t[e]._raiseCollectionChanged&&t[e]._raiseCollectionChanged()}}else{let n=u[e];if(n)n.updateProps(r[e].props);else{n=r[e].getInstance(t);t[e]=n.instance}o[e]=n}const p=[];for(const e of u.$_nonassignable||[])a.has(e.$index)?e.instance&&e.instance.dispose&&wijmo_1.isFunction(e.instance.dispose)&&e.instance.dispose():p.push(e);const d=[];let f=0;for(;f<l.length;f++){let e=p[f];e?e.updateProps(l[f].props):e=l[f].getInstance(t);e.$index=l[f].$index;d.push(e)}o.$_nonassignable=d;for(;f<p.length;f++)p[f].instance&&p[f].instance.dispose&&wijmo_1.isFunction(p[f].instance.dispose)&&p[f].instance.dispose()}if(_oldSyncBehavior)for(const n of Object.keys(e.childInfo))if(wijmo_1.isArray(e.childInfo[n])&&!r[n]&&t[n]&&t[n].remove)for(const r of e.childInfo[n])t[n].remove(r.instance);return o}function getPropsAccordingToSyncMode(e,n,t=null){if(!n||!_oldSyncBehavior){return Object.assign({},e)}const r={};for(const o in e){let s=!1;t&&(s=t.knowProperties.has(o)||t.knowEvents.has(o)||t.knowCustomProps.has(o));(t&&!s||e[o]!==n[o])&&(r[o]=e[o])}return r}function useWjComponentBase(e){const n=React.useRef({}),t=React.useRef(),r=React.useRef(),o=React.useRef(),s=React.useRef(),c=React.useRef({}),i=React.useRef(!1),a=React.useRef(null),l=React.useRef(null);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 u=e.props;if(s.current){u=getPropsAccordingToSyncMode(e.props,n.current,t.current);n.current=e.props}const p={},d={},f={},h={},m={},y=e.ref||null;for(const n in u)if(t.current.knowProperties.has(n))p[n]=u[n];else if(t.current.knowEvents.has(n)){d[n]=u[n];p[n]=u[n]}else e.customProps[n]?h[n]=u[n]:buildInProps.has(n)?m[n]=u[n]:specialProps.has(n)||(f[n]=u[n]);if(s.current&&_oldSyncBehavior)for(const e in d)delete p[e];const updateProps=()=>{y&&y.current&&(y.current.props=e.props);updateChildProps();let n=[],t=p;if(o.current&&s.current&&!_oldSyncBehavior){for(const 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;n.push(s.current[e])}s.current[e].removeHandler(o.current[e])}t=Object.assign({},p);for(const e in d){delete t[e];s.current[e].addHandler(d[e])}}else if(!o.current){t=Object.assign({},p);for(const e in d)delete t[e]}o.current=d;if(s.current){wijmo_1.copy(s.current,t,!1,!0);for(const e in m)_setHostAttribute(s.current.hostElement,e,m[e]);for(const n in h)e.customProps[n](s.current,h[n]);(()=>{for(const e of n)if(e._cachedHandlersChanged){e._handlersChanged=e._cachedHandlersChanged;e._cachedHandlersChanged=null}n=[]})()}},updateChildProps=()=>{c.current=updateChildProperties({controlRef:s,childInfo:c.current},e.props.children)};React.useLayoutEffect(()=>{if(r.current&&!s.current){s.current=new e.constructor(r.current,p);e.prePropsInit&&e.prePropsInit(s.current);if(y)if(wijmo_1.isFunction(y)){const n=y({control:s.current,props:e.props});wijmo_1.isFunction(n)&&(a.current=n)}else y.current&&y.current.control==s.current||(y.current={control:s.current,props:e.props});for(const e in m)_setHostAttribute(s.current.hostElement,e,m[e]);e.props.children&&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;a.current&&a.current()}})}}},[]);s.current&&queueMicrotask(()=>updateProps());const _=React.createElement("div",Object.assign({},f,{ref:r}),[]),_setHostAttribute=(e,n,t)=>{if(e)switch(n){case"className":{const n=l.current;if(n!==t){wijmo_1.removeClass(e,n);wijmo_1.addClass(e,t);l.current=t}break}}};return{renderResult:_,wjControl:s.current}}exports.useWjComponentBase=useWjComponentBase;function filterKnownProps(e,n,t){const r={};for(const o in e)(n.has(o)||t.has(o))&&(r[o]=e[o]);return r}function clearAndGetEvents(e,n,t,r){const o=r.current,s={};for(const e in n)t.has(e)&&(s[e]=n[e]);for(const t in o)e[t]&&(!_oldSyncBehavior||n[t]?e[t].removeHandler(o[t]):s[t]=o[t]);return s}function getCustomPropsData(e,n){const t={};for(const r in n)void 0!==e[r]&&(t[r]=e[r]);return t}function useWjComponentChildBase(e){const n={};n.knowProperties=new Set(e.properties);n.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:t=>{const r={current:{}},o={current:{}},s={current:{}},c=getPropsAccordingToSyncMode(e.props,r.current),i=filterKnownProps(c,n.knowProperties,n.knowEvents),a=getCustomPropsData(c,e.customProps||{}),l=e.customConstructor?e.customConstructor(t,i,a):new e.constructor(e.needParentInstance?t:i,e.needParentInstance?i:void 0);e.ref&&(wijmo_1.isFunction(e.ref)?e.ref({control:l,props:e.props}):e.ref.current&&e.ref.current.control==l||(e.ref.current={control:l,props:e.props}));s.current=clearAndGetEvents(l,c,n.knowEvents,s);const updateProps=t=>{const c=getPropsAccordingToSyncMode(t,r.current);r.current=t;e.ref&&e.ref.current&&(e.ref.current.props=t);s.current=clearAndGetEvents(l,c,n.knowEvents,s);const i=filterKnownProps(c,n.knowProperties,n.knowEvents);l.initialize?l.initialize(i):wijmo_1.copy(l,i,!1,!0);for(const n in e.customProps)void 0!==c[n]&&e.customProps[n](l,c[n]);a=t.children||[],o.current=updateChildProperties({controlRef:{current:l},childInfo:o.current},a);var a};updateProps(e.props||[]);e.props.initialized&&wijmo_1.isFunction(e.props.initialized)&&e.props.initialized(l);return{instance:l,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}exports.useWjComponentChildBase=useWjComponentChildBase;const flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{const e=console.error;let n=!1;console.error=function(){const e=arguments[0]||"";e.includes("flushSync")&&(n=!0)};flushSync(()=>{});console.error=e;flushSyncStateCache.isReactRendering=n}catch(e){}finally{queueMicrotask(()=>{flushSyncStateCache.isReactRendering=null})}return!!flushSyncStateCache.isReactRendering}function getReactDOM(){return ReactDOM}function _doRender(e,n,t=!1){isReactRendering()&&(t=!0);const r=elemRootMap.findIndex(e=>e.host===n);let o;if(-1===r){o=reactDomClient.createRoot(n);elemRootMap.push({host:n,root:o})}else o=elemRootMap[r].root;o.__scheduledForUnmount=!1;t?queueMicrotask(()=>{flushSync(()=>{o.render(e)})}):flushSync(()=>{o.render(e)})}function selectiveDomRender(e,n,t=!1){if(_reactMajorVersion<18){(0,getReactDOM().render)(e,n)}else if(reactDomClientReady)_doRender(e,n,t);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doRender(e,n,t)})))()}return n}exports.selectiveDomRender=selectiveDomRender;function unmountSafely(e){const n=e._internalRoot&&e._internalRoot.containerInfo.firstChild,t=e._internalRoot&&e._internalRoot.current&&e._internalRoot.current.child&&e._internalRoot.current.child.stateNode;t&&n==t?e.unmount():e._internalRoot=null;e.__scheduledForUnmount=null}function _doUnmount(e){const n=elemRootMap.findIndex(n=>n.host===e);if(-1!==n){const e=elemRootMap[n].root;if(isReactRendering()){e.__scheduledForUnmount=!0;queueMicrotask(()=>{e.__scheduledForUnmount&&flushSync(()=>{unmountSafely(e);elemRootMap.splice(n,1)})})}else flushSync(()=>{unmountSafely(e);elemRootMap.splice(n,1)})}}function selectiveDomUnmount(e){if(_reactMajorVersion<18){(0,getReactDOM().unmountComponentAtNode)(e)}else if(reactDomClientReady)_doUnmount(e);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doUnmount(e)})))()}}exports.selectiveDomUnmount=selectiveDomUnmount;function isKeyOrderSame(e,n,t){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(e[r][t]!=n[r][t])return!1;return!0}function baseFlushSync(){flushSync(()=>{})}exports.baseFlushSync=baseFlushSync;
|
package/es2015-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20261.45-nightly.
|
|
3
|
+
* Wijmo Library 5.20261.45-nightly.d20260105.t163143
|
|
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(e,t,n,r){return new(n||(n=Promise))((function(o,s){function fulfilled(e){try{step(r.next(e))}catch(e){s(e)}}function rejected(e){try{step(r.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):new n((function(t){t(e.value)})).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))};import{ObservableArray,asString,copy,isArray,isFunction,removeClass,addClass,asBoolean}from"@mescius/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,reactDomClientLoadPromise=null,reactDomClientReady=!1;function setReactDomClient(e){reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e&&e.flushSync||flushSync}function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const e=yield import("react-dom/client");setReactDomClient(e.default||e)}catch(e){try{setReactDomClient(require("react-dom/client"))}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}}reactDomClientReady=!0}))}function ensureReactDomClientLoaded(){return __awaiter(this,void 0,void 0,(function*(){reactDomClientLoadPromise&&(yield reactDomClientLoadPromise)}))}let _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){const e=parseInt(React.version);_reactMajorVersion=e;e>=18?reactDomClientLoadPromise=lazyImportDomClient():reactDomClientReady=!0}export function wjForwardRef(e){return _reactMajorVersion>=19?t=>e(t,t.ref):React.forwardRef(e)}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"]),buildInProps=new Set(["className"]);function updateChildProperties(e,t){const n=e.controlRef.current,r={},o={};if(t){const s=isArray(t)?t.flat(1/0):[t],c=[];let i=0;const a=new Set;for(let e of s){if(e&&e.type&&e.type.$$typeof==Symbol.for("react.forward_ref")){_reactMajorVersion>=19?c.push(e.type.render(e.props,e.props.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||a.add(i);i++}const l=[];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&&!r[e.parentProp]&&(r[e.parentProp]=[]);e.isParentPropArray?r[e.parentProp].push({getInstance:e.getInstance,props:e.props,$key:e.$key,$index:e.$index}):r[e.parentProp]={getInstance:e.getInstance,props:e.props}}else l.push(e);const u=e.childInfo;for(let e in r)if(isArray(r[e])){let t=!1;if(n[e]&&null!=n[e]._updating&&!unsuppressedChangedEventProps.has(e)){n[e]._updating++;t=!0}let s=u[e];o[e]=[];let c=!1;if(!u[e]){s=[];if(n[e]&&n[e].clear){n[e].clear();c=!0}else n[e]||(n[e]=new ObservableArray)}if(!_oldSyncBehavior&&alwaysClearProps.has(e)){if(n[e]&&n[e].clear){n[e].clear();c=!0}}else if(!isKeyOrderSame(s,r[e],"$key")&&n[e]&&n[e].clear){n[e].clear();c=!0}if(_oldSyncBehavior)for(let t=s.length-1;t>=0;t--)if(a.has(s[t].$index)){n[e].remove(s[t].instance);s.splice(t,1)}const i=[],l={};for(let e of s)null!=e.$key?l[""+e.$key]=e:i.push(e);let p=0;const getExistingInstance=(e=null)=>{if(null!=e){let t=l[e];null!=t&&delete l[e];return t}return i[p++]};for(let t=0;t<r[e].length;t++){let s=getExistingInstance(r[e][t].$key),i=!1;if(s)s.updateProps(r[e][t].props);else{s=r[e][t].getInstance(n);i=!0}s.$index=r[e][t].$index;s.$key=r[e][t].$key;(c||i)&&(n[e].length==t?n[e].push(s.instance):n[e].splice(t,0,s.instance));o[e].push(s)}for(let t of Object.keys(l))n[e].remove(l[t].instance);for(;!_oldSyncBehavior&&n[e].length>o[e].length;)n[e].pop();if(t){n[e]._updating--;!c&&u[e]&&u[e].length==r[e].length||n[e]._raiseCollectionChanged&&n[e]._raiseCollectionChanged()}}else{let t=u[e];if(t)t.updateProps(r[e].props);else{t=r[e].getInstance(n);n[e]=t.instance}o[e]=t}const p=[];for(let e of u.$_nonassignable||[])a.has(e.$index)?e.instance&&e.instance.dispose&&isFunction(e.instance.dispose)&&e.instance.dispose():p.push(e);const d=[];let f=0;for(;f<l.length;f++){let e=p[f];e?e.updateProps(l[f].props):e=l[f].getInstance(n);e.$index=l[f].$index;d.push(e)}o.$_nonassignable=d;for(;f<p.length;f++)p[f].instance&&p[f].instance.dispose&&isFunction(p[f].instance.dispose)&&p[f].instance.dispose()}if(_oldSyncBehavior)for(let t of Object.keys(e.childInfo))if(isArray(e.childInfo[t])&&!r[t]&&n[t]&&n[t].remove)for(let r of e.childInfo[t])n[t].remove(r.instance);return o}function getPropsAccordingToSyncMode(e,t,n=null){if(!t||!_oldSyncBehavior){return Object.assign({},e)}let r={};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]!==t[o])&&(r[o]=e[o])}return r}export function useWjComponentBase(e){const t=React.useRef({}),n=React.useRef(),r=React.useRef(),o=React.useRef(),s=React.useRef(),c=React.useRef({}),i=React.useRef(!1),a=React.useRef(null),l=React.useRef(null);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 u=e.props;if(s.current){u=getPropsAccordingToSyncMode(e.props,t.current,n.current);t.current=e.props}const p={},d={},f={},h={},y={},m=e.ref||null;for(let t in u)if(n.current.knowProperties.has(t))p[t]=u[t];else if(n.current.knowEvents.has(t)){d[t]=u[t];p[t]=u[t]}else e.customProps[t]?h[t]=u[t]:buildInProps.has(t)?y[t]=u[t]:specialProps.has(t)||(f[t]=u[t]);if(s.current&&_oldSyncBehavior)for(let e in d)delete p[e];const updateProps=()=>{m&&m.current&&(m.current.props=e.props);updateChildProps();let t=[],n=p;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;t.push(s.current[e])}s.current[e].removeHandler(o.current[e])}n=Object.assign({},p);for(let e in d){delete n[e];s.current[e].addHandler(d[e])}}else if(!o.current){n=Object.assign({},p);for(let e in d)delete n[e]}o.current=d;if(s.current){copy(s.current,n,!1,!0);for(let e in y)_setHostAttribute(s.current.hostElement,e,y[e]);for(let t in h)e.customProps[t](s.current,h[t]);(()=>{for(let e of t)if(e._cachedHandlersChanged){e._handlersChanged=e._cachedHandlersChanged;e._cachedHandlersChanged=null}t=[]})()}},updateChildProps=()=>{c.current=updateChildProperties({controlRef:s,childInfo:c.current},e.props.children)};React.useLayoutEffect(()=>{if(r.current&&!s.current){s.current=new e.constructor(r.current,p);e.prePropsInit&&e.prePropsInit(s.current);if(m)if(isFunction(m)){const t=m({control:s.current,props:e.props});isFunction(t)&&(a.current=t)}else m.current&&m.current.control==s.current||(m.current={control:s.current,props:e.props});for(let e in y)_setHostAttribute(s.current.hostElement,e,y[e]);e.props.children&&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;a.current&&a.current()}})}}},[]);s.current&&queueMicrotask(()=>updateProps());const R=React.createElement("div",Object.assign({},f,{ref:r}),[]),_setHostAttribute=(e,t,n)=>{if(e)switch(t){case"className":const t=l.current;if(t!==n){removeClass(e,t);addClass(e,n);l.current=n}}};return{renderResult:R,wjControl:s.current}}function filterKnownProps(e,t,n){const r={};for(let o in e)(t.has(o)||n.has(o))&&(r[o]=e[o]);return r}function clearAndGetEvents(e,t,n,r){const o=r.current,s={};for(let e in t)n.has(e)&&(s[e]=t[e]);for(let n in o)e[n]&&(!_oldSyncBehavior||t[n]?e[n].removeHandler(o[n]):s[n]=o[n]);return s}function getCustomPropsData(e,t){const n={};for(let r in t)void 0!==e[r]&&(n[r]=e[r]);return n}export function useWjComponentChildBase(e){const t={};t.knowProperties=new Set(e.properties);t.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:n=>{const r={current:{}},o={current:{}},s={current:{}},c=getPropsAccordingToSyncMode(e.props,r.current),i=filterKnownProps(c,t.knowProperties,t.knowEvents),a=getCustomPropsData(c,e.customProps||{}),l=e.customConstructor?e.customConstructor(n,i,a):new e.constructor(e.needParentInstance?n:i,e.needParentInstance?i:void 0);e.ref&&(isFunction(e.ref)?e.ref({control:l,props:e.props}):e.ref.current&&e.ref.current.control==l||(e.ref.current={control:l,props:e.props}));s.current=clearAndGetEvents(l,c,t.knowEvents,s);const updateProps=n=>{const c=getPropsAccordingToSyncMode(n,r.current);r.current=n;e.ref&&e.ref.current&&(e.ref.current.props=n);s.current=clearAndGetEvents(l,c,t.knowEvents,s);const i=filterKnownProps(c,t.knowProperties,t.knowEvents);l.initialize?l.initialize(i):copy(l,i,!1,!0);for(let t in e.customProps)void 0!==c[t]&&e.customProps[t](l,c[t]);a=n.children||[],o.current=updateChildProperties({controlRef:{current:l},childInfo:o.current},a);var a};updateProps(e.props||[]);e.props.initialized&&isFunction(e.props.initialized)&&e.props.initialized(l);return{instance:l,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}const flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{const e=console.error;let t=!1;console.error=function(){const e=arguments[0]||"";e.includes("flushSync")&&(t=!0)};flushSync(()=>{});console.error=e;flushSyncStateCache.isReactRendering=t}catch(e){}finally{queueMicrotask(()=>{flushSyncStateCache.isReactRendering=null})}return!!flushSyncStateCache.isReactRendering}function getReactDOM(){return ReactDOM}function _doRender(e,t,n=!1){isReactRendering()&&(n=!0);const r=elemRootMap.findIndex(e=>e.host===t);let o;if(-1===r){o=reactDomClient.createRoot(t);elemRootMap.push({host:t,root:o})}else o=elemRootMap[r].root;o.__scheduledForUnmount=!1;n?queueMicrotask(()=>{flushSync(()=>{o.render(e)})}):flushSync(()=>{o.render(e)})}export function selectiveDomRender(e,t,n=!1){if(_reactMajorVersion<18){(0,getReactDOM().render)(e,t)}else if(reactDomClientReady)_doRender(e,t,n);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doRender(e,t,n)})))()}return t}function unmountSafely(e){const t=e._internalRoot&&e._internalRoot.containerInfo.firstChild,n=e._internalRoot&&e._internalRoot.current&&e._internalRoot.current.child&&e._internalRoot.current.child.stateNode;n&&t==n?e.unmount():e._internalRoot=null;e.__scheduledForUnmount=null}function _doUnmount(e){const t=elemRootMap.findIndex(t=>t.host===e);if(-1!==t){const e=elemRootMap[t].root;if(isReactRendering()){e.__scheduledForUnmount=!0;queueMicrotask(()=>{e.__scheduledForUnmount&&flushSync(()=>{unmountSafely(e);elemRootMap.splice(t,1)})})}else flushSync(()=>{unmountSafely(e);elemRootMap.splice(t,1)})}}export function selectiveDomUnmount(e){if(_reactMajorVersion<18){(0,getReactDOM().unmountComponentAtNode)(e)}else if(reactDomClientReady)_doUnmount(e);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doUnmount(e)})))()}}function isKeyOrderSame(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(e[r][n]!=t[r][n])return!1;return!0}export function baseFlushSync(){flushSync(()=>{})}
|
|
14
|
+
var __awaiter=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(o,s){function fulfilled(e){try{step(r.next(e))}catch(e){s(e)}}function rejected(e){try{step(r.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):new t((function(n){n(e.value)})).then(fulfilled,rejected)}step((r=r.apply(e,n||[])).next())}))};import{ObservableArray,asString,copy,isArray,isFunction,removeClass,addClass,asBoolean}from"@mescius/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,reactDomClientLoadPromise=null,reactDomClientReady=!1;function setReactDomClient(e){reactDomClient=e||ReactDOM||ReactDomPolyfill;flushSync=e&&e.flushSync||flushSync}function lazyImportDomClient(){return __awaiter(this,void 0,void 0,(function*(){try{const e=yield import("react-dom/client");setReactDomClient(e.default||e)}catch(e){try{setReactDomClient(require("react-dom/client"))}catch(e){reactDomClient=ReactDOM||ReactDomPolyfill}}reactDomClientReady=!0}))}function ensureReactDomClientLoaded(){return __awaiter(this,void 0,void 0,(function*(){reactDomClientLoadPromise&&(yield reactDomClientLoadPromise)}))}let _reactMajorVersion,elemRootMap=[];if(!_reactMajorVersion){const e=parseInt(React.version);_reactMajorVersion=e;e>=18?reactDomClientLoadPromise=lazyImportDomClient():reactDomClientReady=!0}export function wjForwardRef(e){return _reactMajorVersion>=19?n=>e(n,n.ref):React.forwardRef(e)}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"]),buildInProps=new Set(["className"]);function updateChildProperties(e,n){const t=e.controlRef.current,r={},o={};if(n){const s=isArray(n)?n.flat(1/0):[n],c=[];let i=0;const a=new Set;for(const e of s){if(e&&e.type&&e.type.$$typeof==Symbol.for("react.forward_ref")){_reactMajorVersion>=19?c.push(e.type.render(e.props,e.props.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||a.add(i);i++}const l=[];for(const e of c)if(e.assignedToParent){if(e.wjProperty){e.parentProp=asString(e.wjProperty);e.isParentPropArray=t[e.parentProp]&&isArray(t[e.parentProp])}e.isParentPropArray&&!r[e.parentProp]&&(r[e.parentProp]=[]);e.isParentPropArray?r[e.parentProp].push({getInstance:e.getInstance,props:e.props,$key:e.$key,$index:e.$index}):r[e.parentProp]={getInstance:e.getInstance,props:e.props}}else l.push(e);const u=e.childInfo;for(const e in r)if(isArray(r[e])){let n=!1;if(t[e]&&null!=t[e]._updating&&!unsuppressedChangedEventProps.has(e)){t[e]._updating++;n=!0}let s=u[e];o[e]=[];let c=!1;if(!u[e]){s=[];if(t[e]&&t[e].clear){t[e].clear();c=!0}else t[e]||(t[e]=new ObservableArray)}if(!_oldSyncBehavior&&alwaysClearProps.has(e)){if(t[e]&&t[e].clear){t[e].clear();c=!0}}else if(!isKeyOrderSame(s,r[e],"$key")&&t[e]&&t[e].clear){t[e].clear();c=!0}if(_oldSyncBehavior)for(let n=s.length-1;n>=0;n--)if(a.has(s[n].$index)){t[e].remove(s[n].instance);s.splice(n,1)}const i=[],l={};for(const e of s)null!=e.$key?l[""+e.$key]=e:i.push(e);let p=0;const getExistingInstance=(e=null)=>{if(null!=e){const n=l[e];null!=n&&delete l[e];return n}return i[p++]};for(let n=0;n<r[e].length;n++){let s=getExistingInstance(r[e][n].$key),i=!1;if(s)s.updateProps(r[e][n].props);else{s=r[e][n].getInstance(t);i=!0}s.$index=r[e][n].$index;s.$key=r[e][n].$key;(c||i)&&(t[e].length==n?t[e].push(s.instance):t[e].splice(n,0,s.instance));o[e].push(s)}for(const n of Object.keys(l))t[e].remove(l[n].instance);for(;!_oldSyncBehavior&&t[e].length>o[e].length;)t[e].pop();if(n){t[e]._updating--;!c&&u[e]&&u[e].length==r[e].length||t[e]._raiseCollectionChanged&&t[e]._raiseCollectionChanged()}}else{let n=u[e];if(n)n.updateProps(r[e].props);else{n=r[e].getInstance(t);t[e]=n.instance}o[e]=n}const p=[];for(const e of u.$_nonassignable||[])a.has(e.$index)?e.instance&&e.instance.dispose&&isFunction(e.instance.dispose)&&e.instance.dispose():p.push(e);const d=[];let f=0;for(;f<l.length;f++){let e=p[f];e?e.updateProps(l[f].props):e=l[f].getInstance(t);e.$index=l[f].$index;d.push(e)}o.$_nonassignable=d;for(;f<p.length;f++)p[f].instance&&p[f].instance.dispose&&isFunction(p[f].instance.dispose)&&p[f].instance.dispose()}if(_oldSyncBehavior)for(const n of Object.keys(e.childInfo))if(isArray(e.childInfo[n])&&!r[n]&&t[n]&&t[n].remove)for(const r of e.childInfo[n])t[n].remove(r.instance);return o}function getPropsAccordingToSyncMode(e,n,t=null){if(!n||!_oldSyncBehavior){return Object.assign({},e)}const r={};for(const o in e){let s=!1;t&&(s=t.knowProperties.has(o)||t.knowEvents.has(o)||t.knowCustomProps.has(o));(t&&!s||e[o]!==n[o])&&(r[o]=e[o])}return r}export function useWjComponentBase(e){const n=React.useRef({}),t=React.useRef(),r=React.useRef(),o=React.useRef(),s=React.useRef(),c=React.useRef({}),i=React.useRef(!1),a=React.useRef(null),l=React.useRef(null);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 u=e.props;if(s.current){u=getPropsAccordingToSyncMode(e.props,n.current,t.current);n.current=e.props}const p={},d={},f={},h={},y={},m=e.ref||null;for(const n in u)if(t.current.knowProperties.has(n))p[n]=u[n];else if(t.current.knowEvents.has(n)){d[n]=u[n];p[n]=u[n]}else e.customProps[n]?h[n]=u[n]:buildInProps.has(n)?y[n]=u[n]:specialProps.has(n)||(f[n]=u[n]);if(s.current&&_oldSyncBehavior)for(const e in d)delete p[e];const updateProps=()=>{m&&m.current&&(m.current.props=e.props);updateChildProps();let n=[],t=p;if(o.current&&s.current&&!_oldSyncBehavior){for(const 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;n.push(s.current[e])}s.current[e].removeHandler(o.current[e])}t=Object.assign({},p);for(const e in d){delete t[e];s.current[e].addHandler(d[e])}}else if(!o.current){t=Object.assign({},p);for(const e in d)delete t[e]}o.current=d;if(s.current){copy(s.current,t,!1,!0);for(const e in y)_setHostAttribute(s.current.hostElement,e,y[e]);for(const n in h)e.customProps[n](s.current,h[n]);(()=>{for(const e of n)if(e._cachedHandlersChanged){e._handlersChanged=e._cachedHandlersChanged;e._cachedHandlersChanged=null}n=[]})()}},updateChildProps=()=>{c.current=updateChildProperties({controlRef:s,childInfo:c.current},e.props.children)};React.useLayoutEffect(()=>{if(r.current&&!s.current){s.current=new e.constructor(r.current,p);e.prePropsInit&&e.prePropsInit(s.current);if(m)if(isFunction(m)){const n=m({control:s.current,props:e.props});isFunction(n)&&(a.current=n)}else m.current&&m.current.control==s.current||(m.current={control:s.current,props:e.props});for(const e in y)_setHostAttribute(s.current.hostElement,e,y[e]);e.props.children&&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;a.current&&a.current()}})}}},[]);s.current&&queueMicrotask(()=>updateProps());const R=React.createElement("div",Object.assign({},f,{ref:r}),[]),_setHostAttribute=(e,n,t)=>{if(e)switch(n){case"className":{const n=l.current;if(n!==t){removeClass(e,n);addClass(e,t);l.current=t}break}}};return{renderResult:R,wjControl:s.current}}function filterKnownProps(e,n,t){const r={};for(const o in e)(n.has(o)||t.has(o))&&(r[o]=e[o]);return r}function clearAndGetEvents(e,n,t,r){const o=r.current,s={};for(const e in n)t.has(e)&&(s[e]=n[e]);for(const t in o)e[t]&&(!_oldSyncBehavior||n[t]?e[t].removeHandler(o[t]):s[t]=o[t]);return s}function getCustomPropsData(e,n){const t={};for(const r in n)void 0!==e[r]&&(t[r]=e[r]);return t}export function useWjComponentChildBase(e){const n={};n.knowProperties=new Set(e.properties);n.knowEvents=new Set(e.events);e.customProps||(e.customProps={});return{getInstance:t=>{const r={current:{}},o={current:{}},s={current:{}},c=getPropsAccordingToSyncMode(e.props,r.current),i=filterKnownProps(c,n.knowProperties,n.knowEvents),a=getCustomPropsData(c,e.customProps||{}),l=e.customConstructor?e.customConstructor(t,i,a):new e.constructor(e.needParentInstance?t:i,e.needParentInstance?i:void 0);e.ref&&(isFunction(e.ref)?e.ref({control:l,props:e.props}):e.ref.current&&e.ref.current.control==l||(e.ref.current={control:l,props:e.props}));s.current=clearAndGetEvents(l,c,n.knowEvents,s);const updateProps=t=>{const c=getPropsAccordingToSyncMode(t,r.current);r.current=t;e.ref&&e.ref.current&&(e.ref.current.props=t);s.current=clearAndGetEvents(l,c,n.knowEvents,s);const i=filterKnownProps(c,n.knowProperties,n.knowEvents);l.initialize?l.initialize(i):copy(l,i,!1,!0);for(const n in e.customProps)void 0!==c[n]&&e.customProps[n](l,c[n]);a=t.children||[],o.current=updateChildProperties({controlRef:{current:l},childInfo:o.current},a);var a};updateProps(e.props||[]);e.props.initialized&&isFunction(e.props.initialized)&&e.props.initialized(l);return{instance:l,updateProps:updateProps}},props:e.props,parentProp:e.parentProp,wjProperty:e.props.wjProperty,isParentPropArray:e.isParentPropArray,assignedToParent:e.assignedToParent}}const flushSyncStateCache={isReactRendering:null};function isReactRendering(){if(null==flushSyncStateCache.isReactRendering)try{const e=console.error;let n=!1;console.error=function(){const e=arguments[0]||"";e.includes("flushSync")&&(n=!0)};flushSync(()=>{});console.error=e;flushSyncStateCache.isReactRendering=n}catch(e){}finally{queueMicrotask(()=>{flushSyncStateCache.isReactRendering=null})}return!!flushSyncStateCache.isReactRendering}function getReactDOM(){return ReactDOM}function _doRender(e,n,t=!1){isReactRendering()&&(t=!0);const r=elemRootMap.findIndex(e=>e.host===n);let o;if(-1===r){o=reactDomClient.createRoot(n);elemRootMap.push({host:n,root:o})}else o=elemRootMap[r].root;o.__scheduledForUnmount=!1;t?queueMicrotask(()=>{flushSync(()=>{o.render(e)})}):flushSync(()=>{o.render(e)})}export function selectiveDomRender(e,n,t=!1){if(_reactMajorVersion<18){(0,getReactDOM().render)(e,n)}else if(reactDomClientReady)_doRender(e,n,t);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doRender(e,n,t)})))()}return n}function unmountSafely(e){const n=e._internalRoot&&e._internalRoot.containerInfo.firstChild,t=e._internalRoot&&e._internalRoot.current&&e._internalRoot.current.child&&e._internalRoot.current.child.stateNode;t&&n==t?e.unmount():e._internalRoot=null;e.__scheduledForUnmount=null}function _doUnmount(e){const n=elemRootMap.findIndex(n=>n.host===e);if(-1!==n){const e=elemRootMap[n].root;if(isReactRendering()){e.__scheduledForUnmount=!0;queueMicrotask(()=>{e.__scheduledForUnmount&&flushSync(()=>{unmountSafely(e);elemRootMap.splice(n,1)})})}else flushSync(()=>{unmountSafely(e);elemRootMap.splice(n,1)})}}export function selectiveDomUnmount(e){if(_reactMajorVersion<18){(0,getReactDOM().unmountComponentAtNode)(e)}else if(reactDomClientReady)_doUnmount(e);else{(()=>__awaiter(this,void 0,void 0,(function*(){yield ensureReactDomClientLoaded();_doUnmount(e)})))()}}function isKeyOrderSame(e,n,t){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(e[r][t]!=n[r][t])return!1;return!0}export function baseFlushSync(){flushSync(()=>{})}
|
package/es5-esm.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20261.45-nightly.
|
|
3
|
+
* Wijmo Library 5.20261.45-nightly.d20260105.t163143
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -24,58 +24,58 @@ export interface WjForwardRefExoticComponent<P> extends React.NamedExoticCompone
|
|
|
24
24
|
defaultProps?: Partial<P>;
|
|
25
25
|
propTypes?: React.WeakValidationMap<P>;
|
|
26
26
|
/** bugFix: WJM-35713
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(props: P):
|
|
27
|
+
* **NOTE**: Due to the limitations of React Exotic components, we need to
|
|
28
|
+
* redeclare the props function signature here.
|
|
29
|
+
*
|
|
30
|
+
* Exotic components in React (such as those created by `React.forwardRef`
|
|
31
|
+
* or `React.memo`) are treated as non-callable. This means that the default
|
|
32
|
+
* behavior of exotic components doesn't allow us to directly call them as
|
|
33
|
+
* normal functions. As a workaround, we explicitly redeclare the function
|
|
34
|
+
* signature to ensure proper handling of `props` in our custom implementation.
|
|
35
|
+
*
|
|
36
|
+
* This is done to maintain compatibility with React's internal `ExoticComponent`
|
|
37
|
+
* type while allowing the component to function as expected with `props`.
|
|
38
|
+
*/
|
|
39
|
+
(props: P): React.ReactElement | null;
|
|
40
40
|
}
|
|
41
41
|
export declare function wjForwardRef(fn: any): any;
|
|
42
42
|
/**
|
|
43
|
-
* From 5.20241.19, React interop now supports strict state mode.
|
|
44
|
-
* This means that on each re-render cycle, all of the component properties
|
|
45
|
-
* get synced with their values provided in the JSX.
|
|
46
|
-
* Setting properties via JSX will make that prop externally controlled, and
|
|
47
|
-
* changing its value will be allowed only by updating the state variables passed in JSX.
|
|
48
|
-
*
|
|
49
|
-
* By default, this option is set to false to maintain compatibility with existing user applications.
|
|
50
|
-
* If users want to utilize the Wijmo API in accordance with React's state management philosophy,
|
|
51
|
-
* they can set **strictStateMode** to true.
|
|
52
|
-
*
|
|
53
|
-
* When the strictStateMode flag is false, the value of the underlying component gets synced only when
|
|
54
|
-
* the prop value changes and not when the component re-renders. This makes it possible for JSX to become
|
|
55
|
-
* out of sync with the rendered state.
|
|
56
|
-
*
|
|
57
|
-
* Consider the following: if you set the value on an input control like {@link InputDate} and if strictStateMode
|
|
58
|
-
* is false, it is possible to select a different value in the control. After the value is selected,
|
|
59
|
-
* there is a mismatch between the React-provided state and the rendered state. This leads to potential bugs.
|
|
60
|
-
* That is why React recommends using controlled components. In controlled components, once the value is
|
|
61
|
-
* provided externally via JSX, the control value is not allowed to change unless the externally provided value
|
|
62
|
-
* is changed itself. So in the above scenario (for strictStateMode = true), to be able to change the value,
|
|
63
|
-
* we need to handle the valueChanged event and update the state variable to update the controlled value.
|
|
64
|
-
*
|
|
65
|
-
* ```typescript
|
|
66
|
-
* function App() {
|
|
67
|
-
* const [date, setDate] = useState(new Date());
|
|
68
|
-
*
|
|
69
|
-
* return (
|
|
70
|
-
* <div>
|
|
71
|
-
* <InputDate value={date} valueChanged={(s) => setDate(s.value)} />
|
|
72
|
-
* </div>
|
|
73
|
-
* );
|
|
74
|
-
* }
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @param value Whether to use the strict state mode or not
|
|
78
|
-
*/
|
|
43
|
+
* From 5.20241.19, React interop now supports strict state mode.
|
|
44
|
+
* This means that on each re-render cycle, all of the component properties
|
|
45
|
+
* get synced with their values provided in the JSX.
|
|
46
|
+
* Setting properties via JSX will make that prop externally controlled, and
|
|
47
|
+
* changing its value will be allowed only by updating the state variables passed in JSX.
|
|
48
|
+
*
|
|
49
|
+
* By default, this option is set to false to maintain compatibility with existing user applications.
|
|
50
|
+
* If users want to utilize the Wijmo API in accordance with React's state management philosophy,
|
|
51
|
+
* they can set **strictStateMode** to true.
|
|
52
|
+
*
|
|
53
|
+
* When the strictStateMode flag is false, the value of the underlying component gets synced only when
|
|
54
|
+
* the prop value changes and not when the component re-renders. This makes it possible for JSX to become
|
|
55
|
+
* out of sync with the rendered state.
|
|
56
|
+
*
|
|
57
|
+
* Consider the following: if you set the value on an input control like {@link InputDate} and if strictStateMode
|
|
58
|
+
* is false, it is possible to select a different value in the control. After the value is selected,
|
|
59
|
+
* there is a mismatch between the React-provided state and the rendered state. This leads to potential bugs.
|
|
60
|
+
* That is why React recommends using controlled components. In controlled components, once the value is
|
|
61
|
+
* provided externally via JSX, the control value is not allowed to change unless the externally provided value
|
|
62
|
+
* is changed itself. So in the above scenario (for strictStateMode = true), to be able to change the value,
|
|
63
|
+
* we need to handle the valueChanged event and update the state variable to update the controlled value.
|
|
64
|
+
*
|
|
65
|
+
* ```typescript
|
|
66
|
+
* function App() {
|
|
67
|
+
* const [date, setDate] = useState(new Date());
|
|
68
|
+
*
|
|
69
|
+
* return (
|
|
70
|
+
* <div>
|
|
71
|
+
* <InputDate value={date} valueChanged={(s) => setDate(s.value)} />
|
|
72
|
+
* </div>
|
|
73
|
+
* );
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param value Whether to use the strict state mode or not
|
|
78
|
+
*/
|
|
79
79
|
export declare function strictStateMode(value?: boolean): void;
|
|
80
80
|
export declare type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
81
81
|
export declare type WjRef<T> = {
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mescius/wijmo.react.base",
|
|
3
|
-
"version": "5.20261.45-nightly.
|
|
3
|
+
"version": "5.20261.45-nightly.d20260105.t163143",
|
|
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
|
-
"@mescius/wijmo": "5.20261.45-nightly.
|
|
10
|
+
"@mescius/wijmo": "5.20261.45-nightly.d20260105.t163143"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://developer.mescius.com/wijmo",
|
|
13
13
|
"bugs": {
|