kintone-pretty-fields 0.4.0 → 0.5.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 CHANGED
@@ -117,20 +117,25 @@ Here is a sample code that retrieves form fields of an app.
117
117
 
118
118
  ```ts
119
119
  import { KintoneRestAPIClient } from "@kintone/rest-api-client";
120
- import { kintonePrettyFields } from "kintone-pretty-fields";
120
+ import { kintonePrettyFields, kintonePrettyType } from "kintone-pretty-fields";
121
121
 
122
122
  const client = new KintoneRestAPIClient();
123
123
  const { fields, spacers } = await kintonePrettyFields.get({ client, app: 1, lang: "en", preview: false });
124
124
  console.log({ fields, spacers });
125
125
 
126
- for (const field of fields) {
127
- if (kintonePrettyFields.isSingleLineText(field)) {
128
- // do something
129
- }
130
- if (kintonePrettyFields.isDate(field)) {
131
- // do something
132
- }
133
- }
126
+ const checkBoxFields = fields.filter(kintonePrettyFields.isCheckBox);
127
+ console.log(checkBoxFields);
128
+
129
+ const inSubtableFields = fields.filter(kintonePrettyFields.enableInSubtable).filter(kintonePrettyFields.isInSubtable);
130
+ console.log(inSubtableFields);
131
+
132
+ const myFunction1 = (fields: kintonePrettyType.OneOf[]) => {
133
+ // do something
134
+ };
135
+
136
+ const myFunction2 = (field: kintonePrettyType.CheckBox) => {
137
+ // do something
138
+ };
134
139
  ```
135
140
 
136
141
  ## License
@@ -1,4 +1,4 @@
1
- import type { kintonePrettyType } from "../index";
1
+ import type * as kintonePrettyType from "../exportTypes/formField";
2
2
  export declare const isRecordNumber: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.RecordNumber;
3
3
  export declare const isCreator: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Creator;
4
4
  export declare const isCreatedTime: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.CreatedTime;
@@ -32,4 +32,8 @@ export declare const isReferenceTable: (field: kintonePrettyType.OneOf) => field
32
32
  export declare const isCategory: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Category;
33
33
  export declare const isStatus: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Status;
34
34
  export declare const isStatusAssignee: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.StatusAssignee;
35
+ export declare const enableInSubtable: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.InSubtable;
36
+ export declare const isInSubtable: <T extends kintonePrettyType.InSubtable>(field: T) => field is T & {
37
+ table: string;
38
+ };
35
39
  //# 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,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,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"}
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,7 +1,7 @@
1
1
  import { KintoneRestAPIClient } from "@kintone/rest-api-client";
2
2
  import { AppID, Lang } from "@kintone/rest-api-client/lib/src/client/types";
3
3
  import { Spacer } from "@kintone/rest-api-client/lib/src/KintoneFields/types/fieldLayout";
