@nocobase/plugin-field-sequence 1.2.3-alpha → 1.2.5-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/index.js
CHANGED
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@formily/antd-v5"),require("@formily/core"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@formily/antd-v5","@formily/core","@formily/react","@nocobase/utils/client","antd","react","react-i18next"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o["@nocobase/plugin-field-sequence"]={},o["@nocobase/client"],o.jsxRuntime,o["@formily/antd-v5"],o["@formily/core"],o["@formily/react"],o["@nocobase/utils"],o.antd,o.react,o["react-i18next"]))})(this,function(o,e,t,u,
|
|
10
|
+
(function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@formily/antd-v5"),require("@formily/core"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@formily/antd-v5","@formily/core","@formily/react","@nocobase/utils/client","antd","react","react-i18next"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o["@nocobase/plugin-field-sequence"]={},o["@nocobase/client"],o.jsxRuntime,o["@formily/antd-v5"],o["@formily/core"],o["@formily/react"],o["@nocobase/utils"],o.antd,o.react,o["react-i18next"]))})(this,function(o,e,t,u,F,y,C,d,m,v){"use strict";var w=Object.defineProperty,z=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var q=(o,e,t)=>e in o?w(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,b=(o,e)=>{for(var t in e||(e={}))E.call(e,t)&&q(o,t,e[t]);if(Y)for(var t of Y(e))_.call(e,t)&&q(o,t,e[t]);return o},I=(o,e)=>z(o,B(e));var l=(o,e,t)=>(q(o,typeof e!="symbol"?e+"":e,t),t);var D=(o,e,t)=>new Promise((u,F)=>{var y=m=>{try{d(t.next(m))}catch(v){F(v)}},C=m=>{try{d(t.throw(m))}catch(v){F(v)}},d=m=>m.done?u(m.value):Promise.resolve(m.value).then(y,C);d((t=t.apply(o,e)).next())});const s="field-sequence";function M(n,i={}){return e.i18n.t(n,I(b({},i),{ns:s}))}function A(n){const i=e.useCompile(),{setValuesIn:a}=y.useForm(),c=u.ArrayTable.useIndex();return y.useFormEffects(()=>{F.onFieldValueChange(`patterns.${c}.type`,r=>{const f=h[r.value];a(`patterns.${c}.options`,f.defaults?b({},f.defaults):{})})}),t.jsx(d.Select,I(b({popupMatchSelectWidth:!1},n),{children:Object.keys(h).map(r=>t.jsx(d.Select.Option,{value:r,children:i(h[r].title)},r))}))}function j(){const n=e.useCompile(),{values:i}=y.useForm(),a=u.ArrayTable.useIndex(),{type:c,options:r}=i.patterns[a],f=h[c];return t.jsx("div",{className:e.css`
|
|
11
11
|
display: flex;
|
|
12
12
|
gap: 1em;
|
|
13
13
|
flex-wrap: wrap;
|
|
14
|
-
`,children:Object.keys(r).filter(p=>typeof r[p]!="undefined"&&
|
|
14
|
+
`,children:Object.keys(r).filter(p=>typeof r[p]!="undefined"&&f.optionRenders[p]).map(p=>{const S=f.optionRenders[p],{title:x}=f.fieldset[p];return S?t.jsxs("dl",{className:e.css`
|
|
15
15
|
margin: 0;
|
|
16
16
|
padding: 0;
|
|
17
17
|
`,children:[t.jsx("dt",{children:n(x)}),t.jsx("dd",{className:e.css`
|
|
18
18
|
margin-bottom: 0;
|
|
19
|
-
`,children:t.jsx(S,{value:r[p]},p)})]},p):null})})}const
|
|
19
|
+
`,children:t.jsx(S,{value:r[p]},p)})]},p):null})})}const h={string:{title:`{{t("Fixed text", { ns: "${s}" })}}`,optionRenders:{value(n={value:""}){return t.jsx("code",{children:n.value})}},fieldset:{value:{type:"string",title:`{{t("Text content", { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component":"Input"}}},integer:{title:`{{t("Autoincrement", { ns: "${s}" })}}`,optionRenders:{digits:function({value:i}){return t.jsx("code",{children:i})},start:function({value:i}){return t.jsx("code",{children:i})},cycle:e.Cron.ReadPretty},fieldset:{digits:{type:"number",title:`{{t("Digits", { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:10},required:!0,default:1,"x-reactions":{target:"start",fulfill:{schema:{"x-component-props.max":"{{ 10 ** $self.value - 1 }}"}}}},start:{type:"number",title:`{{t("Start from", { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:0},required:!0,default:0},cycle:{type:"string",title:`{{t("Reset cycle", { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component"({value:n,onChange:i}){const a=[{label:"No reset",value:0},{label:"Daily",value:1,cron:"0 0 * * *"},{label:"Every Monday",value:2,cron:"0 0 * * 1"},{label:"Monthly",value:3,cron:"0 0 1 * *"},{label:"Yearly",value:4,cron:"0 0 1 1 *"},{label:"Customize",value:5,cron:"* * * * *"}],c=typeof n=="undefined"?a[0]:a.find(r=>r.cron==n)||a[5];return t.jsxs("fieldset",{children:[t.jsx(d.Select,{value:c.value,onChange:r=>i(a[r].cron),children:a.map(r=>t.jsx(d.Select.Option,{value:r.value,children:M(r.label)},r.value))}),c.value===5?t.jsx(e.Cron,{value:n,onChange:i,clearButton:!1}):null]})},default:null}},defaults:{digits:4,start:1}},date:{title:`{{t("Date", { ns: "${s}" })}}`,optionRenders:{format(n={value:"YYYYMMDD"}){return t.jsx("code",{children:n.value})}},fieldset:{format:{type:"string",title:`{{t("Date format", { ns: "${s}" })}}`,description:`{{t('Supports all formats of the Day.js library, such as "YYYYMMDD", "YYYY-MM-DD", etc.', { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component":"Input",default:"YYYYMMDD"}},defaults:{format:"YYYYMMDD"}}};function $(){const{t:n}=v.useTranslation(),i=e.useCompile(),a=m.useContext(y.SchemaOptionsContext),{values:c,setValuesIn:r}=y.useForm(),f=u.ArrayTable.useIndex(),{type:p,options:S}=c.patterns[f],x=h[p],{token:N}=e.useToken();return x!=null&&x.fieldset?t.jsx(d.Button,{type:"link",onClick:()=>{u.FormDrawer({title:i(x.title),zIndex:N.zIndexPopupBase+1e3},()=>t.jsxs(u.FormLayout,{layout:"vertical",children:[t.jsx(e.SchemaComponentOptions,{scope:a.scope,components:a.components,children:t.jsx(e.SchemaComponent,{schema:{type:"object","x-component":"fieldset",properties:x.fieldset}})}),t.jsx(u.FormDrawer.Footer,{children:t.jsx(u.FormButtonGroup,{className:e.css`
|
|
20
20
|
justify-content: flex-end;
|
|
21
|
-
`,children:t.jsx(u.Submit,{onSubmit:
|
|
21
|
+
`,children:t.jsx(u.Submit,{onSubmit:g=>g,children:n("Submit")})})})]})).open({initialValues:S}).then(g=>{r(`patterns.${f}`,{type:p,options:b({},g)})}).catch(g=>{C.error(g)})},children:n("Configure")}):null}class O extends e.CollectionFieldInterface{constructor(){super(...arguments);l(this,"name","sequence");l(this,"type","object");l(this,"group","advanced");l(this,"order",3);l(this,"title",`{{t("Sequence", { ns: "${s}" })}}`);l(this,"description",`{{t("Automatically generate codes based on configured rules, supporting combinations of dates, numbers, and text.", { ns: "${s}" })}}`);l(this,"sortable",!0);l(this,"default",{type:"sequence",uiSchema:{type:"string","x-component":"Input","x-component-props":{}}});l(this,"availableTypes",["string"]);l(this,"hasDefaultValue",!1);l(this,"filterable",{operators:e.interfacesProperties.operators.string});l(this,"titleUsable",!0);l(this,"properties",I(b({},e.interfacesProperties.defaultProps),{unique:e.interfacesProperties.unique,patterns:{type:"array",title:`{{t("Sequence rules", { ns: "${s}" })}}`,required:!0,"x-decorator":"FormItem","x-component":"ArrayTable",items:{type:"object",properties:{sort:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:50,title:"",align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},type:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:`{{t("Type", { ns: "${s}" })}}`},properties:{type:{type:"string",name:"type",required:!0,"x-decorator":"FormItem","x-component":A}}},options:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:`{{t("Rule content", { ns: "${s}" })}}`},properties:{options:{type:"object",name:"options","x-component":j}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:`{{t("Operations", { ns: "${s}" })}}`,dataIndex:"operations",fixed:"right",className:e.css`
|
|
22
22
|
> *:not(:last-child) {
|
|
23
23
|
margin-right: 0.5em;
|
|
24
24
|
}
|
|
25
25
|
button {
|
|
26
26
|
padding: 0;
|
|
27
27
|
}
|
|
28
|
-
`},properties:{config:{type:"void",properties:{options:{type:"object","x-component":$}}},remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void","x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{type:"integer",options:{
|
|
28
|
+
`},properties:{config:{type:"void",properties:{options:{type:"object","x-component":$}}},remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void","x-component":"ArrayTable.Addition","x-component-props":{defaultValue:{type:"integer",options:b({},h.integer.defaults)}},title:`{{t("Add rule", { ns: "${s}" })}}`}}},inputable:{type:"boolean",title:`{{t("Inputable", { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox"},match:{type:"boolean",title:`{{t("Match rules", { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["inputable"],fulfill:{state:{value:"{{$deps[0] && $self.value}}",visible:"{{$deps[0] === true}}"}}}}}))}schemaInitialize(a,{block:c,field:r}){return c==="Form"&&Object.assign(a["x-component-props"],{disabled:!r.inputable}),a}}const P=n=>t.jsx(e.SchemaComponentOptions,{components:{RuleConfigForm:$},children:n.children});class T extends e.Plugin{load(){return D(this,null,function*(){this.app.use(P),this.app.dataSourceManager.addFieldInterfaces([O])})}}o.PluginFieldSequenceClient=T,o.default=T,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
|
-
"@nocobase/client": "1.2.
|
|
12
|
+
"@nocobase/client": "1.2.5-alpha",
|
|
13
13
|
"@formily/antd-v5": "1.1.9",
|
|
14
14
|
"@formily/core": "2.3.0",
|
|
15
15
|
"@formily/react": "2.3.0",
|
|
16
|
-
"@nocobase/utils": "1.2.
|
|
16
|
+
"@nocobase/utils": "1.2.5-alpha",
|
|
17
17
|
"antd": "5.12.8",
|
|
18
18
|
"react-i18next": "11.18.6",
|
|
19
|
-
"@nocobase/server": "1.2.
|
|
20
|
-
"@nocobase/database": "1.2.
|
|
19
|
+
"@nocobase/server": "1.2.5-alpha",
|
|
20
|
+
"@nocobase/database": "1.2.5-alpha",
|
|
21
21
|
"dayjs": "1.11.10",
|
|
22
22
|
"lodash": "4.17.21"
|
|
23
23
|
};
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"Autoincrement": "自增数字",
|
|
10
10
|
"Fixed text": "固定文本",
|
|
11
11
|
"Text content": "文本内容",
|
|
12
|
+
"Date": "日期",
|
|
13
|
+
"Date format": "日期格式",
|
|
14
|
+
"Supports all formats of the Day.js library, such as \"YYYYMMDD\", \"YYYY-MM-DD\", etc.": "支持 Day.js 库的所有格式,如“YYYYMMDD”、“YYYY-MM-DD”等。",
|
|
12
15
|
"Rule content": "规则内容",
|
|
13
16
|
"{{value}} Digits": "{{value}} 位数字",
|
|
14
17
|
"Digits": "位数",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2024-06-
|
|
1
|
+
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2024-06-19T23:06:19.057Z"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "数据表字段:自动编码",
|
|
5
5
|
"description": "Automatically generate codes based on configured rules, supporting combinations of dates, numbers, and text.",
|
|
6
6
|
"description.zh-CN": "根据配置的规则自动生成编码,支持日期、数字、文本的组合。",
|
|
7
|
-
"version": "1.2.
|
|
7
|
+
"version": "1.2.5-alpha",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/field-sequence",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@nocobase/test": "1.x",
|
|
30
30
|
"@nocobase/utils": "1.x"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "ca7baa2d4dffe0e2c02f676b96ff841f3ee31e7e",
|
|
33
33
|
"keywords": [
|
|
34
34
|
"Collection fields"
|
|
35
35
|
]
|