kintone-pretty-fields 0.5.8 → 0.6.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.
@@ -21,7 +21,6 @@ export declare const isTime: (field: kintonePrettyType.OneOf) => field is kinton
21
21
  export declare const isDatetime: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.DateTime;
22
22
  export declare const isLink: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Link;
23
23
  export declare const isFile: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.File;
24
- export declare const isLookup: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Lookup;
25
24
  export declare const isSubtable: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Subtable<{
26
25
  [fieldCode: string]: kintonePrettyType.InSubtable;
27
26
  }>;
@@ -32,6 +31,8 @@ export declare const isReferenceTable: (field: kintonePrettyType.OneOf) => field
32
31
  export declare const isCategory: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Category;
33
32
  export declare const isStatus: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Status;
34
33
  export declare const isStatusAssignee: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.StatusAssignee;
34
+ export declare const isLookup: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Lookup;
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;
35
36
  export declare const enableInSubtable: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.InSubtable;
36
37
  export declare const isInSubtable: <T extends kintonePrettyType.InSubtable>(field: T) => field is T & {
37
38
  table: string;
@@ -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,MAAM,oBAAoB,UAAW,kBAAkB,KAAK,kDAC7B,CAAC;AACvC,eAAO,MAAM,aAAa,UAAW,kBAAkB,KAAK,2CAA0E,CAAC;AACvI,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,UAAU,UAAW,kBAAkB,KAAK,wCAAmE,CAAC;AAC7H,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,QAAQ,UAAW,kBAAkB,KAAK,sCAC8B,CAAC;AACtF,eAAO,MAAM,UAAU,UACd,kBAAkB,KAAK;;EAC0F,CAAC;AAC3H,eAAO,MAAM,OAAO,UACX,kBAAkB,KAAK;;EACiF,CAAC;AAClH,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;AACnC,eAAO,MAAM,gBAAgB,UAAW,kBAAkB,KAAK,0CAsB9D,CAAC;AACF,eAAO,MAAM,YAAY;WAA6E,MAAM;CAA+B,CAAC"}
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,MAAM,oBAAoB,UAAW,kBAAkB,KAAK,kDAC7B,CAAC;AACvC,eAAO,MAAM,aAAa,UAAW,kBAAkB,KAAK,2CAA0E,CAAC;AACvI,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,UAAU,UAAW,kBAAkB,KAAK,wCAAmE,CAAC;AAC7H,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,MAAM,UAAW,kBAAkB,KAAK,oCAA2D,CAAC;AACjH,eAAO,MAAM,UAAU,UACd,kBAAkB,KAAK;;EAC0F,CAAC;AAC3H,eAAO,MAAM,OAAO,UACX,kBAAkB,KAAK;;EACiF,CAAC;AAClH,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,gBAAgB,UAAW,kBAAkB,KAAK,0CAsB9D,CAAC;AACF,eAAO,MAAM,YAAY;WAA6E,MAAM;CAA+B,CAAC"}
@@ -1,7 +1,11 @@
1
1
  import { KintoneRestAPIClient } from "@kintone/rest-api-client";
2
- import { AppID, Lang } from "@kintone/rest-api-client/lib/src/client/types";
2
+ import { AppID, Lang, Layout, Properties } from "@kintone/rest-api-client/lib/src/client/types";
3
3
  import { Spacer } from "@kintone/rest-api-client/lib/src/KintoneFields/types/fieldLayout";
4
4
  import type * as kintonePrettyType from "../exportTypes/formField";
5
+ export declare const generateFields: (formFields: Properties, formLayouts: Layout) => {
6
+ fields: kintonePrettyType.OneOf[];
7
+ spacers: Spacer[];
8
+ };
5
9
  declare const get: ({ client, app, lang, preview }: {
6
10
  client: KintoneRestAPIClient;
7
11
  app: AppID;
@@ -1 +1 @@
1
- {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/functions/utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAsB,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,kEAAkE,CAAC;AAI1F,OAAO,KAAK,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAuNnE,QAAA,MAAM,GAAG;YAAoD,oBAAoB;SAAO,KAAK;UAAQ,IAAI;aAAW,OAAO;;;;EAO1H,CAAC;AAEF,OAAO,EAAE,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/functions/utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,kEAAkE,CAAC;AAI1F,OAAO,KAAK,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAanE,eAAO,MAAM,cAAc,eAAgB,UAAU;;;CAwMpD,CAAC;AAEF,QAAA,MAAM,GAAG;YAAoD,oBAAoB;SAAO,KAAK;UAAQ,IAAI;aAAW,OAAO;;;;EAO1H,CAAC;AAEF,OAAO,EAAE,GAAG,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -22,7 +22,6 @@ declare const kintonePrettyFields: {
22
22
  isDatetime: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.DateTime;
23
23
  isLink: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Link;
24
24
  isFile: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.File;
25
- isLookup: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Lookup;
26
25
  isSubtable: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Subtable<{
27
26
  [fieldCode: string]: kintonePrettyType.InSubtable;
28
27
  }>;
@@ -33,6 +32,8 @@ declare const kintonePrettyFields: {
33
32
  isCategory: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Category;
34
33
  isStatus: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Status;
35
34
  isStatusAssignee: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.StatusAssignee;
35
+ isLookup: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Lookup;
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;
36
37
  enableInSubtable: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.InSubtable;
37
38
  isInSubtable: <T extends kintonePrettyType.InSubtable>(field: T) => field is T & {
38
39
  table: string;
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAqC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
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,142 +1,143 @@
1
- const H = (t) => t.type === "RECORD_NUMBER", z = (t) => t.type === "CREATOR", K = (t) => t.type === "CREATED_TIME", W = (t) => t.type === "MODIFIER", Z = (t) => t.type === "UPDATED_TIME", S = (t) => t.type === "SINGLE_LINE_TEXT", m = (t) => t.type === "MULTI_LINE_TEXT", R = (t) => t.type === "RICH_TEXT", L = (t) => t.type === "NUMBER", j = (t) => t.type === "CALC", g = (t) => t.type === "CHECK_BOX", _ = (t) => t.type === "RADIO_BUTTON", C = (t) => t.type === "MULTI_SELECT", b = (t) => t.type === "DROP_DOWN", O = (t) => t.type === "USER_SELECT", I = (t) => t.type === "ORGANIZATION_SELECT", A = (t) => t.type === "GROUP_SELECT", f = (t) => t.type === "DATE", N = (t) => t.type === "TIME", D = (t) => t.type === "DATETIME", M = (t) => t.type === "LINK", v = (t) => t.type === "FILE", X = (t) => (t.type === "SINGLE_LINE_TEXT" || t.type === "NUMBER") && "lookup" in t, Y = (t) => t.type === "SUBTABLE", q = (t) => t.type === "GROUP", w = (t) => t.type === "REFERENCE_TABLE", J = (t) => t.type === "CATEGORY", Q = (t) => t.type === "STATUS", V = (t) => t.type === "STATUS_ASSIGNEE", $ = (t) => S(t) || L(t) || j(t) || m(t) || R(t) || M(t) || g(t) || _(t) || b(t) || C(t) || v(t) || f(t) || N(t) || D(t) || O(t) || I(t) || A(t) || w(t) || X(t), ee = (t) => t.table !== void 0, te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1
+ const v = (t) => t.type === "RECORD_NUMBER", z = (t) => t.type === "CREATOR", K = (t) => t.type === "CREATED_TIME", W = (t) => t.type === "MODIFIER", Z = (t) => t.type === "UPDATED_TIME", E = (t) => t.type === "SINGLE_LINE_TEXT", L = (t) => t.type === "MULTI_LINE_TEXT", S = (t) => t.type === "RICH_TEXT", l = (t) => t.type === "NUMBER", C = (t) => t.type === "CALC", m = (t) => t.type === "CHECK_BOX", R = (t) => t.type === "RADIO_BUTTON", g = (t) => t.type === "MULTI_SELECT", _ = (t) => t.type === "DROP_DOWN", b = (t) => t.type === "USER_SELECT", O = (t) => t.type === "ORGANIZATION_SELECT", I = (t) => t.type === "GROUP_SELECT", A = (t) => t.type === "DATE", D = (t) => t.type === "TIME", N = (t) => t.type === "DATETIME", F = (t) => t.type === "LINK", X = (t) => t.type === "FILE", Y = (t) => t.type === "SUBTABLE", q = (t) => t.type === "GROUP", w = (t) => t.type === "REFERENCE_TABLE", J = (t) => t.type === "CATEGORY", Q = (t) => t.type === "STATUS", V = (t) => t.type === "STATUS_ASSIGNEE", H = (t) => !!(E(t) && "lookup" in t || l(t) && "lookup" in t || C(t) && "lookup" in t || F(t) && "lookup" in t || v(t) && "lookup" in t), $ = (t) => !!(E(t) && "isLookupCopy" in t || L(t) && "isLookupCopy" in t || S(t) && "isLookupCopy" in t || l(t) && "isLookupCopy" in t || C(t) && "isLookupCopy" in t || m(t) && "isLookupCopy" in t || R(t) && "isLookupCopy" in t || g(t) && "isLookupCopy" in t || _(t) && "isLookupCopy" in t || b(t) && "isLookupCopy" in t || O(t) && "isLookupCopy" in t || I(t) && "isLookupCopy" in t || A(t) && "isLookupCopy" in t || D(t) && "isLookupCopy" in t || N(t) && "isLookupCopy" in t || F(t) && "isLookupCopy" in t), ee = (t) => E(t) || l(t) || C(t) || L(t) || S(t) || F(t) || m(t) || R(t) || _(t) || g(t) || X(t) || A(t) || D(t) || N(t) || b(t) || O(t) || I(t) || w(t) || H(t), te = (t) => t.table !== void 0, oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2
2
  __proto__: null,
3
- enableInSubtable: $,
4
- isCalc: j,
3
+ enableInSubtable: ee,
4
+ isCalc: C,
5
5
  isCategory: J,
6
- isCheckBox: g,
6
+ isCheckBox: m,
7
7
  isCreatedTime: K,
8
8
  isCreator: z,
9
- isDate: f,
10
- isDatetime: D,
11
- isDropDown: b,
12
- isFile: v,
9
+ isDate: A,
10
+ isDatetime: N,
11
+ isDropDown: _,
12
+ isFile: X,
13
13
  isGroup: q,
14
- isGroupSelect: A,
15
- isInSubtable: ee,
16
- isLink: M,
17
- isLookup: X,
14
+ isGroupSelect: I,
15
+ isInSubtable: te,
16
+ isLink: F,
17
+ isLookup: H,
18
+ isLookupCopy: $,
18
19
  isModifier: W,
19
- isMultiLineText: m,
20
- isMultiSelect: C,
21
- isNumber: L,
22
- isOrganizationSelect: I,
23
- isRadioButton: _,
24
- isRecordNumber: H,
20
+ isMultiLineText: L,
21
+ isMultiSelect: g,
22
+ isNumber: l,
23
+ isOrganizationSelect: O,
24
+ isRadioButton: R,
25
+ isRecordNumber: v,
25
26
  isReferenceTable: w,
26
- isRichText: R,
27
- isSingleLineText: S,
27
+ isRichText: S,
28
+ isSingleLineText: E,
28
29
  isStatus: Q,
29
30
  isStatusAssignee: V,
30
31
  isSubtable: Y,
31
- isTime: N,
32
+ isTime: D,
32
33
  isUpdatedTime: Z,
33
- isUserSelect: O
34
+ isUserSelect: b
34
35
  }, Symbol.toStringTag, { value: "Module" }));
35
- var ie = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, F = { exports: {} };
36
- (function(t, a) {
37
- (function(o, c) {
38
- c(a);
39
- })(ie, function(o) {
40
- 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" })), E = 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" }));
41
- o.guardFormField = c, o.guardFormLayout = E, o.guardRecord = T, Object.defineProperty(o, Symbol.toStringTag, { value: "Module" });
36
+ var ie = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, f = { exports: {} };
37
+ (function(t, c) {
38
+ (function(i, y) {
39
+ y(c);
40
+ })(ie, function(i) {
41
+ const y = 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" })), d = 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
+ i.guardFormField = y, i.guardFormLayout = d, i.guardRecord = T, Object.defineProperty(i, Symbol.toStringTag, { value: "Module" });
42
43
  });
43
- })(F, F.exports);
44
- var i = F.exports;
45
- const l = (t) => Object.values(t).sort((a, o) => Number(a.index) - Number(o.index)).map(({ label: a }) => a), oe = (t, a) => {
44
+ })(f, f.exports);
45
+ var o = f.exports;
46
+ const U = (t) => Object.values(t).sort((c, i) => Number(c.index) - Number(i.index)).map(({ label: c }) => c), se = (t, c) => {
46
47
  var P;
47
- const o = [], c = [], E = Object.values(t).find(i.guardFormField.isStatus);
48
- E && E.enabled && o.push(E);
49
- const T = Object.values(t).find(i.guardFormField.isStatusAssignee);
50
- T && T.enabled && o.push(T);
51
- const e = Object.values(t).find(i.guardFormField.isCategory);
52
- e && e.enabled && o.push(e);
53
- for (const p of a)
54
- if (i.guardFormLayout.isRow(p))
48
+ const i = [], y = [], d = Object.values(t).find(o.guardFormField.isStatus);
49
+ d && d.enabled && i.push(d);
50
+ const T = Object.values(t).find(o.guardFormField.isStatusAssignee);
51
+ T && T.enabled && i.push(T);
52
+ const e = Object.values(t).find(o.guardFormField.isCategory);
53
+ e && e.enabled && i.push(e);
54
+ for (const p of c)
55
+ if (o.guardFormLayout.isRow(p))
55
56
  for (const r of p.fields) {
56
- if (i.guardFormLayout.isLabel(r) || i.guardFormLayout.isHr(r))
57
+ if (o.guardFormLayout.isLabel(r) || o.guardFormLayout.isHr(r))
57
58
  continue;
58
- if (i.guardFormLayout.isSpacer(r)) {
59
- c.push(r);
59
+ if (o.guardFormLayout.isSpacer(r)) {
60
+ y.push(r);
60
61
  continue;
61
62
  }
62
- const n = t[r.code];
63
- if (!i.guardFormField.isSubtable(n) && !i.guardFormField.isGroup(n)) {
64
- if (i.guardFormField.isCheckBox(n) || i.guardFormField.isDropDown(n) || i.guardFormField.isMultiSelect(n) || i.guardFormField.isRadioButton(n)) {
65
- const s = l(n.options);
66
- o.push({ ...n, sortedOptions: s });
63
+ const u = t[r.code];
64
+ if (!o.guardFormField.isSubtable(u) && !o.guardFormField.isGroup(u)) {
65
+ if (o.guardFormField.isCheckBox(u) || o.guardFormField.isDropDown(u) || o.guardFormField.isMultiSelect(u) || o.guardFormField.isRadioButton(u)) {
66
+ const s = U(u.options);
67
+ i.push({ ...u, sortedOptions: s });
67
68
  continue;
68
69
  }
69
- o.push(n);
70
+ i.push(u);
70
71
  }
71
72
  }
72
- else if (i.guardFormLayout.isSubtable(p)) {
73
- const r = p.code, n = t[r];
74
- if (!i.guardFormField.isSubtable(n))
73
+ else if (o.guardFormLayout.isSubtable(p)) {
74
+ const r = p.code, u = t[r];
75
+ if (!o.guardFormField.isSubtable(u))
75
76
  continue;
76
77
  const s = {};
77
- for (const { code: y } of p.fields) {
78
- const d = n.fields[y];
79
- if (i.guardFormField.isCheckBox(d) || i.guardFormField.isDropDown(d) || i.guardFormField.isMultiSelect(d) || i.guardFormField.isRadioButton(d)) {
80
- const u = l(d.options);
81
- s[d.code] = { ...d, table: r, sortedOptions: u }, o.push({ ...d, table: r, sortedOptions: u });
78
+ for (const { code: M } of p.fields) {
79
+ const a = u.fields[M];
80
+ if (o.guardFormField.isCheckBox(a) || o.guardFormField.isDropDown(a) || o.guardFormField.isMultiSelect(a) || o.guardFormField.isRadioButton(a)) {
81
+ const n = U(a.options);
82
+ s[a.code] = { ...a, table: r, sortedOptions: n }, i.push({ ...a, table: r, sortedOptions: n });
82
83
  continue;
83
84
  }
84
- s[d.code] = { ...d, table: r }, o.push({ ...d, table: r });
85
+ s[a.code] = { ...a, table: r }, i.push({ ...a, table: r });
85
86
  }
86
- o.push({ ...n, fields: s });
87
- } else if (i.guardFormLayout.isGroup(p)) {
88
- const r = p.code, n = t[r];
89
- if (!i.guardFormField.isGroup(n))
87
+ i.push({ ...u, fields: s });
88
+ } else if (o.guardFormLayout.isGroup(p)) {
89
+ const r = p.code, u = t[r];
90
+ if (!o.guardFormField.isGroup(u))
90
91
  continue;
91
92
  const s = {};
92
- for (const y of p.layout)
93
- for (const d of y.fields) {
94
- if (i.guardFormLayout.isLabel(d) || i.guardFormLayout.isHr(d))
93
+ for (const M of p.layout)
94
+ for (const a of M.fields) {
95
+ if (o.guardFormLayout.isLabel(a) || o.guardFormLayout.isHr(a))
95
96
  continue;
96
- if (i.guardFormLayout.isSpacer(d)) {
97
- c.push(d);
97
+ if (o.guardFormLayout.isSpacer(a)) {
98
+ y.push(a);
98
99
  continue;
99
100
  }
100
- const u = t[d.code];
101
- if (!i.guardFormField.isCategory(u) && !i.guardFormField.isStatus(u) && !i.guardFormField.isStatusAssignee(u) && !i.guardFormField.isSubtable(u) && !i.guardFormField.isGroup(u)) {
102
- if (i.guardFormField.isCheckBox(u) || i.guardFormField.isDropDown(u) || i.guardFormField.isMultiSelect(u) || i.guardFormField.isRadioButton(u)) {
103
- const k = l(u.options);
104
- s[u.code] = { ...u, group: r, sortedOptions: k }, o.push({ ...u, group: r, sortedOptions: k });
101
+ const n = t[a.code];
102
+ if (!o.guardFormField.isCategory(n) && !o.guardFormField.isStatus(n) && !o.guardFormField.isStatusAssignee(n) && !o.guardFormField.isSubtable(n) && !o.guardFormField.isGroup(n)) {
103
+ if (o.guardFormField.isCheckBox(n) || o.guardFormField.isDropDown(n) || o.guardFormField.isMultiSelect(n) || o.guardFormField.isRadioButton(n)) {
104
+ const j = U(n.options);
105
+ s[n.code] = { ...n, group: r, sortedOptions: j }, i.push({ ...n, group: r, sortedOptions: j });
105
106
  continue;
106
107
  }
107
- s[u.code] = { ...u, group: r }, o.push({ ...u, group: r });
108
+ s[n.code] = { ...n, group: r }, i.push({ ...n, group: r });
108
109
  }
109
110
  }
110
- o.push({ ...n, fields: s });
111
+ i.push({ ...u, fields: s });
111
112
  }
112
- for (const p of Object.values(o))
113
- if (i.guardFormField.isLookup(p)) {
113
+ for (const p of Object.values(i))
114
+ if (o.guardFormField.isLookup(p)) {
114
115
  if (p.lookup === null)
115
116
  continue;
116
117
  for (const r of p.lookup.fieldMappings) {
117
- const n = (P = o.filter(
118
- (s) => S(s) || L(s) || m(s) || R(s) || M(s) || g(s) || _(s) || b(s) || C(s) || f(s) || N(s) || D(s) || O(s) || I(s) || A(s)
118
+ const u = (P = i.filter(
119
+ (s) => E(s) || l(s) || L(s) || S(s) || F(s) || m(s) || R(s) || _(s) || g(s) || A(s) || D(s) || N(s) || b(s) || O(s) || I(s)
119
120
  )) == null ? void 0 : P.find((s) => s.code === r.field);
120
- n && (n.isLookupCopy = !0);
121
+ u && (u.isLookupCopy = !0);
121
122
  }
122
123
  }
123
- const U = Object.values(t).find(i.guardFormField.isRecordNumber);
124
- U && (o.some(i.guardFormField.isRecordNumber) || o.push(U));
125
- const B = Object.values(t).find(i.guardFormField.isCreator);
126
- B && (o.some(i.guardFormField.isCreator) || o.push(B));
127
- const G = Object.values(t).find(i.guardFormField.isCreatedTime);
128
- G && (o.some(i.guardFormField.isCreatedTime) || o.push(G));
129
- const h = Object.values(t).find(i.guardFormField.isModifier);
130
- h && (o.some(i.guardFormField.isModifier) || o.push(h));
131
- const x = Object.values(t).find(i.guardFormField.isUpdatedTime);
132
- return x && (o.some(i.guardFormField.isUpdatedTime) || o.push(x)), { fields: o, spacers: c };
133
- }, se = async ({ client: t, app: a, lang: o, preview: c }) => {
134
- const [{ properties: E }, { layout: T }] = await Promise.all([
135
- t.app.getFormFields({ app: a, lang: o, preview: c }),
136
- t.app.getFormLayout({ app: a, preview: c })
124
+ const k = Object.values(t).find(o.guardFormField.isRecordNumber);
125
+ k && (i.some(o.guardFormField.isRecordNumber) || i.push(k));
126
+ const B = Object.values(t).find(o.guardFormField.isCreator);
127
+ B && (i.some(o.guardFormField.isCreator) || i.push(B));
128
+ const G = Object.values(t).find(o.guardFormField.isCreatedTime);
129
+ G && (i.some(o.guardFormField.isCreatedTime) || i.push(G));
130
+ const h = Object.values(t).find(o.guardFormField.isModifier);
131
+ h && (i.some(o.guardFormField.isModifier) || i.push(h));
132
+ const x = Object.values(t).find(o.guardFormField.isUpdatedTime);
133
+ return x && (i.some(o.guardFormField.isUpdatedTime) || i.push(x)), { fields: i, spacers: y };
134
+ }, re = async ({ client: t, app: c, lang: i, preview: y }) => {
135
+ const [{ properties: d }, { layout: T }] = await Promise.all([
136
+ t.app.getFormFields({ app: c, lang: i, preview: y }),
137
+ t.app.getFormLayout({ app: c, preview: y })
137
138
  ]);
138
- return oe(E, T);
139
- }, re = { get: se, ...te };
139
+ return se(d, T);
140
+ }, ue = { get: re, ...oe };
140
141
  export {
141
- re as kintonePrettyFields
142
+ ue as kintonePrettyFields
142
143
  };
@@ -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",z=t=>t.type==="CREATOR",W=t=>t.type==="CREATED_TIME",Z=t=>t.type==="MODIFIER",Y=t=>t.type==="UPDATED_TIME",F=t=>t.type==="SINGLE_LINE_TEXT",S=t=>t.type==="MULTI_LINE_TEXT",m=t=>t.type==="RICH_TEXT",R=t=>t.type==="NUMBER",G=t=>t.type==="CALC",g=t=>t.type==="CHECK_BOX",L=t=>t.type==="RADIO_BUTTON",_=t=>t.type==="MULTI_SELECT",b=t=>t.type==="DROP_DOWN",C=t=>t.type==="USER_SELECT",I=t=>t.type==="ORGANIZATION_SELECT",O=t=>t.type==="GROUP_SELECT",f=t=>t.type==="DATE",A=t=>t.type==="TIME",N=t=>t.type==="DATETIME",M=t=>t.type==="LINK",h=t=>t.type==="FILE",x=t=>(t.type==="SINGLE_LINE_TEXT"||t.type==="NUMBER")&&"lookup"in t,q=t=>t.type==="SUBTABLE",J=t=>t.type==="GROUP",P=t=>t.type==="REFERENCE_TABLE",Q=Object.freeze(Object.defineProperty({__proto__:null,enableInSubtable:t=>F(t)||R(t)||G(t)||S(t)||m(t)||M(t)||g(t)||L(t)||b(t)||_(t)||h(t)||f(t)||A(t)||N(t)||C(t)||I(t)||O(t)||P(t)||x(t),isCalc:G,isCategory:t=>t.type==="CATEGORY",isCheckBox:g,isCreatedTime:W,isCreator:z,isDate:f,isDatetime:N,isDropDown:b,isFile:h,isGroup:J,isGroupSelect:O,isInSubtable:t=>t.table!==void 0,isLink:M,isLookup:x,isModifier:Z,isMultiLineText:S,isMultiSelect:_,isNumber:R,isOrganizationSelect:I,isRadioButton:L,isRecordNumber:l,isReferenceTable:P,isRichText:m,isSingleLineText:F,isStatus:t=>t.type==="STATUS",isStatusAssignee:t=>t.type==="STATUS_ASSIGNEE",isSubtable:q,isTime:A,isUpdatedTime:Y,isUserSelect:C},Symbol.toStringTag,{value:"Module"}));var V=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},D={exports:{}};(function(t,a){(function(o,c){c(a)})(V,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"})),T=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"})),y=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=T,o.guardRecord=y,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})})})(D,D.exports);var i=D.exports;const U=t=>Object.values(t).sort((a,o)=>Number(a.index)-Number(o.index)).map(({label:a})=>a),$=(t,a)=>{var H;const o=[],c=[],T=Object.values(t).find(i.guardFormField.isStatus);T&&T.enabled&&o.push(T);const y=Object.values(t).find(i.guardFormField.isStatusAssignee);y&&y.enabled&&o.push(y);const e=Object.values(t).find(i.guardFormField.isCategory);e&&e.enabled&&o.push(e);for(const p of a)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 n=t[r.code];if(!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 s=U(n.options);o.push({...n,sortedOptions:s});continue}o.push(n)}}else if(i.guardFormLayout.isSubtable(p)){const r=p.code,n=t[r];if(!i.guardFormField.isSubtable(n))continue;const s={};for(const{code:B}of p.fields){const d=n.fields[B];if(i.guardFormField.isCheckBox(d)||i.guardFormField.isDropDown(d)||i.guardFormField.isMultiSelect(d)||i.guardFormField.isRadioButton(d)){const u=U(d.options);s[d.code]={...d,table:r,sortedOptions:u},o.push({...d,table:r,sortedOptions:u});continue}s[d.code]={...d,table:r},o.push({...d,table:r})}o.push({...n,fields:s})}else if(i.guardFormLayout.isGroup(p)){const r=p.code,n=t[r];if(!i.guardFormField.isGroup(n))continue;const s={};for(const B of p.layout)for(const d of B.fields){if(i.guardFormLayout.isLabel(d)||i.guardFormLayout.isHr(d))continue;if(i.guardFormLayout.isSpacer(d)){c.push(d);continue}const u=t[d.code];if(!i.guardFormField.isCategory(u)&&!i.guardFormField.isStatus(u)&&!i.guardFormField.isStatusAssignee(u)&&!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 K=U(u.options);s[u.code]={...u,group:r,sortedOptions:K},o.push({...u,group:r,sortedOptions:K});continue}s[u.code]={...u,group:r},o.push({...u,group:r})}}o.push({...n,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 n=(H=o.filter(s=>F(s)||R(s)||S(s)||m(s)||M(s)||g(s)||L(s)||b(s)||_(s)||f(s)||A(s)||N(s)||C(s)||I(s)||O(s)))==null?void 0:H.find(s=>s.code===r.field);n&&(n.isLookupCopy=!0)}}const k=Object.values(t).find(i.guardFormField.isRecordNumber);k&&(o.some(i.guardFormField.isRecordNumber)||o.push(k));const j=Object.values(t).find(i.guardFormField.isCreator);j&&(o.some(i.guardFormField.isCreator)||o.push(j));const v=Object.values(t).find(i.guardFormField.isCreatedTime);v&&(o.some(i.guardFormField.isCreatedTime)||o.push(v));const X=Object.values(t).find(i.guardFormField.isModifier);X&&(o.some(i.guardFormField.isModifier)||o.push(X));const w=Object.values(t).find(i.guardFormField.isUpdatedTime);return w&&(o.some(i.guardFormField.isUpdatedTime)||o.push(w)),{fields:o,spacers:c}},ee={get:async({client:t,app:a,lang:o,preview:c})=>{const[{properties:T},{layout:y}]=await Promise.all([t.app.getFormFields({app:a,lang:o,preview:c}),t.app.getFormLayout({app:a,preview:c})]);return $(T,y)},...Q};E.kintonePrettyFields=ee,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
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",z=t=>t.type==="CREATOR",W=t=>t.type==="CREATED_TIME",Z=t=>t.type==="MODIFIER",Y=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",b=t=>t.type==="RADIO_BUTTON",_=t=>t.type==="MULTI_SELECT",O=t=>t.type==="DROP_DOWN",I=t=>t.type==="USER_SELECT",A=t=>t.type==="ORGANIZATION_SELECT",f=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",G=t=>t.type==="FILE",q=t=>t.type==="SUBTABLE",J=t=>t.type==="GROUP",h=t=>t.type==="REFERENCE_TABLE",Q=t=>t.type==="CATEGORY",V=t=>t.type==="STATUS",$=t=>t.type==="STATUS_ASSIGNEE",x=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),ee=Object.freeze(Object.defineProperty({__proto__:null,enableInSubtable:t=>F(t)||L(t)||R(t)||m(t)||C(t)||S(t)||g(t)||b(t)||O(t)||_(t)||G(t)||D(t)||M(t)||N(t)||I(t)||A(t)||f(t)||h(t)||x(t),isCalc:R,isCategory:Q,isCheckBox:g,isCreatedTime:W,isCreator:z,isDate:D,isDatetime:N,isDropDown:O,isFile:G,isGroup:J,isGroupSelect:f,isInSubtable:t=>t.table!==void 0,isLink:S,isLookup:x,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||b(t)&&"isLookupCopy"in t||_(t)&&"isLookupCopy"in t||O(t)&&"isLookupCopy"in t||I(t)&&"isLookupCopy"in t||A(t)&&"isLookupCopy"in t||f(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:Z,isMultiLineText:m,isMultiSelect:_,isNumber:L,isOrganizationSelect:A,isRadioButton:b,isRecordNumber:l,isReferenceTable:h,isRichText:C,isSingleLineText:F,isStatus:V,isStatusAssignee:$,isSubtable:q,isTime:M,isUpdatedTime:Y,isUserSelect:I},Symbol.toStringTag,{value:"Module"}));var te=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},U={exports:{}};(function(t,c){(function(i,y){y(c)})(te,function(i){const y=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"})),d=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"}));i.guardFormField=y,i.guardFormLayout=d,i.guardRecord=T,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})})})(U,U.exports);var o=U.exports;const k=t=>Object.values(t).sort((c,i)=>Number(c.index)-Number(i.index)).map(({label:c})=>c),oe=(t,c)=>{var H;const i=[],y=[],d=Object.values(t).find(o.guardFormField.isStatus);d&&d.enabled&&i.push(d);const T=Object.values(t).find(o.guardFormField.isStatusAssignee);T&&T.enabled&&i.push(T);const e=Object.values(t).find(o.guardFormField.isCategory);e&&e.enabled&&i.push(e);for(const p of c)if(o.guardFormLayout.isRow(p))for(const r of p.fields){if(o.guardFormLayout.isLabel(r)||o.guardFormLayout.isHr(r))continue;if(o.guardFormLayout.isSpacer(r)){y.push(r);continue}const u=t[r.code];if(!o.guardFormField.isSubtable(u)&&!o.guardFormField.isGroup(u)){if(o.guardFormField.isCheckBox(u)||o.guardFormField.isDropDown(u)||o.guardFormField.isMultiSelect(u)||o.guardFormField.isRadioButton(u)){const s=k(u.options);i.push({...u,sortedOptions:s});continue}i.push(u)}}else if(o.guardFormLayout.isSubtable(p)){const r=p.code,u=t[r];if(!o.guardFormField.isSubtable(u))continue;const s={};for(const{code:B}of p.fields){const a=u.fields[B];if(o.guardFormField.isCheckBox(a)||o.guardFormField.isDropDown(a)||o.guardFormField.isMultiSelect(a)||o.guardFormField.isRadioButton(a)){const n=k(a.options);s[a.code]={...a,table:r,sortedOptions:n},i.push({...a,table:r,sortedOptions:n});continue}s[a.code]={...a,table:r},i.push({...a,table:r})}i.push({...u,fields:s})}else if(o.guardFormLayout.isGroup(p)){const r=p.code,u=t[r];if(!o.guardFormField.isGroup(u))continue;const s={};for(const B of p.layout)for(const a of B.fields){if(o.guardFormLayout.isLabel(a)||o.guardFormLayout.isHr(a))continue;if(o.guardFormLayout.isSpacer(a)){y.push(a);continue}const n=t[a.code];if(!o.guardFormField.isCategory(n)&&!o.guardFormField.isStatus(n)&&!o.guardFormField.isStatusAssignee(n)&&!o.guardFormField.isSubtable(n)&&!o.guardFormField.isGroup(n)){if(o.guardFormField.isCheckBox(n)||o.guardFormField.isDropDown(n)||o.guardFormField.isMultiSelect(n)||o.guardFormField.isRadioButton(n)){const K=k(n.options);s[n.code]={...n,group:r,sortedOptions:K},i.push({...n,group:r,sortedOptions:K});continue}s[n.code]={...n,group:r},i.push({...n,group:r})}}i.push({...u,fields:s})}for(const p of Object.values(i))if(o.guardFormField.isLookup(p)){if(p.lookup===null)continue;for(const r of p.lookup.fieldMappings){const u=(H=i.filter(s=>F(s)||L(s)||m(s)||C(s)||S(s)||g(s)||b(s)||O(s)||_(s)||D(s)||M(s)||N(s)||I(s)||A(s)||f(s)))==null?void 0:H.find(s=>s.code===r.field);u&&(u.isLookupCopy=!0)}}const P=Object.values(t).find(o.guardFormField.isRecordNumber);P&&(i.some(o.guardFormField.isRecordNumber)||i.push(P));const j=Object.values(t).find(o.guardFormField.isCreator);j&&(i.some(o.guardFormField.isCreator)||i.push(j));const v=Object.values(t).find(o.guardFormField.isCreatedTime);v&&(i.some(o.guardFormField.isCreatedTime)||i.push(v));const X=Object.values(t).find(o.guardFormField.isModifier);X&&(i.some(o.guardFormField.isModifier)||i.push(X));const w=Object.values(t).find(o.guardFormField.isUpdatedTime);return w&&(i.some(o.guardFormField.isUpdatedTime)||i.push(w)),{fields:i,spacers:y}},ie={get:async({client:t,app:c,lang:i,preview:y})=>{const[{properties:d},{layout:T}]=await Promise.all([t.app.getFormFields({app:c,lang:i,preview:y}),t.app.getFormLayout({app:c,preview:y})]);return oe(d,T)},...ee};E.kintonePrettyFields=ie,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "files": [
5
5
  "dist"
6
6
  ],
7
- "version": "0.5.8",
7
+ "version": "0.6.0",
8
8
  "description": "Get kintone form fields in a pretty format.",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,7 +37,8 @@
37
37
  "prebuild": "rimraf ./dist",
38
38
  "build": "tsc && vite build",
39
39
  "watch": "tsc && vite build --watch",
40
- "prepare": "npm run build"
40
+ "prepare": "npm run build",
41
+ "test": "vitest"
41
42
  },
42
43
  "dependencies": {
43
44
  "@kintone/rest-api-client": "^5.0.8",
@@ -48,6 +49,7 @@
48
49
  "prettier": "^3.2.5",
49
50
  "rimraf": "^5.0.5",
50
51
  "typescript": "^5.3.3",
51
- "vite": "^5.1.3"
52
+ "vite": "^5.1.3",
53
+ "vitest": "^1.3.1"
52
54
  }
53
55
  }