@pdfme/ui 4.2.3-dev.4 → 4.2.4-dev.1

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/dist/index.es.js CHANGED
@@ -151864,34 +151864,57 @@ const FormRender = withProvider(FormCore, defaultWidgets), svgBaseProp = {
151864
151864
  );
151865
151865
  }) }) });
151866
151866
  }, ButtonGroupWidget$1 = ButtonGroupWidget, { Text: Text$2 } = Typography$1, DetailView = (a) => {
151867
- const { token: s } = theme.useToken(), { size: $, changeSchemas: _, deselectSchema: _e, activeSchema: tt } = a, nt = useForm(), at = reactExports.useContext(I18nContext), ot = reactExports.useContext(PluginsRegistry), rt = reactExports.useContext(OptionsContext);
151867
+ const { token: s } = theme.useToken(), { size: $, changeSchemas: _, deselectSchema: _e, activeSchema: tt } = a, nt = useForm(), at = reactExports.useContext(I18nContext), ot = reactExports.useContext(PluginsRegistry), rt = reactExports.useContext(OptionsContext), [st, lt] = reactExports.useState({});
151868
151868
  reactExports.useEffect(() => {
151869
- const dt = { ...tt };
151870
- dt.x = dt.position.x, dt.y = dt.position.y, delete dt.position, nt.setValues(dt);
151869
+ const gt = {
151870
+ AlignWidget: (pt) => /* @__PURE__ */ jsxRuntimeExports.jsx(AlignWidget$1, { ...pt, ...a, options: rt }),
151871
+ Divider: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Divider$1, { style: { marginTop: s.marginXS, marginBottom: s.marginXS } }),
151872
+ ButtonGroup: (pt) => /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonGroupWidget$1, { ...pt, ...a, options: rt })
151873
+ };
151874
+ for (const pt of Object.values(ot)) {
151875
+ const mt = (pt == null ? void 0 : pt.propPanel.widgets) || {};
151876
+ Object.entries(mt).forEach(([ct, vt]) => {
151877
+ gt[ct] = (At) => /* @__PURE__ */ jsxRuntimeExports.jsx(
151878
+ WidgetRenderer$1,
151879
+ {
151880
+ ...At,
151881
+ ...a,
151882
+ options: rt,
151883
+ theme: s,
151884
+ i18n: at,
151885
+ widget: vt
151886
+ }
151887
+ );
151888
+ });
151889
+ }
151890
+ lt(gt);
151891
+ }, [tt, ot, JSON.stringify(rt)]), reactExports.useEffect(() => {
151892
+ const gt = { ...tt };
151893
+ gt.x = gt.position.x, gt.y = gt.position.y, delete gt.position, nt.setValues(gt);
151871
151894
  }, [tt, nt]);