4
- import { kintonePrettyType } from "../index";
4
+ import type * as kintonePrettyType from "../exportTypes/formField";
5
5
  declare const get: ({ client, app, lang, preview }: {
6
6
  client: KintoneRestAPIClient;
7
7
  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,EAAuB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAsNlE,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,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"}
package/dist/index.d.ts CHANGED
@@ -33,6 +33,10 @@ declare const kintonePrettyFields: {
33
33
  isCategory: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Category;
34
34
  isStatus: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.Status;
35
35
  isStatusAssignee: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.StatusAssignee;
36
+ enableInSubtable: (field: kintonePrettyType.OneOf) => field is kintonePrettyType.InSubtable;
37
+ isInSubtable: <T extends kintonePrettyType.InSubtable>(field: T) => field is T & {
38
+ table: string;
39
+ };
36
40
  get: ({ client, app, lang, preview }: {
37
41
  client: import("@kintone/rest-api-client").KintoneRestAPIClient;
38
42
  app: import("@kintone/rest-api-client/lib/src/client/types").AppID;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAElE,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,73 +1,107 @@
1
- var O = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, S = { exports: {} };
2
- (function(t, c) {
3
- (function(o, l) {
4
- l(c);
5
- })(O, function(o) {
6
- const l = 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" })), E = 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" }));
7
- o.guardFormField = l, o.guardFormLayout = T, o.guardRecord = E, Object.defineProperty(o, Symbol.toStringTag, { value: "Module" });
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({
2
+ __proto__: null,
3
+ enableInSubtable: $,
4
+ isCalc: j,
5
+ isCategory: J,
6
+ isCheckBox: g,
7
+ isCreatedTime: K,
8
+ isCreator: z,
9
+ isDate: f,
10
+ isDatetime: D,
11
+ isDropDown: b,
12
+ isFile: v,
13
+ isGroup: q,
14
+ isGroupSelect: A,
15
+ isInSubtable: ee,
16
+ isLink: M,
17
+ isLookup: X,
18
+ isModifier: W,
19
+ isMultiLineText: m,
20
+ isMultiSelect: C,
21
+ isNumber: L,
22
+ isOrganizationSelect: I,
23
+ isRadioButton: _,
24
+ isRecordNumber: H,
25
+ isReferenceTable: w,
26
+ isRichText: R,
27
+ isSingleLineText: S,
28
+ isStatus: Q,
29
+ isStatusAssignee: V,
30
+ isSubtable: Y,
31
+ isTime: N,
32
+ isUpdatedTime: Z,
33
+ isUserSelect: O
34
+ }, 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" });
8
42
  });
9
- })(S, S.exports);
10
- var i = S.exports;
11
- const F = (t) => Object.values(t).sort((c, o) => Number(c.index) - Number(o.index)).map(({ label: c }) => c), I = (t, c) => {
12
- var C;
13
- const o = [], l = [], T = Object.values(t).find(i.guardFormField.isStatus);
14
- T && T.enabled && o.push(T);
15
- const E = Object.values(t).find(i.guardFormField.isStatusAssignee);
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) => {
46
+ var P;
47
+ const o = [], c = [], E = Object.values(t).find(i.guardFormField.isStatus);
16
48
  E && E.enabled && o.push(E);
49
+ const T = Object.values(t).find(i.guardFormField.isStatusAssignee);
50
+ T && T.enabled && o.push(T);
17
51
  const e = Object.values(t).find(i.guardFormField.isCategory);
18
52
  e && e.enabled && o.push(e);
19
- for (const d of c)
20
- if (i.guardFormLayout.isRow(d))
21
- for (const r of d.fields) {
53
+ for (const p of a)
54
+ if (i.guardFormLayout.isRow(p))
55
+ for (const r of p.fields) {
22
56
  if (i.guardFormLayout.isLabel(r) || i.guardFormLayout.isHr(r))
23
57
  continue;
24
58
  if (i.guardFormLayout.isSpacer(r)) {
25
- l.push(r);
59
+ c.push(r);
26
60
  continue;
27
61
  }
28
62
  const n = t[r.code];
29
63
  if (!i.guardFormField.isSubtable(n) && !i.guardFormField.isGroup(n)) {
30
64
  if (i.guardFormField.isCheckBox(n) || i.guardFormField.isDropDown(n) || i.guardFormField.isMultiSelect(n) || i.guardFormField.isRadioButton(n)) {
31
- const s = F(n.options);
65
+ const s = l(n.options);
32
66
  o.push({ ...n, sortedOptions: s });
33
67
  continue;
34
68
  }
35
69
  o.push(n);
36
70
  }
37
71
  }
38
- else if (i.guardFormLayout.isSubtable(d)) {
39
- const r = d.code, n = t[r];
72
+ else if (i.guardFormLayout.isSubtable(p)) {
73
+ const r = p.code, n = t[r];
40
74
  if (!i.guardFormField.isSubtable(n))
41
75
  continue;
42
76
  const s = {};
43
- for (const { code: y } of d.fields) {
44
- const p = n.fields[y];
45
- if (i.guardFormField.isCheckBox(p) || i.guardFormField.isDropDown(p) || i.guardFormField.isMultiSelect(p) || i.guardFormField.isRadioButton(p)) {
46
- const u = F(p.options);
47
- s[p.code] = { ...p, table: r, sortedOptions: u }, o.push({ ...p, table: r, sortedOptions: u });
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 });
48
82
  continue;
49
83
  }
50
- s[p.code] = { ...p, table: r }, o.push({ ...p, table: r });
84
+ s[d.code] = { ...d, table: r }, o.push({ ...d, table: r });
51
85
  }
52
86
  o.push({ ...n, fields: s });
53
- } else if (i.guardFormLayout.isGroup(d)) {
54
- const r = d.code, n = t[r];
87
+ } else if (i.guardFormLayout.isGroup(p)) {
88
+ const r = p.code, n = t[r];
55
89
  if (!i.guardFormField.isGroup(n))
56
90
  continue;
57
91
  const s = {};
58
- for (const y of d.layout)
59
- for (const p of y.fields) {
60
- if (i.guardFormLayout.isLabel(p) || i.guardFormLayout.isHr(p))
92
+ for (const y of p.layout)
93
+ for (const d of y.fields) {
94
+ if (i.guardFormLayout.isLabel(d) || i.guardFormLayout.isHr(d))
61
95
  continue;
62
- if (i.guardFormLayout.isSpacer(p)) {
63
- l.push(p);
96
+ if (i.guardFormLayout.isSpacer(d)) {
97
+ c.push(d);
64
98
  continue;
65
99
  }
66
- const u = t[p.code];
100
+ const u = t[d.code];
67
101
  if (!i.guardFormField.isCategory(u) && !i.guardFormField.isStatus(u) && !i.guardFormField.isStatusAssignee(u) && !i.guardFormField.isSubtable(u) && !i.guardFormField.isGroup(u)) {
68
102
  if (i.guardFormField.isCheckBox(u) || i.guardFormField.isDropDown(u) || i.guardFormField.isMultiSelect(u) || i.guardFormField.isRadioButton(u)) {
69
- const f = F(u.options);
70
- s[u.code] = { ...u, group: r, sortedOptions: f }, o.push({ ...u, group: r, sortedOptions: f });
103
+ const k = l(u.options);
104
+ s[u.code] = { ...u, group: r, sortedOptions: k }, o.push({ ...u, group: r, sortedOptions: k });
71
105
  continue;
72
106
  }
73
107
  s[u.code] = { ...u, group: r }, o.push({ ...u, group: r });
@@ -75,65 +109,34 @@ const F = (t) => Object.values(t).sort((c, o) => Number(c.index) - Number(o.inde
75
109
  }
76
110
  o.push({ ...n, fields: s });
77
111
  }
78
- for (const d of Object.values(o))
79
- if (i.guardFormField.isLookup(d)) {
80
- if (d.lookup === null)
112
+ for (const p of Object.values(o))
113
+ if (i.guardFormField.isLookup(p)) {
114
+ if (p.lookup === null)
81
115
  continue;
82
- for (const r of d.lookup.fieldMappings) {
83
- const n = (C = o.filter(
84
- (s) => a.isSingleLineText(s) || a.isNumber(s) || a.isMultiLineText(s) || a.isRichText(s) || a.isLink(s) || a.isCheckBox(s) || a.isRadioButton(s) || a.isDropDown(s) || a.isMultiSelect(s) || a.isDate(s) || a.isTime(s) || a.isDatetime(s) || a.isUserSelect(s) || a.isOrganizationSelect(s) || a.isGroupSelect(s)
85
- )) == null ? void 0 : C.find((s) => s.code === r.field);
116
+ 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)
119
+ )) == null ? void 0 : P.find((s) => s.code === r.field);
86
120
  n && (n.isLookupCopy = !0);
87
121
  }
88
122
  }
89
- const m = Object.values(t).find(i.guardFormField.isRecordNumber);
90
- m && (o.some(i.guardFormField.isRecordNumber) || o.push(m));
91
- const R = Object.values(t).find(i.guardFormField.isCreator);
92
- R && (o.some(i.guardFormField.isCreator) || o.push(R));
93
- const L = Object.values(t).find(i.guardFormField.isCreatedTime);
94
- L && (o.some(i.guardFormField.isCreatedTime) || o.push(L));
95
- const g = Object.values(t).find(i.guardFormField.isModifier);
96
- g && (o.some(i.guardFormField.isModifier) || o.push(g));
97
- const _ = Object.values(t).find(i.guardFormField.isUpdatedTime);
98
- return _ && (o.some(i.guardFormField.isUpdatedTime) || o.push(_)), { fields: o, spacers: l };
99
- }, b = async ({ client: t, app: c, lang: o, preview: l }) => {
100
- const [{ properties: T }, { layout: E }] = await Promise.all([
101
- t.app.getFormFields({ app: c, lang: o, preview: l }),
102
- t.app.getFormLayout({ app: c, preview: l })
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 })
103
137
  ]);
104
- return I(T, E);
105
- }, A = (t) => t.type === "RECORD_NUMBER", D = (t) => t.type === "CREATOR", N = (t) => t.type === "CREATED_TIME", M = (t) => t.type === "MODIFIER", U = (t) => t.type === "UPDATED_TIME", B = (t) => t.type === "SINGLE_LINE_TEXT", G = (t) => t.type === "MULTI_LINE_TEXT", h = (t) => t.type === "RICH_TEXT", x = (t) => t.type === "NUMBER", k = (t) => t.type === "CALC", P = (t) => t.type === "CHECK_BOX", j = (t) => t.type === "RADIO_BUTTON", X = (t) => t.type === "MULTI_SELECT", v = (t) => t.type === "DROP_DOWN", w = (t) => t.type === "USER_SELECT", H = (t) => t.type === "ORGANIZATION_SELECT", z = (t) => t.type === "GROUP_SELECT", K = (t) => t.type === "DATE", W = (t) => t.type === "TIME", Z = (t) => t.type === "DATETIME", Y = (t) => t.type === "LINK", q = (t) => t.type === "FILE", J = (t) => (t.type === "SINGLE_LINE_TEXT" || t.type === "NUMBER") && "lookup" in t, Q = (t) => t.type === "SUBTABLE", V = (t) => t.type === "GROUP", $ = (t) => t.type === "REFERENCE_TABLE", ee = (t) => t.type === "CATEGORY", te = (t) => t.type === "STATUS", ie = (t) => t.type === "STATUS_ASSIGNEE", oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
106
- __proto__: null,
107
- isCalc: k,
108
- isCategory: ee,
109
- isCheckBox: P,
110
- isCreatedTime: N,
111
- isCreator: D,
112
- isDate: K,
113
- isDatetime: Z,
114
- isDropDown: v,
115
- isFile: q,
116
- isGroup: V,
117
- isGroupSelect: z,
118
- isLink: Y,
119
- isLookup: J,
120
- isModifier: M,
121
- isMultiLineText: G,
122
- isMultiSelect: X,
123
- isNumber: x,
124
- isOrganizationSelect: H,
125
- isRadioButton: j,
126
- isRecordNumber: A,
127
- isReferenceTable: $,
128
- isRichText: h,
129
- isSingleLineText: B,
130
- isStatus: te,
131
- isStatusAssignee: ie,
132
- isSubtable: Q,
133
- isTime: W,
134
- isUpdatedTime: U,
135
- isUserSelect: w
136
- }, Symbol.toStringTag, { value: "Module" })), a = { get: b, ...oe };
138
+ return oe(E, T);
139
+ }, re = { get: se, ...te };
137
140
  export {
138
- a as kintonePrettyFields
141
+ re as kintonePrettyFields
139
142
  };
