kintone-pretty-fields 0.6.0 → 0.7.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/README.md +1 -1
- package/dist/functions/formField.d.ts +4 -2
- package/dist/functions/formField.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -95
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ console.log({ fields, spacers });
|
|
|
128
128
|
const checkBoxFields = fields.filter(kintonePrettyFields.isCheckBox);
|
|
129
129
|
console.log(checkBoxFields);
|
|
130
130
|
|
|
131
|
-
const inSubtableFields = fields.filter(kintonePrettyFields.
|
|
131
|
+
const inSubtableFields = fields.filter(kintonePrettyFields.isInSubtable);
|
|
132
132
|
console.log(inSubtableFields);
|
|
133
133
|
|
|
134
134
|
const myFunction1 = (fields: kintonePrettyType.OneOf[]) => {
|
|
@@ -33,8 +33,10 @@ export declare const isStatus: (field: kintonePrettyType.OneOf) => field is kint
|
|
|
33
33
|
export declare const isStatusAssignee: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.StatusAssignee;
|
|
34
34
|
export declare const isLookup: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Lookup;
|
|
35
35
|
export declare const isLookupCopy: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.SingleLineText | kintonePrettyType.MultiLineText | kintonePrettyType.RichText | kintonePrettyType.Number | kintonePrettyType.Calc | kintonePrettyType.CheckBox | kintonePrettyType.RadioButton | kintonePrettyType.MultiSelect | kintonePrettyType.Dropdown | kintonePrettyType.UserSelect | kintonePrettyType.OrganizationSelect | kintonePrettyType.GroupSelect | kintonePrettyType.Date | kintonePrettyType.Time | kintonePrettyType.DateTime | kintonePrettyType.Link;
|
|
36
|
-
export declare const
|
|
37
|
-
|
|
36
|
+
export declare const isInGroup: <T extends kintonePrettyType.OneOf>(field: T) => field is T & {
|
|
37
|
+
group: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const isInSubtable: <T extends kintonePrettyType.OneOf>(field: T) => field is T & {
|
|
38
40
|
table: string;
|
|
39
41
|
};
|
|
40
42
|
//# sourceMappingURL=formField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formField.d.ts","sourceRoot":"","sources":["../../src/functions/formField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAEnE,eAAO,MAAM,cAAc,UAAW,kBAAkB,KAAK,4CAA4E,CAAC;AAC1I,eAAO,MAAM,SAAS,UAAW,kBAAkB,KAAK,uCAAiE,CAAC;AAC1H,eAAO,MAAM,aAAa,UAAW,kBAAkB,KAAK,2CAA0E,CAAC;AACvI,eAAO,MAAM,UAAU,UAAW,kBAAkB,KAAK,wCAAmE,CAAC;AAC7H,eAAO,MAAM,aAAa,UAAW,kBAAkB,KAAK,2CAA0E,CAAC;AACvI,eAAO,MAAM,gBAAgB,UAAW,kBAAkB,KAAK,8CAC5B,CAAC;AACpC,eAAO,MAAM,eAAe,UAAW,kBAAkB,KAAK,6CAC5B,CAAC;AACnC,eAAO,MAAM,UAAU,UAAW,kBAAkB,KAAK,wCAAoE,CAAC;AAC9H,eAAO,MAAM,QAAQ,UAAW,kBAAkB,KAAK,sCAA+D,CAAC;AACvH,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,UAAU,UAAW,kBAAkB,KAAK,wCAAoE,CAAC;AAC9H,eAAO,MAAM,aAAa,UAAW,kBAAkB,KAAK,2CAA0E,CAAC;AACvI,eAAO,MAAM,aAAa,UAAW,kBAAkB,KAAK,2CAA0E,CAAC;AACvI,eAAO,MAAM,UAAU,UAAW,kBAAkB,KAAK,wCAAoE,CAAC;AAC9H,eAAO,MAAM,YAAY,UAAW,kBAAkB,KAAK,0CAAwE,CAAC;AACpI,eAAO,M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H,eAAO,MAAM,gBAAgB,UAAW,kBAAkB,KAAK,8CAC7B,CAAC;AACnC,eAAO,MAAM,UAAU,UAAW,kBAAkB,KAAK,wCAAmE,CAAC;AAC7H,eAAO,MAAM,QAAQ,UAAW,kBAAkB,KAAK,sCAA+D,CAAC;AACvH,eAAO,MAAM,gBAAgB,UAAW,kBAAkB,KAAK,8CAC7B,CAAC;AAEnC,eAAO,MAAM,QAAQ,UAAW,kBAAkB,KAAK,sCAOtD,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,kBAAkB,KAAK,yeAmC/B,CAAC;AACF,eAAO,MAAM,SAAS;WAAwE,MAAM;CAAsB,CAAC;AAC3H,eAAO,MAAM,YAAY;WAAwE,MAAM;CAAsB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,8 +34,10 @@ declare const kintonePrettyFields: {
|
|
|
34
34
|
isStatusAssignee: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.StatusAssignee;
|
|
35
35
|
isLookup: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Lookup;
|
|
36
36
|
isLookupCopy: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.SingleLineText | kintonePrettyType.MultiLineText | kintonePrettyType.RichText | kintonePrettyType.Number | kintonePrettyType.Calc | kintonePrettyType.CheckBox | kintonePrettyType.RadioButton | kintonePrettyType.MultiSelect | kintonePrettyType.Dropdown | kintonePrettyType.UserSelect | kintonePrettyType.OrganizationSelect | kintonePrettyType.GroupSelect | kintonePrettyType.Date | kintonePrettyType.Time | kintonePrettyType.DateTime | kintonePrettyType.Link;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
isInGroup: <T extends kintonePrettyType.OneOf>(field: T) => field is T & {
|
|
38
|
+
group: string;
|
|
39
|
+
};
|
|
40
|
+
isInSubtable: <T_1 extends kintonePrettyType.OneOf>(field: T_1) => field is T_1 & {
|
|
39
41
|
table: string;
|
|
40
42
|
};
|
|
41
43
|
get: ({ client, app, lang, preview }: {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAGlE,QAAA,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAGlE,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAqC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
const v = (t) => t.type === "RECORD_NUMBER",
|
|
1
|
+
const v = (t) => t.type === "RECORD_NUMBER", X = (t) => t.type === "CREATOR", w = (t) => t.type === "CREATED_TIME", H = (t) => t.type === "MODIFIER", z = (t) => t.type === "UPDATED_TIME", E = (t) => t.type === "SINGLE_LINE_TEXT", m = (t) => t.type === "MULTI_LINE_TEXT", R = (t) => t.type === "RICH_TEXT", l = (t) => t.type === "NUMBER", g = (t) => t.type === "CALC", _ = (t) => t.type === "CHECK_BOX", O = (t) => t.type === "RADIO_BUTTON", b = (t) => t.type === "MULTI_SELECT", I = (t) => t.type === "DROP_DOWN", A = (t) => t.type === "USER_SELECT", f = (t) => t.type === "ORGANIZATION_SELECT", D = (t) => t.type === "GROUP_SELECT", N = (t) => t.type === "DATE", M = (t) => t.type === "TIME", U = (t) => t.type === "DATETIME", F = (t) => t.type === "LINK", K = (t) => t.type === "FILE", W = (t) => t.type === "SUBTABLE", Z = (t) => t.type === "GROUP", Y = (t) => t.type === "REFERENCE_TABLE", q = (t) => t.type === "CATEGORY", J = (t) => t.type === "STATUS", Q = (t) => t.type === "STATUS_ASSIGNEE", V = (t) => !!(E(t) && "lookup" in t || l(t) && "lookup" in t || g(t) && "lookup" in t || F(t) && "lookup" in t || v(t) && "lookup" in t), $ = (t) => !!(E(t) && "isLookupCopy" in t || m(t) && "isLookupCopy" in t || R(t) && "isLookupCopy" in t || l(t) && "isLookupCopy" in t || g(t) && "isLookupCopy" in t || _(t) && "isLookupCopy" in t || O(t) && "isLookupCopy" in t || b(t) && "isLookupCopy" in t || I(t) && "isLookupCopy" in t || A(t) && "isLookupCopy" in t || f(t) && "isLookupCopy" in t || D(t) && "isLookupCopy" in t || N(t) && "isLookupCopy" in t || M(t) && "isLookupCopy" in t || U(t) && "isLookupCopy" in t || F(t) && "isLookupCopy" in t), ee = (t) => "group" in t, te = (t) => "table" in t, ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2
2
|
__proto__: null,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
isCalc: g,
|
|
4
|
+
isCategory: q,
|
|
5
|
+
isCheckBox: _,
|
|
6
|
+
isCreatedTime: w,
|
|
7
|
+
isCreator: X,
|
|
8
|
+
isDate: N,
|
|
9
|
+
isDatetime: U,
|
|
10
|
+
isDropDown: I,
|
|
11
|
+
isFile: K,
|
|
12
|
+
isGroup: Z,
|
|
13
|
+
isGroupSelect: D,
|
|
14
|
+
isInGroup: ee,
|
|
15
15
|
isInSubtable: te,
|
|
16
16
|
isLink: F,
|
|
17
|
-
isLookup:
|
|
17
|
+
isLookup: V,
|
|
18
18
|
isLookupCopy: $,
|
|
19
|
-
isModifier:
|
|
20
|
-
isMultiLineText:
|
|
21
|
-
isMultiSelect:
|
|
19
|
+
isModifier: H,
|
|
20
|
+
isMultiLineText: m,
|
|
21
|
+
isMultiSelect: b,
|
|
22
22
|
isNumber: l,
|
|
23
|
-
isOrganizationSelect:
|
|
24
|
-
isRadioButton:
|
|
23
|
+
isOrganizationSelect: f,
|
|
24
|
+
isRadioButton: O,
|
|
25
25
|
isRecordNumber: v,
|
|
26
|
-
isReferenceTable:
|
|
27
|
-
isRichText:
|
|
26
|
+
isReferenceTable: Y,
|
|
27
|
+
isRichText: R,
|
|
28
28
|
isSingleLineText: E,
|
|
29
|
-
isStatus:
|
|
30
|
-
isStatusAssignee:
|
|
31
|
-
isSubtable:
|
|
32
|
-
isTime:
|
|
33
|
-
isUpdatedTime:
|
|
34
|
-
isUserSelect:
|
|
29
|
+
isStatus: J,
|
|
30
|
+
isStatusAssignee: Q,
|
|
31
|
+
isSubtable: W,
|
|
32
|
+
isTime: M,
|
|
33
|
+
isUpdatedTime: z,
|
|
34
|
+
isUserSelect: A
|
|
35
35
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
36
|
-
var
|
|
37
|
-
(function(t,
|
|
38
|
-
(function(
|
|
39
|
-
|
|
40
|
-
})(
|
|
41
|
-
const
|
|
42
|
-
|
|
36
|
+
var oe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, S = { exports: {} };
|
|
37
|
+
(function(t, d) {
|
|
38
|
+
(function(o, c) {
|
|
39
|
+
c(d);
|
|
40
|
+
})(oe, function(o) {
|
|
41
|
+
const c = Object.freeze(Object.defineProperty({ __proto__: null, isCalc: (e) => e.type === "CALC", isCategory: (e) => e.type === "CATEGORY", isCheckBox: (e) => e.type === "CHECK_BOX", isCreatedTime: (e) => e.type === "CREATED_TIME", isCreator: (e) => e.type === "CREATOR", isDate: (e) => e.type === "DATE", isDatetime: (e) => e.type === "DATETIME", isDropDown: (e) => e.type === "DROP_DOWN", isFile: (e) => e.type === "FILE", isGroup: (e) => e.type === "GROUP", isGroupSelect: (e) => e.type === "GROUP_SELECT", isLink: (e) => e.type === "LINK", isLookup: (e) => (e.type === "SINGLE_LINE_TEXT" || e.type === "NUMBER") && "lookup" in e, isModifier: (e) => e.type === "MODIFIER", isMultiLineText: (e) => e.type === "MULTI_LINE_TEXT", isMultiSelect: (e) => e.type === "MULTI_SELECT", isNumber: (e) => e.type === "NUMBER", isOrganizationSelect: (e) => e.type === "ORGANIZATION_SELECT", isRadioButton: (e) => e.type === "RADIO_BUTTON", isRecordNumber: (e) => e.type === "RECORD_NUMBER", isReferenceTable: (e) => e.type === "REFERENCE_TABLE", isRichText: (e) => e.type === "RICH_TEXT", isSingleLineText: (e) => e.type === "SINGLE_LINE_TEXT", isStatus: (e) => e.type === "STATUS", isStatusAssignee: (e) => e.type === "STATUS_ASSIGNEE", isSubtable: (e) => e.type === "SUBTABLE", isTime: (e) => e.type === "TIME", isUpdatedTime: (e) => e.type === "UPDATED_TIME", isUserSelect: (e) => e.type === "USER_SELECT" }, Symbol.toStringTag, { value: "Module" })), y = Object.freeze(Object.defineProperty({ __proto__: null, isCalc: (e) => e.type === "CALC", isCheckBox: (e) => e.type === "CHECK_BOX", isCreatedTime: (e) => e.type === "CREATED_TIME", isCreator: (e) => e.type === "CREATOR", isDate: (e) => e.type === "DATE", isDatetime: (e) => e.type === "DATETIME", isDropDown: (e) => e.type === "DROP_DOWN", isFile: (e) => e.type === "FILE", isGroup: (e) => e.type === "GROUP", isGroupSelect: (e) => e.type === "GROUP_SELECT", isHr: (e) => e.type === "HR", isLabel: (e) => e.type === "LABEL", isLink: (e) => e.type === "LINK", isModifier: (e) => e.type === "MODIFIER", isMultiLineText: (e) => e.type === "MULTI_LINE_TEXT", isMultiSelect: (e) => e.type === "MULTI_SELECT", isNumber: (e) => e.type === "NUMBER", isOrganizationSelect: (e) => e.type === "ORGANIZATION_SELECT", isRadioButon: (e) => e.type === "RADIO_BUTTON", isRecordNumber: (e) => e.type === "RECORD_NUMBER", isReferenceTable: (e) => e.type === "REFERENCE_TABLE", isRichText: (e) => e.type === "RICH_TEXT", isRow: (e) => e.type === "ROW", isSingleLineText: (e) => e.type === "SINGLE_LINE_TEXT", isSpacer: (e) => e.type === "SPACER", isSubtable: (e) => e.type === "SUBTABLE", isTime: (e) => e.type === "TIME", isUpdatedTime: (e) => e.type === "UPDATED_TIME", isUserSelect: (e) => e.type === "USER_SELECT" }, Symbol.toStringTag, { value: "Module" })), T = Object.freeze(Object.defineProperty({ __proto__: null, isCalc: (e) => e.type === "CALC", isCategory: (e) => e.type === "CATEGORY", isCheckBox: (e) => e.type === "CHECK_BOX", isCreatedTime: (e) => e.type === "CREATED_TIME", isCreator: (e) => e.type === "CREATOR", isDate: (e) => e.type === "DATE", isDatetime: (e) => e.type === "DATETIME", isDropDown: (e) => e.type === "DROP_DOWN", isFile: (e) => e.type === "FILE", isGroupSelect: (e) => e.type === "GROUP_SELECT", isLink: (e) => e.type === "LINK", isModifier: (e) => e.type === "MODIFIER", isMultiLineText: (e) => e.type === "MULTI_LINE_TEXT", isMultiSelect: (e) => e.type === "MULTI_SELECT", isNumber: (e) => e.type === "NUMBER", isOrganizationSelect: (e) => e.type === "ORGANIZATION_SELECT", isRadioButton: (e) => e.type === "RADIO_BUTTON", isRecordNumber: (e) => e.type === "RECORD_NUMBER", isRichText: (e) => e.type === "RICH_TEXT", isSingleLineText: (e) => e.type === "SINGLE_LINE_TEXT", isStatus: (e) => e.type === "STATUS", isStatusAssignee: (e) => e.type === "STATUS_ASSIGNEE", isSubtable: (e) => e.type === "SUBTABLE", isTime: (e) => e.type === "TIME", isUpdatedTime: (e) => e.type === "UPDATED_TIME", isUserSelect: (e) => e.type === "USER_SELECT" }, Symbol.toStringTag, { value: "Module" }));
|
|
42
|
+
o.guardFormField = c, o.guardFormLayout = y, o.guardRecord = T, Object.defineProperty(o, Symbol.toStringTag, { value: "Module" });
|
|
43
43
|
});
|
|
44
|
-
})(
|
|
45
|
-
var
|
|
46
|
-
const
|
|
44
|
+
})(S, S.exports);
|
|
45
|
+
var i = S.exports;
|
|
46
|
+
const C = (t) => Object.values(t).sort((d, o) => Number(d.index) - Number(o.index)).map(({ label: d }) => d), se = (t, d) => {
|
|
47
47
|
var P;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const T = Object.values(t).find(
|
|
51
|
-
T && T.enabled &&
|
|
52
|
-
const e = Object.values(t).find(
|
|
53
|
-
e && e.enabled &&
|
|
54
|
-
for (const p of
|
|
55
|
-
if (
|
|
48
|
+
const o = [], c = [], y = Object.values(t).find(i.guardFormField.isStatus);
|
|
49
|
+
y && y.enabled && o.push(y);
|
|
50
|
+
const T = Object.values(t).find(i.guardFormField.isStatusAssignee);
|
|
51
|
+
T && T.enabled && o.push(T);
|
|
52
|
+
const e = Object.values(t).find(i.guardFormField.isCategory);
|
|
53
|
+
e && e.enabled && o.push(e);
|
|
54
|
+
for (const p of d)
|
|
55
|
+
if (i.guardFormLayout.isRow(p))
|
|
56
56
|
for (const r of p.fields) {
|
|
57
|
-
if (
|
|
57
|
+
if (i.guardFormLayout.isLabel(r) || i.guardFormLayout.isHr(r))
|
|
58
58
|
continue;
|
|
59
|
-
if (
|
|
60
|
-
|
|
59
|
+
if (i.guardFormLayout.isSpacer(r)) {
|
|
60
|
+
c.push(r);
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
63
|
const u = t[r.code];
|
|
64
|
-
if (!
|
|
65
|
-
if (
|
|
66
|
-
const s =
|
|
67
|
-
|
|
64
|
+
if (!i.guardFormField.isSubtable(u) && !i.guardFormField.isGroup(u)) {
|
|
65
|
+
if (i.guardFormField.isCheckBox(u) || i.guardFormField.isDropDown(u) || i.guardFormField.isMultiSelect(u) || i.guardFormField.isRadioButton(u)) {
|
|
66
|
+
const s = C(u.options);
|
|
67
|
+
o.push({ ...u, sortedOptions: s });
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
o.push(u);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
else if (
|
|
73
|
+
else if (i.guardFormLayout.isSubtable(p)) {
|
|
74
74
|
const r = p.code, u = t[r];
|
|
75
|
-
if (!
|
|
75
|
+
if (!i.guardFormField.isSubtable(u))
|
|
76
76
|
continue;
|
|
77
77
|
const s = {};
|
|
78
|
-
for (const { code:
|
|
79
|
-
const a = u.fields[
|
|
80
|
-
if (
|
|
81
|
-
const n =
|
|
82
|
-
s[a.code] = { ...a, table: r, sortedOptions: n },
|
|
78
|
+
for (const { code: L } of p.fields) {
|
|
79
|
+
const a = u.fields[L];
|
|
80
|
+
if (i.guardFormField.isCheckBox(a) || i.guardFormField.isDropDown(a) || i.guardFormField.isMultiSelect(a) || i.guardFormField.isRadioButton(a)) {
|
|
81
|
+
const n = C(a.options);
|
|
82
|
+
s[a.code] = { ...a, table: r, sortedOptions: n }, o.push({ ...a, table: r, sortedOptions: n });
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
|
-
s[a.code] = { ...a, table: r },
|
|
85
|
+
s[a.code] = { ...a, table: r }, o.push({ ...a, table: r });
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
} else if (
|
|
87
|
+
o.push({ ...u, fields: s });
|
|
88
|
+
} else if (i.guardFormLayout.isGroup(p)) {
|
|
89
89
|
const r = p.code, u = t[r];
|
|
90
|
-
if (!
|
|
90
|
+
if (!i.guardFormField.isGroup(u))
|
|
91
91
|
continue;
|
|
92
92
|
const s = {};
|
|
93
|
-
for (const
|
|
94
|
-
for (const a of
|
|
95
|
-
if (
|
|
93
|
+
for (const L of p.layout)
|
|
94
|
+
for (const a of L.fields) {
|
|
95
|
+
if (i.guardFormLayout.isLabel(a) || i.guardFormLayout.isHr(a))
|
|
96
96
|
continue;
|
|
97
|
-
if (
|
|
98
|
-
|
|
97
|
+
if (i.guardFormLayout.isSpacer(a)) {
|
|
98
|
+
c.push(a);
|
|
99
99
|
continue;
|
|
100
100
|
}
|
|
101
101
|
const n = t[a.code];
|
|
102
|
-
if (!
|
|
103
|
-
if (
|
|
104
|
-
const j =
|
|
105
|
-
s[n.code] = { ...n, group: r, sortedOptions: j },
|
|
102
|
+
if (!i.guardFormField.isCategory(n) && !i.guardFormField.isStatus(n) && !i.guardFormField.isStatusAssignee(n) && !i.guardFormField.isSubtable(n) && !i.guardFormField.isGroup(n)) {
|
|
103
|
+
if (i.guardFormField.isCheckBox(n) || i.guardFormField.isDropDown(n) || i.guardFormField.isMultiSelect(n) || i.guardFormField.isRadioButton(n)) {
|
|
104
|
+
const j = C(n.options);
|
|
105
|
+
s[n.code] = { ...n, group: r, sortedOptions: j }, o.push({ ...n, group: r, sortedOptions: j });
|
|
106
106
|
continue;
|
|
107
107
|
}
|
|
108
|
-
s[n.code] = { ...n, group: r },
|
|
108
|
+
s[n.code] = { ...n, group: r }, o.push({ ...n, group: r });
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
o.push({ ...u, fields: s });
|
|
112
112
|
}
|
|
113
|
-
for (const p of Object.values(
|
|
114
|
-
if (
|
|
113
|
+
for (const p of Object.values(o))
|
|
114
|
+
if (i.guardFormField.isLookup(p)) {
|
|
115
115
|
if (p.lookup === null)
|
|
116
116
|
continue;
|
|
117
117
|
for (const r of p.lookup.fieldMappings) {
|
|
118
|
-
const u = (P =
|
|
119
|
-
(s) => E(s) || l(s) ||
|
|
118
|
+
const u = (P = o.filter(
|
|
119
|
+
(s) => E(s) || l(s) || m(s) || R(s) || F(s) || _(s) || O(s) || I(s) || b(s) || N(s) || M(s) || U(s) || A(s) || f(s) || D(s)
|
|
120
120
|
)) == null ? void 0 : P.find((s) => s.code === r.field);
|
|
121
121
|
u && (u.isLookupCopy = !0);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const k = Object.values(t).find(
|
|
125
|
-
k && (
|
|
126
|
-
const B = Object.values(t).find(
|
|
127
|
-
B && (
|
|
128
|
-
const G = Object.values(t).find(
|
|
129
|
-
G && (
|
|
130
|
-
const h = Object.values(t).find(
|
|
131
|
-
h && (
|
|
132
|
-
const x = Object.values(t).find(
|
|
133
|
-
return x && (
|
|
134
|
-
}, re = async ({ client: t, app:
|
|
135
|
-
const [{ properties:
|
|
136
|
-
t.app.getFormFields({ app:
|
|
137
|
-
t.app.getFormLayout({ app:
|
|
124
|
+
const k = Object.values(t).find(i.guardFormField.isRecordNumber);
|
|
125
|
+
k && (o.some(i.guardFormField.isRecordNumber) || o.push(k));
|
|
126
|
+
const B = Object.values(t).find(i.guardFormField.isCreator);
|
|
127
|
+
B && (o.some(i.guardFormField.isCreator) || o.push(B));
|
|
128
|
+
const G = Object.values(t).find(i.guardFormField.isCreatedTime);
|
|
129
|
+
G && (o.some(i.guardFormField.isCreatedTime) || o.push(G));
|
|
130
|
+
const h = Object.values(t).find(i.guardFormField.isModifier);
|
|
131
|
+
h && (o.some(i.guardFormField.isModifier) || o.push(h));
|
|
132
|
+
const x = Object.values(t).find(i.guardFormField.isUpdatedTime);
|
|
133
|
+
return x && (o.some(i.guardFormField.isUpdatedTime) || o.push(x)), { fields: o, spacers: c };
|
|
134
|
+
}, re = async ({ client: t, app: d, lang: o, preview: c }) => {
|
|
135
|
+
const [{ properties: y }, { layout: T }] = await Promise.all([
|
|
136
|
+
t.app.getFormFields({ app: d, lang: o, preview: c }),
|
|
137
|
+
t.app.getFormLayout({ app: d, preview: c })
|
|
138
138
|
]);
|
|
139
|
-
return se(
|
|
140
|
-
}, ue = { get: re, ...
|
|
139
|
+
return se(y, T);
|
|
140
|
+
}, ue = { get: re, ...ie };
|
|
141
141
|
export {
|
|
142
142
|
ue as kintonePrettyFields
|
|
143
143
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(E,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(E=typeof globalThis<"u"?globalThis:E||self,l(E.KintonePrettyFields={}))})(this,function(E){"use strict";const l=t=>t.type==="RECORD_NUMBER",
|
|
1
|
+
(function(E,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(E=typeof globalThis<"u"?globalThis:E||self,l(E.KintonePrettyFields={}))})(this,function(E){"use strict";const l=t=>t.type==="RECORD_NUMBER",w=t=>t.type==="CREATOR",H=t=>t.type==="CREATED_TIME",K=t=>t.type==="MODIFIER",z=t=>t.type==="UPDATED_TIME",F=t=>t.type==="SINGLE_LINE_TEXT",m=t=>t.type==="MULTI_LINE_TEXT",C=t=>t.type==="RICH_TEXT",L=t=>t.type==="NUMBER",R=t=>t.type==="CALC",g=t=>t.type==="CHECK_BOX",_=t=>t.type==="RADIO_BUTTON",b=t=>t.type==="MULTI_SELECT",f=t=>t.type==="DROP_DOWN",O=t=>t.type==="USER_SELECT",I=t=>t.type==="ORGANIZATION_SELECT",A=t=>t.type==="GROUP_SELECT",D=t=>t.type==="DATE",M=t=>t.type==="TIME",N=t=>t.type==="DATETIME",S=t=>t.type==="LINK",W=Object.freeze(Object.defineProperty({__proto__:null,isCalc:R,isCategory:t=>t.type==="CATEGORY",isCheckBox:g,isCreatedTime:H,isCreator:w,isDate:D,isDatetime:N,isDropDown:f,isFile:t=>t.type==="FILE",isGroup:t=>t.type==="GROUP",isGroupSelect:A,isInGroup:t=>"group"in t,isInSubtable:t=>"table"in t,isLink:S,isLookup:t=>!!(F(t)&&"lookup"in t||L(t)&&"lookup"in t||R(t)&&"lookup"in t||S(t)&&"lookup"in t||l(t)&&"lookup"in t),isLookupCopy:t=>!!(F(t)&&"isLookupCopy"in t||m(t)&&"isLookupCopy"in t||C(t)&&"isLookupCopy"in t||L(t)&&"isLookupCopy"in t||R(t)&&"isLookupCopy"in t||g(t)&&"isLookupCopy"in t||_(t)&&"isLookupCopy"in t||b(t)&&"isLookupCopy"in t||f(t)&&"isLookupCopy"in t||O(t)&&"isLookupCopy"in t||I(t)&&"isLookupCopy"in t||A(t)&&"isLookupCopy"in t||D(t)&&"isLookupCopy"in t||M(t)&&"isLookupCopy"in t||N(t)&&"isLookupCopy"in t||S(t)&&"isLookupCopy"in t),isModifier:K,isMultiLineText:m,isMultiSelect:b,isNumber:L,isOrganizationSelect:I,isRadioButton:_,isRecordNumber:l,isReferenceTable:t=>t.type==="REFERENCE_TABLE",isRichText:C,isSingleLineText:F,isStatus:t=>t.type==="STATUS",isStatusAssignee:t=>t.type==="STATUS_ASSIGNEE",isSubtable:t=>t.type==="SUBTABLE",isTime:M,isUpdatedTime:z,isUserSelect:O},Symbol.toStringTag,{value:"Module"}));var Z=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},U={exports:{}};(function(t,d){(function(o,c){c(d)})(Z,function(o){const c=Object.freeze(Object.defineProperty({__proto__:null,isCalc:e=>e.type==="CALC",isCategory:e=>e.type==="CATEGORY",isCheckBox:e=>e.type==="CHECK_BOX",isCreatedTime:e=>e.type==="CREATED_TIME",isCreator:e=>e.type==="CREATOR",isDate:e=>e.type==="DATE",isDatetime:e=>e.type==="DATETIME",isDropDown:e=>e.type==="DROP_DOWN",isFile:e=>e.type==="FILE",isGroup:e=>e.type==="GROUP",isGroupSelect:e=>e.type==="GROUP_SELECT",isLink:e=>e.type==="LINK",isLookup:e=>(e.type==="SINGLE_LINE_TEXT"||e.type==="NUMBER")&&"lookup"in e,isModifier:e=>e.type==="MODIFIER",isMultiLineText:e=>e.type==="MULTI_LINE_TEXT",isMultiSelect:e=>e.type==="MULTI_SELECT",isNumber:e=>e.type==="NUMBER",isOrganizationSelect:e=>e.type==="ORGANIZATION_SELECT",isRadioButton:e=>e.type==="RADIO_BUTTON",isRecordNumber:e=>e.type==="RECORD_NUMBER",isReferenceTable:e=>e.type==="REFERENCE_TABLE",isRichText:e=>e.type==="RICH_TEXT",isSingleLineText:e=>e.type==="SINGLE_LINE_TEXT",isStatus:e=>e.type==="STATUS",isStatusAssignee:e=>e.type==="STATUS_ASSIGNEE",isSubtable:e=>e.type==="SUBTABLE",isTime:e=>e.type==="TIME",isUpdatedTime:e=>e.type==="UPDATED_TIME",isUserSelect:e=>e.type==="USER_SELECT"},Symbol.toStringTag,{value:"Module"})),y=Object.freeze(Object.defineProperty({__proto__:null,isCalc:e=>e.type==="CALC",isCheckBox:e=>e.type==="CHECK_BOX",isCreatedTime:e=>e.type==="CREATED_TIME",isCreator:e=>e.type==="CREATOR",isDate:e=>e.type==="DATE",isDatetime:e=>e.type==="DATETIME",isDropDown:e=>e.type==="DROP_DOWN",isFile:e=>e.type==="FILE",isGroup:e=>e.type==="GROUP",isGroupSelect:e=>e.type==="GROUP_SELECT",isHr:e=>e.type==="HR",isLabel:e=>e.type==="LABEL",isLink:e=>e.type==="LINK",isModifier:e=>e.type==="MODIFIER",isMultiLineText:e=>e.type==="MULTI_LINE_TEXT",isMultiSelect:e=>e.type==="MULTI_SELECT",isNumber:e=>e.type==="NUMBER",isOrganizationSelect:e=>e.type==="ORGANIZATION_SELECT",isRadioButon:e=>e.type==="RADIO_BUTTON",isRecordNumber:e=>e.type==="RECORD_NUMBER",isReferenceTable:e=>e.type==="REFERENCE_TABLE",isRichText:e=>e.type==="RICH_TEXT",isRow:e=>e.type==="ROW",isSingleLineText:e=>e.type==="SINGLE_LINE_TEXT",isSpacer:e=>e.type==="SPACER",isSubtable:e=>e.type==="SUBTABLE",isTime:e=>e.type==="TIME",isUpdatedTime:e=>e.type==="UPDATED_TIME",isUserSelect:e=>e.type==="USER_SELECT"},Symbol.toStringTag,{value:"Module"})),T=Object.freeze(Object.defineProperty({__proto__:null,isCalc:e=>e.type==="CALC",isCategory:e=>e.type==="CATEGORY",isCheckBox:e=>e.type==="CHECK_BOX",isCreatedTime:e=>e.type==="CREATED_TIME",isCreator:e=>e.type==="CREATOR",isDate:e=>e.type==="DATE",isDatetime:e=>e.type==="DATETIME",isDropDown:e=>e.type==="DROP_DOWN",isFile:e=>e.type==="FILE",isGroupSelect:e=>e.type==="GROUP_SELECT",isLink:e=>e.type==="LINK",isModifier:e=>e.type==="MODIFIER",isMultiLineText:e=>e.type==="MULTI_LINE_TEXT",isMultiSelect:e=>e.type==="MULTI_SELECT",isNumber:e=>e.type==="NUMBER",isOrganizationSelect:e=>e.type==="ORGANIZATION_SELECT",isRadioButton:e=>e.type==="RADIO_BUTTON",isRecordNumber:e=>e.type==="RECORD_NUMBER",isRichText:e=>e.type==="RICH_TEXT",isSingleLineText:e=>e.type==="SINGLE_LINE_TEXT",isStatus:e=>e.type==="STATUS",isStatusAssignee:e=>e.type==="STATUS_ASSIGNEE",isSubtable:e=>e.type==="SUBTABLE",isTime:e=>e.type==="TIME",isUpdatedTime:e=>e.type==="UPDATED_TIME",isUserSelect:e=>e.type==="USER_SELECT"},Symbol.toStringTag,{value:"Module"}));o.guardFormField=c,o.guardFormLayout=y,o.guardRecord=T,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})})})(U,U.exports);var i=U.exports;const k=t=>Object.values(t).sort((d,o)=>Number(d.index)-Number(o.index)).map(({label:d})=>d),Y=(t,d)=>{var v;const o=[],c=[],y=Object.values(t).find(i.guardFormField.isStatus);y&&y.enabled&&o.push(y);const T=Object.values(t).find(i.guardFormField.isStatusAssignee);T&&T.enabled&&o.push(T);const e=Object.values(t).find(i.guardFormField.isCategory);e&&e.enabled&&o.push(e);for(const p of d)if(i.guardFormLayout.isRow(p))for(const r of p.fields){if(i.guardFormLayout.isLabel(r)||i.guardFormLayout.isHr(r))continue;if(i.guardFormLayout.isSpacer(r)){c.push(r);continue}const u=t[r.code];if(!i.guardFormField.isSubtable(u)&&!i.guardFormField.isGroup(u)){if(i.guardFormField.isCheckBox(u)||i.guardFormField.isDropDown(u)||i.guardFormField.isMultiSelect(u)||i.guardFormField.isRadioButton(u)){const s=k(u.options);o.push({...u,sortedOptions:s});continue}o.push(u)}}else if(i.guardFormLayout.isSubtable(p)){const r=p.code,u=t[r];if(!i.guardFormField.isSubtable(u))continue;const s={};for(const{code:B}of p.fields){const a=u.fields[B];if(i.guardFormField.isCheckBox(a)||i.guardFormField.isDropDown(a)||i.guardFormField.isMultiSelect(a)||i.guardFormField.isRadioButton(a)){const n=k(a.options);s[a.code]={...a,table:r,sortedOptions:n},o.push({...a,table:r,sortedOptions:n});continue}s[a.code]={...a,table:r},o.push({...a,table:r})}o.push({...u,fields:s})}else if(i.guardFormLayout.isGroup(p)){const r=p.code,u=t[r];if(!i.guardFormField.isGroup(u))continue;const s={};for(const B of p.layout)for(const a of B.fields){if(i.guardFormLayout.isLabel(a)||i.guardFormLayout.isHr(a))continue;if(i.guardFormLayout.isSpacer(a)){c.push(a);continue}const n=t[a.code];if(!i.guardFormField.isCategory(n)&&!i.guardFormField.isStatus(n)&&!i.guardFormField.isStatusAssignee(n)&&!i.guardFormField.isSubtable(n)&&!i.guardFormField.isGroup(n)){if(i.guardFormField.isCheckBox(n)||i.guardFormField.isDropDown(n)||i.guardFormField.isMultiSelect(n)||i.guardFormField.isRadioButton(n)){const X=k(n.options);s[n.code]={...n,group:r,sortedOptions:X},o.push({...n,group:r,sortedOptions:X});continue}s[n.code]={...n,group:r},o.push({...n,group:r})}}o.push({...u,fields:s})}for(const p of Object.values(o))if(i.guardFormField.isLookup(p)){if(p.lookup===null)continue;for(const r of p.lookup.fieldMappings){const u=(v=o.filter(s=>F(s)||L(s)||m(s)||C(s)||S(s)||g(s)||_(s)||f(s)||b(s)||D(s)||M(s)||N(s)||O(s)||I(s)||A(s)))==null?void 0:v.find(s=>s.code===r.field);u&&(u.isLookupCopy=!0)}}const G=Object.values(t).find(i.guardFormField.isRecordNumber);G&&(o.some(i.guardFormField.isRecordNumber)||o.push(G));const h=Object.values(t).find(i.guardFormField.isCreator);h&&(o.some(i.guardFormField.isCreator)||o.push(h));const x=Object.values(t).find(i.guardFormField.isCreatedTime);x&&(o.some(i.guardFormField.isCreatedTime)||o.push(x));const P=Object.values(t).find(i.guardFormField.isModifier);P&&(o.some(i.guardFormField.isModifier)||o.push(P));const j=Object.values(t).find(i.guardFormField.isUpdatedTime);return j&&(o.some(i.guardFormField.isUpdatedTime)||o.push(j)),{fields:o,spacers:c}},q={get:async({client:t,app:d,lang:o,preview:c})=>{const[{properties:y},{layout:T}]=await Promise.all([t.app.getFormFields({app:d,lang:o,preview:c}),t.app.getFormLayout({app:d,preview:c})]);return Y(y,T)},...W};E.kintonePrettyFields=q,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|