151872
- const st = (dt) => {
151873
- const gt = (mt, ct) => typeof mt == "object" ? JSON.stringify(mt) !== JSON.stringify(ct) : mt !== ct;
151874
- let pt = [];
151875
- for (let mt in dt) {
151876
- if (["id", "content"].includes(mt))
151895
+ const et = (gt) => {
151896
+ const pt = (ct, vt) => typeof ct == "object" ? JSON.stringify(ct) !== JSON.stringify(vt) : ct !== vt;
151897
+ let mt = [];
151898
+ for (let ct in gt) {
151899
+ if (["id", "content"].includes(ct))
151877
151900
  continue;
151878
- let ct = dt[mt], vt = !1;
151879
- ["x", "y"].includes(mt) ? (vt = ct !== tt.position[mt], mt = "position." + mt) : vt = gt(ct, tt[mt]), vt && (ct === null && ["rotate", "opacity"].includes(mt) && (ct = void 0), pt.push({ key: mt, value: ct, schemaId: tt.id }));
151901
+ let vt = gt[ct], At = !1;
151902
+ ["x", "y"].includes(ct) ? (At = vt !== tt.position[ct], ct = "position." + ct) : At = pt(vt, tt[ct]), At && (vt === null && ["rotate", "opacity"].includes(ct) && (vt = void 0), mt.push({ key: ct, value: vt, schemaId: tt.id }));
151880
151903
  }
151881
- pt.length && nt.validateFields().then(() => _(pt)).catch((mt) => {
151882
- mt.errorFields.length && (pt = pt.filter((ct) => !mt.errorFields.find(
151883
- (vt) => vt.name.includes(ct.key)
151884
- ))), pt.length && _(pt);
151904
+ mt.length && nt.validateFields().then(() => _(mt)).catch((ct) => {
151905
+ ct.errorFields.length && (mt = mt.filter((vt) => !ct.errorFields.find(
151906
+ (At) => At.name.includes(vt.key)
151907
+ ))), mt.length && _(mt);
151885
151908
  });
151886
- }, lt = Object.values(ot).find(
151887
- (dt) => (dt == null ? void 0 : dt.propPanel.defaultSchema.type) === tt.type
151888
- ), et = lt == null ? void 0 : lt.propPanel.schema;
151889
- et || console.error(`[@pdfme/ui] No propPanel.schema for ${tt.type}.
151909
+ }, it = Object.values(ot).find(
151910
+ (gt) => (gt == null ? void 0 : gt.propPanel.defaultSchema.type) === tt.type
151911
+ ), ut = it == null ? void 0 : it.propPanel.schema;
151912
+ ut || console.error(`[@pdfme/ui] No propPanel.schema for ${tt.type}.
151890
151913
  Check this document: https://pdfme.com/docs/custom-schemas`);
151891
- const it = Object.entries(ot).map(([dt, gt]) => ({
151892
- label: dt,
151893
- value: gt == null ? void 0 : gt.propPanel.defaultSchema.type
151894
- })), ut = lt.propPanel.defaultSchema, ft = {
151914
+ const ft = Object.entries(ot).map(([gt, pt]) => ({
151915
+ label: gt,
151916
+ value: pt == null ? void 0 : pt.propPanel.defaultSchema.type
151917
+ })), ht = it.propPanel.defaultSchema, dt = {
151895
151918
  type: "object",
151896
151919
  column: 2,
151897
151920
  properties: {
@@ -151899,7 +151922,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
151899
151922
  title: at("type"),
151900
151923
  type: "string",
151901
151924
  widget: "select",
151902
- props: { options: it },
151925
+ props: { options: ft },
151903
151926
  required: !0,
151904
151927
  span: 12
151905
151928
  },
@@ -151912,7 +151935,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
151912
151935
  title: at("rotate"),
151913
151936
  type: "number",
151914
151937
  widget: "inputNumber",
151915
- disabled: (ut == null ? void 0 : ut.rotate) === void 0,
151938
+ disabled: (ht == null ? void 0 : ht.rotate) === void 0,
151916
151939
  max: 360,
151917
151940
  props: { min: 0 },
151918
151941
  span: 8
@@ -151937,53 +151960,32 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
151937
151960
  title: at("opacity"),
151938
151961
  type: "number",
151939
151962
  widget: "inputNumber",
151940
- disabled: (ut == null ? void 0 : ut.opacity) === void 0,
151963
+ disabled: (ht == null ? void 0 : ht.opacity) === void 0,
151941
151964
  props: { step: 0.1, min: 0, max: 1 },
151942
151965
  span: 8
151943
151966
  }
151944
151967
  }
151945
151968
  };
151946
- if (typeof et == "function") {
151947
- const dt = et({
151969
+ if (typeof ut == "function") {
151970
+ const gt = ut({
151948
151971
  ...a,
151949
151972
  options: rt,
151950
151973
  theme: s,
151951
151974
  i18n: at
151952
151975
  }) || {};
151953
- ft.properties = {
151954
- ...ft.properties,
151955
- ...Object.keys(dt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151956
- ...dt
151976
+ dt.properties = {
151977
+ ...dt.properties,
151978
+ ...Object.keys(gt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151979
+ ...gt
151957
151980
  };
151958
151981
  } else {
151959
- const dt = et || {};
151960
- ft.properties = {
151961
- ...ft.properties,
151962
- ...Object.keys(dt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151963
- ...dt
151982
+ const gt = ut || {};
151983
+ dt.properties = {
151984
+ ...dt.properties,
151985
+ ...Object.keys(gt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151986
+ ...gt
151964
151987
  };
151965
151988
  }
151966
- const ht = {
151967
- AlignWidget: (dt) => /* @__PURE__ */ jsxRuntimeExports.jsx(AlignWidget$1, { ...dt, ...a, options: rt }),
151968
- Divider: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Divider$1, { style: { marginTop: s.marginXS, marginBottom: s.marginXS } }),
151969
- ButtonGroup: (dt) => /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonGroupWidget$1, { ...dt, ...a, options: rt })
151970
- };
151971
- for (const dt of Object.values(ot)) {
151972
- const gt = (dt == null ? void 0 : dt.propPanel.widgets) || {};
151973
- Object.entries(gt).forEach(([pt, mt]) => {
151974
- ht[pt] = (ct) => /* @__PURE__ */ jsxRuntimeExports.jsx(
151975
- WidgetRenderer$1,
151976
- {
151977
- ...ct,
151978
- ...a,
151979
- options: rt,
151980
- theme: s,
151981
- i18n: at,
151982
- widget: mt
151983
- }
151984
- );
151985
- });
151986
- }
151987
151989
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
151988
151990
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { height: 40, display: "flex", alignItems: "center" }, children: [
151989
151991
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -152015,9 +152017,9 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
152015
152017
  FormRender,
152016
152018
  {
152017
152019
  form: nt,
152018
- schema: ft,
152019
- widgets: ht,
152020
- watch: { "#": st },
152020
+ schema: dt,
152021
+ widgets: st,
152022
+ watch: { "#": et },
152021
152023
  locale: "en-US"
152022
152024
  }
152023
152025
  )
package/dist/index.umd.js CHANGED
@@ -704,8 +704,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
704
704
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _iterableToArrayLimit$2(a,s){var $=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if($!=null){var _,_e,tt,nt,at=[],ot=!0,rt=!1;try{if(tt=($=$.call(a)).next,s===0){if(Object($)!==$)return;ot=!1}else for(;!(ot=(_=tt.call($)).done)&&(at.push(_.value),at.length!==s);ot=!0);}catch(st){rt=!0,_e=st}finally{try{if(!ot&&$.return!=null&&(nt=$.return(),Object(nt)!==nt))return}finally{if(rt)throw _e}}return at}}function _arrayWithHoles$2(a){if(Array.isArray(a))return a}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray$2(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
705
705
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$2(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray$2(a,s);var $=Object.prototype.toString.call(a).slice(8,-1);if($==="Object"&&a.constructor&&($=a.constructor.name),$==="Map"||$==="Set")return Array.from(a);if($==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test($))return _arrayLikeToArray$2(a,s)}}function _iterableToArray(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray$2(a)}function _arrayLikeToArray$2(a,s){(s==null||s>a.length)&&(s=a.length);for(var $=0,_=new Array(s);$<s;$++)_[$]=a[$];return _}var TabPaneContent=function a(s){var $=s.renderCore,_=s.name,_e=s.schema,tt=s.rootPath;return reactExports.useMemo(function(){return React$a.createElement("div",{style:{flex:1}},$({schema:_e,parentPath:[_],rootPath:[].concat(_toConsumableArray(tt),[_])}))},[JSON.stringify(s)])},TabList=function a(s){var $=s.schema,_=s.fields,_e=s.rootPath,tt=s.renderCore,nt=s.readOnly,at=s.delConfirmProps,ot=s.tabName,rt=s.hideDelete,st=s.hideAdd,lt=s.addItem,et=s.removeItem,it=s.tabItemProps,ut=it===void 0?{}:it,ft=s.activeKey,ht=__rest$3(s,["schema","fields","rootPath","renderCore","readOnly","delConfirmProps","tabName","hideDelete","hideAdd","addItem","removeItem","tabItemProps","activeKey"]),dt=reactExports.useState("0"),gt=_slicedToArray$2(dt,2),pt=gt[0],mt=gt[1],ct=reactExports.useContext(ThemeConfigProvider.ConfigContext),vt=translation(ct);reactExports.useEffect(function(){mt(ft||"0")},[ft]);var At=function(Bt){return ot instanceof Array?ot[Bt]||Bt+1:"".concat(ot||vt("item")," ").concat(Bt+1)},xt=function(Bt){et(Bt),mt("".concat(Bt>1?Bt-1:0))},bt=function(Bt,Ot){if(Ot==="add"&&(!$.max||_.length<$.max)&&!nt&&!st){lt();var Tt=_.length;mt("".concat(Tt))}},Et=function(Bt){return!nt&&!rt?React$a.createElement(_Popconfirm,Object.assign({onConfirm:function(){return xt(Bt)}},at),React$a.createElement(default_1$3,null)):React$a.createElement(React$a.Fragment,null)};return React$a.createElement(_Tabs,Object.assign({className:"fr-tab-list",type:"editable-card"},ht,{onChange:mt,activeKey:"".concat(pt),onEdit:bt,hideAdd:nt||st}),_.map(function(St){var Bt=St.key,Ot=St.name;return React$a.createElement(_Tabs.TabPane,Object.assign({key:Bt,className:"fr-list-item"},ut,{tab:At(Ot),closeIcon:Et(Ot)}),React$a.createElement(TabPaneContent,{name:Ot,rootPath:_e,schema:$,renderCore:tt}))}))};function _typeof(a){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},_typeof(a)}function _defineProperty(a,s,$){return s=_toPropertyKey(s),s in a?Object.defineProperty(a,s,{value:$,enumerable:!0,configurable:!0,writable:!0}):a[s]=$,a}function _toPropertyKey(a){var s=_toPrimitive(a,"string");return _typeof(s)==="symbol"?s:String(s)}function _toPrimitive(a,s){if(_typeof(a)!=="object"||a===null)return a;var $=a[Symbol.toPrimitive];if($!==void 0){var _=$.call(a,s||"default");if(_typeof(_)!=="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}const index=function(a){var s=a.schema;return React$a.createElement("div",{className:classnames("fr-void-title",_defineProperty({},s==null?void 0:s.className,!!(s!=null&&s.className)))},s.title)};var ErrorSchema=function a(s){var $=reactExports.useContext(ThemeConfigProvider.ConfigContext),_=translation($);return React$a.createElement("div",null,React$a.createElement("div",{style:{color:"red"}},_("schema_not_match")),React$a.createElement("div",null,JSON.stringify(s)))};const defaultWidgets=Object.freeze(Object.defineProperty({__proto__:null,Card:BoxCard,CardList,Checkbox,Checkboxes:Checkboxes$1,Collapse:BoxCollapse,Color,DatePicker,DateRange:DateRange$1,DrawerList:TableList,ErrorSchema,Html:html,ImageInput:ImageInput$1,Input,InputNumber,LineTitle:FLineTitle,MultiSelect,PercentSlider,Radio,Rate:index$2,Select:MultiSelect,SimpleList,Slider,SubInline:BoxSubInline,Switch,TabList,TableList:TableList$1,TextArea:TextArea$1,TimePicker,TimeRange,TreeSelect,Upload:FrUpload,UrlInput:UrlInput$1,VirtualList,VoidTitle:index},Symbol.toStringTag,{value:"Module"}));function _slicedToArray$1(a,s){return _arrayWithHoles$1(a)||_iterableToArrayLimit$1(a,s)||_unsupportedIterableToArray$1(a,s)||_nonIterableRest$1()}function _nonIterableRest$1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
706
706
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$1(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray$1(a,s);var $=Object.prototype.toString.call(a).slice(8,-1);if($==="Object"&&a.constructor&&($=a.constructor.name),$==="Map"||$==="Set")return Array.from(a);if($==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test($))return _arrayLikeToArray$1(a,s)}}function _arrayLikeToArray$1(a,s){(s==null||s>a.length)&&(s=a.length);for(var $=0,_=new Array(s);$<s;$++)_[$]=a[$];return _}function _iterableToArrayLimit$1(a,s){var $=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if($!=null){var _,_e,tt,nt,at=[],ot=!0,rt=!1;try{if(tt=($=$.call(a)).next,s===0){if(Object($)!==$)return;ot=!1}else for(;!(ot=(_=tt.call($)).done)&&(at.push(_.value),at.length!==s);ot=!0);}catch(st){rt=!0,_e=st}finally{try{if(!ot&&$.return!=null&&(nt=$.return(),Object(nt)!==nt))return}finally{if(rt)throw _e}}return at}}function _arrayWithHoles$1(a){if(Array.isArray(a))return a}function flattenSchema(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0,$=arguments.length>2?arguments[2]:void 0,_=arguments.length>3?arguments[3]:void 0,_e=_||{},tt=_cloneDeep(a)||{},nt=s||"#";tt.$id||(tt.$id=nt);var at=[];return isObjType(tt)&&(sortProperties(Object.entries(tt.properties)).forEach(function(ot){var rt=_slicedToArray$1(ot,2),st=rt[0],lt=rt[1],et=isListType(lt)?st+"[]":st,it=nt==="#"?et:nt+"."+et;at.push(it),flattenSchema(lt,it,nt,_e)}),tt.properties={}),isListType(tt)&&(sortProperties(Object.entries(tt.items.properties)).forEach(function(ot){var rt=_slicedToArray$1(ot,2),st=rt[0],lt=rt[1],et=isListType(lt)?st+"[]":st,it=nt==="#"?et:nt+"."+et;at.push(it),flattenSchema(lt,it,nt,_e)}),tt.items.properties={}),tt.type&&(_e[nt]={parent:$,schema:tt,children:at}),_e}function _slicedToArray(a,s){return _arrayWithHoles(a)||_iterableToArrayLimit(a,s)||_unsupportedIterableToArray(a,s)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
707
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray(a,s);var $=Object.prototype.toString.call(a).slice(8,-1);if($==="Object"&&a.constructor&&($=a.constructor.name),$==="Map"||$==="Set")return Array.from(a);if($==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test($))return _arrayLikeToArray(a,s)}}function _arrayLikeToArray(a,s){(s==null||s>a.length)&&(s=a.length);for(var $=0,_=new Array(s);$<s;$++)_[$]=a[$];return _}function _iterableToArrayLimit(a,s){var $=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if($!=null){var _,_e,tt,nt,at=[],ot=!0,rt=!1;try{if(tt=($=$.call(a)).next,s===0){if(Object($)!==$)return;ot=!1}else for(;!(ot=(_=tt.call($)).done)&&(at.push(_.value),at.length!==s);ot=!0);}catch(st){rt=!0,_e=st}finally{try{if(!ot&&$.return!=null&&(nt=$.return(),Object(nt)!==nt))return}finally{if(rt)throw _e}}return at}}function _arrayWithHoles(a){if(Array.isArray(a))return a}var updateSchemaByPath=function a(s,$,_){var _e=getSchemaFullPath(s,_),tt=_get(_,_e,{}),nt=isFunction$2($)?$(tt):$,at=Object.assign(Object.assign({},tt),nt);nt.props&&(at.props=Object.assign(Object.assign({},tt==null?void 0:tt.props),nt.props)),_set(_,_e,at)},getFieldName=function a(s){if(s){if(typeof s=="boolean")return s;var $=[];return isArray$3(s)&&($=s.map(function(_){return _.split(".").map(function(_e){return isNaN(Number(_e))?_e:_e*1})})),$=s.split(".").map(function(_){return isNaN(Number(_))?_:_*1}),$=$.map(function(_){return typeof _=="string"&&(_==null?void 0:_.indexOf("["))===0&&(_==null?void 0:_.indexOf("]"))===(_==null?void 0:_.length)-1?Number(_.substring(1,_.length-1)):_}),$}},useForm=function a(){var s=Form$3.useForm(),$=_slicedToArray(s,1),_=$[0],_e=reactExports.useRef({}),tt=reactExports.useRef(),nt=reactExports.useRef({}),at=reactExports.useRef({});_.getFieldError;var ot=_.getFieldsError,rt=_.getFieldInstance,st=_.setFieldsValue,lt=_.setFields,et=_.scrollToField,it=_.isFieldsTouched,ut=_.isFieldTouched,ft=_.isFieldValidating,ht=_.resetFields,dt=_.validateFields,gt=__rest$3(_,["getFieldError","getFieldsError","getFieldInstance","setFieldsValue","setFields","scrollToField","isFieldsTouched","isFieldTouched","isFieldValidating","resetFields","validateFields"]),pt=gt,mt=function(At){var xt=tt.current.setState;xt||setTimeout(function(){xt({schema:nt.current,flattenSchema:_e.current})},0),xt(At)},ct=function(At){_e.current=flattenSchema(At)||{},nt.current=At,mt({schema:At,flattenSchema:_e.current})};return pt.setSchema=function(vt){var At=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(isObject$6(vt)){if(At){ct(vt);return}var xt=cloneDeep(nt.current);Object.keys(vt||{}).forEach(function(bt){updateSchemaByPath(bt,vt[bt],xt)}),ct(xt)}},pt.setSchemaByPath=function(vt,At){if(!(!hasFuncProperty(At)&&_isMatch(At,pt.getSchemaByPath(vt)))){var xt=cloneDeep(nt.current);updateSchemaByPath(vt,At,xt),ct(xt)}},pt.setValues=function(vt){var At=parseBindToValues(vt,_e.current);st(At)},pt.getValues=function(vt,At){var xt,bt=cloneDeep(_.getFieldsValue(getFieldName(vt),At)),Et=((xt=tt.current)===null||xt===void 0?void 0:xt.getState())||{},St=Et.removeHiddenData;return St&&(bt=filterValuesHidden(bt,_e.current)),bt=filterValuesUndefined(bt),parseValuesToBind(bt,_e.current)},pt.getValueByPath=function(vt){var At=getFieldName(vt);return _.getFieldValue(At)},pt.setValueByPath=function(vt,At){if(!_.setFieldValue){var xt=_.getFieldsValue();_set(xt,vt,At),pt.setValues(xt);return}var bt=getFieldName(vt);_.setFieldValue(bt,At);try{JSON.stringify(_.getFieldValue(bt))!==JSON.stringify(At)&&_.setFieldValue(bt,At)}catch{}},pt.getSchemaByPath=function(vt){typeof vt!="string"&&console.warn("请输入正确的路径");var At=getSchemaFullPath(vt,nt.current);return _get(nt.current,At)},pt.getSchema=function(){return nt.current},pt.setErrorFields=function(vt){var At=transformFieldsData(vt,getFieldName);At&&lt(At)},pt.removeErrorField=function(vt){lt([{name:getFieldName(vt),errors:[]}])},pt.getFieldError=function(vt){var At=getFieldName(vt);return _.getFieldError(At)},pt.getFieldsError=function(vt){var At=getFieldName(vt);return ot(At)},pt.getFieldInstance=function(vt){var At=getFieldName(vt);return rt(At)},pt.getHiddenValues=function(){var vt=pt.getValues(),At=pt.getValues(!0),xt={},bt=function Et(St,Bt,Ot){Object.keys(St).forEach(function(Tt){var wt=St[Tt],Ct=Ot?"".concat(Ot,".").concat(Tt):Tt;if(!Bt.hasOwnProperty(Tt)){_set(xt,Ct,wt);return}isObject$6(wt)&&Et(wt,Bt[Tt],Ct),isArray$3(wt)&&wt.map(function(It,yt){Et(It,_get(Bt,"".concat(Tt,"[").concat(yt,"]"),[]),"".concat(Ct,"[").concat(yt,"]"))})})};return bt(At,vt,null),xt},pt.setFields=function(vt){var At=transformFieldsData(vt,getFieldName);At&&lt(At)},pt.__initStore=function(vt){tt.current=vt},pt.scrollToPath=function(vt){for(var At=getFieldName(vt),xt=arguments.length,bt=new Array(xt>1?xt-1:0),Et=1;Et<xt;Et++)bt[Et-1]=arguments[Et];et.apply(void 0,[At].concat(bt))},pt.isFieldsTouched=function(vt,At){var xt=(vt||[]).map(function(bt){return getFieldName(bt)});return it(xt,At)},pt.isFieldTouched=function(vt){var At=getFieldName(vt);return ut(At)},pt.isFieldValidating=function(vt){var At=getFieldName(vt);return ft(At)},pt.resetFields=function(vt){var At=(vt||[]).map(function(xt){return getFieldName(xt)});At.length>0?ht(At):ht()},pt.validateFields=function(vt){var At=(vt||[]).map(function(xt){return getFieldName(xt)});return At.length>0?dt(At):dt()},pt.getFlattenSchema=function(vt){var At;return vt?(At=_e.current)===null||At===void 0?void 0:At[vt]:_e.current},pt.onItemChange=pt.setValueByPath,pt.setFieldRef=function(vt,At){vt&&(at.current[vt]=At)},pt.getFieldRef=function(vt){return at.current[vt]},pt};const FormRender=withProvider(FormCore,defaultWidgets),svgBaseProp={style:{width:"90%",height:"90%"},xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#000000"},createSvgIcon=a=>jsxRuntimeExports.jsxs("svg",{...svgBaseProp,children:[jsxRuntimeExports.jsx("rect",{fill:"none",height:"24",width:"24"}),a]}),createButtonConfig=(a,s,$)=>({id:a,icon:createSvgIcon(s),onClick:$}),AlignWidget=a=>{const{activeElements:s,changeSchemas:$,schemas:_,pageSize:_e,schema:tt}=a,nt=rt=>{const st=s.map(ct=>ct.id),lt=_.filter(ct=>st.includes(ct.id)),et=["left","center","right"].includes(rt),it=et?"x":"y",ut=et?"width":"height",ft=lt.length===1,ht=_e[ut],dt=ft?0:Math.min(...lt.map(ct=>ct.position[it])),gt=ft?ht:Math.max(...lt.map(ct=>ct.position[it]+ct[ut]));let pt=dt,mt=ct=>0;["center","middle"].includes(rt)?(pt=(dt+gt)/2,mt=ct=>ct/2):["right","bottom"].includes(rt)&&(pt=gt,mt=ct=>ct),$(lt.map(ct=>({key:`position.${it}`,value:round(pt-mt(ct[ut]),2),schemaId:ct.id})))},at=rt=>{const st=s.map(At=>At.id),lt=_.filter(At=>st.includes(At.id)),et=rt==="vertical",it=et?"y":"x",ut=et?"height":"width",ft=Math.min(...lt.map(At=>At.position[it])),ht=Math.max(...lt.map(At=>At.position[it]+At[ut]));if(lt.length<3)return;const dt=ft,gt=ht-ft,pt=lt.reduce((At,xt)=>At+xt[ut],0),ct=(gt-pt)/(lt.length-1);let vt=0;$(lt.map((At,xt)=>{vt+=xt===0?0:lt[xt-1][ut]+ct;const bt=round(dt+vt,2);return{key:`position.${it}`,value:bt,schemaId:At.id}}))},ot=[createButtonConfig("left",jsxRuntimeExports.jsx("path",{d:"M4,22H2V2h2V22z M22,7H6v3h16V7z M16,14H6v3h10V14z"}),()=>nt("left")),createButtonConfig("center",jsxRuntimeExports.jsx("polygon",{points:"11,2 13,2 13,7 21,7 21,10 13,10 13,14 18,14 18,17 13,17 13,22 11,22 11,17 6,17 6,14 11,14 11,10 3,10 3,7 11,7"}),()=>nt("center")),createButtonConfig("right",jsxRuntimeExports.jsx("path",{d:"M20,2h2v20h-2V2z M2,10h16V7H2V10z M8,17h10v-3H8V17z"}),()=>nt("right")),createButtonConfig("top",jsxRuntimeExports.jsx("path",{d:"M22,2v2H2V2H22z M7,22h3V6H7V22z M14,16h3V6h-3V16z"}),()=>nt("top")),createButtonConfig("middle",jsxRuntimeExports.jsx("polygon",{points:"22,11 17,11 17,6 14,6 14,11 10,11 10,3 7,3 7,11 1.84,11 1.84,13 7,13 7,21 10,21 10,13 14,13 14,18 17,18 17,13 22,13"}),()=>nt("middle")),createButtonConfig("bottom",jsxRuntimeExports.jsx("path",{d:"M22,22H2v-2h20V22z M10,2H7v16h3V2z M17,8h-3v10h3V8z"}),()=>nt("bottom")),createButtonConfig("vertical",jsxRuntimeExports.jsx("path",{d:"M22,2v2H2V2H22z M7,10.5v3h10v-3H7z M2,20v2h20v-2H2z"}),()=>at("vertical")),createButtonConfig("horizontal",jsxRuntimeExports.jsx("path",{d:"M4,22H2V2h2V22z M22,2h-2v20h2V2z M13.5,7h-3v10h3V7z"}),()=>at("horizontal"))];return jsxRuntimeExports.jsx(Form$3.Item,{label:tt.title,children:jsxRuntimeExports.jsx(Button$2.Group,{children:ot.map(rt=>jsxRuntimeExports.jsx(Button$2,{style:{padding:7},disabled:s.length<=2&&["vertical","horizontal"].includes(rt.id),...rt},rt.id))})})},AlignWidget$1=AlignWidget,WidgetRenderer=a=>{const{widget:s,...$}=a,_=reactExports.useRef(null);return reactExports.useEffect(()=>(_.current&&(_.current.innerHTML="",s({...$,rootElement:_.current})),()=>{_.current&&(_.current.innerHTML="")}),[a.activeSchema]),jsxRuntimeExports.jsx("div",{ref:_})},WidgetRenderer$1=WidgetRenderer,ButtonGroupWidget=a=>{const{activeElements:s,changeSchemas:$,schemas:_,schema:_e}=a,tt=ot=>{const rt=ot.key,st=ot.type,lt=s.map(it=>it.id),et=_.filter(it=>lt.includes(it.id));$(et.map(it=>{const ut=it[rt]??!1,ft=st==="boolean"?!ut:ot.value;return{key:rt,value:ft,schemaId:it.id}}))},nt=ot=>{const rt=ot.key,st=ot.type;let lt=!1;const et=s.map(ut=>ut.id);return _.filter(ut=>et.includes(ut.id)).forEach(ut=>{lt=st==="boolean"?ut[rt]??!1:ut[rt]===ot.value}),lt},at=ot=>{const rt=`data:image/svg+xml;utf8,${encodeURIComponent(ot)}`;return jsxRuntimeExports.jsx("img",{width:17,height:17,src:rt})};return jsxRuntimeExports.jsx(Form$3.Item,{children:jsxRuntimeExports.jsx(Button$2.Group,{children:_e.buttons.map((ot,rt)=>{const st=nt(ot);return jsxRuntimeExports.jsx(Button$2,{type:st?"primary":void 0,ghost:st,onClick:()=>tt(ot),style:{padding:7,zIndex:st?2:0},icon:at(ot.icon)},rt)})})})},ButtonGroupWidget$1=ButtonGroupWidget,{Text:Text$2}=Typography$1,DetailView=a=>{const{token:s}=theme.useToken(),{size:$,changeSchemas:_,deselectSchema:_e,activeSchema:tt}=a,nt=useForm(),at=reactExports.useContext(I18nContext),ot=reactExports.useContext(PluginsRegistry),rt=reactExports.useContext(OptionsContext);reactExports.useEffect(()=>{const dt={...tt};dt.x=dt.position.x,dt.y=dt.position.y,delete dt.position,nt.setValues(dt)},[tt,nt]);const st=dt=>{const gt=(mt,ct)=>typeof mt=="object"?JSON.stringify(mt)!==JSON.stringify(ct):mt!==ct;let pt=[];for(let mt in dt){if(["id","content"].includes(mt))continue;let ct=dt[mt],vt=!1;["x","y"].includes(mt)?(vt=ct!==tt.position[mt],mt="position."+mt):vt=gt(ct,tt[mt]),vt&&(ct===null&&["rotate","opacity"].includes(mt)&&(ct=void 0),pt.push({key:mt,value:ct,schemaId:tt.id}))}pt.length&&nt.validateFields().then(()=>_(pt)).catch(mt=>{mt.errorFields.length&&(pt=pt.filter(ct=>!mt.errorFields.find(vt=>vt.name.includes(ct.key)))),pt.length&&_(pt)})},lt=Object.values(ot).find(dt=>(dt==null?void 0:dt.propPanel.defaultSchema.type)===tt.type),et=lt==null?void 0:lt.propPanel.schema;et||console.error(`[@pdfme/ui] No propPanel.schema for ${tt.type}.
708
- Check this document: https://pdfme.com/docs/custom-schemas`);const it=Object.entries(ot).map(([dt,gt])=>({label:dt,value:gt==null?void 0:gt.propPanel.defaultSchema.type})),ut=lt.propPanel.defaultSchema,ft={type:"object",column:2,properties:{type:{title:at("type"),type:"string",widget:"select",props:{options:it},required:!0,span:12},key:{title:at("fieldName"),type:"string",required:!0,span:12},"-":{type:"void",widget:"Divider"},align:{title:at("align"),type:"void",widget:"AlignWidget"},x:{title:"X",type:"number",widget:"inputNumber",required:!0,span:8,min:0},y:{title:"Y",type:"number",widget:"inputNumber",required:!0,span:8,min:0},rotate:{title:at("rotate"),type:"number",widget:"inputNumber",disabled:(ut==null?void 0:ut.rotate)===void 0,max:360,props:{min:0},span:8},width:{title:at("width"),type:"number",widget:"inputNumber",required:!0,span:8,props:{min:0}},height:{title:at("height"),type:"number",widget:"inputNumber",required:!0,span:8,props:{min:0}},opacity:{title:at("opacity"),type:"number",widget:"inputNumber",disabled:(ut==null?void 0:ut.opacity)===void 0,props:{step:.1,min:0,max:1},span:8}}};if(typeof et=="function"){const dt=et({...a,options:rt,theme:s,i18n:at})||{};ft.properties={...ft.properties,...Object.keys(dt).length===0?{}:{"--":{type:"void",widget:"Divider"}},...dt}}else{const dt=et||{};ft.properties={...ft.properties,...Object.keys(dt).length===0?{}:{"--":{type:"void",widget:"Divider"}},...dt}}const ht={AlignWidget:dt=>jsxRuntimeExports.jsx(AlignWidget$1,{...dt,...a,options:rt}),Divider:()=>jsxRuntimeExports.jsx(Divider$1,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),ButtonGroup:dt=>jsxRuntimeExports.jsx(ButtonGroupWidget$1,{...dt,...a,options:rt})};for(const dt of Object.values(ot)){const gt=(dt==null?void 0:dt.propPanel.widgets)||{};Object.entries(gt).forEach(([pt,mt])=>{ht[pt]=ct=>jsxRuntimeExports.jsx(WidgetRenderer$1,{...ct,...a,options:rt,theme:s,i18n:at,widget:mt})})}return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{style:{height:40,display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$2,{style:{position:"absolute",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:_e,icon:jsxRuntimeExports.jsx(MenuOutlined$1,{})}),jsxRuntimeExports.jsx(Text$2,{strong:!0,style:{textAlign:"center",width:"100%"},children:at("editField")})]}),jsxRuntimeExports.jsx(Divider$1,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),jsxRuntimeExports.jsx("div",{style:{height:getSidebarContentHeight($.height),overflowY:"auto",overflowX:"hidden"},children:jsxRuntimeExports.jsx(FormRender,{form:nt,schema:ft,widgets:ht,watch:{"#":st},locale:"en-US"})})]})},propsAreUnchanged=(a,s)=>JSON.stringify(a.activeSchema)==JSON.stringify(s.activeSchema),DetailView$1=React$a.memo(DetailView,propsAreUnchanged),Sidebar=a=>{const{sidebarOpen:s,setSidebarOpen:$,activeElements:_,schemas:_e}=a,{token:tt}=theme.useToken(),nt=()=>_e.filter(ot=>_.map(rt=>rt.id).includes(ot.id)),at=()=>{const ot=nt();return ot[ot.length-1]};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",right:0,zIndex:1,height:"100%",width:s?RIGHT_SIDEBAR_WIDTH:0},children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Button$2,{style:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",top:"1rem",right:"1rem",zIndex:100},icon:s?jsxRuntimeExports.jsx(ArrowRightOutlined$1,{}):jsxRuntimeExports.jsx(ArrowLeftOutlined$1,{}),onClick:()=>$(!s)}),jsxRuntimeExports.jsx("div",{style:{width:RIGHT_SIDEBAR_WIDTH,height:"100%",display:s?"block":"none",top:0,right:0,position:"absolute",padding:"0.7rem 1rem",overflowY:"auto",fontFamily:"'Open Sans', sans-serif",boxSizing:"border-box",background:tt.colorBgLayout},children:jsxRuntimeExports.jsx("div",{children:nt().length===0?jsxRuntimeExports.jsx(ListView$1,{...a}):jsxRuntimeExports.jsx(DetailView$1,{...a,activeSchema:at()})})})]})})},RightSidebar=Sidebar,useRerenderDependencies=({plugin:a,value:s,mode:$,scale:_,schema:_e,options:tt})=>reactExports.useMemo(()=>a.uninterruptedEditMode&&$==="designer"?[$]:[s,$,_,JSON.stringify(_e),JSON.stringify(tt)],[s,$,_,_e,tt]),Wrapper=({children:a,outline:s,onChangeHoveringSchemaId:$,schema:_})=>jsxRuntimeExports.jsx("div",{title:_.key,onMouseEnter:()=>$&&$(_.id),onMouseLeave:()=>$&&$(null),className:SELECTABLE_CLASSNAME,id:_.id,style:{position:"absolute",cursor:_.readOnly?"initial":"pointer",height:_.height*ZOOM,width:_.width*ZOOM,top:_.position.y*ZOOM,left:_.position.x*ZOOM,transform:`rotate(${_.rotate??0}deg)`,opacity:_.opacity??1,outline:s},children:a}),Renderer=a=>{const s=reactExports.useContext(PluginsRegistry),$=reactExports.useContext(OptionsContext),_=reactExports.useContext(I18nContext),{token:_e}=theme.useToken(),{schema:tt,basePdf:nt,value:at,mode:ot,onChange:rt,stopEditing:st,tabIndex:lt,placeholder:et,scale:it}=a,ut=reactExports.useRef(null),ft=reactExports.useRef(new Map),ht=Object.values(s).find(gt=>(gt==null?void 0:gt.propPanel.defaultSchema.type)===tt.type);if(!ht||!ht.ui)return console.error(`[@pdfme/ui] Renderer for type ${tt.type} not found.
707
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray(a,s);var $=Object.prototype.toString.call(a).slice(8,-1);if($==="Object"&&a.constructor&&($=a.constructor.name),$==="Map"||$==="Set")return Array.from(a);if($==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test($))return _arrayLikeToArray(a,s)}}function _arrayLikeToArray(a,s){(s==null||s>a.length)&&(s=a.length);for(var $=0,_=new Array(s);$<s;$++)_[$]=a[$];return _}function _iterableToArrayLimit(a,s){var $=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if($!=null){var _,_e,tt,nt,at=[],ot=!0,rt=!1;try{if(tt=($=$.call(a)).next,s===0){if(Object($)!==$)return;ot=!1}else for(;!(ot=(_=tt.call($)).done)&&(at.push(_.value),at.length!==s);ot=!0);}catch(st){rt=!0,_e=st}finally{try{if(!ot&&$.return!=null&&(nt=$.return(),Object(nt)!==nt))return}finally{if(rt)throw _e}}return at}}function _arrayWithHoles(a){if(Array.isArray(a))return a}var updateSchemaByPath=function a(s,$,_){var _e=getSchemaFullPath(s,_),tt=_get(_,_e,{}),nt=isFunction$2($)?$(tt):$,at=Object.assign(Object.assign({},tt),nt);nt.props&&(at.props=Object.assign(Object.assign({},tt==null?void 0:tt.props),nt.props)),_set(_,_e,at)},getFieldName=function a(s){if(s){if(typeof s=="boolean")return s;var $=[];return isArray$3(s)&&($=s.map(function(_){return _.split(".").map(function(_e){return isNaN(Number(_e))?_e:_e*1})})),$=s.split(".").map(function(_){return isNaN(Number(_))?_:_*1}),$=$.map(function(_){return typeof _=="string"&&(_==null?void 0:_.indexOf("["))===0&&(_==null?void 0:_.indexOf("]"))===(_==null?void 0:_.length)-1?Number(_.substring(1,_.length-1)):_}),$}},useForm=function a(){var s=Form$3.useForm(),$=_slicedToArray(s,1),_=$[0],_e=reactExports.useRef({}),tt=reactExports.useRef(),nt=reactExports.useRef({}),at=reactExports.useRef({});_.getFieldError;var ot=_.getFieldsError,rt=_.getFieldInstance,st=_.setFieldsValue,lt=_.setFields,et=_.scrollToField,it=_.isFieldsTouched,ut=_.isFieldTouched,ft=_.isFieldValidating,ht=_.resetFields,dt=_.validateFields,gt=__rest$3(_,["getFieldError","getFieldsError","getFieldInstance","setFieldsValue","setFields","scrollToField","isFieldsTouched","isFieldTouched","isFieldValidating","resetFields","validateFields"]),pt=gt,mt=function(At){var xt=tt.current.setState;xt||setTimeout(function(){xt({schema:nt.current,flattenSchema:_e.current})},0),xt(At)},ct=function(At){_e.current=flattenSchema(At)||{},nt.current=At,mt({schema:At,flattenSchema:_e.current})};return pt.setSchema=function(vt){var At=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(isObject$6(vt)){if(At){ct(vt);return}var xt=cloneDeep(nt.current);Object.keys(vt||{}).forEach(function(bt){updateSchemaByPath(bt,vt[bt],xt)}),ct(xt)}},pt.setSchemaByPath=function(vt,At){if(!(!hasFuncProperty(At)&&_isMatch(At,pt.getSchemaByPath(vt)))){var xt=cloneDeep(nt.current);updateSchemaByPath(vt,At,xt),ct(xt)}},pt.setValues=function(vt){var At=parseBindToValues(vt,_e.current);st(At)},pt.getValues=function(vt,At){var xt,bt=cloneDeep(_.getFieldsValue(getFieldName(vt),At)),Et=((xt=tt.current)===null||xt===void 0?void 0:xt.getState())||{},St=Et.removeHiddenData;return St&&(bt=filterValuesHidden(bt,_e.current)),bt=filterValuesUndefined(bt),parseValuesToBind(bt,_e.current)},pt.getValueByPath=function(vt){var At=getFieldName(vt);return _.getFieldValue(At)},pt.setValueByPath=function(vt,At){if(!_.setFieldValue){var xt=_.getFieldsValue();_set(xt,vt,At),pt.setValues(xt);return}var bt=getFieldName(vt);_.setFieldValue(bt,At);try{JSON.stringify(_.getFieldValue(bt))!==JSON.stringify(At)&&_.setFieldValue(bt,At)}catch{}},pt.getSchemaByPath=function(vt){typeof vt!="string"&&console.warn("请输入正确的路径");var At=getSchemaFullPath(vt,nt.current);return _get(nt.current,At)},pt.getSchema=function(){return nt.current},pt.setErrorFields=function(vt){var At=transformFieldsData(vt,getFieldName);At&&lt(At)},pt.removeErrorField=function(vt){lt([{name:getFieldName(vt),errors:[]}])},pt.getFieldError=function(vt){var At=getFieldName(vt);return _.getFieldError(At)},pt.getFieldsError=function(vt){var At=getFieldName(vt);return ot(At)},pt.getFieldInstance=function(vt){var At=getFieldName(vt);return rt(At)},pt.getHiddenValues=function(){var vt=pt.getValues(),At=pt.getValues(!0),xt={},bt=function Et(St,Bt,Ot){Object.keys(St).forEach(function(Tt){var wt=St[Tt],Ct=Ot?"".concat(Ot,".").concat(Tt):Tt;if(!Bt.hasOwnProperty(Tt)){_set(xt,Ct,wt);return}isObject$6(wt)&&Et(wt,Bt[Tt],Ct),isArray$3(wt)&&wt.map(function(It,yt){Et(It,_get(Bt,"".concat(Tt,"[").concat(yt,"]"),[]),"".concat(Ct,"[").concat(yt,"]"))})})};return bt(At,vt,null),xt},pt.setFields=function(vt){var At=transformFieldsData(vt,getFieldName);At&&lt(At)},pt.__initStore=function(vt){tt.current=vt},pt.scrollToPath=function(vt){for(var At=getFieldName(vt),xt=arguments.length,bt=new Array(xt>1?xt-1:0),Et=1;Et<xt;Et++)bt[Et-1]=arguments[Et];et.apply(void 0,[At].concat(bt))},pt.isFieldsTouched=function(vt,At){var xt=(vt||[]).map(function(bt){return getFieldName(bt)});return it(xt,At)},pt.isFieldTouched=function(vt){var At=getFieldName(vt);return ut(At)},pt.isFieldValidating=function(vt){var At=getFieldName(vt);return ft(At)},pt.resetFields=function(vt){var At=(vt||[]).map(function(xt){return getFieldName(xt)});At.length>0?ht(At):ht()},pt.validateFields=function(vt){var At=(vt||[]).map(function(xt){return getFieldName(xt)});return At.length>0?dt(At):dt()},pt.getFlattenSchema=function(vt){var At;return vt?(At=_e.current)===null||At===void 0?void 0:At[vt]:_e.current},pt.onItemChange=pt.setValueByPath,pt.setFieldRef=function(vt,At){vt&&(at.current[vt]=At)},pt.getFieldRef=function(vt){return at.current[vt]},pt};const FormRender=withProvider(FormCore,defaultWidgets),svgBaseProp={style:{width:"90%",height:"90%"},xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#000000"},createSvgIcon=a=>jsxRuntimeExports.jsxs("svg",{...svgBaseProp,children:[jsxRuntimeExports.jsx("rect",{fill:"none",height:"24",width:"24"}),a]}),createButtonConfig=(a,s,$)=>({id:a,icon:createSvgIcon(s),onClick:$}),AlignWidget=a=>{const{activeElements:s,changeSchemas:$,schemas:_,pageSize:_e,schema:tt}=a,nt=rt=>{const st=s.map(ct=>ct.id),lt=_.filter(ct=>st.includes(ct.id)),et=["left","center","right"].includes(rt),it=et?"x":"y",ut=et?"width":"height",ft=lt.length===1,ht=_e[ut],dt=ft?0:Math.min(...lt.map(ct=>ct.position[it])),gt=ft?ht:Math.max(...lt.map(ct=>ct.position[it]+ct[ut]));let pt=dt,mt=ct=>0;["center","middle"].includes(rt)?(pt=(dt+gt)/2,mt=ct=>ct/2):["right","bottom"].includes(rt)&&(pt=gt,mt=ct=>ct),$(lt.map(ct=>({key:`position.${it}`,value:round(pt-mt(ct[ut]),2),schemaId:ct.id})))},at=rt=>{const st=s.map(At=>At.id),lt=_.filter(At=>st.includes(At.id)),et=rt==="vertical",it=et?"y":"x",ut=et?"height":"width",ft=Math.min(...lt.map(At=>At.position[it])),ht=Math.max(...lt.map(At=>At.position[it]+At[ut]));if(lt.length<3)return;const dt=ft,gt=ht-ft,pt=lt.reduce((At,xt)=>At+xt[ut],0),ct=(gt-pt)/(lt.length-1);let vt=0;$(lt.map((At,xt)=>{vt+=xt===0?0:lt[xt-1][ut]+ct;const bt=round(dt+vt,2);return{key:`position.${it}`,value:bt,schemaId:At.id}}))},ot=[createButtonConfig("left",jsxRuntimeExports.jsx("path",{d:"M4,22H2V2h2V22z M22,7H6v3h16V7z M16,14H6v3h10V14z"}),()=>nt("left")),createButtonConfig("center",jsxRuntimeExports.jsx("polygon",{points:"11,2 13,2 13,7 21,7 21,10 13,10 13,14 18,14 18,17 13,17 13,22 11,22 11,17 6,17 6,14 11,14 11,10 3,10 3,7 11,7"}),()=>nt("center")),createButtonConfig("right",jsxRuntimeExports.jsx("path",{d:"M20,2h2v20h-2V2z M2,10h16V7H2V10z M8,17h10v-3H8V17z"}),()=>nt("right")),createButtonConfig("top",jsxRuntimeExports.jsx("path",{d:"M22,2v2H2V2H22z M7,22h3V6H7V22z M14,16h3V6h-3V16z"}),()=>nt("top")),createButtonConfig("middle",jsxRuntimeExports.jsx("polygon",{points:"22,11 17,11 17,6 14,6 14,11 10,11 10,3 7,3 7,11 1.84,11 1.84,13 7,13 7,21 10,21 10,13 14,13 14,18 17,18 17,13 22,13"}),()=>nt("middle")),createButtonConfig("bottom",jsxRuntimeExports.jsx("path",{d:"M22,22H2v-2h20V22z M10,2H7v16h3V2z M17,8h-3v10h3V8z"}),()=>nt("bottom")),createButtonConfig("vertical",jsxRuntimeExports.jsx("path",{d:"M22,2v2H2V2H22z M7,10.5v3h10v-3H7z M2,20v2h20v-2H2z"}),()=>at("vertical")),createButtonConfig("horizontal",jsxRuntimeExports.jsx("path",{d:"M4,22H2V2h2V22z M22,2h-2v20h2V2z M13.5,7h-3v10h3V7z"}),()=>at("horizontal"))];return jsxRuntimeExports.jsx(Form$3.Item,{label:tt.title,children:jsxRuntimeExports.jsx(Button$2.Group,{children:ot.map(rt=>jsxRuntimeExports.jsx(Button$2,{style:{padding:7},disabled:s.length<=2&&["vertical","horizontal"].includes(rt.id),...rt},rt.id))})})},AlignWidget$1=AlignWidget,WidgetRenderer=a=>{const{widget:s,...$}=a,_=reactExports.useRef(null);return reactExports.useEffect(()=>(_.current&&(_.current.innerHTML="",s({...$,rootElement:_.current})),()=>{_.current&&(_.current.innerHTML="")}),[a.activeSchema]),jsxRuntimeExports.jsx("div",{ref:_})},WidgetRenderer$1=WidgetRenderer,ButtonGroupWidget=a=>{const{activeElements:s,changeSchemas:$,schemas:_,schema:_e}=a,tt=ot=>{const rt=ot.key,st=ot.type,lt=s.map(it=>it.id),et=_.filter(it=>lt.includes(it.id));$(et.map(it=>{const ut=it[rt]??!1,ft=st==="boolean"?!ut:ot.value;return{key:rt,value:ft,schemaId:it.id}}))},nt=ot=>{const rt=ot.key,st=ot.type;let lt=!1;const et=s.map(ut=>ut.id);return _.filter(ut=>et.includes(ut.id)).forEach(ut=>{lt=st==="boolean"?ut[rt]??!1:ut[rt]===ot.value}),lt},at=ot=>{const rt=`data:image/svg+xml;utf8,${encodeURIComponent(ot)}`;return jsxRuntimeExports.jsx("img",{width:17,height:17,src:rt})};return jsxRuntimeExports.jsx(Form$3.Item,{children:jsxRuntimeExports.jsx(Button$2.Group,{children:_e.buttons.map((ot,rt)=>{const st=nt(ot);return jsxRuntimeExports.jsx(Button$2,{type:st?"primary":void 0,ghost:st,onClick:()=>tt(ot),style:{padding:7,zIndex:st?2:0},icon:at(ot.icon)},rt)})})})},ButtonGroupWidget$1=ButtonGroupWidget,{Text:Text$2}=Typography$1,DetailView=a=>{const{token:s}=theme.useToken(),{size:$,changeSchemas:_,deselectSchema:_e,activeSchema:tt}=a,nt=useForm(),at=reactExports.useContext(I18nContext),ot=reactExports.useContext(PluginsRegistry),rt=reactExports.useContext(OptionsContext),[st,lt]=reactExports.useState({});reactExports.useEffect(()=>{const gt={AlignWidget:pt=>jsxRuntimeExports.jsx(AlignWidget$1,{...pt,...a,options:rt}),Divider:()=>jsxRuntimeExports.jsx(Divider$1,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),ButtonGroup:pt=>jsxRuntimeExports.jsx(ButtonGroupWidget$1,{...pt,...a,options:rt})};for(const pt of Object.values(ot)){const mt=(pt==null?void 0:pt.propPanel.widgets)||{};Object.entries(mt).forEach(([ct,vt])=>{gt[ct]=At=>jsxRuntimeExports.jsx(WidgetRenderer$1,{...At,...a,options:rt,theme:s,i18n:at,widget:vt})})}lt(gt)},[tt,ot,JSON.stringify(rt)]),reactExports.useEffect(()=>{const gt={...tt};gt.x=gt.position.x,gt.y=gt.position.y,delete gt.position,nt.setValues(gt)},[tt,nt]);const et=gt=>{const pt=(ct,vt)=>typeof ct=="object"?JSON.stringify(ct)!==JSON.stringify(vt):ct!==vt;let mt=[];for(let ct in gt){if(["id","content"].includes(ct))continue;let vt=gt[ct],At=!1;["x","y"].includes(ct)?(At=vt!==tt.position[ct],ct="position."+ct):At=pt(vt,tt[ct]),At&&(vt===null&&["rotate","opacity"].includes(ct)&&(vt=void 0),mt.push({key:ct,value:vt,schemaId:tt.id}))}mt.length&&nt.validateFields().then(()=>_(mt)).catch(ct=>{ct.errorFields.length&&(mt=mt.filter(vt=>!ct.errorFields.find(At=>At.name.includes(vt.key)))),mt.length&&_(mt)})},it=Object.values(ot).find(gt=>(gt==null?void 0:gt.propPanel.defaultSchema.type)===tt.type),ut=it==null?void 0:it.propPanel.schema;ut||console.error(`[@pdfme/ui] No propPanel.schema for ${tt.type}.
708
+ Check this document: https://pdfme.com/docs/custom-schemas`);const ft=Object.entries(ot).map(([gt,pt])=>({label:gt,value:pt==null?void 0:pt.propPanel.defaultSchema.type})),ht=it.propPanel.defaultSchema,dt={type:"object",column:2,properties:{type:{title:at("type"),type:"string",widget:"select",props:{options:ft},required:!0,span:12},key:{title:at("fieldName"),type:"string",required:!0,span:12},"-":{type:"void",widget:"Divider"},align:{title:at("align"),type:"void",widget:"AlignWidget"},x:{title:"X",type:"number",widget:"inputNumber",required:!0,span:8,min:0},y:{title:"Y",type:"number",widget:"inputNumber",required:!0,span:8,min:0},rotate:{title:at("rotate"),type:"number",widget:"inputNumber",disabled:(ht==null?void 0:ht.rotate)===void 0,max:360,props:{min:0},span:8},width:{title:at("width"),type:"number",widget:"inputNumber",required:!0,span:8,props:{min:0}},height:{title:at("height"),type:"number",widget:"inputNumber",required:!0,span:8,props:{min:0}},opacity:{title:at("opacity"),type:"number",widget:"inputNumber",disabled:(ht==null?void 0:ht.opacity)===void 0,props:{step:.1,min:0,max:1},span:8}}};if(typeof ut=="function"){const gt=ut({...a,options:rt,theme:s,i18n:at})||{};dt.properties={...dt.properties,...Object.keys(gt).length===0?{}:{"--":{type:"void",widget:"Divider"}},...gt}}else{const gt=ut||{};dt.properties={...dt.properties,...Object.keys(gt).length===0?{}:{"--":{type:"void",widget:"Divider"}},...gt}}return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{style:{height:40,display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$2,{style:{position:"absolute",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:_e,icon:jsxRuntimeExports.jsx(MenuOutlined$1,{})}),jsxRuntimeExports.jsx(Text$2,{strong:!0,style:{textAlign:"center",width:"100%"},children:at("editField")})]}),jsxRuntimeExports.jsx(Divider$1,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),jsxRuntimeExports.jsx("div",{style:{height:getSidebarContentHeight($.height),overflowY:"auto",overflowX:"hidden"},children:jsxRuntimeExports.jsx(FormRender,{form:nt,schema:dt,widgets:st,watch:{"#":et},locale:"en-US"})})]})},propsAreUnchanged=(a,s)=>JSON.stringify(a.activeSchema)==JSON.stringify(s.activeSchema),DetailView$1=React$a.memo(DetailView,propsAreUnchanged),Sidebar=a=>{const{sidebarOpen:s,setSidebarOpen:$,activeElements:_,schemas:_e}=a,{token:tt}=theme.useToken(),nt=()=>_e.filter(ot=>_.map(rt=>rt.id).includes(ot.id)),at=()=>{const ot=nt();return ot[ot.length-1]};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",right:0,zIndex:1,height:"100%",width:s?RIGHT_SIDEBAR_WIDTH:0},children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Button$2,{style:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",top:"1rem",right:"1rem",zIndex:100},icon:s?jsxRuntimeExports.jsx(ArrowRightOutlined$1,{}):jsxRuntimeExports.jsx(ArrowLeftOutlined$1,{}),onClick:()=>$(!s)}),jsxRuntimeExports.jsx("div",{style:{width:RIGHT_SIDEBAR_WIDTH,height:"100%",display:s?"block":"none",top:0,right:0,position:"absolute",padding:"0.7rem 1rem",overflowY:"auto",fontFamily:"'Open Sans', sans-serif",boxSizing:"border-box",background:tt.colorBgLayout},children:jsxRuntimeExports.jsx("div",{children:nt().length===0?jsxRuntimeExports.jsx(ListView$1,{...a}):jsxRuntimeExports.jsx(DetailView$1,{...a,activeSchema:at()})})})]})})},RightSidebar=Sidebar,useRerenderDependencies=({plugin:a,value:s,mode:$,scale:_,schema:_e,options:tt})=>reactExports.useMemo(()=>a.uninterruptedEditMode&&$==="designer"?[$]:[s,$,_,JSON.stringify(_e),JSON.stringify(tt)],[s,$,_,_e,tt]),Wrapper=({children:a,outline:s,onChangeHoveringSchemaId:$,schema:_})=>jsxRuntimeExports.jsx("div",{title:_.key,onMouseEnter:()=>$&&$(_.id),onMouseLeave:()=>$&&$(null),className:SELECTABLE_CLASSNAME,id:_.id,style:{position:"absolute",cursor:_.readOnly?"initial":"pointer",height:_.height*ZOOM,width:_.width*ZOOM,top:_.position.y*ZOOM,left:_.position.x*ZOOM,transform:`rotate(${_.rotate??0}deg)`,opacity:_.opacity??1,outline:s},children:a}),Renderer=a=>{const s=reactExports.useContext(PluginsRegistry),$=reactExports.useContext(OptionsContext),_=reactExports.useContext(I18nContext),{token:_e}=theme.useToken(),{schema:tt,basePdf:nt,value:at,mode:ot,onChange:rt,stopEditing:st,tabIndex:lt,placeholder:et,scale:it}=a,ut=reactExports.useRef(null),ft=reactExports.useRef(new Map),ht=Object.values(s).find(gt=>(gt==null?void 0:gt.propPanel.defaultSchema.type)===tt.type);if(!ht||!ht.ui)return console.error(`[@pdfme/ui] Renderer for type ${tt.type} not found.
709
709
  Check this document: https://pdfme.com/docs/custom-schemas`),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const dt=useRerenderDependencies({plugin:ht,value:at,mode:ot,scale:it,schema:tt,options:$});return reactExports.useEffect(()=>{if(ut.current&&tt.type){ut.current.innerHTML="";const gt=ht.ui;gt({key:tt.key,value:at,schema:tt,basePdf:nt,rootElement:ut.current,mode:ot,onChange:rt,stopEditing:st,tabIndex:lt,placeholder:et,options:$,theme:_e,i18n:_,pdfJs,_cache:ft.current})}return()=>{ut.current&&(ut.current.innerHTML="")}},dt),jsxRuntimeExports.jsx(Wrapper,{...a,children:jsxRuntimeExports.jsx("div",{style:{height:"100%",width:"100%"},ref:ut})})},Renderer$1=Renderer,Draggable$1=a=>{const{scale:s,basePdf:$,plugin:_}=a,{token:_e}=theme.useToken(),tt=_.propPanel.defaultSchema,nt=useDraggable({id:tt.type,data:tt}),{listeners:at,setNodeRef:ot,attributes:rt,transform:st,isDragging:lt}=nt,et={transform:CSS$1.Translate.toString(st)};return jsxRuntimeExports.jsxs("div",{ref:ot,style:et,...at,...rt,children:[lt&&jsxRuntimeExports.jsx("div",{style:{transform:`scale(${s})`},children:jsxRuntimeExports.jsx(Renderer$1,{schema:{...tt,id:tt.type,key:tt.type},basePdf:$,value:tt.content||"",onChangeHoveringSchemaId:()=>{},mode:"viewer",outline:`1px solid ${_e.colorPrimary}`,scale:s},tt.type)}),jsxRuntimeExports.jsx("div",{style:{visibility:lt?"hidden":"visible"},children:a.children})]})},LeftSidebar=({height:a,scale:s,basePdf:$})=>{const{token:_}=theme.useToken(),_e=reactExports.useContext(PluginsRegistry),tt=reactExports.useContext(OptionsContext),[nt,at]=reactExports.useState(!1);return reactExports.useEffect(()=>{const ot=()=>{nt&&at(!1)};return document.addEventListener("mouseup",ot),()=>{document.removeEventListener("mouseup",ot)}},[nt]),jsxRuntimeExports.jsx("div",{style:{left:0,right:0,position:"absolute",zIndex:1,height:a,width:45,background:_.colorBgLayout,textAlign:"center",overflow:nt?"visible":"auto"},children:Object.entries(_e).map(([ot,rt])=>{var lt;if(!(rt!=null&&rt.propPanel.defaultSchema))return null;const st=((lt=tt.icons)==null?void 0:lt[rt.propPanel.defaultSchema.type])??rt.icon;return jsxRuntimeExports.jsx(Draggable$1,{scale:s,basePdf:$,plugin:rt,children:jsxRuntimeExports.jsx(Button$2,{title:ot,onMouseDown:()=>{at(!0)},style:{width:35,height:35,marginTop:"0.25rem",padding:"0.25rem"},children:st?jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:st}}):jsxRuntimeExports.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:ot})})},ot)})})},LeftSidebar$1=LeftSidebar,Paper=a=>{const{paperRefs:s,scale:$,size:_,schemasList:_e,pageSizes:tt,backgrounds:nt,renderPaper:at,renderSchema:ot,hasRulers:rt}=a,st=reactExports.useContext(FontContext),lt=rt?RULER_HEIGHT:0;return tt.length!==nt.length||tt.length!==_e.length?null:jsxRuntimeExports.jsx("div",{style:{transform:`scale(${$})`,transformOrigin:"top left",height:$,width:$},children:nt.map((et,it)=>{const ut=tt[it],ft={width:ut.width*ZOOM,height:ut.height*ZOOM},ht=ft.width*$+lt<_.width?`${(_.width/$-ft.width)/2}px`:`${lt}px`;let dt=it>0?(lt+PAGE_GAP)*(it+1):lt;return rt||(dt+=PAGE_GAP*2),jsxRuntimeExports.jsxs("div",{ref:gt=>{gt&&(s.current[it]=gt)},onMouseDown:gt=>{gt.currentTarget===gt.target&&document&&document.hasFocus()&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()},style:{fontFamily:`'${getFallbackFontName(st)}'`,top:`${dt}px`,left:ht,position:"relative",backgroundImage:`url(${et})`,backgroundSize:`${ft.width}px ${ft.height}px`,...ft},children:[at&&at({paperSize:ft,index:it}),_e[it].map((gt,pt)=>jsxRuntimeExports.jsx("div",{children:ot({schema:gt,index:it===0?pt:pt+_e[it-1].length})},gt.id))]},String(it)+JSON.stringify(ft))})})},Paper$1=Paper;var FUNCTION="function",OBJECT="object",STRING="string",UNDEFINED="undefined",doc=typeof document!==UNDEFINED&&document,OPEN_CLOSED_CHARACTERS=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],TINY_NUM$1=1e-7,DEFAULT_UNIT_PRESETS={cm:function(a){return a*96/2.54},mm:function(a){return a*96/254},in:function(a){return a*96},pt:function(a){return a*96/72},pc:function(a){return a*96/6},"%":function(a,s){return a*s/100},vw:function(a,s){return s===void 0&&(s=window.innerWidth),a/100*s},vh:function(a,s){return s===void 0&&(s=window.innerHeight),a/100*s},vmax:function(a,s){return s===void 0&&(s=Math.max(window.innerWidth,window.innerHeight)),a/100*s},vmin:function(a,s){return s===void 0&&(s=Math.min(window.innerWidth,window.innerHeight)),a/100*s}};/*! *****************************************************************************
710
710
  Copyright (c) Microsoft Corporation.
711
711
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "4.2.3-dev.4",
3
+ "version": "4.2.4-dev.1",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  import FormRender, { useForm } from 'form-render';
2
- import React, { useContext, useEffect } from 'react';
2
+ import React, { useContext, useState, useEffect } from 'react';
3
3
  import type { ChangeSchemaItem, Dict, SchemaForUI, PropPanelWidgetProps, PropPanelSchema } from '@pdfme/common';
4
4
  import type { SidebarProps } from '../../../../types';
5
5
  import { MenuOutlined } from '@ant-design/icons';
@@ -29,6 +29,36 @@ const DetailView = (props: DetailViewProps) => {
29
29
  const pluginsRegistry = useContext(PluginsRegistry);
30
30
  const options = useContext(OptionsContext);
31
31
 
32
+ const [widgets, setWidgets] = useState<{
33
+ [key: string]: (props: PropPanelWidgetProps) => React.JSX.Element;
34
+ }>({});
35
+
36
+ useEffect(() => {
37
+ const newWidgets: typeof widgets = {
38
+ AlignWidget: (p) => <AlignWidget {...p} {...props} options={options} />,
39
+ Divider: () => (
40
+ <Divider style={{ marginTop: token.marginXS, marginBottom: token.marginXS }} />
41
+ ),
42
+ ButtonGroup: (p) => <ButtonGroupWidget {...p} {...props} options={options} />,
43
+ };
44
+ for (const plugin of Object.values(pluginsRegistry)) {
45
+ const widgets = plugin?.propPanel.widgets || {};
46
+ Object.entries(widgets).forEach(([widgetKey, widgetValue]) => {
47
+ newWidgets[widgetKey] = (p) => (
48
+ <WidgetRenderer
49
+ {...p}
50
+ {...props}
51
+ options={options}
52
+ theme={token}
53
+ i18n={i18n as (key: keyof Dict | string) => string}
54
+ widget={widgetValue}
55
+ />
56
+ );
57
+ });
58
+ }
59
+ setWidgets(newWidgets);
60
+ }, [activeSchema, pluginsRegistry, JSON.stringify(options)]);
61
+
32
62
  useEffect(() => {
33
63
  const values: any = { ...activeSchema };
34
64
  // [position] Change the nested position object into a flat, as a three-column layout is difficult to implement
@@ -39,7 +69,6 @@ const DetailView = (props: DetailViewProps) => {
39
69
 
40
70
  }, [activeSchema, form]);
41
71
 
42
-
43
72
  const handleWatch = (formSchema: any) => {
44
73
  const formAndSchemaValuesDiffer = (formValue: any, schemaValue: any): boolean => {
45
74
  if (typeof formValue === 'object') {
@@ -181,31 +210,6 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
181
210
  };
182
211
  }
183
212
 
184
- const allWidgets: {
185
- [key: string]: (props: PropPanelWidgetProps) => React.JSX.Element;
186
- } = {
187
- AlignWidget: (p) => <AlignWidget {...p} {...props} options={options} />,
188
- Divider: () => (
189
- <Divider style={{ marginTop: token.marginXS, marginBottom: token.marginXS }} />
190
- ),
191
- ButtonGroup: (p) => <ButtonGroupWidget {...p} {...props} options={options} />,
192
- };
193
- for (const plugin of Object.values(pluginsRegistry)) {
194
- const widgets = plugin?.propPanel.widgets || {};
195
- Object.entries(widgets).forEach(([widgetKey, widgetValue]) => {
196
- allWidgets[widgetKey] = (p) => (
197
- <WidgetRenderer
198
- {...p}
199
- {...props}
200
- options={options}
201
- theme={token}
202
- i18n={i18n as (key: keyof Dict | string) => string}
203
- widget={widgetValue}
204
- />
205
- );
206
- });
207
- }
208
-
209
213
  return (
210
214
  <div>
211
215
  <div style={{ height: 40, display: 'flex', alignItems: 'center' }}>
@@ -235,7 +239,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
235
239
  <FormRender
236
240
  form={form}
237
241
  schema={propPanelSchema}
238
- widgets={allWidgets}
242
+ widgets={widgets}
239
243
  watch={{ '#': handleWatch }}
240
244
  locale="en-US"
241
245
  />