@nocobase/plugin-public-forms 2.1.0-beta.8 → 2.1.0
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/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/192.8517b0a03feac7ee.js +10 -0
- package/dist/client/397.b68774708fca6416.js +10 -0
- package/dist/client/595.b7c06702cf42a9f1.js +10 -0
- package/dist/client/755.54e2c6a5fba42eb6.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/594.3ec7d41fb076d365.js +10 -0
- package/dist/client-v2/599.be4aea35e18fe34f.js +10 -0
- package/dist/client-v2/610.5a762348c1d0e93d.js +10 -0
- package/dist/client-v2/64.14dd13ceb37723c5.js +10 -0
- package/dist/client-v2/965.9ebc606a71f466a5.js +10 -0
- package/dist/client-v2/constants.d.ts +20 -0
- package/dist/client-v2/index.d.ts +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +12 -0
- package/dist/client-v2/modelTree.d.ts +125 -0
- package/dist/client-v2/models/PublicFormLayoutModel.d.ts +32 -0
- package/dist/client-v2/models/PublicFormPageModel.d.ts +19 -0
- package/dist/client-v2/models/PublicFormSubmitActionModel.d.ts +20 -0
- package/dist/client-v2/models/PublicFormsSettingsLayoutModel.d.ts +14 -0
- package/dist/client-v2/pages/PublicFormsSettingsPage.d.ts +12 -0
- package/dist/client-v2/plugin.d.ts +14 -0
- package/dist/client-v2/publicFormFlowModelRepository.d.ts +34 -0
- package/dist/client-v2/route.d.ts +17 -0
- package/dist/externalVersion.js +8 -4
- package/dist/locale/en-US.json +19 -2
- package/dist/locale/zh-CN.json +19 -2
- package/dist/server/collections/publicForms.js +1 -0
- package/dist/server/plugin.d.ts +19 -40
- package/dist/server/plugin.js +168 -31
- package/package.json +5 -2
- package/dist/client/299daa599f56ed18.js +0 -10
- package/dist/client/6d049e4a903a70c8.js +0 -10
- package/dist/client/9001d28b0af050a8.js +0 -10
- package/dist/client/9e93e160b756c6d1.js +0 -10
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("dayjs"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/client"),require("react-router"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-public-forms",["@formily/core","dayjs","@formily/antd-v5","react","@emotion/css","@formily/shared","@nocobase/client","react-router","react-router-dom","@formily/react","@ant-design/icons","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-public-forms"]=t(require("@formily/core"),require("dayjs"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("@formily/shared"),require("@nocobase/client"),require("react-router"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@nocobase/plugin-public-forms"]=t(e["@formily/core"],e.dayjs,e["@formily/antd-v5"],e.react,e["@emotion/css"],e["@formily/shared"],e["@nocobase/client"],e["react-router"],e["react-router-dom"],e["@formily/react"],e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,t,r,n,o,i,u,c,a,l,s,f,p){return function(){var m,d,b,y,h,g,v,x,_={5018:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return k},PluginPublicFormsClient:function(){return _}});var n=r(3772),o=function(e){return{type:"void","x-toolbar":"BlockSchemaToolbar","x-toolbar-props":{draggable:!1},"x-settings":"blockSettings:publicForm","x-component":"CardItem","x-decorator":"FormBlockProvider","x-decorator-props":{collection:e.collection,dataSource:e.dataSource,type:"publicForm"},"x-use-decorator-props":"useCreateFormBlockDecoratorProps",properties:{a69vmspkv8h:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"form:configureFields"},l9xfwp6cfh1:{type:"void","x-component":"ActionBar","x-initializer":"createForm:configureActions","x-component-props":{layout:"one-column"}}}}}}},i=r(3505),u=r(3238),c=new n.SchemaSettings({name:"blockSettings:publicForm",items:[{name:"title",Component:n.SchemaSettingsBlockTitleItem},{name:"linkageRules",Component:n.SchemaSettingsLinkageRules,useComponentProps:function(){return{collectionName:(0,n.useCollection)().name}}}]}),a=new n.SchemaSettings({name:"blockSettings:publicMarkdown",items:[{name:"EditMarkdown",type:"item",useComponentProps:function(){var e=(0,i.useField)();return{title:(0,(0,u.useTranslation)().t)("Edit markdown"),onClick:function(){e.editable=!0}}}},{name:"setBlockTemplate",Component:n.SchemaSettingsRenderEngine}]}),l=r(7641),s=r(3581);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t,r,n,o,i,u){try{var c=e[i](u),a=c.value}catch(e){r(e);return}c.done?t(a):Promise.resolve(a).then(n,o)}function m(e,t,r){return(m=h()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&b(o,r.prototype),o}).apply(null,arguments)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){var t="function"==typeof Map?new Map:void 0;return(y=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return m(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,e)})(e)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}var g=(0,n.lazy)(function(){return s("imported_1fpftdr_component",Promise.all([r.e("112"),r.e("309"),r.e("19")]).then(r.bind(r,665)))},"AdminPublicFormList").AdminPublicFormList,v=(0,n.lazy)(function(){return s("imported_7lbes3_component",Promise.all([r.e("112"),r.e("309"),r.e("725")]).then(r.bind(r,9987)))},"AdminPublicFormPage").AdminPublicFormPage,x=(0,n.lazy)(function(){return s("imported_17kipkb_component",Promise.all([r.e("112"),r.e("309")]).then(r.bind(r,8975)))},"PublicFormPage").PublicFormPage,_=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n,o,i,u;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=d(t),o=e=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(t,n||[],d(this).constructor):t.apply(this,n)),i="formTypes",u=new Map,i in o?Object.defineProperty(o,i,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[i]=u,e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&b(r,e),t=[{key:"registerFormType",value:function(e,t){this.formTypes.set(e,t)}},{key:"getFormSchemaByType",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"form";return this.formTypes.get(e)?this.formTypes.get(e).uiSchema:function(){return null}}},{key:"getFormTypeOptions",value:function(){var e=[],t=!0,r=!1,n=void 0;try{for(var o,i=this.formTypes[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var u,c=(u=o.value,function(e){if(Array.isArray(e))return e}(u)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(e);!(u=(r=o.next()).done)&&(i.push(r.value),i.length!==t);u=!0);}catch(e){c=!0,n=e}finally{try{u||null==o.return||o.return()}finally{if(c)throw n}}return i}}(u,2)||function(e,t){if(e){if("string"==typeof e)return f(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(u,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=c[0],l=c[1].label;e.push({value:a,label:l})}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(e){return t.app.schemaSettingsManager.add(c),t.app.schemaSettingsManager.add(a),t.registerFormType("form",{label:"Form",uiSchema:o}),t.app.router.add("public-forms",{path:"/public-forms/:name",Component:x,skipAuthCheck:!0}),t.app.pluginSettingsManager.add("public-forms",{title:'{{t("Public forms", { ns: "'.concat(l.A7,'" })}}'),icon:"TableOutlined",Component:g}),t.app.pluginSettingsManager.add("public-forms/:name",{title:!1,pluginKey:"public-forms",isTopLevel:!1,Component:v}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){p(i,n,o,u,c,"next",e)}function c(e){p(i,n,o,u,c,"throw",e)}u(void 0)})})()}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(y(n.Plugin)),k=_},7641:function(e,t,r){"use strict";r.d(t,{A7:function(){return u},NY:function(){return a},NT:function(){return c}});var n=r(3772),o=r(3238),i=JSON.parse('{"u2":"@nocobase/plugin-public-forms"}'),u="public-forms";function c(){var e=(0,n.useApp)();return function(t){return e.i18n.t(t,{ns:[i.u2,"client"]})}}function a(){return(0,o.useTranslation)([u,"client"],{nsMode:"fallback"})}},3581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=s},4964:function(e){"use strict";e.exports=o},4632:function(e){"use strict";e.exports=r},8563:function(t){"use strict";t.exports=e},3505:function(e){"use strict";e.exports=l},8875:function(e){"use strict";e.exports=i},3772:function(e){"use strict";e.exports=u},2721:function(e){"use strict";e.exports=f},5760:function(e){"use strict";e.exports=t},8156:function(e){"use strict";e.exports=n},3238:function(e){"use strict";e.exports=p},5432:function(e){"use strict";e.exports=c},6128:function(e){"use strict";e.exports=a}},k={};function w(e){var t=k[e];if(void 0!==t)return t.exports;var r=k[e]={id:e,exports:{}};return _[e].call(r.exports,r,r.exports,w),r.exports}return w.m=_,w.amdO={},w.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return w.d(t,{a:t}),t},d=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},w.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);w.r(r);var n={};m=m||[null,d({}),d([]),d(d)];for(var o=2&t&&e;"object"==typeof o&&!~m.indexOf(o);o=d(o))Object.getOwnPropertyNames(o).forEach(function(t){n[t]=function(){return e[t]}});return n.default=function(){return e},w.d(r,n),r},w.d=function(e,t){for(var r in t)w.o(t,r)&&!w.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},w.f={},w.e=function(e){return Promise.all(Object.keys(w.f).reduce(function(t,r){return w.f[r](e,t),t},[]))},w.u=function(e){return""+({112:"6d049e4a903a70c8",19:"9001d28b0af050a8",309:"299daa599f56ed18",725:"9e93e160b756c6d1"})[e]+".js"},w.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),w.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},y="@nocobase/plugin-public-forms:",w.l=function(e,t,r,n){if(b[e])return void b[e].push(t);if(void 0!==r)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-webpack")==y+r){o=a;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,w.nc&&o.setAttribute("nonce",w.nc),o.setAttribute("data-webpack",y+r),o.src=e),b[e]=[t];var l=function(t,r){o.onerror=o.onload=null,clearTimeout(s);var n=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},w.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},w.nc=void 0,(h=window.__webpack_public_path__||"/").endsWith("/")||(h+="/"),w.p=h+"static/plugins/@nocobase/plugin-public-forms/dist/client/",g={909:0},w.f.j=function(e,t){var r=w.o(g,e)?g[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=g[e]=[t,n]});t.push(r[2]=n);var o=w.p+w.u(e),i=Error();w.l(o,function(t){if(w.o(g,e)&&(0!==(r=g[e])&&(g[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,r[1](i)}},"chunk-"+e,e)}},v=function(e,t){var r,n,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==g[e]})){for(r in i)w.o(i,r)&&(w.m[r]=i[r]);u&&u(w)}for(e&&e(t);c<o.length;c++)n=o[c],w.o(g,n)&&g[n]&&g[n][0](),g[n]=0},(x=self.webpackChunk_nocobase_plugin_public_forms=self.webpackChunk_nocobase_plugin_public_forms||[]).forEach(v.bind(null,0)),x.push=v.bind(null,x.push.bind(x)),w(5018)}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("ahooks"),require("dayjs"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("react-router")):"function"==typeof define&&define.amd?define("@nocobase/plugin-public-forms",["react-i18next","@emotion/css","react-router-dom","@formily/antd-v5","@formily/react","@ant-design/icons","ahooks","dayjs","@formily/core","@formily/shared","react","antd","@nocobase/client","react-router"],t):"object"==typeof exports?exports["@nocobase/plugin-public-forms"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("ahooks"),require("dayjs"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("react-router")):e["@nocobase/plugin-public-forms"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@formily/antd-v5"],e["@formily/react"],e["@ant-design/icons"],e.ahooks,e.dayjs,e["@formily/core"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["react-router"])}(self,function(e,t,r,n,o,i,u,c,a,l,s,f,p,m){return function(){"use strict";var d,b,y,h={3127:function(e,t,r){r.r(t),r.d(t,{PluginPublicFormsClient:function(){return x},default:function(){return w}});var n=r(3342),o=function(e){return{type:"void","x-toolbar":"BlockSchemaToolbar","x-toolbar-props":{draggable:!1},"x-settings":"blockSettings:publicForm","x-component":"CardItem","x-decorator":"FormBlockProvider","x-decorator-props":{collection:e.collection,dataSource:e.dataSource,type:"publicForm"},"x-use-decorator-props":"useCreateFormBlockDecoratorProps",properties:{a69vmspkv8h:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:{grid:{type:"void","x-component":"Grid","x-initializer":"form:configureFields"},l9xfwp6cfh1:{type:"void","x-component":"ActionBar","x-initializer":"createForm:configureActions","x-component-props":{layout:"one-column"}}}}}}},i=r(5230),u=r(5953),c=new n.SchemaSettings({name:"blockSettings:publicForm",items:[{name:"title",Component:n.SchemaSettingsBlockTitleItem},{name:"linkageRules",Component:n.SchemaSettingsLinkageRules,useComponentProps:function(){return{collectionName:(0,n.useCollection)().name}}}]}),a=new n.SchemaSettings({name:"blockSettings:publicMarkdown",items:[{name:"EditMarkdown",type:"item",useComponentProps:function(){var e=(0,i.useField)();return{title:(0,(0,u.useTranslation)().t)("Edit markdown"),onClick:function(){e.editable=!0}}}},{name:"setBlockTemplate",Component:n.SchemaSettingsRenderEngine}]}),l=r(5375);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,o,i,u){try{var c=e[i](u),a=c.value}catch(e){r(e);return}c.done?t(a):Promise.resolve(a).then(n,o)}function p(e,t,r){return(p=y()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&d(o,r.prototype),o}).apply(null,arguments)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){var t="function"==typeof Map?new Map:void 0;return(b=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return p(e,arguments,m(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),d(r,e)})(e)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}var h=(0,n.lazy)(function(){return Promise.all([r.e("755"),r.e("595"),r.e("397")]).then(r.bind(r,1636))},"AdminPublicFormList").AdminPublicFormList,g=(0,n.lazy)(function(){return Promise.all([r.e("755"),r.e("595"),r.e("192")]).then(r.bind(r,3155))},"AdminPublicFormPage").AdminPublicFormPage,v=(0,n.lazy)(function(){return Promise.all([r.e("755"),r.e("595")]).then(r.bind(r,3170))},"PublicFormPage").PublicFormPage,x=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n,o,i,u;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=m(t),o=e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,y()?Reflect.construct(t,n||[],m(this).constructor):t.apply(this,n)),i="formTypes",u=new Map,i in o?Object.defineProperty(o,i,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[i]=u,e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&d(r,e),t=[{key:"registerFormType",value:function(e,t){this.formTypes.set(e,t)}},{key:"getFormSchemaByType",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"form";return this.formTypes.get(e)?this.formTypes.get(e).uiSchema:function(){return null}}},{key:"getFormTypeOptions",value:function(){var e=[],t=!0,r=!1,n=void 0;try{for(var o,i=this.formTypes[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var u,c=(u=o.value,function(e){if(Array.isArray(e))return e}(u)||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,u=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(u)throw r}}return o}}(u)||function(e){if(e){if("string"==typeof e)return s(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return s(e,2)}}(u)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=c[0],l=c[1].label;e.push({value:a,label:l})}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.schemaSettingsManager.add(c),this.app.schemaSettingsManager.add(a),this.registerFormType("form",{label:"Form",uiSchema:o}),this.app.router.add("public-forms",{path:"/public-forms/:name",Component:v,skipAuthCheck:!0}),this.app.pluginSettingsManager.add("public-forms",{title:'{{t("Public forms", { ns: "'.concat(l.CU,'" })}}'),icon:"TableOutlined",Component:h}),this.app.pluginSettingsManager.add("public-forms/:name",{title:!1,pluginKey:"public-forms",isTopLevel:!1,Component:g}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){f(i,n,o,u,c,"next",e)}function c(e){f(i,n,o,u,c,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(b(n.Plugin)),w=x},5375:function(e,t,r){r.d(t,{CU:function(){return u},kO:function(){return a},kj:function(){return c}});var n=r(3342),o=r(5953),i=JSON.parse('{"UU":"@nocobase/plugin-public-forms"}'),u="public-forms";function c(){var e=(0,n.useApp)();return function(t){return e.i18n.t(t,{ns:[i.UU,"client"]})}}function a(){return(0,o.useTranslation)([u,"client"],{nsMode:"fallback"})}},7375:function(e){e.exports=i},5477:function(e){e.exports=t},418:function(e){e.exports=n},9452:function(e){e.exports=a},5230:function(e){e.exports=o},166:function(e){e.exports=l},3342:function(e){e.exports=p},2625:function(e){e.exports=u},2059:function(e){e.exports=f},9185:function(e){e.exports=c},9155:function(e){e.exports=s},5953:function(t){t.exports=e},2707:function(e){e.exports=m},4442:function(e){e.exports=r},1729:function(e,t,r){var n="",o="u">typeof document?document.currentScript:null;if(o&&o.src&&(n=o.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!n){var i=window.__webpack_public_path__||"";i&&("/"!==i.charAt(i.length-1)&&(i+="/"),n=i+"static/plugins/@nocobase/plugin-public-forms/dist/client/")}if(!n){var u=window.__nocobase_modern_client_prefix__||"v",c="/"+(u=String(u).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(n=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",l=a.indexOf(c);n=l>=0?a.slice(0,l+1):"/"}n&&(n=n.replace(RegExp("/"+u+"/?$"),"/")),n||(n="/"),"/"!==n.charAt(n.length-1)&&(n+="/"),n+="static/plugins/@nocobase/plugin-public-forms/dist/client/"}r.p=n}},g={};function v(e){var t=g[e];if(void 0!==t)return t.exports;var r=g[e]={id:e,exports:{}};return h[e].call(r.exports,r,r.exports,v),r.exports}v.m=h,v.amdO={},v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},w=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},v.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);v.r(r);var n={};x=x||[null,w({}),w([]),w(w)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~x.indexOf(o);o=w(o))Object.getOwnPropertyNames(o).forEach(function(t){n[t]=function(){return e[t]}});return n.default=function(){return e},v.d(r,n),r},v.d=function(e,t){for(var r in t)v.o(t,r)&&!v.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},v.f={},v.e=function(e){return Promise.all(Object.keys(v.f).reduce(function(t,r){return v.f[r](e,t),t},[]))},v.u=function(e){return""+e+"."+({192:"8517b0a03feac7ee",397:"b68774708fca6416",595:"b7c06702cf42a9f1",755:"54e2c6a5fba42eb6"})[e]+".js"},v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},S={},v.l=function(e,t,r,n){if(S[e])return void S[e].push(t);if(void 0!==r)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-public-forms:"+r){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,v.nc&&o.setAttribute("nonce",v.nc),o.setAttribute("data-rspack","@nocobase/plugin-public-forms:"+r),o.src=e),S[e]=[t];var l=function(t,r){o.onerror=o.onload=null,clearTimeout(s);var n=S[e];if(delete S[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},v.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},v.nc=void 0,v.g.importScripts&&(k=v.g.location+"");var x,w,S,k,_=v.g.document;if(!k&&_&&(_.currentScript&&"SCRIPT"===_.currentScript.tagName.toUpperCase()&&(k=_.currentScript.src),!k)){var P=_.getElementsByTagName("script");if(P.length)for(var O=P.length-1;O>-1&&(!k||!/^http(s?):/.test(k));)k=P[O--].src}if(!k)throw Error("Automatic publicPath is not supported in this browser");return v.p=k.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),d={889:0},v.f.j=function(e,t){var r=v.o(d,e)?d[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=d[e]=[t,n]});t.push(r[2]=n);var o=v.p+v.u(e),i=Error();v.l(o,function(t){if(v.o(d,e)&&(0!==(r=d[e])&&(d[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,r[1](i)}},"chunk-"+e,e)}},b=function(e,t){var r,n,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==d[e]})){for(r in i)v.o(i,r)&&(v.m[r]=i[r]);u&&u(v)}for(e&&e(t);c<o.length;c++)n=o[c],v.o(d,n)&&d[n]&&d[n][0](),d[n]=0},(y=self.webpackChunk_nocobase_plugin_public_forms=self.webpackChunk_nocobase_plugin_public_forms||[]).forEach(b.bind(null,0)),y.push=b.bind(null,y.push.bind(y)),v(1729),v(3127)}()});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_public_forms_client_v2=self.webpackChunk_nocobase_plugin_public_forms_client_v2||[]).push([["594"],{913:function(e,t,n){n.r(t),n.d(t,{default:function(){return C},PublicFormsSettingsLayoutModel:function(){return _}});var r=n(375),o=n(485),l=n(694),a=n(625),u=n(59),i=n(155),c=n.n(i),s=n(442),f=n(488),p=function(e){return e&&"/"!==e?"/".concat(e.replace(/^\/+/,"")):"/"},b=function(e){var t=p(e).replace(/\/+$/,"");return""===t||"/"===t?"":t},d=function(e,t){var n=b(e),r=p(t);return n?"".concat(n).concat(r):r};function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,o,l,a){try{var u=e[l](a),i=u.value}catch(e){n(e);return}u.done?t(i):Promise.resolve(i).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function a(e){y(l,r,o,a,u,"next",e)}function u(e){y(l,r,o,a,u,"throw",e)}a(void 0)})}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}function S(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:i(0)}),u(a,"throw",{value:i(1)}),u(a,"return",{value:i(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function i(u){return function(i){var c=[u,i];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return l.label++,{value:c[1],done:!1};case 5:l.label++,r=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var O=function(e){var t=e.link,n=(0,f.kj)(),r=u.theme.useToken().token,o=k((0,i.useState)(!1),2),l=o[0],a=o[1];return c().createElement(u.Popover,{trigger:"hover",placement:"bottom",open:l,onOpenChange:a,content:l?c().createElement(u.QRCode,{value:t,bordered:!1}):" ",zIndex:r.zIndexPopupBase+100},c().createElement("a",null,n("QR code")))};function j(e){var t=e.record,n=e.onSubmitted,r=(0,f.kj)(),a=(0,l.useFlowContext)(),s=k(u.Form.useForm(),1)[0],p=k((0,i.useState)(!1),2),b=p[0],d=p[1],m=a.api.resource("publicForms"),y=(0,i.useCallback)(function(){return v(function(){var e;return S(this,function(r){switch(r.label){case 0:return[4,s.validateFields()];case 1:e=r.sent(),d(!0),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,m.update({filterByTk:t.key,values:e})];case 3:return r.sent(),n(e),[3,5];case 4:return d(!1),[7];case 5:return[2]}})})()},[s,n,t.key,m]);return c().createElement(o.DrawerFormLayout,{title:r("Set password"),submitText:r("Submit"),cancelText:r("Cancel"),submitting:b,onSubmit:y},c().createElement(u.Form,{form:s,layout:"vertical",initialValues:{password:t.password}},c().createElement(u.Form.Item,{name:"password",label:r("Password")},c().createElement(o.EnvVariableInput,{password:!0}))))}var x=(0,l.observer)(function(e){var t,n=e.model,o=(0,s.useOutlet)(),b=(0,l.useFlowContext)(),m=(0,f.kj)(),y=u.App.useApp().message,h=u.theme.useToken().token,g=n.getPageUidFromLayoutRoute(n.currentLayoutRoute),k=(t=(0,l.useFlowContext)(),(0,i.useMemo)(function(){var e,n,r,o,l,a;return g?new URL((e=t.app,n="/public-forms/".concat(g),(a=null==e||null==(o=e.router)||null==(r=o.getBasename)?void 0:r.call(o))?d(a,n):(null==e?void 0:e.getRouteUrl)?p(e.getRouteUrl(n)):d(null==e||null==(l=e.getPublicPath)?void 0:l.call(e),n)),window.location.origin).toString():""},[t.app,g])),E=b.api.resource("publicForms"),x=(0,a.useRequest)(function(){return v(function(){return S(this,function(e){switch(e.label){case 0:if(!g)return[2,null];return[4,E.get({filterByTk:g})];case 1:var t,n;return[2,(null==(t=e.sent())||null==(n=t.data)?void 0:n.data)||(null==t?void 0:t.data)||null]}})})()},{refreshDeps:[g]}),_=x.data,C=x.mutate,P=(null==_?void 0:_.key)===g?_:null,F=(0,i.useCallback)(function(e){return v(function(){return S(this,function(t){switch(t.label){case 0:if(!(null==P?void 0:P.key))return[2];return[4,E.update({filterByTk:P.key,values:e})];case 1:return t.sent(),C(w({},P,e)),[2]}})})()},[C,P,E]),T=(0,i.useCallback)(function(){return v(function(){return S(this,function(e){switch(e.label){case 0:return[4,navigator.clipboard.writeText(k)];case 1:return e.sent(),y.success(m("Link copied successfully")),[2]}})})()},[y,k,m]),L=(0,i.useCallback)(function(){P&&b.viewer.drawer({width:h.screenSM,closable:!0,content:function(){return c().createElement(j,{record:P,onSubmitted:function(e){return C(w({},P,e))}})}})},[b.viewer,C,P,h.screenSM]);return o?P?c().createElement("div",{style:{display:"flex",flexDirection:"column",gap:h.marginLG,height:"calc(100dvh - var(--nb-header-height) - ".concat(h.controlHeightLG+3*h.paddingLG,"px)"),minHeight:0,overflow:"hidden",width:"100%",boxSizing:"border-box"}},c().createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:h.margin,flexWrap:"wrap"}},c().createElement(u.Breadcrumb,{items:[{title:c().createElement(s.Link,{to:"/admin/settings/public-forms"},m("Public forms"))},{title:P.title}]}),c().createElement(u.Space,{wrap:!0},c().createElement(u.Button,{disabled:!P.enabled,icon:c().createElement(r.EyeOutlined,null),onClick:function(){return window.open(k,"_blank","noopener,noreferrer")}},m("Open form")),c().createElement(u.Dropdown,{menu:{items:[{key:"enabled",label:c().createElement("a",{onClick:function(){return F({enabled:!P.enabled})}},c().createElement(u.Space,null,c().createElement("span",null,m("Enable form")),c().createElement(u.Switch,{size:"small",checked:!!P.enabled})))},{key:"password",label:c().createElement("a",{onClick:L},m("Set password"))},{key:"divider",type:"divider"},{key:"copyLink",label:c().createElement("a",{onClick:T},m("Copy link"))},{key:"qrcode",label:c().createElement(O,{link:k})}]}},c().createElement(u.Button,{icon:c().createElement(r.SettingOutlined,null)},m("Settings"))))),c().createElement("div",{style:{flex:1,minHeight:0,overflow:"auto",position:"relative",width:"100%"}},o)):c().createElement(u.Spin,null):null}),_=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=h(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,E()?Reflect.construct(e,t||[],h(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&g(n,e),t=[{key:"render",value:function(){return c().createElement(x,{model:this})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(o.BaseLayoutModel),C=_},488:function(e,t,n){n.d(t,{MZ:function(){return a},kj:function(){return u}});var r=n(694),o=n(953),l=n(401).gr;function a(e){return(0,r.tExpr)(e,{ns:l})}function u(){return(0,o.useTranslation)([l,"client"],{nsMode:"fallback"}).t}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_public_forms_client_v2=self.webpackChunk_nocobase_plugin_public_forms_client_v2||[]).push([["599"],{826:function(e,t,n){n.r(t),n.d(t,{PublicFormPageModel:function(){return v}});var r=n(477),o=n(992),i=n(485),u=n(694),c=n(59),l=n(155),a=n.n(l),s=n(401),f=n(488);function p(e,t,n){return(p="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function g(){var e,t,n=(e=["\n max-width: 800px;\n margin: 20px auto 0;\n\n .nb-block-grid {\n padding: 0 !important;\n }\n\n .public-form-settings-content-title {\n margin: ","px 0 ","px;\n font-size: ","px;\n font-weight: ",";\n line-height: ",";\n }\n\n [data-flow-add-block],\n div:has(> [data-flow-add-block]) {\n display: none !important;\n }\n\n .public-form-settings-powered-by {\n margin-top: ","px;\n }\n\n @media (max-width: ","px) {\n margin-top: 20px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return g=function(){return n},n}var h=(0,u.observer)(function(e){var t=e.model,n=(0,f.kj)(),o=c.theme.useToken().token,u=(0,l.useMemo)(function(){return(0,r.css)(g(),o.marginLG,o.marginSM,o.fontSizeHeading4,o.fontWeightStrong,o.lineHeightHeading4,o.marginLG,o.screenMD)},[o.fontSizeHeading4,o.fontWeightStrong,o.lineHeightHeading4,o.marginLG,o.marginSM,o.screenMD]);return a().createElement("div",{className:u},t.renderStep(0),a().createElement("div",{className:"public-form-settings-content-title"},n("Prompt after successful submission")),t.renderStep(1),a().createElement("div",{className:"public-form-settings-powered-by"},a().createElement(i.PoweredBy,null)))}),v=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(e){var t,r,i,u;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,i=[e],r=b(r),t=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,m()?Reflect.construct(r,i||[],b(this).constructor):r.apply(this,i)),(u="publicFormSubmitted")in t?Object.defineProperty(t,u,{value:!1,enumerable:!0,configurable:!0,writable:!0}):t[u]=!1,(0,o.define)(t,{publicFormSubmitted:o.observable.ref}),t}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&d(n,e),t=[{key:"getPublicFormDataSourceManager",value:function(){var e,t,n,r=this.flowEngine.getModel(s.ND,!0),o=null==(e=this.parent)?void 0:e.uid,i=null==r||null==(t=r.getPageUidFromLayoutRoute)?void 0:t.call(r,r.currentLayoutRoute);if(o&&i===o)return null==r||null==(n=r.context)?void 0:n.dataSourceManager}},{key:"onInit",value:function(e){var t=this;p(b(n.prototype),"onInit",this).call(this,e),this.setProps("showFlowSettings",!1),this.context.defineProperty("dataSourceManager",{get:function(){return t.getPublicFormDataSourceManager()||t.flowEngine.context.dataSourceManager},cache:!1}),this.context.defineProperty("publicFormPageModel",{value:this}),this.context.defineProperty("allowedFormActionModelNames",{value:[s.BQ]}),this.context.defineProperty("publicFormSubmitted",{get:function(){return t.publicFormSubmitted},observable:!0,cache:!1}),this.context.defineMethod("setPublicFormSubmitted",function(e){t.setPublicFormSubmitted(e)})}},{key:"setPublicFormSubmitted",value:function(e){this.publicFormSubmitted=!!e,this.setProps("publicFormSubmitted",this.publicFormSubmitted)}},{key:"renderStep",value:function(e){var t,n,r;return(null==(r=this.subModels.tabs)||null==(n=r[e])||null==(t=n.renderChildren)?void 0:t.call(n))||null}},{key:"render",value:function(){return this.props.publicRuntime||this.context.publicFormRuntime?this.renderStep(this.publicFormSubmitted||this.props.publicFormSubmitted?1:0):a().createElement(h,{model:this})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(i.ChildPageModel);t.default=v},488:function(e,t,n){n.d(t,{MZ:function(){return u},kj:function(){return c}});var r=n(694),o=n(953),i=n(401).gr;function u(e){return(0,r.tExpr)(e,{ns:i})}function c(){return(0,o.useTranslation)([i,"client"],{nsMode:"fallback"}).t}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_public_forms_client_v2=self.webpackChunk_nocobase_plugin_public_forms_client_v2||[]).push([["610"],{57:function(e,t,n){n.r(t),n.d(t,{PublicFormLayoutModel:function(){return C},default:function(){return A}});var r=n(477),o=n(992),i=n(485),u=n(694),l=n(625),a=n(59),c=n(155),s=n.n(c),f=n(442),p=n(401),d=n(488);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n,r,o,i,u){try{var l=e[i](u),a=l.value}catch(e){n(e);return}l.done?t(a):Promise.resolve(a).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){b(i,r,o,u,l,"next",e)}function l(e){b(i,r,o,u,l,"throw",e)}u(void 0)})}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:a(0)}),l(u,"throw",{value:a(1)}),l(u,"return",{value:a(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function a(l){return function(a){var c=[l,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var g=function(){var e;function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");v(this,"options",void 0),v(this,"__publicFormFlowModelRepository",void 0),v(this,"formKey",void 0),this.options=e,this.__publicFormFlowModelRepository=!0,this.formKey="",this.formKey=e.formKey||""}return e=[{key:"setFormKey",value:function(e){this.formKey=e||""}},{key:"findOne",value:function(e){return h(function(){var t,n;return m(this,function(r){var o,i,u;switch(r.label){case 0:if(!(this.formKey&&((null==e?void 0:e.uid)||(null==e?void 0:e.parentId)&&(null==e?void 0:e.subKey))))return[3,2];return[4,this.options.app.apiClient.request({url:"publicForms:getFlowModel/".concat(this.formKey),skipAuth:!0,params:Object.fromEntries(Object.entries({uid:e.uid,parentId:e.parentId,subKey:e.subKey}).filter(function(e){return void 0!==(function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return y(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return y(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1]}))})];case 1:return[2,null!=(i=null==(o=r.sent())||null==(u=o.data)?void 0:u.data)?i:null];case 2:return[2,null!=(t=null==(n=this.options.delegate)?void 0:n.findOne(e))?t:null]}})}).call(this)}},{key:"save",value:function(e,t){return h(function(){var n,r;return m(this,function(o){return[2,null!=(n=null==(r=this.options.delegate)?void 0:r.save(e,t))?n:{}]})}).call(this)}},{key:"destroy",value:function(e){return h(function(){var t,n;return m(this,function(r){return[2,null!=(t=null==(n=this.options.delegate)?void 0:n.destroy(e))&&t]})}).call(this)}},{key:"move",value:function(e,t,n){return h(function(){var r;return m(this,function(o){switch(o.label){case 0:return[4,null==(r=this.options.delegate)?void 0:r.move(e,t,n)];case 1:return o.sent(),[2]}})}).call(this)}},{key:"duplicate",value:function(e){return h(function(){var t,n;return m(this,function(r){return[2,null!=(t=null==(n=this.options.delegate)?void 0:n.duplicate(e))?t:null]})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}();function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function M(e,t,n,r,o,i,u){try{var l=e[i](u),a=l.value}catch(e){n(e);return}l.done?t(a):Promise.resolve(a).then(r,o)}function S(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){M(i,r,o,u,l,"next",e)}function l(e){M(i,r,o,u,l,"throw",e)}u(void 0)})}}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t,n){return(O="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,l=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{u||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function x(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:a(0)}),l(u,"throw",{value:a(1)}),l(u,"return",{value:a(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function a(l){return function(a){var c=[l,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function _(){var e=P(["\n @media (max-width: ","px) {\n .nb-block-grid {\n overflow-x: hidden;\n padding: 0 !important;\n }\n\n .nb-block-grid > .ant-space > .ant-space-item > div > .ant-row {\n margin-inline: 0 !important;\n }\n\n .nb-block-grid > .ant-space > .ant-space-item > div > .ant-row > .ant-col {\n padding-inline: 0 !important;\n }\n }\n "]);return _=function(){return e},e}function I(){var e=P(["\n min-height: 100vh;\n background: ",";\n padding: 10vh ","px ","px;\n\n @media (max-width: ","px) {\n padding: 0;\n }\n "]);return I=function(){return e},e}var K=(0,u.observer)(function(e){var t,n,o,y,b,h=e.model,v=(0,f.useOutlet)(),m=(0,i.useApp)(),g=(0,d.kj)(),w=a.theme.useToken().token,M=R((0,c.useState)(""),2),F=M[0],O=M[1],k=R((0,c.useState)(""),2),E=k[0],P=k[1],j=R((0,c.useState)(1),2),K=j[0],C=j[1],A=R((0,c.useState)(null),2),D=A[0],T=A[1],q=(0,c.useRef)(null),L=h.getPageUidFromLayoutRoute(h.currentLayoutRoute),B=(0,l.useRequest)(function(e){return S(function(){var t;return x(this,function(n){switch(n.label){case 0:if(!L)return[2,null];return[4,m.apiClient.request({url:"publicForms:getMeta/".concat(L),skipAuth:!0,params:"string"==typeof e?{password:e}:void 0})];case 1:var r,o;return t=null==(r=n.sent())||null==(o=r.data)?void 0:o.data,h.applyPublicDataSource(null==t?void 0:t.dataSource),[2,t]}})})()},{onSuccess:function(e){P(""),(null==e?void 0:e.token)&&localStorage.setItem(p.l_,e.token)},onError:function(e){var t;(null==e||null==(t=e.response)?void 0:t.status)===401&&P(g("Incorrect password"))},refreshDeps:[L]}),U=B.data,z=B.error,N=B.loading,X=B.run,G=(n=(0,u.useFlowEngine)(),(0,l.useRequest)(function(){return S(function(){var e,t;return x(this,function(r){switch(r.label){case 0:if(!(null==(e=null==U?void 0:U.flowModel)?void 0:e.uid))return[2,null];return[4,n.resolveModelTree(e)];case 1:if(r.sent(),t=n.getModel(e.uid))return[3,3];return[4,n.createModelAsync(e)];case 2:t=r.sent(),r.label=3;case 3:return[2,t]}})})()},{refreshDeps:[null==U||null==(t=U.flowModel)?void 0:t.uid]})),H=G.loading,$=G.data,W=(null==z||null==(y=z.response)?void 0:y.status)===401||(null==U?void 0:U.passwordRequired),Z=(0,c.useCallback)(function(e){q.current=e,T(e),h.setLayoutContentElement(e)},[h]),J=(0,c.useCallback)(function(){var e,t;if(D){var n=D.querySelector(".nb-block-grid")||D.querySelector(".ant-card")||(null==(t=D.children[1])||null==(e=t.firstElementChild)?void 0:e.firstElementChild),r=Math.ceil((null==n?void 0:n.getBoundingClientRect().height)||(null==n?void 0:n.scrollHeight)||0);r>0&&C(function(e){return e===r?e:r})}},[D]),Q=(0,c.useMemo)(function(){return{maxWidth:w.screenMD,marginInline:"auto"}},[w.screenMD]),V=(0,c.useMemo)(function(){return{position:"relative",minHeight:K}},[K]),Y=(0,c.useMemo)(function(){return(0,r.css)(_(),w.screenSM)},[w.screenSM]),ee=(0,c.useMemo)(function(){return(0,r.css)(I(),w.colorBgLayout,w.padding,w.paddingXL,w.screenSM)},[w.colorBgLayout,w.padding,w.paddingXL,w.screenSM]);return(o=(0,i.useApp)(),(0,c.useEffect)(function(){var e=o.apiClient.axios.interceptors.request.use(function(e){return e.headers=e.headers||{},e.headers["X-Form-Token"]=localStorage.getItem(p.l_)||"",e});return function(){o.apiClient.axios.interceptors.request.eject(e)}},[o.apiClient.axios.interceptors.request]),(0,c.useEffect)(function(){var e=q.current;if(e){var t=0,n=function(){cancelAnimationFrame(t),t=requestAnimationFrame(J)},r=new ResizeObserver(n),o=new MutationObserver(n);return r.observe(e),o.observe(e,{childList:!0,subtree:!0}),n(),function(){cancelAnimationFrame(t),r.disconnect(),o.disconnect()}}},[J,v,D]),(0,c.useEffect)(function(){h.setPublicFormSubmitted(!1)},[h,L]),(0,c.useEffect)(function(){h.setPublicFormKey(L)},[h,L]),(0,c.useEffect)(function(){(null==U?void 0:U.title)&&(document.title=U.title)},[null==U?void 0:U.title]),W)?s().createElement(a.Modal,{centered:!0,title:g("Password"),open:!0,cancelButtonProps:{hidden:!0},confirmLoading:N,onOk:function(){P(""),X(F)}},s().createElement(a.Form,{layout:"vertical"},s().createElement(a.Form.Item,{validateStatus:E?"error":void 0,help:E||void 0,style:{marginBottom:0}},s().createElement(a.Input.Password,{value:F,onChange:function(e){O(e.target.value),E&&P("")}})))):(null==z||null==(b=z.response)?void 0:b.status)>=500?s().createElement(a.Result,{status:"warning",title:g("The form is not found")}):h.currentLayoutRoute?L?N||H?s().createElement(a.Spin,null):U?$?s().createElement("div",{className:ee},s().createElement("div",{style:Q},s().createElement("div",{ref:Z,className:Y,style:V},v),s().createElement("div",null,s().createElement(i.PoweredBy,null)))):s().createElement(a.Result,{status:"warning",title:g("The form is not found")}):s().createElement(a.Result,{status:"info",title:g("The form is not enabled and cannot be accessed")}):s().createElement(a.Result,{status:"warning",title:g("The form is not found")}):s().createElement(a.Spin,null)}),C=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(e){var t,r,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,i=[e],r=k(r),F(t=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(r,i||[],k(this).constructor):r.apply(this,i)),"publicFormSubmitted",!1),F(t,"publicFormKey",""),F(t,"originalModelRepository",void 0),F(t,"publicFormModelRepository",void 0),F(t,"publicDataSourceManager",void 0),(0,o.define)(t,{publicFormSubmitted:o.observable.ref}),t}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&E(n,e),t=[{key:"setPublicFormSubmitted",value:function(e){this.publicFormSubmitted=!!e}},{key:"setPublicFormKey",value:function(e){var t;this.publicFormKey=e||"",null==(t=this.publicFormModelRepository)||t.setFormKey(this.publicFormKey)}},{key:"getPublicDataSourceManager",value:function(){if(!this.publicDataSourceManager){var e=new u.DataSourceManager,t=this.flowEngine.context.dataSourceManager;e.setFlowEngine(this.flowEngine),e.setRequester(null==t?void 0:t.requester),e.setCollectionFieldInterfaceManager(null==t?void 0:t.collectionFieldInterfaceManager),this.publicDataSourceManager=e}return this.publicDataSourceManager}},{key:"applyPublicDataSource",value:function(e){if(null==e?void 0:e.key){var t,n=e.collections,r=function(e,t){if(null==e)return{};var n,r,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}(e,["collections"]),o=this.getPublicDataSourceManager();o.upsertDataSource(r),null==(t=o.getDataSource(e.key))||t.setCollections(void 0===n?[]:n,{clearFields:!0})}}},{key:"setupPublicFormModelRepository",value:function(){var e=this.flowEngine.modelRepository;if(e&&e.__publicFormFlowModelRepository){this.publicFormModelRepository=e,this.publicFormModelRepository.setFormKey(this.publicFormKey);return}var t=this.flowEngine.context.app;if((null==t?void 0:t.apiClient)&&e){var n=new g({app:t,formKey:this.publicFormKey,delegate:e});this.originalModelRepository=e,this.publicFormModelRepository=n,this.flowEngine.setModelRepository(n)}}},{key:"restoreModelRepository",value:function(){if(this.publicFormModelRepository&&this.flowEngine.modelRepository===this.publicFormModelRepository){var e=this.originalModelRepository;e&&this.flowEngine.setModelRepository(e)}this.publicFormModelRepository=void 0,this.originalModelRepository=void 0}},{key:"onMount",value:function(){var e=this;O(k(n.prototype),"onMount",this).call(this),this.setupPublicFormModelRepository(),this.context.defineProperty("publicFormRuntime",{get:function(){return!0},cache:!1}),this.context.defineProperty("dataSourceManager",{get:function(){return e.getPublicDataSourceManager()},cache:!1}),this.context.defineProperty("publicFormSubmitted",{get:function(){return e.publicFormSubmitted},observable:!0,cache:!1}),this.context.defineProperty("skipAclCheck",{get:function(){return!0},cache:!1}),this.context.defineProperty("flowSettingsEnabled",{get:function(){return!1},cache:!1}),this.context.defineMethod("setPublicFormSubmitted",function(t){e.setPublicFormSubmitted(t)})}},{key:"onUnmount",value:function(){this.restoreModelRepository(),O(k(n.prototype),"onUnmount",this).call(this)}},{key:"render",value:function(){return s().createElement(K,{model:this})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(i.BaseLayoutModel),A=C},488:function(e,t,n){n.d(t,{MZ:function(){return u},kj:function(){return l}});var r=n(694),o=n(953),i=n(401).gr;function u(e){return(0,r.tExpr)(e,{ns:i})}function l(){return(0,o.useTranslation)([i,"client"],{nsMode:"fallback"}).t}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_public_forms_client_v2=self.webpackChunk_nocobase_plugin_public_forms_client_v2||[]).push([["64"],{43:function(e,t,n){n.r(t),n.d(t,{PublicFormSubmitActionModel:function(){return l}});var r=n(485),o=n(488);function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i=function(){return!!e})()}var l=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=u(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,i()?Reflect.construct(e,t||[],u(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&c(n,e),t=[{key:"getInputArgs",value:function(){var e,t,n=null==(t=this.context.resource)||null==(e=t.getSourceId)?void 0:e.call(t);return n?{sourceId:n,defaultInputKeys:["sourceId"]}:{}}},{key:"onClick",value:function(e){this.dispatchEvent("click",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({event:e},this.getInputArgs()),{debounce:!0,sequential:!0})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(r.FormSubmitActionModel);l.define({label:(0,o.MZ)("Submit")}),l.registerFlow({key:"publicFormSubmission",on:{eventName:"click",phase:"afterAllFlows"},steps:{showSuccessMessage:{handler:function(e){var t,n,r;e.publicFormRuntime&&(null==(n=e.publicFormPageModel)||null==(t=n.setPublicFormSubmitted)||t.call(n,!0),null==(r=e.setPublicFormSubmitted)||r.call(e,!0))}}}}),t.default=l},488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return i}});var r=n(694),o=n(953),u=n(401).gr;function c(e){return(0,r.tExpr)(e,{ns:u})}function i(){return(0,o.useTranslation)([u,"client"],{nsMode:"fallback"}).t}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_public_forms_client_v2=self.webpackChunk_nocobase_plugin_public_forms_client_v2||[]).push([["965"],{260:function(e,t,r){r.r(t),r.d(t,{toCollectionCascaderValue:function(){return C},default:function(){return P},fromCollectionCascaderValue:function(){return M}});var n=r(375),o=r(485),a=r(694),l=r(625),u=r(59),i=r(155),c=r.n(i),s=r(442),f=r(401),d=r(488);function p(e,t,r,n,o,a,l){try{var u=e[a](l),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,o)}function m(e){return(0,a.randomId)(e)}function b(e,t,r){var n;return(n=function(){var n,o,a,l;return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var c=[u,i];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(u){switch(u.label){case 0:if(!(n=t.key))throw Error("[NocoBase] public form key is required before creating FlowModel tree.");return[4,e.loadModel({uid:n,refresh:!0})];case 1:var i,c,s,d,p,b,y,v,g,h;if(o=u.sent())return[2,o];return i=t,c=r,b=(p=(d=(s=String(i.collection||"").split(":")).pop()||"",{dataSourceKey:s.pop()||"main",collectionName:d})).dataSourceKey,y=p.collectionName,v=i.key,g=m("pft_"),h=m("pft_"),a={uid:v,use:"RouteModel",subModels:{page:{use:f.B4,props:{title:i.title,displayTitle:!1,enableTabs:!1,showFlowSettings:!1},stepParams:{pageSettings:{general:{displayTitle:!1,enableTabs:!1}}},subModels:{tabs:[{uid:g,use:"ChildPageTabModel",stepParams:{pageTabSettings:{tab:{title:c("Configure form")}}},subModels:{grid:{use:"BlockGridModel",subModels:{items:[{use:"CreateFormModel",stepParams:{resourceSettings:{init:{dataSourceKey:b,collectionName:y}}},subModels:{grid:{use:"FormGridModel"},actions:[{use:f.BQ,stepParams:{submitSettings:{saveResource:{requestConfig:{url:"".concat(y,":publicSubmit")}}}}}]}}]}}}},{uid:h,use:"ChildPageTabModel",stepParams:{pageTabSettings:{tab:{title:c("After successful submission")}}},subModels:{grid:{use:"BlockGridModel",subModels:{items:[{use:"MarkdownBlockModel",props:{content:c(f.AU)},stepParams:{markdownBlockSettings:{editMarkdown:{content:c(f.AU)}}}}]}}}}]}}}},[4,e.resolveModelTree(a)];case 2:return u.sent(),[4,e.createModelAsync(a)];case 3:return[4,(l=u.sent()).save()];case 4:return u.sent(),[2,l]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function l(e){p(a,r,o,l,u,"next",e)}function u(e){p(a,r,o,l,u,"throw",e)}l(void 0)})})()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t,r,n,o,a,l){try{var u=e[a](l),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,o)}function g(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){v(a,n,o,l,u,"next",e)}function u(e){v(a,n,o,l,u,"throw",e)}l(void 0)})}}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,u=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(u)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var c=[u,i];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function S(e){return!!e}function E(e){return e?e.replace(/[-_]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,function(e){return e.toUpperCase()}):""}function C(e){if(Array.isArray(e))return e;if(e){var t=w(String(e).includes(":")?String(e).split(":"):["main",e],2);return[t[0],t[1]].filter(Boolean)}}function M(e){if(!Array.isArray(e))return e;var t=w(e,2),r=t[0],n=t[1];return r&&n?"".concat(r,":").concat(n):e.filter(Boolean).join(":")||void 0}function O(){var e=(0,a.useFlowContext)(),t=(0,d.kj)();return(0,i.useMemo)(function(){var r,n;return((null==(n=e.dataSourceManager)||null==(r=n.getDataSources)?void 0:r.call(n))||[]).map(function(e){var r=e.getCollections().filter(function(e){return!!e.filterTargetKey}).map(function(e){return{label:e.title||e.name,value:e.name}});return r.length?{label:e.displayName||t(e.key),value:e.key,children:r}:null}).filter(S)},[e.dataSourceManager,t])}function A(e){var t=e.mode,r=e.record,n=e.onSubmitted,l=(0,d.kj)(),s=(0,a.useFlowContext)(),f=(0,a.useFlowEngine)(),p=O(),m=(0,i.useMemo)(function(){return[{label:l("Form"),value:"form"}]},[l]),y=s.api.resource("publicForms"),v=w(u.Form.useForm(),1)[0],S=w((0,i.useState)(!1),2),E=S[0],A=S[1],P=(0,i.useMemo)(function(){return"edit"===t?h({},r):{type:"form",enabled:!0}},[t,r]);(0,i.useEffect)(function(){v.setFieldsValue(P)},[v,P]);var j=(0,i.useCallback)(function(){return g(function(){var e,o;return k(this,function(u){switch(u.label){case 0:return[4,v.validateFields()];case 1:e=u.sent(),A(!0),u.label=2;case 2:var i,c;if(u.trys.push([2,,9,10]),"create"!==t)return[3,5];return i=h({},e),c=c={type:e.type||"form",key:(0,a.randomId)()},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(c)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))}),o=i,[4,y.create({values:o})];case 3:return u.sent(),[4,b(f,o,l)];case 4:case 6:return u.sent(),[3,8];case 5:if(!(null==r?void 0:r.key))return[3,7];return[4,y.update({filterByTk:r.key,values:e})];case 7:throw Error("[NocoBase] Missing public form key.");case 8:return n(),[3,10];case 9:return A(!1),[7];case 10:return[2]}})})()},[f,v,t,n,null==r?void 0:r.key,y,l]);return c().createElement(o.DrawerFormLayout,{title:"create"===t?l("Add New"):l("Edit"),onSubmit:j,submitting:E,submitText:l("Submit"),cancelText:l("Cancel")},c().createElement(u.Form,{form:v,layout:"vertical",initialValues:P},c().createElement(u.Form.Item,{name:"title",label:l("Title"),rules:[{required:!0}]},c().createElement(u.Input,null)),c().createElement(u.Form.Item,{name:"collection",label:l("Collection"),rules:[{required:!0}],getValueProps:function(e){return{value:C(e)}},normalize:M},c().createElement(u.Cascader,{disabled:"edit"===t,options:p,showSearch:!0})),c().createElement(u.Form.Item,{name:"type",label:l("Type")},c().createElement(u.Radio.Group,{options:m})),c().createElement(u.Form.Item,{name:"description",label:l("Description")},c().createElement(u.Input.TextArea,null)),c().createElement(u.Form.Item,{name:"password",label:l("Password")},c().createElement(o.EnvVariableInput,{password:!0})),c().createElement(u.Form.Item,{name:"enabled",label:l("Enable form"),valuePropName:"checked"},c().createElement(u.Switch,null))))}function P(){var e=(0,d.kj)(),t=(0,a.useFlowContext)(),r=(0,a.useFlowEngine)(),p=(0,s.useNavigate)(),m=(0,s.useOutlet)(),y=u.App.useApp().modal,v=u.theme.useToken().token,h=t.api.resource("publicForms"),S=O(),M=w((0,i.useState)(1),2),P=M[0],j=M[1],T=w((0,i.useState)(o.DEFAULT_PAGE_SIZE),2),F=T[0],x=T[1],I=w((0,i.useState)([]),2),B=I[0],_=I[1],D=(0,l.useRequest)(function(){return g(function(){return k(this,function(e){switch(e.label){case 0:return[4,h.list({page:P,pageSize:F,sort:["-createdAt"],appends:["createdBy","updatedBy"]})];case 1:var t,r,n,o,a;return[2,{records:o=Array.isArray(n=null==(r=null==(t=e.sent())?void 0:t.data)?void 0:r.data)?n:Array.isArray(null==n?void 0:n.data)?n.data:[],total:(a=(null==r?void 0:r.meta)||(null==n?void 0:n.meta)||{}).count||a.total||o.length}]}})})()},{refreshDeps:[P,F]}),N=D.data,R=D.loading,G=D.refresh,K=(0,l.useMemoizedFn)(function(e,t){if(t!==F){x(t),j(1);return}j(e)}),V=(0,i.useCallback)(function(e,r){t.viewer.drawer({width:v.screenMD,closable:!0,content:function(){return c().createElement(A,{mode:e,record:r,onSubmitted:function(){return G()}})}})},[t.viewer,G,v.screenMD]),q=(0,i.useCallback)(function(t){y.confirm({title:e("Delete"),content:e("Are you sure you want to delete it?"),onOk:function(){return g(function(){return k(this,function(e){switch(e.label){case 0:return[4,h.destroy({filterByTk:t})];case 1:return e.sent(),_([]),G(),[2]}})})()}})},[y,G,h,e]),z=(0,i.useCallback)(function(n){return g(function(){var o;return k(this,function(a){switch(a.label){case 0:return[4,b(r,n,e)];case 1:return a.sent(),o=t.app.pluginSettingsManager.getRoutePath("".concat(f.gr,".index")),p("".concat(o,"/").concat(f.n7,"/").concat(n.key)),[2]}})})()},[t.app.pluginSettingsManager,r,p,e]),U=(0,i.useMemo)(function(){return[{title:e("Title"),dataIndex:"title"},{title:e("Collection"),dataIndex:"collection",width:160,render:function(e){return e?c().createElement(u.Tag,null,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=C(e);if(!Array.isArray(r)||r.length<2)return e||"";var n=w(r,2),o=n[0],a=n[1],l=t.find(function(e){return e.value===o}),u=null==l?void 0:l.children.find(function(e){return e.value===a});return[l?String(l.label):E(o),u?String(u.label):E(a)].filter(Boolean).join(" / ")}(e,S)):null}},{title:e("Type"),dataIndex:"type",width:100,render:function(t){return t?c().createElement(u.Tag,null,"form"===t?e("Form"):e(t)):null}},{title:e("Enabled"),dataIndex:"enabled",width:80,render:function(e){return e?c().createElement(n.CheckOutlined,{style:{color:v.colorSuccess}}):null}},{title:e("Description"),dataIndex:"description"},{title:e("Actions"),render:function(t,r){return c().createElement(u.Space,null,c().createElement("a",{onClick:function(){return z(r)}},e("Configure")),c().createElement("a",{onClick:function(){return V("edit",r)}},e("Edit")),c().createElement("a",{onClick:function(){return q(r.key)}},e("Delete")))}}]},[S,z,q,V,e,v.colorSuccess]);return m||c().createElement(u.Card,{variant:"borderless"},c().createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:v.marginXS,marginBottom:v.margin}},c().createElement(u.Button,{icon:c().createElement(n.ReloadOutlined,null),loading:R,onClick:G},e("Refresh")),c().createElement(u.Button,{icon:c().createElement(n.DeleteOutlined,null),disabled:!B.length,onClick:function(){return q(B)}},e("Delete")),c().createElement(u.Button,{type:"primary",icon:c().createElement(n.PlusOutlined,null),onClick:function(){return V("create")}},e("Add New"))),c().createElement(o.Table,{rowKey:"key",loading:R,columns:U,dataSource:(null==N?void 0:N.records)||[],rowSelection:{selectedRowKeys:B,onChange:_},pagination:{current:P,pageSize:F,total:(null==N?void 0:N.total)||0,onChange:K}}))}},488:function(e,t,r){r.d(t,{MZ:function(){return l},kj:function(){return u}});var n=r(694),o=r(953),a=r(401).gr;function l(e){return(0,n.tExpr)(e,{ns:a})}function u(){return(0,o.useTranslation)([a,"client"],{nsMode:"fallback"}).t}}}]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PUBLIC_FORMS_NAMESPACE = "public-forms";
|
|
10
|
+
export declare const PUBLIC_FORMS_SETTINGS_ROUTE_NAME = "admin.settings.public-forms.index.layout";
|
|
11
|
+
export declare const PUBLIC_FORMS_SETTINGS_CONFIGURE_ROUTE_PATH = "configure";
|
|
12
|
+
export declare const PUBLIC_FORMS_SETTINGS_LAYOUT_UID = "public-forms-settings-layout-model";
|
|
13
|
+
export declare const PUBLIC_FORMS_SETTINGS_LAYOUT_MODEL = "PublicFormsSettingsLayoutModel";
|
|
14
|
+
export declare const PUBLIC_FORM_ROUTE_NAME = "public-forms";
|
|
15
|
+
export declare const PUBLIC_FORM_LAYOUT_UID = "public-form-layout-model";
|
|
16
|
+
export declare const PUBLIC_FORM_LAYOUT_MODEL = "PublicFormLayoutModel";
|
|
17
|
+
export declare const PUBLIC_FORM_PAGE_MODEL = "PublicFormPageModel";
|
|
18
|
+
export declare const PUBLIC_FORM_SUBMIT_ACTION_MODEL = "PublicFormSubmitActionModel";
|
|
19
|
+
export declare const PUBLIC_FORM_TOKEN_KEY = "NOCOBASE_FORM_TOKEN";
|
|
20
|
+
export declare const DEFAULT_SUCCESS_MESSAGE = "# Submitted successfully!\nThis is a demo text, **supports Markdown syntax**.";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { PluginPublicFormsClientV2 } from './plugin';
|
|
10
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("react-router-dom"),require("@formily/reactive"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-public-forms/client-v2",["ahooks","react-i18next","@emotion/css","@nocobase/client-v2","react-router-dom","@formily/reactive","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-public-forms/client-v2"]=t(require("ahooks"),require("react-i18next"),require("@emotion/css"),require("@nocobase/client-v2"),require("react-router-dom"),require("@formily/reactive"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-public-forms/client-v2"]=t(e.ahooks,e["react-i18next"],e["@emotion/css"],e["@nocobase/client-v2"],e["react-router-dom"],e["@formily/reactive"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,u,c,a,l){return function(){"use strict";var s,f,p,b={401:function(e,t,n){n.d(t,{$x:function(){return a},AU:function(){return d},B4:function(){return f},BQ:function(){return p},MM:function(){return u},ND:function(){return l},ei:function(){return o},gr:function(){return r},l_:function(){return b},n7:function(){return i},oh:function(){return s},rl:function(){return c}});var r="public-forms",o="admin.settings.public-forms.index.layout",i="configure",u="public-forms-settings-layout-model",c="PublicFormsSettingsLayoutModel",a="public-forms",l="public-form-layout-model",s="PublicFormLayoutModel",f="PublicFormPageModel",p="PublicFormSubmitActionModel",b="NOCOBASE_FORM_TOKEN",d="# Submitted successfully!\nThis is a demo text, **supports Markdown syntax**."},375:function(e){e.exports=a},477:function(e){e.exports=n},992:function(e){e.exports=i},485:function(e){e.exports=r},694:function(e){e.exports=l},625:function(t){t.exports=e},59:function(e){e.exports=c},155:function(e){e.exports=u},953:function(e){e.exports=t},442:function(e){e.exports=o}},d={};function m(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return b[e](n,n.exports,m),n.exports}m.m=b,m.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return m.d(t,{a:t}),t},m.d=function(e,t){for(var n in t)m.o(t,n)&&!m.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},m.f={},m.e=function(e){return Promise.all(Object.keys(m.f).reduce(function(t,n){return m.f[n](e,t),t},[]))},m.u=function(e){return""+e+"."+({594:"3ec7d41fb076d365",599:"be4aea35e18fe34f",610:"5a762348c1d0e93d",64:"14dd13ceb37723c5",965:"9ebc606a71f466a5"})[e]+".js"},m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},m.l=function(e,t,n,r){if(h[e])return void h[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-public-forms/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,m.nc&&o.setAttribute("nonce",m.nc),o.setAttribute("data-rspack","@nocobase/plugin-public-forms/client-v2:"+n),o.src=e),h[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=h[e];if(delete h[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},m.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},m.g.importScripts&&(y=m.g.location+"");var h,y,v=m.g.document;if(!y&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(y=v.currentScript.src),!y)){var g=v.getElementsByTagName("script");if(g.length)for(var w=g.length-1;w>-1&&(!y||!/^http(s?):/.test(y));)y=g[w--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");m.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},m.f.j=function(e,t){var n=m.o(s,e)?s[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var o=m.p+m.u(e),i=Error();m.l(o,function(t){if(m.o(s,e)&&(0!==(n=s[e])&&(s[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},f=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)m.o(i,n)&&(m.m[n]=i[n]);u&&u(m)}for(e&&e(t);c<o.length;c++)r=o[c],m.o(s,r)&&s[r]&&s[r][0](),s[r]=0},(p=self.webpackChunk_nocobase_plugin_public_forms_client_v2=self.webpackChunk_nocobase_plugin_public_forms_client_v2||[]).forEach(f.bind(null,0)),p.push=f.bind(null,p.push.bind(p));var _={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-public-forms/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(o);e=u>=0?i.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-public-forms/dist/client-v2/"}m.p=e}(),!function(){m.r(_),m.d(_,{default:function(){return s},PluginPublicFormsClientV2:function(){return l}});var e=m(485),t=m(401);function n(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function r(e,t,n){return(r=a()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&u(o,n.prototype),o}).apply(null,arguments)}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)})(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var l=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=i(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,a()?Reflect.construct(e,t||[],i(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&u(c,e),r=[{key:"load",value:function(){var e;return(e=function(){var e,n;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){return e=this.app.i18n.t("Public forms",{ns:t.gr}),this.flowEngine.registerModelLoaders((o(n={},t.rl,{loader:function(){return m.e("594").then(m.bind(m,913))}}),o(n,t.oh,{loader:function(){return m.e("610").then(m.bind(m,57))}}),o(n,t.B4,{loader:function(){return m.e("599").then(m.bind(m,826))}}),o(n,t.BQ,{loader:function(){return m.e("64").then(m.bind(m,43))}}),n)),this.pluginSettingsManager.addMenuItem({key:t.gr,title:e,icon:"TableOutlined",aclSnippet:"pm.public-forms"}),this.pluginSettingsManager.addPageTabItem({menuKey:t.gr,key:"index",title:e,componentLoader:function(){return m.e("965").then(m.bind(m,260))}}),this.app.layoutManager.registerLayout({routeName:t.ei,routePath:t.n7,uid:t.MM,layoutModelClass:t.rl}),this.app.layoutManager.registerLayout({routeName:t.$x,routePath:"/public-forms",uid:t.ND,layoutModelClass:t.oh,rootPageModelClass:t.B4,authCheck:!1}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var u=e.apply(t,r);function c(e){n(u,o,i,c,a,"next",e)}function a(e){n(u,o,i,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,r),c}(c(e.Plugin)),s=l}(),_}()});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const NAMESPACE = "public-forms";
|
|
10
|
+
export declare function tExpr(key: string): string;
|
|
11
|
+
export declare function useT(): import("react-i18next").TFunction<("public-forms" | "client")[], undefined>;
|
|
12
|
+
export declare function usePublicFormTranslation(): import("react-i18next").UseTranslationResponse<("public-forms" | "client")[], undefined>;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { FlowEngine } from '@nocobase/flow-engine';
|
|
10
|
+
export interface PublicFormRecord {
|
|
11
|
+
key: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
collection?: string;
|
|
14
|
+
type?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
password?: string;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export declare function parseCollectionValue(value?: string): {
|
|
21
|
+
dataSourceKey: string;
|
|
22
|
+
collectionName: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function createPublicFormFlowModelTree(record: PublicFormRecord, t: (key: string) => string): {
|
|
25
|
+
uid: string;
|
|
26
|
+
use: string;
|
|
27
|
+
subModels: {
|
|
28
|
+
page: {
|
|
29
|
+
use: string;
|
|
30
|
+
props: {
|
|
31
|
+
title: string;
|
|
32
|
+
displayTitle: boolean;
|
|
33
|
+
enableTabs: boolean;
|
|
34
|
+
showFlowSettings: boolean;
|
|
35
|
+
};
|
|
36
|
+
stepParams: {
|
|
37
|
+
pageSettings: {
|
|
38
|
+
general: {
|
|
39
|
+
displayTitle: boolean;
|
|
40
|
+
enableTabs: boolean;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
subModels: {
|
|
45
|
+
tabs: ({
|
|
46
|
+
uid: string;
|
|
47
|
+
use: string;
|
|
48
|
+
stepParams: {
|
|
49
|
+
pageTabSettings: {
|
|
50
|
+
tab: {
|
|
51
|
+
title: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
subModels: {
|
|
56
|
+
grid: {
|
|
57
|
+
use: string;
|
|
58
|
+
subModels: {
|
|
59
|
+
items: {
|
|
60
|
+
use: string;
|
|
61
|
+
stepParams: {
|
|
62
|
+
resourceSettings: {
|
|
63
|
+
init: {
|
|
64
|
+
dataSourceKey: string;
|
|
65
|
+
collectionName: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
subModels: {
|
|
70
|
+
grid: {
|
|
71
|
+
use: string;
|
|
72
|
+
};
|
|
73
|
+
actions: {
|
|
74
|
+
use: string;
|
|
75
|
+
stepParams: {
|
|
76
|
+
submitSettings: {
|
|
77
|
+
saveResource: {
|
|
78
|
+
requestConfig: {
|
|
79
|
+
url: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}[];
|
|
85
|
+
};
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
uid: string;
|
|
92
|
+
use: string;
|
|
93
|
+
stepParams: {
|
|
94
|
+
pageTabSettings: {
|
|
95
|
+
tab: {
|
|
96
|
+
title: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
subModels: {
|
|
101
|
+
grid: {
|
|
102
|
+
use: string;
|
|
103
|
+
subModels: {
|
|
104
|
+
items: {
|
|
105
|
+
use: string;
|
|
106
|
+
props: {
|
|
107
|
+
content: string;
|
|
108
|
+
};
|
|
109
|
+
stepParams: {
|
|
110
|
+
markdownBlockSettings: {
|
|
111
|
+
editMarkdown: {
|
|
112
|
+
content: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
}[];
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
})[];
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
export declare function ensurePublicFormFlowModel(flowEngine: FlowEngine, record: PublicFormRecord, t: (key: string) => string): Promise<import("@nocobase/flow-engine").FlowModel<import("@nocobase/flow-engine").DefaultStructure>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { BaseLayoutModel } from '@nocobase/client-v2';
|
|
10
|
+
import type { CollectionOptions, DataSourceOptions } from '@nocobase/flow-engine';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
type PublicFormDataSourceOptions = DataSourceOptions & {
|
|
13
|
+
collections?: CollectionOptions[];
|
|
14
|
+
};
|
|
15
|
+
export declare class PublicFormLayoutModel extends BaseLayoutModel {
|
|
16
|
+
publicFormSubmitted: boolean;
|
|
17
|
+
private publicFormKey;
|
|
18
|
+
private originalModelRepository?;
|
|
19
|
+
private publicFormModelRepository?;
|
|
20
|
+
private publicDataSourceManager?;
|
|
21
|
+
constructor(options: any);
|
|
22
|
+
setPublicFormSubmitted(submitted: boolean): void;
|
|
23
|
+
setPublicFormKey(formKey?: string): void;
|
|
24
|
+
private getPublicDataSourceManager;
|
|
25
|
+
applyPublicDataSource(dataSource?: PublicFormDataSourceOptions | null): void;
|
|
26
|
+
private setupPublicFormModelRepository;
|
|
27
|
+
private restoreModelRepository;
|
|
28
|
+
protected onMount(): void;
|
|
29
|
+
protected onUnmount(): void;
|
|
30
|
+
render(): React.JSX.Element;
|
|
31
|
+
}
|
|
32
|
+
export default PublicFormLayoutModel;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { ChildPageModel } from '@nocobase/client-v2';
|
|
10
|
+
export declare class PublicFormPageModel extends ChildPageModel {
|
|
11
|
+
publicFormSubmitted: boolean;
|
|
12
|
+
constructor(options: any);
|
|
13
|
+
private getPublicFormDataSourceManager;
|
|
14
|
+
onInit(options: any): void;
|
|
15
|
+
setPublicFormSubmitted(submitted: boolean): void;
|
|
16
|
+
renderStep(index: number): any;
|
|
17
|
+
render(): any;
|
|
18
|
+
}
|
|
19
|
+
export default PublicFormPageModel;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { FormSubmitActionModel } from '@nocobase/client-v2';
|
|
10
|
+
export declare class PublicFormSubmitActionModel extends FormSubmitActionModel {
|
|
11
|
+
getInputArgs(): {
|
|
12
|
+
sourceId?: undefined;
|
|
13
|
+
defaultInputKeys?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
sourceId: any;
|
|
16
|
+
defaultInputKeys: string[];
|
|
17
|
+
};
|
|
18
|
+
onClick(event: any): void;
|
|
19
|
+
}
|
|
20
|
+
export default PublicFormSubmitActionModel;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { BaseLayoutModel } from '@nocobase/client-v2';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export declare class PublicFormsSettingsLayoutModel extends BaseLayoutModel {
|
|
12
|
+
render(): React.JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export default PublicFormsSettingsLayoutModel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export declare function toCollectionCascaderValue(value?: string | string[]): string[];
|
|
11
|
+
export declare function fromCollectionCascaderValue(value?: string | string[]): string;
|
|
12
|
+
export default function PublicFormsSettingsPage(): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Application } from '@nocobase/client-v2';
|
|
10
|
+
import { Plugin } from '@nocobase/client-v2';
|
|
11
|
+
export declare class PluginPublicFormsClientV2 extends Plugin<Record<string, never>, Application> {
|
|
12
|
+
load(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export default PluginPublicFormsClientV2;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { FlowModel, IFlowModelRepository } from '@nocobase/flow-engine';
|
|
10
|
+
type PublicFormFlowModelRepositoryOptions = {
|
|
11
|
+
app: {
|
|
12
|
+
apiClient: {
|
|
13
|
+
request: (options: any) => Promise<any>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
formKey?: string;
|
|
17
|
+
delegate?: IFlowModelRepository<FlowModel> | null;
|
|
18
|
+
};
|
|
19
|
+
export declare class PublicFormFlowModelRepository implements IFlowModelRepository<FlowModel> {
|
|
20
|
+
private options;
|
|
21
|
+
readonly __publicFormFlowModelRepository = true;
|
|
22
|
+
private formKey;
|
|
23
|
+
constructor(options: PublicFormFlowModelRepositoryOptions);
|
|
24
|
+
setFormKey(formKey?: string): void;
|
|
25
|
+
findOne(query: Record<string, any>): Promise<any>;
|
|
26
|
+
save(model: FlowModel, options?: {
|
|
27
|
+
onlyStepParams?: boolean;
|
|
28
|
+
}): Promise<{}>;
|
|
29
|
+
destroy(uid: string): Promise<boolean>;
|
|
30
|
+
move(sourceId: string, targetId: string, position: 'before' | 'after'): Promise<void>;
|
|
31
|
+
duplicate(uid: string): Promise<Record<string, any>>;
|
|
32
|
+
}
|
|
33
|
+
export declare function isPublicFormFlowModelRepository(repository: unknown): repository is PublicFormFlowModelRepository;
|
|
34
|
+
export {};
|