firstly 0.0.3 → 0.0.5
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/CHANGELOG.md +21 -0
- package/esm/{KitBaseEnum.d.ts → BaseEnum.d.ts} +18 -9
- package/esm/{KitBaseEnum.js → BaseEnum.js} +2 -13
- package/esm/{KitEntity.d.ts → FF_Entity.d.ts} +1 -1
- package/esm/{KitEntity.js → FF_Entity.js} +9 -9
- package/esm/{KitFields.d.ts → FF_Fields.d.ts} +4 -5
- package/esm/{KitFields.js → FF_Fields.js} +41 -55
- package/esm/ROUTES.d.ts +4 -2
- package/esm/ROUTES.js +4 -7
- package/esm/SqlDatabase/FF_LogToConsole.d.ts +1 -0
- package/esm/SqlDatabase/{LogToConsoleCustom.js → FF_LogToConsole.js} +1 -1
- package/esm/api/index.d.ts +1 -0
- package/esm/auth/Adapter.js +10 -8
- package/esm/auth/{AuthController.d.ts → AuthController.server.d.ts} +2 -2
- package/esm/auth/{AuthController.js → AuthController.server.js} +15 -51
- package/esm/auth/Entities.d.ts +18 -17
- package/esm/auth/Entities.js +66 -63
- package/esm/auth/README.md +13 -0
- package/esm/auth/{RoleController.d.ts → RoleHelpers.d.ts} +2 -4
- package/esm/auth/RoleHelpers.js +43 -0
- package/esm/auth/client/Auth.d.ts +69 -0
- package/esm/auth/client/Auth.js +121 -0
- package/esm/auth/client/index.d.ts +2 -0
- package/esm/auth/client/index.js +2 -0
- package/esm/auth/index.d.ts +10 -11
- package/esm/auth/index.js +37 -21
- package/esm/auth/providers/github.d.ts +22 -17
- package/esm/auth/providers/github.js +29 -15
- package/esm/auth/providers/strava.d.ts +22 -17
- package/esm/auth/providers/strava.js +23 -15
- package/esm/auth/static/assets/{Page-BwHye0GW.d.ts → Page-BYzkK4q3.d.ts} +1 -1
- package/esm/auth/static/assets/{Page-BwHye0GW.js → Page-BYzkK4q3.js} +1 -1
- package/esm/auth/static/assets/Page-ByIhtXVt.d.ts +5 -0
- package/esm/auth/static/assets/Page-ByIhtXVt.js +8190 -0
- package/esm/auth/static/assets/{Page-BMOLAIFx.d.ts → Page-Do7F0Mzd.d.ts} +1 -1
- package/esm/auth/static/assets/{Page-BMOLAIFx.js → Page-Do7F0Mzd.js} +1 -1
- package/esm/auth/static/assets/index-czJ1PA1n.js +2 -0
- package/esm/auth/static/index.html +1 -1
- package/esm/bin/cmd.js +182 -83
- package/esm/cellsBuildor.d.ts +45 -0
- package/esm/{kitCellsBuildor.js → cellsBuildor.js} +24 -14
- package/esm/feedback/ui/DialogIssue.svelte +2 -2
- package/esm/formats/dates.js +2 -2
- package/esm/formats/strings.js +0 -11
- package/esm/handle/index.d.ts +1 -0
- package/esm/helper.d.ts +8 -10
- package/esm/helper.js +13 -12
- package/esm/index.d.ts +37 -48
- package/esm/index.js +29 -20
- package/esm/{kitStoreItem.d.ts → storeItem.d.ts} +1 -1
- package/esm/{kitStoreItem.js → storeItem.js} +3 -3
- package/esm/{kitStoreList.d.ts → storeList.d.ts} +4 -4
- package/esm/{kitStoreList.js → storeList.js} +1 -1
- package/esm/ui/Button.svelte +7 -9
- package/esm/ui/Button.svelte.d.ts +2 -2
- package/esm/ui/Field.svelte +9 -8
- package/esm/ui/Field.svelte.d.ts +2 -2
- package/esm/ui/FieldGroup.svelte +5 -3
- package/esm/ui/FieldGroup.svelte.d.ts +4 -4
- package/esm/ui/Grid.svelte.d.ts +5 -5
- package/esm/ui/GridPaginate.svelte +3 -6
- package/esm/ui/Icon.svelte +6 -7
- package/esm/ui/LibIcon.js +0 -2
- package/esm/ui/dialog/DialogForm.svelte +5 -6
- package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +2 -2
- package/esm/ui/dialog/FormEditAction.svelte.d.ts +2 -2
- package/esm/ui/dialog/dialog.d.ts +7 -5
- package/esm/ui/dialog/dialog.js +1 -0
- package/esm/ui/index.d.ts +2 -2
- package/esm/ui/internals/FieldContainer.svelte +1 -1
- package/esm/ui/internals/Input.svelte +1 -1
- package/esm/ui/internals/select/MultiSelectMelt.svelte +16 -19
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +3 -3
- package/esm/ui/internals/select/SelectMelt.svelte +10 -14
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +3 -3
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +2 -2
- package/esm/ui/link/LinkPlus.svelte.d.ts +2 -2
- package/esm/utils/types.d.ts +0 -15
- package/esm/utils/types.js +1 -17
- package/esm/virtual/Customer.js +2 -2
- package/esm/virtual/FilterEntity.js +1 -1
- package/esm/virtual/StateDemoEnum.d.ts +4 -4
- package/esm/virtual/StateDemoEnum.js +2 -2
- package/esm/virtual/UIEntity.js +4 -4
- package/esm/vite/index.js +1 -1
- package/package.json +10 -5
- package/esm/SqlDatabase/LogToConsoleCustom.d.ts +0 -1
- package/esm/auth/RoleController.js +0 -57
- package/esm/auth/static/assets/Page-BMFREPjF.d.ts +0 -5
- package/esm/auth/static/assets/Page-BMFREPjF.js +0 -18
- package/esm/auth/static/assets/index-CKmKKRRL.js +0 -2
- package/esm/kitCellsBuildor.d.ts +0 -45
- /package/esm/auth/static/assets/{index-CKmKKRRL.d.ts → index-czJ1PA1n.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as o,b as r,a as l,H as i,d as c,n as a,k as f}from"./index-
|
|
1
|
+
import{S as o,b as r,a as l,H as i,d as c,n as a,k as f}from"./index-czJ1PA1n.js";function u(s){let t;return{c(){t=i("Hello from files")},m(e,n){c(e,t,n)},p:a,i:a,o:a,d(e){e&&f(t)}}}class p extends o{constructor(t){super(),r(this,t,null,u,l,{})}}export{p as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Page-ByIhtXVt.js","assets/Page-gV58jf2r.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var nt=Object.defineProperty;var rt=(t,e,n)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>rt(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const ot="modulepreload",st=function(t){return"/api/static/"+t},q={},P=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.all(n.map(i=>{if(i=st(i),i in q)return;q[i]=!0;const u=i.endsWith(".css"),l=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${l}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":ot,u||(f.as="script",f.crossOrigin=""),f.href=i,c&&f.setAttribute("nonce",c),document.head.appendChild(f),u)return new Promise((a,_)=>{f.addEventListener("load",a),f.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${i}`)))})}))}return s.then(()=>e()).catch(o=>{const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o})};function d(){}function ct(t,e){for(const n in e)t[n]=e[n];return t}function ut(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function J(t){return t()}function B(){return Object.create(null)}function x(t){t.forEach(J)}function N(t){return typeof t=="function"}function lt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Nt(t,e){return t!=t?e==e:t!==e}function it(t){return Object.keys(t).length===0}function Q(t,...e){if(t==null){for(const r of e)r(void 0);return d}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function It(t){let e;return Q(t,n=>e=n)(),e}function Rt(t,e,n){t.$$.on_destroy.push(Q(e,n))}function Tt(t,e,n,r){if(t){const s=W(t,e,n,r);return t[0](s)}}function W(t,e,n,r){return t[1]&&r?ct(n.ctx.slice(),t[1](r(e))):n.ctx}function zt(t,e,n,r){if(t[2]&&r){const s=t[2](r(n));if(e.dirty===void 0)return s;if(typeof s=="object"){const o=[],c=Math.max(e.dirty.length,s.length);for(let i=0;i<c;i+=1)o[i]=e.dirty[i]|s[i];return o}return e.dirty|s}return e.dirty}function qt(t,e,n,r,s,o){if(s){const c=W(e,n,r,o);t.p(c,s)}}function Bt(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let r=0;r<n;r++)e[r]=-1;return e}return-1}function Ut(t){const e={};for(const n in t)n[0]!=="$"&&(e[n]=t[n]);return e}function Vt(t,e){const n={};e=new Set(e);for(const r in t)!e.has(r)&&r[0]!=="$"&&(n[r]=t[r]);return n}function Mt(t,e,n){return t.set(n),e}function Ft(t){return t&&N(t.destroy)?t.destroy:d}function Kt(t,e){t.appendChild(e)}function k(t,e,n){t.insertBefore(e,n||null)}function y(t){t.parentNode&&t.parentNode.removeChild(t)}function ft(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function C(t){return document.createElement(t)}function X(t){return document.createTextNode(t)}function at(){return X(" ")}function dt(){return X("")}function ht(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function Gt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function I(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const _t=["width","height"];function Ht(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const r in e)e[r]==null?t.removeAttribute(r):r==="style"?t.style.cssText=e[r]:r==="__value"?t.value=t[r]=e[r]:n[r]&&n[r].set&&_t.indexOf(r)===-1?t[r]=e[r]:I(t,r,e[r])}function pt(t){return Array.from(t.childNodes)}function Jt(t,e){e=""+e,t.data!==e&&(t.data=e)}function Qt(t,e){t.value=e??""}function Wt(t,e,n){t.classList.toggle(e,!!n)}let w;function h(t){w=t}function v(){if(!w)throw new Error("Function called outside component initialization");return w}function mt(t){v().$$.on_mount.push(t)}function Xt(t){v().$$.on_destroy.push(t)}function Yt(t,e){return v().$$.context.set(t,e),e}function Zt(t){return v().$$.context.get(t)}function te(t){return v().$$.context.has(t)}function ee(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const b=[],U=[];let $=[];const D=[],gt=Promise.resolve();let S=!1;function bt(){S||(S=!0,gt.then(R))}function j(t){$.push(t)}function ne(t){D.push(t)}const A=new Set;let g=0;function R(){if(g!==0)return;const t=w;do{try{for(;g<b.length;){const e=b[g];g++,h(e),yt(e.$$)}}catch(e){throw b.length=0,g=0,e}for(h(null),b.length=0,g=0;U.length;)U.pop()();for(let e=0;e<$.length;e+=1){const n=$[e];A.has(n)||(A.add(n),n())}$.length=0}while(b.length);for(;D.length;)D.pop()();S=!1,A.clear(),h(t)}function yt(t){if(t.fragment!==null){t.update(),x(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(j)}}function $t(t){const e=[],n=[];$.forEach(r=>t.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),$=e}const O=new Set;let p;function Y(){p={r:0,c:[],p}}function Z(){p.r||x(p.c),p=p.p}function m(t,e){t&&t.i&&(O.delete(t),t.i(e))}function E(t,e,n,r){if(t&&t.o){if(O.has(t))return;O.add(t),p.c.push(()=>{O.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function V(t,e){const n=e.token={};function r(s,o,c,i){if(e.token!==n)return;e.resolved=i;let u=e.ctx;c!==void 0&&(u=u.slice(),u[c]=i);const l=s&&(e.current=s)(u);let f=!1;e.block&&(e.blocks?e.blocks.forEach((a,_)=>{_!==o&&a&&(Y(),E(a,1,1,()=>{e.blocks[_]===a&&(e.blocks[_]=null)}),Z())}):e.block.d(1),l.c(),m(l,1),l.m(e.mount(),e.anchor),f=!0),e.block=l,e.blocks&&(e.blocks[o]=l),f&&R()}if(ut(t)){const s=v();if(t.then(o=>{h(s),r(e.then,1,e.value,o),h(null)},o=>{if(h(s),r(e.catch,2,e.error,o),h(null),!e.hasCatch)throw o}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function vt(t,e,n){const r=e.slice(),{resolved:s}=t;t.current===t.then&&(r[t.value]=s),t.current===t.catch&&(r[t.error]=s),t.block.p(r,n)}function M(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function re(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function kt(t){t&&t.c()}function tt(t,e,n){const{fragment:r,after_update:s}=t.$$;r&&r.m(e,n),j(()=>{const o=t.$$.on_mount.map(J).filter(N);t.$$.on_destroy?t.$$.on_destroy.push(...o):x(o),t.$$.on_mount=[]}),s.forEach(j)}function et(t,e){const n=t.$$;n.fragment!==null&&($t(n.after_update),x(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function wt(t,e){t.$$.dirty[0]===-1&&(b.push(t),bt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Et(t,e,n,r,s,o,c=null,i=[-1]){const u=w;h(t);const l=t.$$={fragment:null,ctx:[],props:o,update:d,not_equal:s,bound:B(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(u?u.$$.context:[])),callbacks:B(),dirty:i,skip_bound:!1,root:e.target||u.$$.root};c&&c(l.root);let f=!1;if(l.ctx=n?n(t,e.props||{},(a,_,...T)=>{const z=T.length?T[0]:_;return l.ctx&&s(l.ctx[a],l.ctx[a]=z)&&(!l.skip_bound&&l.bound[a]&&l.bound[a](z),f&&wt(t,a)),_}):[],l.update(),f=!0,x(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){const a=pt(e.target);l.fragment&&l.fragment.l(a),a.forEach(y)}else l.fragment&&l.fragment.c();e.intro&&m(t.$$.fragment),tt(t,e.target,e.anchor),R()}h(u)}class xt{constructor(){L(this,"$$");L(this,"$$set")}$destroy(){et(this,1),this.$destroy=d}$on(e,n){if(!N(n))return d;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}$set(e){this.$$set&&!it(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ot="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ot);function F(t,e,n){const r=t.slice();return r[6]=e[n],r}function K(t){t[9]=t[10].default}function G(t){let e,n,r,s={ctx:t,current:null,token:null,hasCatch:!1,pending:At,then:Pt,catch:Lt,value:10,blocks:[,,,]};return V(n=t[1],s),{c(){e=dt(),s.block.c()},m(o,c){k(o,e,c),s.block.m(o,s.anchor=c),s.mount=()=>e.parentNode,s.anchor=e,r=!0},p(o,c){t=o,s.ctx=t,c&2&&n!==(n=t[1])&&V(n,s)||vt(s,t,c)},i(o){r||(m(s.block),r=!0)},o(o){for(let c=0;c<3;c+=1){const i=s.blocks[c];E(i)}r=!1},d(o){o&&y(e),s.block.d(o),s.token=null,s=null}}}function Lt(t){return{c:d,m:d,p:d,i:d,o:d,d}}function Pt(t){K(t);let e,n;return e=new t[9]({props:{firstlyData:t[0]}}),{c(){kt(e.$$.fragment)},m(r,s){tt(e,r,s),n=!0},p(r,s){K(r);const o={};s&1&&(o.firstlyData=r[0]),e.$set(o)},i(r){n||(m(e.$$.fragment,r),n=!0)},o(r){E(e.$$.fragment,r),n=!1},d(r){et(e,r)}}}function At(t){return{c:d,m:d,p:d,i:d,o:d,d}}function H(t){let e,n,r;function s(){return t[4](t[6])}return{c(){e=C("button"),e.textContent=`Load ${t[6]}`,I(e,"class","svelte-4ze7zl")},m(o,c){k(o,e,c),n||(r=ht(e,"click",s),n=!0)},p(o,c){t=o},d(o){o&&y(e),n=!1,r()}}}function Ct(t){let e,n,r,s,o=t[1]&&G(t),c=M(t[3]()),i=[];for(let u=0;u<c.length;u+=1)i[u]=H(F(t,c,u));return{c(){e=C("main"),o&&o.c(),n=at(),r=C("div");for(let u=0;u<i.length;u+=1)i[u].c();I(r,"class","debug svelte-4ze7zl")},m(u,l){k(u,e,l),o&&o.m(e,null),k(u,n,l),k(u,r,l);for(let f=0;f<i.length;f+=1)i[f]&&i[f].m(r,null);s=!0},p(u,[l]){if(u[1]?o?(o.p(u,l),l&2&&m(o,1)):(o=G(u),o.c(),m(o,1),o.m(e,null)):o&&(Y(),E(o,1,1,()=>{o=null}),Z()),l&12){c=M(u[3]());let f;for(f=0;f<c.length;f+=1){const a=F(u,c,f);i[f]?i[f].p(a,l):(i[f]=H(a),i[f].c(),i[f].m(r,null))}for(;f<i.length;f+=1)i[f].d(1);i.length=c.length}},i(u){s||(m(o),s=!0)},o(u){E(o),s=!1},d(u){u&&(y(e),y(n),y(r)),o&&o.d(),ft(i,u)}}}function Dt(t,e,n){let{firstlyData:r}=e;const s={auth:P(()=>import("./Page-ByIhtXVt.js"),__vite__mapDeps([0,1])),admin:P(()=>import("./Page-BYzkK4q3.js"),[]),storage:P(()=>import("./Page-Do7F0Mzd.js"),[])};let o;function c(l){n(1,o=s[l])}const i=()=>Object.keys(s);mt(()=>{c(r.module)});const u=l=>c(l);return t.$$set=l=>{"firstlyData"in l&&n(0,r=l.firstlyData)},[r,o,c,i,u]}class St extends xt{constructor(e){super(),Et(this,e,Dt,Ct,lt,{firstlyData:0})}}new St({target:document.getElementById("app"),props:{firstlyData}});export{C as A,Ht as B,Ft as C,ht as D,Vt as E,Ut as F,ee as G,X as H,at as I,I as J,Wt as K,Kt as L,Qt as M,Gt as N,Jt as O,kt as P,tt as Q,et as R,xt as S,U as T,re as U,ne as V,lt as a,Et as b,Nt as c,k as d,dt as e,Y as f,It as g,E as h,N as i,Z as j,y as k,Rt as l,te as m,d as n,Zt as o,Xt as p,Yt as q,x as r,Q as s,m as t,Mt as u,Tt as v,qt as w,Bt as x,zt as y,ct as z};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" href="/api/static/favicon.svg" />
|
|
7
7
|
<title>firstly</title>
|
|
8
|
-
<script type="module" crossorigin src="/api/static/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/api/static/assets/index-czJ1PA1n.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/api/static/assets/index-R27C_TlP.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/esm/bin/cmd.js
CHANGED
|
@@ -18,7 +18,7 @@ const options = [
|
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
value: 'module-demo',
|
|
21
|
-
label: 'module
|
|
21
|
+
label: 'module task',
|
|
22
22
|
hint: 'A default module with a task entity and a controller (you can rename the folder and make it yours)',
|
|
23
23
|
},
|
|
24
24
|
{
|
|
@@ -32,10 +32,11 @@ const res = (await p.multiselect({
|
|
|
32
32
|
options,
|
|
33
33
|
}));
|
|
34
34
|
const devDependenciesPrepare = {
|
|
35
|
-
'@kitql/eslint-config': '0.3.
|
|
35
|
+
'@kitql/eslint-config': '0.3.6',
|
|
36
36
|
'@kitql/helpers': '0.8.9',
|
|
37
|
+
pg: '8.12.0',
|
|
38
|
+
oslo: '^1.2.0',
|
|
37
39
|
remult: versionFirstly,
|
|
38
|
-
pg: '8.11.3',
|
|
39
40
|
...pkg.devDependencies,
|
|
40
41
|
};
|
|
41
42
|
// sort by name
|
|
@@ -58,11 +59,11 @@ if (res.includes('all') || res.includes('dependencies')) {
|
|
|
58
59
|
const obj = {
|
|
59
60
|
'./.eslintrc.cjs': [
|
|
60
61
|
`module.exports = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
62
|
+
extends: ['@kitql'],
|
|
63
|
+
rules: {
|
|
64
|
+
// Your overrides here
|
|
65
65
|
}
|
|
66
|
+
}
|
|
66
67
|
`,
|
|
67
68
|
],
|
|
68
69
|
'./.prettierignore': [
|
|
@@ -89,59 +90,74 @@ src/lib/ROUTES.ts
|
|
|
89
90
|
],
|
|
90
91
|
'./.prettierrc.cjs': [
|
|
91
92
|
`const {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
//plugins,
|
|
94
|
+
...prettierConfig
|
|
95
|
+
} = require('@kitql/eslint-config/.prettierrc.cjs')
|
|
96
|
+
|
|
97
|
+
module.exports = {
|
|
98
|
+
...prettierConfig,
|
|
99
|
+
// Your overrides here
|
|
100
|
+
}`,
|
|
100
101
|
],
|
|
101
102
|
'.env.example': [
|
|
102
103
|
`# Enable some roles
|
|
103
|
-
#
|
|
104
|
-
#
|
|
104
|
+
# FF_ADMIN = 'JYC'
|
|
105
|
+
# FF_AUTH_ADMIN = ''
|
|
105
106
|
|
|
106
107
|
# Enable GitHub login
|
|
107
|
-
GITHUB_CLIENT_ID = ''
|
|
108
|
-
GITHUB_CLIENT_SECRET = ''
|
|
108
|
+
# GITHUB_CLIENT_ID = ''
|
|
109
|
+
# GITHUB_CLIENT_SECRET = ''
|
|
109
110
|
`,
|
|
110
111
|
],
|
|
111
112
|
'./src/lib/firstly/index.ts': [
|
|
112
|
-
`import {
|
|
113
|
+
`import { FF_Role } from 'firstly'
|
|
114
|
+
import { firstly } from 'firstly/api'
|
|
113
115
|
import { auth } from 'firstly/auth'
|
|
114
|
-
// import { github } from 'firstly/auth/providers'
|
|
115
|
-
// import { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } from '$env/static/private'
|
|
116
116
|
import { Log } from '@kitql/helpers'
|
|
117
117
|
|
|
118
|
-
import {
|
|
118
|
+
import { task } from './modules/task'
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
//----------------------------------------
|
|
121
|
+
// To switch to postgres (1/2)
|
|
122
|
+
//----------------------------------------
|
|
121
123
|
// import { createPostgresConnection } from 'remult/postgres'
|
|
122
124
|
// import { DATABASE_URL } from '$env/static/private'
|
|
123
125
|
|
|
124
|
-
|
|
126
|
+
//----------------------------------------
|
|
127
|
+
// To enable OAuth via Github (1/2)
|
|
128
|
+
//----------------------------------------
|
|
129
|
+
// import { github } from 'firstly/auth/providers'
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Your roles, use them in your app !
|
|
133
|
+
*/
|
|
125
134
|
export const Role = {
|
|
126
|
-
|
|
127
|
-
SUPER_ADMIN: 'super_admin',
|
|
135
|
+
Boss: 'Boss',
|
|
128
136
|
}
|
|
129
137
|
|
|
130
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Your logs with a nice prefix, use \`log.info("Hello")\` / \`log.success("Yeah")\` / \`log.error("Ho nooo!")\` and see !
|
|
140
|
+
*/
|
|
131
141
|
export const log = new Log('${pkg.name}')
|
|
132
142
|
|
|
133
143
|
export const api = firstly({
|
|
144
|
+
//----------------------------------------
|
|
145
|
+
// To switch to postgres (2/2)
|
|
146
|
+
//----------------------------------------
|
|
134
147
|
// dataProvider: await createPostgresConnection({
|
|
135
148
|
// connectionString: DATABASE_URL,
|
|
136
149
|
// }),
|
|
150
|
+
|
|
137
151
|
modules: [
|
|
138
|
-
|
|
152
|
+
//----------------------------------------
|
|
153
|
+
// Core Module: auth
|
|
154
|
+
//----------------------------------------
|
|
139
155
|
auth({
|
|
140
156
|
providers: {
|
|
141
157
|
demo: [
|
|
142
158
|
{ name: 'Ermin' },
|
|
143
|
-
{ name: 'JYC', roles: [
|
|
144
|
-
{ name: 'Noam', roles: [Role.
|
|
159
|
+
{ name: 'JYC', roles: [FF_Role.Admin] },
|
|
160
|
+
{ name: 'Noam', roles: [FF_Role.Admin, Role.Boss] },
|
|
145
161
|
],
|
|
146
162
|
|
|
147
163
|
// password: {},
|
|
@@ -149,22 +165,23 @@ export const api = firstly({
|
|
|
149
165
|
// otp: {},
|
|
150
166
|
|
|
151
167
|
oAuths: [
|
|
152
|
-
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
//
|
|
157
|
-
// window.location.href = await AuthController.signInOAuthGetUrl({ provider: 'github', redirect: window.location.pathname })
|
|
158
|
-
// }
|
|
159
|
-
// github( { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } )
|
|
168
|
+
//----------------------------------------
|
|
169
|
+
// To enable OAuth via Github (2/2)
|
|
170
|
+
// Instructions by hovering the method \`github\`
|
|
171
|
+
//----------------------------------------
|
|
172
|
+
// github(),
|
|
160
173
|
],
|
|
161
174
|
},
|
|
162
175
|
}),
|
|
163
176
|
|
|
177
|
+
//----------------------------------------
|
|
164
178
|
// example of a userland module
|
|
165
|
-
|
|
179
|
+
//----------------------------------------
|
|
180
|
+
task({ specialInfo: 'hello from userland' }),
|
|
166
181
|
|
|
182
|
+
//----------------------------------------
|
|
167
183
|
// example of a userland inline module
|
|
184
|
+
//----------------------------------------
|
|
168
185
|
{
|
|
169
186
|
name: 'app',
|
|
170
187
|
entities: [],
|
|
@@ -210,37 +227,13 @@ export const load = (async () => {
|
|
|
210
227
|
'./src/routes/+layout.svelte': [
|
|
211
228
|
`<script lang="ts">
|
|
212
229
|
import { remult } from 'remult'
|
|
213
|
-
import { isError } from 'firstly'
|
|
214
|
-
import { AuthController } from 'firstly/auth'
|
|
215
|
-
|
|
216
|
-
import { invalidateAll } from '$app/navigation'
|
|
217
230
|
|
|
218
231
|
import { route } from '${libAlias}/ROUTES'
|
|
232
|
+
import SignIn from '${libAlias}/ui/SignIn.svelte'
|
|
233
|
+
import SignOut from '${libAlias}/ui/SignOut.svelte'
|
|
219
234
|
|
|
220
235
|
import type { LayoutData } from './$types'
|
|
221
236
|
|
|
222
|
-
const login = async (identif: string) => {
|
|
223
|
-
try {
|
|
224
|
-
await AuthController.signInDemo(identif)
|
|
225
|
-
invalidateAll()
|
|
226
|
-
} catch (error) {
|
|
227
|
-
if (isError(error)) {
|
|
228
|
-
alert(error.message)
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const logout = async () => {
|
|
234
|
-
try {
|
|
235
|
-
await AuthController.signOut()
|
|
236
|
-
invalidateAll()
|
|
237
|
-
} catch (error) {
|
|
238
|
-
if (isError(error)) {
|
|
239
|
-
alert(error.message)
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
237
|
export let data: LayoutData
|
|
245
238
|
$: remult.user = data.user
|
|
246
239
|
</script>
|
|
@@ -257,12 +250,17 @@ export const load = (async () => {
|
|
|
257
250
|
<h1>${pkg.name}</h1>
|
|
258
251
|
|
|
259
252
|
{#if remult.authenticated()}
|
|
260
|
-
<
|
|
253
|
+
<div style="float:right;">
|
|
254
|
+
<SignOut></SignOut>
|
|
255
|
+
</div>
|
|
261
256
|
<span>{remult.user?.name} ({remult.user?.roles})<br /><br /></span>
|
|
262
257
|
{:else}
|
|
263
|
-
<
|
|
264
|
-
<
|
|
265
|
-
<
|
|
258
|
+
<SignIn demo="Ermin"></SignIn>
|
|
259
|
+
<SignIn demo="JYC"></SignIn>
|
|
260
|
+
<SignIn demo="Noam"></SignIn>
|
|
261
|
+
<br />
|
|
262
|
+
<SignIn ffLink></SignIn>
|
|
263
|
+
<SignIn oauth="github"></SignIn>
|
|
266
264
|
{/if}
|
|
267
265
|
|
|
268
266
|
<hr />
|
|
@@ -271,11 +269,87 @@ export const load = (async () => {
|
|
|
271
269
|
|
|
272
270
|
<hr />
|
|
273
271
|
|
|
274
|
-
<
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
<div style="float: right; text-align: right;">
|
|
273
|
+
<a href={route('remult_admin')} target="_blank">🚀 admin</a>
|
|
274
|
+
<p style="font-size: small;">
|
|
275
|
+
<i>Login as <b>JYC</b> to get admin rights ☝️</i>
|
|
276
|
+
</p>
|
|
277
|
+
</div>
|
|
278
|
+
<a href={route('github', { owner: 'jycouet', repo: 'firstly' })} target="_blank"> ⭐️ firstly </a>
|
|
277
279
|
|
|
|
278
280
|
<a href={route('github', { owner: 'remult', repo: 'remult' })} target="_blank">⭐️ remult</a>
|
|
281
|
+
`,
|
|
282
|
+
],
|
|
283
|
+
'./src/lib/ui/SignIn.svelte': [
|
|
284
|
+
`<script lang="ts">
|
|
285
|
+
import { isError } from 'firstly'
|
|
286
|
+
import { Auth } from 'firstly/auth/client'
|
|
287
|
+
|
|
288
|
+
import { goto, invalidateAll } from '$app/navigation'
|
|
289
|
+
|
|
290
|
+
import { route } from '../ROUTES'
|
|
291
|
+
|
|
292
|
+
// Examples of signin modes
|
|
293
|
+
export let demo = ''
|
|
294
|
+
export let ffLink = false
|
|
295
|
+
export let oauth: 'github' | undefined = undefined
|
|
296
|
+
|
|
297
|
+
const signinDemo = async (identif: string) => {
|
|
298
|
+
try {
|
|
299
|
+
await Auth.signInDemo(identif)
|
|
300
|
+
invalidateAll()
|
|
301
|
+
} catch (error) {
|
|
302
|
+
if (isError(error)) {
|
|
303
|
+
// TODO: You will probably not leave this alert in production
|
|
304
|
+
alert(error.message)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
async function signinOAuth(provider: 'github') {
|
|
310
|
+
try {
|
|
311
|
+
window.location.href = await Auth.signInOAuthGetUrl({
|
|
312
|
+
provider,
|
|
313
|
+
redirect: window.location.pathname,
|
|
314
|
+
})
|
|
315
|
+
} catch (error) {
|
|
316
|
+
if (isError(error)) {
|
|
317
|
+
// TODO: You will probably not leave this alert in production
|
|
318
|
+
alert(error.message)
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
</script>
|
|
323
|
+
|
|
324
|
+
{#if demo}
|
|
325
|
+
<button on:click={() => signinDemo(demo)}>Login as {demo}</button>
|
|
326
|
+
{:else if ffLink}
|
|
327
|
+
<button on:click={() => goto(route('firstly_sign_in'))}>Login with Firstly</button>
|
|
328
|
+
{:else if oauth}
|
|
329
|
+
<button on:click={() => signinOAuth(oauth)}>Login With {oauth}</button>
|
|
330
|
+
{/if}
|
|
331
|
+
`,
|
|
332
|
+
],
|
|
333
|
+
'./src/lib/ui/SignOut.svelte': [
|
|
334
|
+
`<script lang="ts">
|
|
335
|
+
import { isError } from 'firstly'
|
|
336
|
+
import { Auth } from 'firstly/auth/client'
|
|
337
|
+
|
|
338
|
+
import { invalidateAll } from '$app/navigation'
|
|
339
|
+
|
|
340
|
+
const logout = async () => {
|
|
341
|
+
try {
|
|
342
|
+
await Auth.signOut()
|
|
343
|
+
invalidateAll()
|
|
344
|
+
} catch (error) {
|
|
345
|
+
if (isError(error)) {
|
|
346
|
+
alert(error.message)
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
</script>
|
|
351
|
+
|
|
352
|
+
<button on:click={logout}>Logout</button>
|
|
279
353
|
`,
|
|
280
354
|
],
|
|
281
355
|
'./tsconfig.json': [
|
|
@@ -312,7 +386,11 @@ export default defineConfig({
|
|
|
312
386
|
plugins: [
|
|
313
387
|
firstly<KIT_ROUTES>({
|
|
314
388
|
kitRoutes: {
|
|
315
|
-
LINKS: {
|
|
389
|
+
LINKS: {
|
|
390
|
+
firstly_sign_in: 'ff/auth/sign-in',
|
|
391
|
+
github: 'https://github.com/[owner]/[repo]',
|
|
392
|
+
remult_admin: 'api/admin',
|
|
393
|
+
},
|
|
316
394
|
}
|
|
317
395
|
}),
|
|
318
396
|
sveltekit(),
|
|
@@ -320,7 +398,28 @@ export default defineConfig({
|
|
|
320
398
|
})
|
|
321
399
|
`,
|
|
322
400
|
],
|
|
323
|
-
'
|
|
401
|
+
'./.gitignore': [
|
|
402
|
+
`node_modules
|
|
403
|
+
|
|
404
|
+
# Output
|
|
405
|
+
/.svelte-kit
|
|
406
|
+
/build
|
|
407
|
+
|
|
408
|
+
# Env
|
|
409
|
+
.env
|
|
410
|
+
.env.*
|
|
411
|
+
!.env.example
|
|
412
|
+
!.env.test
|
|
413
|
+
|
|
414
|
+
# Vite
|
|
415
|
+
vite.config.js.timestamp-*
|
|
416
|
+
vite.config.ts.timestamp-*
|
|
417
|
+
|
|
418
|
+
# Firstly / Remult
|
|
419
|
+
/db
|
|
420
|
+
`,
|
|
421
|
+
],
|
|
422
|
+
'./src/lib/firstly/modules/task/index.ts': [
|
|
324
423
|
`import type { Module } from 'firstly/api'
|
|
325
424
|
|
|
326
425
|
import { log } from '${libAlias}/firstly'
|
|
@@ -328,7 +427,7 @@ import { log } from '${libAlias}/firstly'
|
|
|
328
427
|
import { Task } from './Task'
|
|
329
428
|
import { TaskController } from './TaskController'
|
|
330
429
|
|
|
331
|
-
export const
|
|
430
|
+
export const task: (o: { specialInfo: string }) => Module = ({ specialInfo }) => {
|
|
332
431
|
return {
|
|
333
432
|
name: 'task',
|
|
334
433
|
entities: [Task],
|
|
@@ -339,11 +438,11 @@ export const tasks: (o: { specialInfo: string }) => Module = ({ specialInfo }) =
|
|
|
339
438
|
}
|
|
340
439
|
}`,
|
|
341
440
|
],
|
|
342
|
-
'./src/lib/firstly/modules/
|
|
441
|
+
'./src/lib/firstly/modules/task/Task.ts': [
|
|
343
442
|
`import { Entity, Field, Fields, ValueListFieldType } from 'remult'
|
|
344
|
-
import {
|
|
443
|
+
import { BaseEnum, LibIcon_Add, LibIcon_Delete, type BaseEnumOptions } from 'firstly'
|
|
345
444
|
|
|
346
|
-
@Entity('
|
|
445
|
+
@Entity('task', {
|
|
347
446
|
allowApiCrud: true,
|
|
348
447
|
})
|
|
349
448
|
export class Task {
|
|
@@ -368,7 +467,7 @@ export class Task {
|
|
|
368
467
|
}
|
|
369
468
|
|
|
370
469
|
@ValueListFieldType()
|
|
371
|
-
export class TypeOfTaskEnum extends
|
|
470
|
+
export class TypeOfTaskEnum extends BaseEnum {
|
|
372
471
|
static EASY = new TypeOfTaskEnum('EASY', {
|
|
373
472
|
caption: 'Easy',
|
|
374
473
|
icon: { data: LibIcon_Add },
|
|
@@ -377,13 +476,13 @@ export class TypeOfTaskEnum extends KitBaseEnum {
|
|
|
377
476
|
caption: 'Hard',
|
|
378
477
|
icon: { data: LibIcon_Delete },
|
|
379
478
|
})
|
|
380
|
-
constructor(id: string, o?:
|
|
479
|
+
constructor(id: string, o?: BaseEnumOptions<TypeOfTaskEnum>) {
|
|
381
480
|
super(id, o)
|
|
382
481
|
}
|
|
383
482
|
}
|
|
384
483
|
`,
|
|
385
484
|
],
|
|
386
|
-
'./src/lib/firstly/modules/
|
|
485
|
+
'./src/lib/firstly/modules/task/TaskController.ts': [
|
|
387
486
|
`import { BackendMethod } from 'remult'
|
|
388
487
|
|
|
389
488
|
import { log } from '${libAlias}/firstly'
|
|
@@ -406,7 +505,7 @@ for (const [path, content] of Object.entries(obj)) {
|
|
|
406
505
|
}
|
|
407
506
|
else {
|
|
408
507
|
if (res.includes('module-demo')) {
|
|
409
|
-
if (path.startsWith('./src/lib/firstly/modules/
|
|
508
|
+
if (path.startsWith('./src/lib/firstly/modules/task')) {
|
|
410
509
|
write(path, content);
|
|
411
510
|
}
|
|
412
511
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SvelteComponent } from 'svelte';
|
|
2
|
+
import { type EntityFilter, type FieldMetadata, type Repository } from 'remult';
|
|
3
|
+
import type { UnArray } from './utils/types.js';
|
|
4
|
+
export type VisibilityMode = 'view' | 'edit' | 'hide';
|
|
5
|
+
type CellInternal<Entity> = {
|
|
6
|
+
col?: keyof Entity;
|
|
7
|
+
kind?: 'field' | 'field_link' | 'entity_link' | 'slot' | 'header' | 'component';
|
|
8
|
+
class?: string;
|
|
9
|
+
header?: string;
|
|
10
|
+
headerSlot?: boolean;
|
|
11
|
+
modeEdit?: VisibilityMode;
|
|
12
|
+
modeView?: VisibilityMode;
|
|
13
|
+
clipboardable?: boolean;
|
|
14
|
+
clearable?: boolean;
|
|
15
|
+
component?: new (...args: any[]) => SvelteComponent;
|
|
16
|
+
props?: any;
|
|
17
|
+
rowToProps?: (row: any) => any;
|
|
18
|
+
};
|
|
19
|
+
export type Cell<Entity> = CellInternal<Entity> & {
|
|
20
|
+
field?: FieldMetadata<any, Entity>;
|
|
21
|
+
};
|
|
22
|
+
export type CellsInput<Entity> = (keyof Entity | CellInternal<Entity>)[];
|
|
23
|
+
/**
|
|
24
|
+
* cellsBuildor is a function to build cells for a <Grid /> or <FieldGroup /> component.
|
|
25
|
+
*
|
|
26
|
+
* ```html
|
|
27
|
+
* <script lang="ts">
|
|
28
|
+
* import { repo } from 'remult'
|
|
29
|
+
*
|
|
30
|
+
* const cells = cellsBuildor(repo(Site), ['name', 'description'])
|
|
31
|
+
* const store = storeList( repo(Site) )
|
|
32
|
+
* $: store.fetch()
|
|
33
|
+
* </script>
|
|
34
|
+
*
|
|
35
|
+
* <Grid {cells} {store} />
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export declare function cellsBuildor<Entity>(repo: Repository<Entity>, inputBuildor: CellsInput<Entity>): Cell<Entity>[];
|
|
40
|
+
export declare function cellBuildor<Entity>(repo: Repository<Entity>, inputBuildor: UnArray<CellsInput<Entity>>): Cell<Entity>;
|
|
41
|
+
export declare const fieldsOf: <Entity>(b: Cell<Entity>[]) => FieldMetadata<any, Entity>[];
|
|
42
|
+
export declare const getPlaceholder: <Entity>(fields: FieldMetadata<any, Entity>[]) => string;
|
|
43
|
+
export declare const buildSearchWhere: <Entity>(entity: Entity | undefined, fields: FieldMetadata<any, Entity>[], search?: string | null) => EntityFilter<Entity>[];
|
|
44
|
+
export declare const buildWhere: <Entity>(entity: Entity | undefined, defaultWhere: EntityFilter<Entity> | undefined, fields_filter: FieldMetadata<any, Entity>[], fields_search: FieldMetadata<any, Entity>[], obj: Record<string, string>) => EntityFilter<Entity>;
|
|
45
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {} from 'remult';
|
|
2
2
|
import { getRelationFieldInfo } from 'remult/internals';
|
|
3
|
-
import {
|
|
3
|
+
import {} from './BaseEnum.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* cellsBuildor is a function to build cells for a <Grid /> or <FieldGroup /> component.
|
|
6
6
|
*
|
|
7
7
|
* ```html
|
|
8
8
|
* <script lang="ts">
|
|
9
9
|
* import { repo } from 'remult'
|
|
10
10
|
*
|
|
11
|
-
* const cells =
|
|
12
|
-
* const store =
|
|
11
|
+
* const cells = cellsBuildor(repo(Site), ['name', 'description'])
|
|
12
|
+
* const store = storeList( repo(Site) )
|
|
13
13
|
* $: store.fetch()
|
|
14
14
|
* </script>
|
|
15
15
|
*
|
|
@@ -17,7 +17,7 @@ import { getEnum, KitBaseEnum } from './KitBaseEnum.js';
|
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
-
export function
|
|
20
|
+
export function cellsBuildor(repo, inputBuildor) {
|
|
21
21
|
const buildor = [];
|
|
22
22
|
for (let i = 0; i < inputBuildor.length; i++) {
|
|
23
23
|
const item = inputBuildor[i];
|
|
@@ -38,8 +38,8 @@ export function kitCellsBuildor(repo, inputBuildor) {
|
|
|
38
38
|
}
|
|
39
39
|
return buildor;
|
|
40
40
|
}
|
|
41
|
-
export function
|
|
42
|
-
return
|
|
41
|
+
export function cellBuildor(repo, inputBuildor) {
|
|
42
|
+
return cellsBuildor(repo, [inputBuildor])[0];
|
|
43
43
|
}
|
|
44
44
|
export const fieldsOf = (b) => {
|
|
45
45
|
return b.filter((c) => c.field).map((c) => c.field) ?? [];
|
|
@@ -47,13 +47,23 @@ export const fieldsOf = (b) => {
|
|
|
47
47
|
export const getPlaceholder = (fields) => {
|
|
48
48
|
return fields.map((c) => c.caption).join(', ');
|
|
49
49
|
};
|
|
50
|
-
export const buildSearchWhere = (fields, search) => {
|
|
50
|
+
export const buildSearchWhere = (entity, fields, search) => {
|
|
51
51
|
if (!search) {
|
|
52
52
|
return [];
|
|
53
53
|
}
|
|
54
54
|
const f = [
|
|
55
55
|
{
|
|
56
56
|
$or: fields.map((f) => {
|
|
57
|
+
if (f.isServerExpression) {
|
|
58
|
+
// check if this field has a specific filter function
|
|
59
|
+
const fnName = f.key + 'Filter';
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
if (entity && entity[fnName]) {
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
return entity[fnName](search);
|
|
64
|
+
}
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
57
67
|
if (f.inputType === 'number') {
|
|
58
68
|
return { [f.key]: search };
|
|
59
69
|
}
|
|
@@ -66,18 +76,18 @@ export const buildSearchWhere = (fields, search) => {
|
|
|
66
76
|
];
|
|
67
77
|
return f;
|
|
68
78
|
};
|
|
69
|
-
export const buildWhere = (defaultWhere, fields_filter, fields_search, obj) => {
|
|
79
|
+
export const buildWhere = (entity, defaultWhere, fields_filter, fields_search, obj) => {
|
|
70
80
|
const and = [];
|
|
71
81
|
if (defaultWhere) {
|
|
72
82
|
and.push(defaultWhere);
|
|
73
83
|
}
|
|
74
84
|
if (obj.search) {
|
|
75
|
-
and.push(...buildSearchWhere(fields_search, obj.search));
|
|
85
|
+
and.push(...buildSearchWhere(entity, fields_search, obj.search));
|
|
76
86
|
}
|
|
77
87
|
for (const field of fields_filter) {
|
|
78
|
-
const rfi = getRelationFieldInfo(field);
|
|
79
88
|
// if there is a value
|
|
80
89
|
if (obj[field.key]) {
|
|
90
|
+
const rfi = getRelationFieldInfo(field);
|
|
81
91
|
if (field.inputType === 'checkbox') {
|
|
82
92
|
// @ts-ignore
|
|
83
93
|
and.push({ [field.key]: obj[field.key] });
|
|
@@ -87,12 +97,12 @@ export const buildWhere = (defaultWhere, fields_filter, fields_search, obj) => {
|
|
|
87
97
|
const theEnum = getEnum(field, obj[field.key]);
|
|
88
98
|
// Take the where of the enum if it exists, or it's using this selection as a filter
|
|
89
99
|
// @ts-ignore
|
|
90
|
-
const wheretoUse = theEnum?.where ?? new
|
|
100
|
+
const wheretoUse = theEnum?.where ?? new BaseEnum(obj[field.key]);
|
|
91
101
|
// @ts-ignore
|
|
92
102
|
and.push({ [field.key]: wheretoUse });
|
|
93
103
|
}
|
|
94
|
-
else if (rfi
|
|
95
|
-
// @ts-ignore (
|
|
104
|
+
else if (rfi?.type === 'toOne') {
|
|
105
|
+
// @ts-ignore (setting the id of the relation)
|
|
96
106
|
and.push({ [field.key]: obj[field.key] });
|
|
97
107
|
}
|
|
98
108
|
else {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { repo } from "remult";
|
|
3
3
|
import { page } from "$app/stores";
|
|
4
4
|
import { FeedbackController } from "..";
|
|
5
|
-
import { Button, Field, FilterEntity,
|
|
5
|
+
import { Button, cellBuildor, Field, FilterEntity, Loading } from "../..";
|
|
6
6
|
import Textarea from "../../ui/internals/Textarea.svelte";
|
|
7
7
|
export let dialogId;
|
|
8
8
|
const rmvWarning = dialogId;
|
|
@@ -84,7 +84,7 @@ const reOpen = async () => {
|
|
|
84
84
|
</div>
|
|
85
85
|
{:else}
|
|
86
86
|
{#if issueNumber === null}
|
|
87
|
-
<Field cell={
|
|
87
|
+
<Field cell={cellBuildor(repo(FilterEntity), 'title')} bind:value={title} />
|
|
88
88
|
{/if}
|
|
89
89
|
<Textarea bind:value={content}></Textarea>
|
|
90
90
|
<div class="flex justify-between">
|
package/esm/formats/dates.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ff_Log } from '../';
|
|
2
2
|
export const dateISOToPlainDate = (iso) => {
|
|
3
3
|
try {
|
|
4
4
|
// const ti = Temporal.Instant.from(iso)
|
|
@@ -9,7 +9,7 @@ export const dateISOToPlainDate = (iso) => {
|
|
|
9
9
|
}
|
|
10
10
|
catch (error) { }
|
|
11
11
|
const msg = `fn dateISOToPlainDate -> "${iso}" is not valid iso`;
|
|
12
|
-
|
|
12
|
+
ff_Log.error(msg);
|
|
13
13
|
throw new Error(msg);
|
|
14
14
|
};
|
|
15
15
|
export const offsetedToPlainDate = (dt) => {
|
package/esm/formats/strings.js
CHANGED
|
@@ -16,17 +16,6 @@ const formatPhone = (phone) => {
|
|
|
16
16
|
return '';
|
|
17
17
|
}
|
|
18
18
|
return phone;
|
|
19
|
-
// TODO: Let's be smart one day... and add a ton of tests!
|
|
20
|
-
// const replaced = phone.replaceAll(' ', '').replaceAll('.', '')
|
|
21
|
-
// let formatted: string = replaced
|
|
22
|
-
// if (replaced.charAt(0) === '+') {
|
|
23
|
-
// return formatted
|
|
24
|
-
// } else if (replaced.slice(0, 2) === '00') {
|
|
25
|
-
// return `+${formatted.slice(2)}`
|
|
26
|
-
// } else if (replaced.length > 10) {
|
|
27
|
-
// formatted = replaced.slice(0, 10)
|
|
28
|
-
// }
|
|
29
|
-
// return `+33${formatted.slice(1)}`
|
|
30
19
|
};
|
|
31
20
|
export const arrToStr = (arr) => {
|
|
32
21
|
if (!arr)
|