@@ -1 +1 @@
1
- (function(E,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(E=typeof globalThis<"u"?globalThis:E||self,S(E.KintonePrettyFields={}))})(this,function(E){"use strict";var S=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},F={exports:{}};(function(i,c){(function(s,l){l(c)})(S,function(s){const l=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"}));s.guardFormField=l,s.guardFormLayout=T,s.guardRecord=y,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})})})(F,F.exports);var t=F.exports;const m=i=>Object.values(i).sort((c,s)=>Number(c.index)-Number(s.index)).map(({label:c})=>c),I=(i,c)=>{var b;const s=[],l=[],T=Object.values(i).find(t.guardFormField.isStatus);T&&T.enabled&&s.push(T);const y=Object.values(i).find(t.guardFormField.isStatusAssignee);y&&y.enabled&&s.push(y);const e=Object.values(i).find(t.guardFormField.isCategory);e&&e.enabled&&s.push(e);for(const d of c)if(t.guardFormLayout.isRow(d))for(const r of d.fields){if(t.guardFormLayout.isLabel(r)||t.guardFormLayout.isHr(r))continue;if(t.guardFormLayout.isSpacer(r)){l.push(r);continue}const n=i[r.code];if(!t.guardFormField.isSubtable(n)&&!t.guardFormField.isGroup(n)){if(t.guardFormField.isCheckBox(n)||t.guardFormField.isDropDown(n)||t.guardFormField.isMultiSelect(n)||t.guardFormField.isRadioButton(n)){const o=m(n.options);s.push({...n,sortedOptions:o});continue}s.push(n)}}else if(t.guardFormLayout.isSubtable(d)){const r=d.code,n=i[r];if(!t.guardFormField.isSubtable(n))continue;const o={};for(const{code:R}of d.fields){const p=n.fields[R];if(t.guardFormField.isCheckBox(p)||t.guardFormField.isDropDown(p)||t.guardFormField.isMultiSelect(p)||t.guardFormField.isRadioButton(p)){const u=m(p.options);o[p.code]={...p,table:r,sortedOptions:u},s.push({...p,table:r,sortedOptions:u});continue}o[p.code]={...p,table:r},s.push({...p,table:r})}s.push({...n,fields:o})}else if(t.guardFormLayout.isGroup(d)){const r=d.code,n=i[r];if(!t.guardFormField.isGroup(n))continue;const o={};for(const R of d.layout)for(const p of R.fields){if(t.guardFormLayout.isLabel(p)||t.guardFormLayout.isHr(p))continue;if(t.guardFormLayout.isSpacer(p)){l.push(p);continue}const u=i[p.code];if(!t.guardFormField.isCategory(u)&&!t.guardFormField.isStatus(u)&&!t.guardFormField.isStatusAssignee(u)&&!t.guardFormField.isSubtable(u)&&!t.guardFormField.isGroup(u)){if(t.guardFormField.isCheckBox(u)||t.guardFormField.isDropDown(u)||t.guardFormField.isMultiSelect(u)||t.guardFormField.isRadioButton(u)){const O=m(u.options);o[u.code]={...u,group:r,sortedOptions:O},s.push({...u,group:r,sortedOptions:O});continue}o[u.code]={...u,group:r},s.push({...u,group:r})}}s.push({...n,fields:o})}for(const d of Object.values(s))if(t.guardFormField.isLookup(d)){if(d.lookup===null)continue;for(const r of d.lookup.fieldMappings){const n=(b=s.filter(o=>a.isSingleLineText(o)||a.isNumber(o)||a.isMultiLineText(o)||a.isRichText(o)||a.isLink(o)||a.isCheckBox(o)||a.isRadioButton(o)||a.isDropDown(o)||a.isMultiSelect(o)||a.isDate(o)||a.isTime(o)||a.isDatetime(o)||a.isUserSelect(o)||a.isOrganizationSelect(o)||a.isGroupSelect(o)))==null?void 0:b.find(o=>o.code===r.field);n&&(n.isLookupCopy=!0)}}const L=Object.values(i).find(t.guardFormField.isRecordNumber);L&&(s.some(t.guardFormField.isRecordNumber)||s.push(L));const f=Object.values(i).find(t.guardFormField.isCreator);f&&(s.some(t.guardFormField.isCreator)||s.push(f));const g=Object.values(i).find(t.guardFormField.isCreatedTime);g&&(s.some(t.guardFormField.isCreatedTime)||s.push(g));const C=Object.values(i).find(t.guardFormField.isModifier);C&&(s.some(t.guardFormField.isModifier)||s.push(C));const _=Object.values(i).find(t.guardFormField.isUpdatedTime);return _&&(s.some(t.guardFormField.isUpdatedTime)||s.push(_)),{fields:s,spacers:l}},a={get:async({client:i,app:c,lang:s,preview:l})=>{const[{properties:T},{layout:y}]=await Promise.all([i.app.getFormFields({app:c,lang:s,preview:l}),i.app.getFormLayout({app:c,preview:l})]);return I(T,y)},...Object.freeze(Object.defineProperty({__proto__:null,isCalc:i=>i.type==="CALC",isCategory:i=>i.type==="CATEGORY",isCheckBox:i=>i.type==="CHECK_BOX",isCreatedTime:i=>i.type==="CREATED_TIME",isCreator:i=>i.type==="CREATOR",isDate:i=>i.type==="DATE",isDatetime:i=>i.type==="DATETIME",isDropDown:i=>i.type==="DROP_DOWN",isFile:i=>i.type==="FILE",isGroup:i=>i.type==="GROUP",isGroupSelect:i=>i.type==="GROUP_SELECT",isLink:i=>i.type==="LINK",isLookup:i=>(i.type==="SINGLE_LINE_TEXT"||i.type==="NUMBER")&&"lookup"in i,isModifier:i=>i.type==="MODIFIER",isMultiLineText:i=>i.type==="MULTI_LINE_TEXT",isMultiSelect:i=>i.type==="MULTI_SELECT",isNumber:i=>i.type==="NUMBER",isOrganizationSelect:i=>i.type==="ORGANIZATION_SELECT",isRadioButton:i=>i.type==="RADIO_BUTTON",isRecordNumber:i=>i.type==="RECORD_NUMBER",isReferenceTable:i=>i.type==="REFERENCE_TABLE",isRichText:i=>i.type==="RICH_TEXT",isSingleLineText:i=>i.type==="SINGLE_LINE_TEXT",isStatus:i=>i.type==="STATUS",isStatusAssignee:i=>i.type==="STATUS_ASSIGNEE",isSubtable:i=>i.type==="SUBTABLE",isTime:i=>i.type==="TIME",isUpdatedTime:i=>i.type==="UPDATED_TIME",isUserSelect:i=>i.type==="USER_SELECT"},Symbol.toStringTag,{value:"Module"}))};E.kintonePrettyFields=a,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",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"})});
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "files": [
5
5
  "dist"
6
6
  ],
7
- "version": "0.4.0",
7
+ "version": "0.5.0",
8
8
  "description": "Retrieve kintone form field(@kintone/rest-api-client) information in a pretty format.",
9
9
  "repository": {
10
10
  "type": "git",